@@ -18,16 +18,6 @@ export type includeFilePromise = (baseFile: string, includeString: string) => Pr
18
18
export type TableDetail = { [ name : string ] : { fetched : number , fetching ?: boolean , recordFormats : Declaration [ ] } } ;
19
19
export interface ParseOptions { withIncludes ?: boolean , ignoreCache ?: boolean , collectReferences ?: boolean } ;
20
20
21
- const lineTokens = ( input : string , lineNumber : number , lineIndex : number ) : Token [ ] => {
22
- let tokens = tokenise ( input , {
23
- baseIndex : lineIndex ,
24
- lineNumber,
25
- ignoreTypes : [ `tab` ]
26
- } ) ;
27
-
28
- return tokens ;
29
- }
30
-
31
21
const PROGRAMPARMS_NAME = `PROGRAMPARMS` ;
32
22
33
23
export default class Parser {
@@ -155,6 +145,16 @@ export default class Parser {
155
145
}
156
146
}
157
147
148
+ static lineTokens ( input : string , lineNumber : number , lineIndex : number ) : Token [ ] {
149
+ let tokens = tokenise ( input , {
150
+ baseIndex : lineIndex ,
151
+ lineNumber,
152
+ ignoreTypes : [ `tab` ]
153
+ } ) ;
154
+
155
+ return tokens ;
156
+ }
157
+
158
158
async getDocs ( workingUri : string , baseContent ?: string , options : ParseOptions = { withIncludes : true , collectReferences : true } ) : Promise < Cache | undefined > {
159
159
const existingCache = this . getParsedCache ( workingUri ) ;
160
160
if ( options . ignoreCache !== true && existingCache ) {
@@ -570,7 +570,7 @@ export default class Parser {
570
570
} ;
571
571
572
572
const lineIsComment = line . trim ( ) . startsWith ( `//` ) ;
573
- tokens = lineTokens ( getValidStatement ( line ) , lineNumber , lineIndex ) ;
573
+ tokens = Parser . lineTokens ( getValidStatement ( line ) , lineNumber , lineIndex ) ;
574
574
partsLower = tokens . filter ( piece => piece . value ) . map ( piece => piece . value ) ;
575
575
parts = partsLower . map ( piece => piece . toUpperCase ( ) ) ;
576
576
@@ -711,7 +711,7 @@ export default class Parser {
711
711
// This means the line is just part of the end of the last statement as well.
712
712
line = currentStmtStart . content + getValidStatement ( baseLine ) ;
713
713
714
- tokens = lineTokens ( line , currentStmtStart . line , currentStmtStart . index ) ;
714
+ tokens = Parser . lineTokens ( line , currentStmtStart . line , currentStmtStart . index ) ;
715
715
partsLower = tokens . filter ( piece => piece . value ) . map ( piece => piece . value ) ;
716
716
parts = partsLower . map ( piece => piece . toUpperCase ( ) ) ;
717
717
@@ -1368,7 +1368,7 @@ export default class Parser {
1368
1368
tokens = [ cSpec . indicator , cSpec . ind1 , cSpec . ind2 , cSpec . ind3 ] ;
1369
1369
1370
1370
const fromToken = ( token ?: Token ) => {
1371
- return token ? lineTokens ( token . value , lineNumber , token . range . start ) : [ ] ;
1371
+ return token ? Parser . lineTokens ( token . value , lineNumber , token . range . start ) : [ ] ;
1372
1372
} ;
1373
1373
1374
1374
if ( cSpec . opcode && ALLOWS_EXTENDED . includes ( cSpec . opcode . value ) && ! cSpec . factor1 && cSpec . extended ) {
@@ -1769,10 +1769,10 @@ export default class Parser {
1769
1769
1770
1770
static getTokens ( content : string | string [ ] | Token [ ] , lineNumber ?: number , baseIndex ?: number ) : Token [ ] {
1771
1771
if ( Array . isArray ( content ) && typeof content [ 0 ] === `string` ) {
1772
- return lineTokens ( content . join ( ` ` ) , lineNumber , baseIndex ) ;
1772
+ return Parser . lineTokens ( content . join ( ` ` ) , lineNumber , baseIndex ) ;
1773
1773
} else
1774
1774
if ( typeof content === `string` ) {
1775
- return lineTokens ( content , lineNumber , baseIndex ) ;
1775
+ return Parser . lineTokens ( content , lineNumber , baseIndex ) ;
1776
1776
} else {
1777
1777
return content as Token [ ] ;
1778
1778
}
0 commit comments