Skip to content

Commit daef0b1

Browse files
committed
Added specific rs274ngc regexes. Tweaks for #40 fix
1 parent cbdcc13 commit daef0b1

File tree

1 file changed

+29
-30
lines changed

1 file changed

+29
-30
lines changed

syntaxes/gcode.tmLanguage.json

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
{
1313
"include": "#comments"
1414
},
15-
{
16-
"include": "#bracket-expression"
17-
},
1815
{
1916
"include": "#control"
2017
},
@@ -44,6 +41,9 @@
4441
},
4542
{
4643
"include": "#macrovars"
44+
},
45+
{
46+
"include": "#rs274ngc"
4747
}
4848
]
4949
},
@@ -63,15 +63,15 @@
6363
"control": {
6464
"patterns": [
6565
{
66-
"match": "(GOTO\\s?\\d*)",
66+
"match": "(?i)(GOTO\\s?\\d+)",
6767
"name": "keyword.control.gcode"
6868
},
6969
{
70-
"match": "(EQ|NE|LT|GT|LE|GE|AND|OR|XOR)",
70+
"match": "(?i)(EQ|NE|LT|GT|LE|GE|AND|OR|XOR)",
7171
"name": "keyword.control.gcode"
7272
},
7373
{
74-
"match": "(DO\\s?\\d*|WHILE|WH|END|IF|THEN|ELSE|ENDIF)",
74+
"match": "(?i)(DO\\s?\\d*|WHILE|WH|END|IF|THEN|ELSE|ENDIF)",
7575
"name": "keyword.control.gcode"
7676
},
7777
{
@@ -111,11 +111,11 @@
111111
"operators": {
112112
"patterns": [
113113
{
114-
"match": "(SIN|COS|TAN|ASIN|ACOS|ATAN|FIX|FUP|LN|ROUND|SQRT)",
114+
"match": "(?i)(SIN|COS|TAN|ASIN|ACOS|ATAN|FIX|FUP|LN|ROUND|SQRT)",
115115
"name": "support.constant.math.gcode"
116116
},
117117
{
118-
"match": "(FIX|FUP|ROUND|ABS|MOD)",
118+
"match": "(?i)(FIX|FUP|ROUND|ABS|MOD)",
119119
"name": "support.constant.math.gcode"
120120
},
121121
{
@@ -135,7 +135,7 @@
135135
"name": "constant.language.gcode"
136136
},
137137
{
138-
"match": "([eEfF])\\s?(\\d*\\.?\\d+\\.?|\\.?(?=[#\\[]))",
138+
"match": "([eEfF])\\s?\\.?(\\d+(\\.\\d*)?|(?=[#\\[]))",
139139
"name": "constant.language.gcode"
140140
}
141141
]
@@ -147,7 +147,7 @@
147147
"name": "constant.numeric.gcode"
148148
},
149149
{
150-
"match": "(^[oO])(\\d+)",
150+
"match": "(^[oO])(\\d+)?",
151151
"name": "string.regexp.gcode"
152152
},
153153
{
@@ -211,32 +211,31 @@
211211
"macrovars": {
212212
"patterns": [
213213
{
214-
"match": "[#][0-9]+",
215-
"name": "variable.other.gcode"
216-
},
217-
{
218-
"match": "[#][\\[].+[\\]]",
214+
"match": "[#][0-9]*",
219215
"name": "variable.other.gcode"
220216
}
221217
]
222218
},
223-
"bracket-expression": {
224-
"begin": "\\[",
225-
"end": "\\]",
226-
"beginCaptures": {
227-
"0": {
228-
"name": "punctuation.paren.open"
229-
}
230-
},
231-
"endCaptures": {
232-
"0": {
233-
"name": "punctuation.paren.close"
234-
}
235-
},
236-
"name": "expression.group",
219+
"rs274ngc": {
237220
"patterns": [
238221
{
239-
"include": "#all"
222+
"match": "(?i)(ENDSUB|SUB)",
223+
"name": "keyword.control.gcode"
224+
},
225+
{
226+
"begin": "<",
227+
"end": ">",
228+
"beginCaptures": {
229+
"0": {
230+
"name": "markup.bold.gcode"
231+
}
232+
},
233+
"endCaptures": {
234+
"0": {
235+
"name": "markup.bold.gcode"
236+
}
237+
},
238+
"name": "support.type.gcode"
240239
}
241240
]
242241
}

0 commit comments

Comments
 (0)