File tree Expand file tree Collapse file tree
libs/parsing/syntax-tree/src/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,14 +2,18 @@ import { IFoundTokens } from '@idl/tokenizer';
22import { GlobalTokens , ICompileOptions } from '@idl/types/core' ;
33import { IDisabledProblems , SyntaxProblems } from '@idl/types/problem-codes' ;
44import { PositionArray } from '@idl/types/tokenizer' ;
5+ import copy from 'fast-copy' ;
56import { DocumentSymbol , SemanticTokens } from 'vscode-languageserver' ;
67
78import { SyntaxTree } from './branches.interface' ;
89import {
910 DEFAULT_USES_THESE_GLOBAL_TOKEN ,
1011 UsesTheseGlobalTokens ,
1112} from './build-syntax-tree.interface' ;
12- import { ILocalTokens } from './populators/populate-local.interface' ;
13+ import {
14+ DEFAULT_LOCAL_TOKENS ,
15+ ILocalTokens ,
16+ } from './populators/populate-local.interface' ;
1317
1418/**
1519 * Type of parsed item that we have
@@ -90,11 +94,7 @@ export const DEFAULT_PARSED: IParsed = {
9094 postProcessProblems : [ ] ,
9195 tree : [ ] ,
9296 global : [ ] ,
93- local : {
94- func : { } ,
95- pro : { } ,
96- main : { } ,
97- } ,
97+ local : copy ( DEFAULT_LOCAL_TOKENS ) ,
9898 compile : {
9999 func : { } ,
100100 pro : { } ,
Original file line number Diff line number Diff line change @@ -64,17 +64,15 @@ export interface ILocalIndexedToken<T extends LocalTokenTypes>
6464 meta : LocalTokenMetadata < T > ;
6565}
6666
67- /**
68- * Local tokens that we extract from a routine or main level program
69- */
70- export type LocalTokens = ILocalIndexedToken < LocalTokenTypes > [ ] ;
67+ /** Single local token (i.e. variable in IDL code) */
68+ export type LocalToken = ILocalIndexedToken < LocalTokenTypes > ;
7169
7270/**
7371 * Lookup for tokens defined locally within a routine or main level program
7472 */
7573export interface ILocalTokenLookup {
7674 /** Key should be lower-case variable name */
77- [ key : string ] : ILocalIndexedToken < LocalTokenTypes > ;
75+ [ key : string ] : LocalToken ;
7876}
7977
8078/**
@@ -94,3 +92,12 @@ export interface ILocalTokens {
9492 */
9593 main : ILocalTokenLookup ;
9694}
95+
96+ /**
97+ * Default tokens for local
98+ */
99+ export const DEFAULT_LOCAL_TOKENS : ILocalTokens = {
100+ pro : { } ,
101+ func : { } ,
102+ main : { } ,
103+ } ;
You can’t perform that action at this time.
0 commit comments