Skip to content

Commit

Permalink
Fix rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Apr 7, 2021
1 parent dd61480 commit bfca40a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 59 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"displayName": "Rhai Language Support",
"description": "Highlight and formatter for Rhai",
"publisher": "rhaiscript",
"version": "0.5.0",
"version": "0.5.1",
"icon": "assets/icon.png",
"repository": {
"type": "git",
Expand Down
27 changes: 9 additions & 18 deletions syntax/rhai.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ information_for_contributors:
patterns:
- include: '#comment'
- include: '#literal'
- include: '#operator'
repository:
comment:
patterns:
Expand Down Expand Up @@ -36,15 +37,15 @@ repository:
match: (//).*$\n?
captures:
'1': {name: punctuation.definition.comment.line.rhai}

literal:
patterns:
- include: '#keyword'
- include: '#string'
- include: '#number'
- include: '#symbol'
- include: '#variable'
- include: '#dict'
- include: '#operators'

keyword:
patterns:
- match: \b(let|const)\b
Expand All @@ -67,20 +68,22 @@ repository:
name: keyword.other.rhai support.function.rhai
- match: \b(var|static|begin|end|shared|each|then|goto|exit|unless|match|case|public|protected|new|use|with|module|package|super|thread|spawn|go|await|async|sync|yield|default|void|null|nil)\b
name: invalid.illegal.rhai
operators:

operator:
patterns:
- match: (==|!=|<=|>=|<|>)
name: keyword.operator.comparison.rhai
- match: (\+|-|\*|/|\*\*|%)
name: keyword.operator.arithmetic.rhai
- match: (\||&|>>|<<|^)
- match: (\||&|>>|<<|\^)
name: keyword.operator.bitwise.rhai
- match: (=|\+=|-=|\*=|/=|\*\*=|%=|\|=|&=|^=|>>=|<<=)
- match: (=|\+=|-=|\*=|/=|\*\*=|%=|\|=|&=|\^=|>>=|<<=)
name: keyword.operator.assignment.rhai
- match: (!)
name: keyword.operator.infix.rhai
- match: (\|\||&&)
name: keyword.operator.logical.rhai

number:
patterns:
- match: (?<!\w)(0x[0-9a-fA-F][_0-9a-fA-F]*)(?!\w)
Expand All @@ -95,6 +98,7 @@ repository:
name: constant.numeric.decimal.rhai
- match: ([\+-]?[0-9][_0-9]*)
name: constant.numeric.integer.rhai

string:
patterns:
- name: string.quoted.block.rhai
Expand All @@ -114,19 +118,6 @@ repository:
patterns:
- match: \\([tnr"\\\n]|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})
name: constant.character.escape.rhai
dict:
patterns:
- begin: (#\{)
beginCaptures:
'1': {name: variable.other.readwrite.begin.rhai}
end: (\})
endCaptures:
'1': {name: variable.other.readwrite.end.rhai}
patterns:
- include: '#comment'
- match: (?<!\w)([_a-zA-Z][_0-9a-zA-Z]*)\s*(:)\s*(?!\w)
name: variable.other.readwrite.rhai
- include: '#literal'

symbol:
patterns:
Expand Down
2 changes: 1 addition & 1 deletion syntax/rhai.markdown.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
]
}
]
}
}
45 changes: 6 additions & 39 deletions syntax/rhai.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
},
{
"include": "#literal"
},
{
"include": "#operator"
}
],
"repository": {
Expand Down Expand Up @@ -93,12 +96,6 @@
},
{
"include": "#variable"
},
{
"include": "#dict"
},
{
"include": "#operators"
}
]
},
Expand Down Expand Up @@ -146,7 +143,7 @@
}
]
},
"operators": {
"operator": {
"patterns": [
{
"match": "(==|!=|<=|>=|<|>)",
Expand All @@ -157,11 +154,11 @@
"name": "keyword.operator.arithmetic.rhai"
},
{
"match": "(\\||&|>>|<<|^)",
"match": "(\\||&|>>|<<|\\^)",
"name": "keyword.operator.bitwise.rhai"
},
{
"match": "(=|\\+=|-=|\\*=|/=|\\*\\*=|%=|\\|=|&=|^=|>>=|<<=)",
"match": "(=|\\+=|-=|\\*=|/=|\\*\\*=|%=|\\|=|&=|\\^=|>>=|<<=)",
"name": "keyword.operator.assignment.rhai"
},
{
Expand Down Expand Up @@ -241,36 +238,6 @@
}
]
},
"dict": {
"patterns": [
{
"begin": "(#\\{)",
"beginCaptures": {
"1": {
"name": "variable.other.readwrite.begin.rhai"
}
},
"end": "(\\})",
"endCaptures": {
"1": {
"name": "variable.other.readwrite.end.rhai"
}
},
"patterns": [
{
"include": "#comment"
},
{
"match": "(?<!\\w)([_a-zA-Z][_0-9a-zA-Z]*)\\s*(:)\\s*(?!\\w)",
"name": "variable.other.readwrite.rhai"
},
{
"include": "#literal"
}
]
}
]
},
"symbol": {
"patterns": [
{
Expand Down

0 comments on commit bfca40a

Please sign in to comment.