Skip to content

Commit bfca40a

Browse files
committed
Fix rules.
1 parent dd61480 commit bfca40a

File tree

4 files changed

+17
-59
lines changed

4 files changed

+17
-59
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"displayName": "Rhai Language Support",
55
"description": "Highlight and formatter for Rhai",
66
"publisher": "rhaiscript",
7-
"version": "0.5.0",
7+
"version": "0.5.1",
88
"icon": "assets/icon.png",
99
"repository": {
1010
"type": "git",

syntax/rhai.YAML-tmLanguage

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ information_for_contributors:
77
patterns:
88
- include: '#comment'
99
- include: '#literal'
10+
- include: '#operator'
1011
repository:
1112
comment:
1213
patterns:
@@ -36,15 +37,15 @@ repository:
3637
match: (//).*$\n?
3738
captures:
3839
'1': {name: punctuation.definition.comment.line.rhai}
40+
3941
literal:
4042
patterns:
4143
- include: '#keyword'
4244
- include: '#string'
4345
- include: '#number'
4446
- include: '#symbol'
4547
- include: '#variable'
46-
- include: '#dict'
47-
- include: '#operators'
48+
4849
keyword:
4950
patterns:
5051
- match: \b(let|const)\b
@@ -67,20 +68,22 @@ repository:
6768
name: keyword.other.rhai support.function.rhai
6869
- 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
6970
name: invalid.illegal.rhai
70-
operators:
71+
72+
operator:
7173
patterns:
7274
- match: (==|!=|<=|>=|<|>)
7375
name: keyword.operator.comparison.rhai
7476
- match: (\+|-|\*|/|\*\*|%)
7577
name: keyword.operator.arithmetic.rhai
76-
- match: (\||&|>>|<<|^)
78+
- match: (\||&|>>|<<|\^)
7779
name: keyword.operator.bitwise.rhai
78-
- match: (=|\+=|-=|\*=|/=|\*\*=|%=|\|=|&=|^=|>>=|<<=)
80+
- match: (=|\+=|-=|\*=|/=|\*\*=|%=|\|=|&=|\^=|>>=|<<=)
7981
name: keyword.operator.assignment.rhai
8082
- match: (!)
8183
name: keyword.operator.infix.rhai
8284
- match: (\|\||&&)
8385
name: keyword.operator.logical.rhai
86+
8487
number:
8588
patterns:
8689
- match: (?<!\w)(0x[0-9a-fA-F][_0-9a-fA-F]*)(?!\w)
@@ -95,6 +98,7 @@ repository:
9598
name: constant.numeric.decimal.rhai
9699
- match: ([\+-]?[0-9][_0-9]*)
97100
name: constant.numeric.integer.rhai
101+
98102
string:
99103
patterns:
100104
- name: string.quoted.block.rhai
@@ -114,19 +118,6 @@ repository:
114118
patterns:
115119
- match: \\([tnr"\\\n]|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})
116120
name: constant.character.escape.rhai
117-
dict:
118-
patterns:
119-
- begin: (#\{)
120-
beginCaptures:
121-
'1': {name: variable.other.readwrite.begin.rhai}
122-
end: (\})
123-
endCaptures:
124-
'1': {name: variable.other.readwrite.end.rhai}
125-
patterns:
126-
- include: '#comment'
127-
- match: (?<!\w)([_a-zA-Z][_0-9a-zA-Z]*)\s*(:)\s*(?!\w)
128-
name: variable.other.readwrite.rhai
129-
- include: '#literal'
130121

131122
symbol:
132123
patterns:

syntax/rhai.markdown.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@
3636
]
3737
}
3838
]
39-
}
39+
}

syntax/rhai.tmLanguage.json

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
},
1313
{
1414
"include": "#literal"
15+
},
16+
{
17+
"include": "#operator"
1518
}
1619
],
1720
"repository": {
@@ -93,12 +96,6 @@
9396
},
9497
{
9598
"include": "#variable"
96-
},
97-
{
98-
"include": "#dict"
99-
},
100-
{
101-
"include": "#operators"
10299
}
103100
]
104101
},
@@ -146,7 +143,7 @@
146143
}
147144
]
148145
},
149-
"operators": {
146+
"operator": {
150147
"patterns": [
151148
{
152149
"match": "(==|!=|<=|>=|<|>)",
@@ -157,11 +154,11 @@
157154
"name": "keyword.operator.arithmetic.rhai"
158155
},
159156
{
160-
"match": "(\\||&|>>|<<|^)",
157+
"match": "(\\||&|>>|<<|\\^)",
161158
"name": "keyword.operator.bitwise.rhai"
162159
},
163160
{
164-
"match": "(=|\\+=|-=|\\*=|/=|\\*\\*=|%=|\\|=|&=|^=|>>=|<<=)",
161+
"match": "(=|\\+=|-=|\\*=|/=|\\*\\*=|%=|\\|=|&=|\\^=|>>=|<<=)",
165162
"name": "keyword.operator.assignment.rhai"
166163
},
167164
{
@@ -241,36 +238,6 @@
241238
}
242239
]
243240
},
244-
"dict": {
245-
"patterns": [
246-
{
247-
"begin": "(#\\{)",
248-
"beginCaptures": {
249-
"1": {
250-
"name": "variable.other.readwrite.begin.rhai"
251-
}
252-
},
253-
"end": "(\\})",
254-
"endCaptures": {
255-
"1": {
256-
"name": "variable.other.readwrite.end.rhai"
257-
}
258-
},
259-
"patterns": [
260-
{
261-
"include": "#comment"
262-
},
263-
{
264-
"match": "(?<!\\w)([_a-zA-Z][_0-9a-zA-Z]*)\\s*(:)\\s*(?!\\w)",
265-
"name": "variable.other.readwrite.rhai"
266-
},
267-
{
268-
"include": "#literal"
269-
}
270-
]
271-
}
272-
]
273-
},
274241
"symbol": {
275242
"patterns": [
276243
{

0 commit comments

Comments
 (0)