Skip to content

Commit b7fef2e

Browse files
committed
bugfix:行尾符号是lf时无法正确工作的问题
1 parent c187bf9 commit b7fef2e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "MASM/TASM",
44
"publisher": "xsro",
55
"description": "DOS汇编语言开发环境和语法支持,安装即用,自带DOSBox.exe和TASM/MASM工具",
6-
"version": "0.2.0",
6+
"version": "0.2.1-alpha.1",
77
"keywords":["dosbox","16位","汇编","微机原理","tasm","masm"],
88
"icon":"dosboxasm.png",
99
"engines": {

src/language/wordinfo.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Asmline{
7979
function scanline(item:string,line:number):Asmline|null{
8080
let r: RegExpMatchArray | null=null
8181
let asmline:Asmline|null=null
82-
r=item.match(/^\s*(\w+)\s+(\w+)\s/)
82+
r=item.match(/^\s*(\w+)\s+(\w+)\s*/)
8383
if(r) {
8484
let type1:linetype|undefined
8585
switch (r[2].toUpperCase()){
@@ -126,7 +126,8 @@ function getvarlabel(item:string,index:number,belong?:string):vscode.DocumentSym
126126
return vscsymbol
127127
}
128128
export function sacnDoc(document:vscode.TextDocument) : vscode.DocumentSymbol[] {
129-
_document=document;symbols=[];let doc=document.getText().split('\n')
129+
_document=document;symbols=[];let doc=document.getText().split("\n")
130+
console.log(doc,document.getText())
130131
// scan the document for necessary information
131132
let docsymbol:vscode.DocumentSymbol[]=[]
132133
let asmline:Asmline[]=[]
@@ -167,12 +168,14 @@ export function sacnDoc(document:vscode.TextDocument) : vscode.DocumentSymbol[]
167168
if(array[i].type===linetype.proc){
168169
proc=array[i]
169170
}
171+
//找到子程序结束标志
170172
if(array[i].type===linetype.endp && proc?.name ===array[i].name){
171173
let _name=array[i].name
172174
if(proc?.name && _name){
173175
let range:vscode.Range=new vscode.Range(proc?.line,proc?.index,array[i].line,array[i].index+_name.length)
174176
let srange:vscode.Range=new vscode.Range(proc.line,proc.index,proc?.line,proc?.index+proc?.name?.length)
175177
procschild.push(new vscode.DocumentSymbol(proc?.name,doc[proc?.line],SymbolVSCfy(symboltype.procedure),range,srange))
178+
symbols.push(new TasmSymbol(symboltype.procedure,_name,range))
176179
}
177180
}
178181
//寻找段结束语句
@@ -192,6 +195,7 @@ export function sacnDoc(document:vscode.TextDocument) : vscode.DocumentSymbol[]
192195
}
193196
}
194197
)
198+
//寻找变量,标号信息
195199
docsymbol.forEach(
196200
(item)=>{
197201
//将宏指令范围内的变量和标号添加到宏
@@ -652,8 +656,8 @@ const KEYWORD_DICONTARY : Array<KeywordDef>= [
652656
new KeywordDef("wrt", localize("keyword.wrt","(Not supported)"),KeywordType.Instruction,"wrt",0),
653657
//Repeating
654658
new KeywordDef("loop", localize("keyword.loop","- decrease `CX`\n\n- Jumps to a label if cx is not 0"),KeywordType.Instruction,"loop [label]",1,AllowKinds.Label),
655-
new KeywordDef("loopz", localize("keyword.loope","- decrease `CX`\n\n- Jumps to a label if cx is not 0 **and** Zero flag is 1"),KeywordType.Instruction,"loope [label]",1,AllowKinds.Label,['loope']),
656-
new KeywordDef("loopnz", localize("keyword.loopz","- decrease `CX`\n\n- Jumps to a label if cx is not 0 **and** zero flag is not 1"),KeywordType.Instruction,"loopz [label]",1,AllowKinds.Label,['loopne']),
659+
new KeywordDef("loopz", localize("keyword.loopz","- decrease `CX`\n\n- Jumps to a label if cx is not 0 **and** Zero flag is 1"),KeywordType.Instruction,"loope [label]",1,AllowKinds.Label,['loope']),
660+
new KeywordDef("loopnz", localize("keyword.loopnz","- decrease `CX`\n\n- Jumps to a label if cx is not 0 **and** zero flag is not 1"),KeywordType.Instruction,"loopz [label]",1,AllowKinds.Label,['loopne']),
657661
];
658662
export function GetKeyword(word : string) : KeywordDef | undefined{
659663
for (let i = 0; i < KEYWORD_DICONTARY.length; i++) {

0 commit comments

Comments
 (0)