Skip to content

Commit

Permalink
scopes changed
Browse files Browse the repository at this point in the history
  • Loading branch information
iSorp committed Jun 7, 2020
1 parent be31b7c commit 0df6c51
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@
"constant.numeric"
],
"variable": [
"variable.other.readwrite"
"variable.other.field"
],
"symbol": [
"variable.other.constant"
"variable.other.numeric"
],
"constant": [
"constant.other.numeric"
Expand Down
Binary file modified resources/semantic.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions server/src/macroLanguageService/services/macroSemantic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ export class MacroSemantic {
if (type === nodes.ValueType.Variable) {
builder.push(pos.line, pos.character, variable.symbol.length, TokenTypes.variable, 0);
}
if (type === nodes.ValueType.Constant || type === nodes.ValueType.Numeric) {
else if (type === nodes.ValueType.Constant) {
if (!RegExp(/(true)|(false)/i).test(variable.symbol.getText())) {
builder.push(pos.line, pos.character, variable.symbol.length, TokenTypes.constant, 0);
}
}

else if (type === nodes.ValueType.Numeric) {
builder.push(pos.line, pos.character, variable.symbol.length, TokenTypes.symbol, 0);
}
else if (type === nodes.ValueType.NcCode) {
builder.push(pos.line, pos.character, variable.symbol.length, TokenTypes.code, 0);
}
Expand Down
6 changes: 3 additions & 3 deletions syntaxes/key_words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ meta.definition.variable.macro
punctuation.definition.keyword.variable.macro // @
variable.other.symbol.macro // @<symbol>

meta.symbol.macro // any symbol
variable.macro // any symbol

variable.language.macro // $LIST, $INCLUDE, $, %, #, ..

Expand All @@ -53,10 +53,10 @@ comment.line.macro // /*, ;
"constant.numeric"
],
"variable": [
"variable.other.readwrite"
"variable.other.field"
],
"symbol": [
"variable.other.constant"
"variable.other.numeric"
],
"constant": [
"constant.other.numeric"
Expand Down
4 changes: 2 additions & 2 deletions syntaxes/macro.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
"name":"keyword.operator.assignment.macro"
},
"symbol" : {
"name":"meta.symbol.macro",
"name":"variable.macro",
"match":"\\b([\\w\\_])*(?=[a-zA-Z])([\\w\\_])+\\b"
},
"sequence" : {
Expand Down Expand Up @@ -263,7 +263,7 @@
},
"assignment":{
"begin" : "(?=#?\\w+\\s*\\=)|(?<=\\=)(\\w*)",
"end" : "(?=\\(|\/|\\,)|$",
"end" : "(?=\\(|\/|\\;)|$",
"name":"meta.var.expr.macro",
"patterns":[
{
Expand Down

0 comments on commit 0df6c51

Please sign in to comment.