@@ -4,7 +4,7 @@ import * as nls from 'vscode-nls'
44const localize = nls . loadMessageBundle ( )
55
66enum symboltype {
7- macro , procedure , label , struct
7+ macro , procedure , struct , label , asmvar
88}
99class TasmSymbol {
1010 type :number
@@ -21,6 +21,7 @@ class TasmSymbol{
2121 let typestr :string = " "
2222 switch ( this . type ) {
2323 case symboltype . label :typestr = localize ( "keykind.Label" , "label" ) ; break ;
24+ case symboltype . asmvar :typestr = localize ( "keykind.Variable" , "variable" ) ; break ;
2425 case symboltype . procedure :typestr = localize ( "keykind.Procedure" , "procedure" ) ; break ;
2526 case symboltype . struct :typestr = localize ( "keykind.Structure" , "Structure" ) ; break ;
2627 case symboltype . macro :typestr = localize ( "keykind.Macro" , "macro" ) ; break ;
@@ -30,13 +31,7 @@ class TasmSymbol{
3031 }
3132}
3233enum linetype { other , macro , endm , segment , ends , proc , endp }
33- function readline ( line :string ) {
34- // let regmacro=/
35- // let regendm
36- // let regproc
37- // let regendp=/
3834
39- }
4035export function findSymbol ( word :string ) :TasmSymbol | undefined {
4136 for ( let sym of symbols ) {
4237 if ( sym . name === word ) {
@@ -46,6 +41,15 @@ export function findSymbol (word:string):TasmSymbol|undefined{
4641 return
4742}
4843const symbols :TasmSymbol [ ] = [ ]
44+ function scanline ( line :string ) {
45+ let str = line . toLowerCase ( )
46+ if ( str . includes ( "macro" ) ) return linetype . macro
47+ if ( str . includes ( "endm" ) ) return linetype . endm
48+ if ( str . includes ( "segment" ) ) return linetype . segment
49+ if ( str . includes ( "ends" ) ) return linetype . ends
50+ if ( str . includes ( "proc" ) ) return linetype . proc
51+ if ( str . includes ( "endp" ) ) return linetype . endp
52+ }
4953async function sacnDoc ( document :string [ ] , alsoVars : boolean = true ) : Promise < number > {
5054 // scan the document for necessary information
5155 let labelreg = / ^ \s * ( \w + ) \s * : /
@@ -54,10 +58,17 @@ async function sacnDoc(document:string[],alsoVars : boolean = true) : Promise<nu
5458 let a = labelreg . exec ( item )
5559 if ( a ) {
5660 let name :string = a [ 1 ]
57- let idx :number = a . index
61+ let idx :number = item . indexOf ( a [ 1 ] )
5862 let one :TasmSymbol = new TasmSymbol ( symboltype . label , name , new vscode . Position ( index , idx ) )
5963 symbols . push ( one )
6064 }
65+ let b = item . match ( / \s * ( \w + ) \s * [ d b | D B | d w | D W | d d | D D | d f | D F | d q | D Q | d t | D T ] / )
66+ if ( b ) {
67+ let name :string = b [ 1 ]
68+ let idx :number = item . indexOf ( b [ 1 ] )
69+ let one :TasmSymbol = new TasmSymbol ( symboltype . asmvar , name , new vscode . Position ( index , idx ) )
70+ symbols . push ( one )
71+ }
6172 } ,
6273 )
6374 return new Promise ( resolve => {
0 commit comments