fluidd

Форк
0
/
gcode.tmLanguage.json 
222 строки · 6.8 Кб
1
{
2
    "scopeName": "source.gcode",
3
    "name": "VSCode GCode Syntax",
4
    "patterns": [
5
        {
6
            "include": "#all"
7
        }
8
    ],
9
    "repository": {
10
        "all": {
11
            "patterns": [
12
                {
13
                    "include": "#comments"
14
                },
15
                {
16
                    "include": "#speedsfeeds"
17
                },
18
                {
19
                    "include": "#prognumbers"
20
                },
21
                {
22
                    "include": "#coords"
23
                },
24
                {
25
                    "include": "#tools"
26
                },
27
                {
28
                    "include": "#modifiers"
29
                },
30
                {
31
                    "include": "#macrovars"
32
                },
33
                {
34
                    "include": "#keywords"
35
                },
36
                {
37
                    "include": "#operators"
38
                },
39
                {
40
                    "include": "#bracket-expression"
41
                }
42
            ]
43
        },
44
        "comments": {
45
            "patterns": [
46
                {
47
                    "name": "comment.gcode",
48
                    "match": "(\\(.+\\))"
49
                },
50
                {
51
                    "name": "comment.gcode",
52
                    "begin": ";",
53
                    "end": "\\n"
54
                }
55
            ]
56
        },
57
        "keywords": {
58
            "patterns": [
59
                {
60
                    "match": "(GOTO(?>\\d+))|(IF)|(EQ)|(NE)|(LT)|(GT)|(LE)|(GE)|(DO(?>\\d+))|(WHILE)|(WH)|(END(?>\\d+))|(AND)|(OR)|(XOR)",
61
                    "name": "keyword.control.gcode"
62
                },
63
                {
64
                    "match": "[gG](1)?5[4-9](.1)?\\s?(P[0-9]{1,3})?",
65
                    "name": "constant.numeric.gcode"
66
                },
67
                {
68
                    "match": "[gG]1[1-2][0-9]",
69
                    "name": "constant.numeric.gcode"
70
                },
71
                {
72
                    "match": "[gG]15\\s?(H[0-9]{1,2})?",
73
                    "name": "constant.numeric.gcode"
74
                },
75
                {
76
                    "match": "[gG][0-9]{1,3}(\\.[0-9])?",
77
                    "name": "markup.bold.gcode"
78
                },
79
                {
80
                    "match": "[mM][0-9]{1,3}",
81
                    "name": "keyword.operator.quantifier.regexp.gcode"
82
                },
83
                {
84
                    "match": "([\\%])",
85
                    "name": "string.gcode"
86
                }
87
            ]
88
        },
89
        "operators": {
90
            "patterns": [
91
                {
92
                    "match": "(SIN)|(COS)|(TAN)|(ASIN)|(ACOS)|(ATAN)|(FIX)|(FUP)|(LN)|(ROUND)|(SQRT)",
93
                    "name": "support.constant.math.gcode"
94
                },
95
                {
96
                    "match": "(FIX)|(FUP)|(ROUND)|(ABS)|(MOD)",
97
                    "name": "support.constant.math.gcode"
98
                },
99
                {
100
                    "match": "(\\+)|(\\*)|(\\/)|(\\*\\*)",
101
                    "name": "support.constant.math.gcode"
102
                },
103
                {
104
                    "match": "(\\-)",
105
                    "name": "invalid.gcode"
106
                }
107
            ]
108
        },
109
        "speedsfeeds": {
110
            "patterns": [
111
                {
112
                    "match": "([sS])\\s?(\\d+|(?=[#\\[]))",
113
                    "name": "constant.language.gcode"
114
                },
115
                {
116
                    "match": "([eEfF])\\s?(\\d*\\.?\\d+\\.?|\\.?(?=[#\\[]))",
117
                    "name": "constant.language.gcode"
118
                }
119
            ]
120
        },
121
        "prognumbers": {
122
            "patterns": [
123
                {
124
                    "match": "(^[nN])(\\d+)",
125
                    "name": "constant.numeric.gcode"
126
                },
127
                {
128
                    "match": "(^[oO])(\\d+)",
129
                    "name": "string.regexp.gcode"
130
                },
131
                {
132
                    "match": "([pP])\\s?(\\d?\\.?\\d+\\.?|\\.?(?=[#\\[]))",
133
                    "name": "string.regexp.gcode"
134
                }
135
            ]
136
        },
137
        "coords": {
138
            "patterns": [
139
                {
140
                    "match": "([xX])\\s?(\\-?\\d?\\.?\\d+\\.?|\\-?\\.?(?=[#\\[]))",
141
                    "name": "string.gcode"
142
                },
143
                {
144
                    "match": "([yY])\\s?(\\-?\\d?\\.?\\d+\\.?|\\-?\\.?(?=[#\\[]))",
145
                    "name": "string.gcode"
146
                },
147
                {
148
                    "match": "([zZ])\\s?(\\-?\\d?\\.?\\d+\\.?|\\-?\\.?(?=[#\\[]))",
149
                    "name": "invalid.gcode"
150
                },
151
                {
152
                    "match": "([aAbBcC])\\s?(\\-?\\d?\\.?\\d+\\.?|\\-?\\.?(?=[#\\[]))",
153
                    "name": "constant.character.escape.gcode"
154
                }
155
            ]
156
        },
157
        "tools": {
158
            "patterns": [
159
                {
160
                    "match": "([dD])\\s?(\\d+\\.?\\d*|(?=[#\\[]))",
161
                    "name": "constant.character.gcode"
162
                },
163
                {
164
                    "match": "([hH])\\s?(\\d+\\.?\\d*|(?=[#\\[]))",
165
                    "name": "constant.character.gcode"
166
                },
167
                {
168
                    "match": "([tT])\\s?(\\d+\\.?\\d*|(?=[#\\[]))",
169
                    "name": "constant.character.gcode"
170
                }
171
            ]
172
        },
173
        "modifiers": {
174
            "patterns": [
175
                {
176
                    "match": "([iIjJkK])(\\-?\\d?\\.?\\d+\\.?|\\-?\\.?(?=[#\\[]))",
177
                    "name": "constant.character.escape.gcode"
178
                },
179
                {
180
                    "match": "([qQrR])(\\-?\\d?\\.?\\d+\\.?|\\-?\\.?(?=[#\\[]]))",
181
                    "name": "support.constant.math.gcode"
182
                },
183
                {
184
                    "match": "([uUwW])(\\-?\\d?\\.?\\d+\\.?|\\-?\\.?(?=[#\\[]]))",
185
                    "name": "support.constant.math.gcode"
186
                }
187
            ]
188
        },
189
        "macrovars": {
190
            "patterns": [
191
                {
192
                    "match": "[#][0-9]+",
193
                    "name": "variable.other.gcode"
194
                },
195
                {
196
                    "match": "[#][\\[].+[\\]]",
197
                    "name": "variable.other.gcode"
198
                }
199
            ]
200
        },
201
        "bracket-expression": {
202
            "begin": "\\[",
203
            "end": "\\]",
204
            "beginCaptures": {
205
                "0": {
206
                    "name": "punctuation.paren.open"
207
                }
208
            },
209
            "endCaptures": {
210
                "0": {
211
                    "name": "punctuation.paren.close"
212
                }
213
            },
214
            "name": "expression.group",
215
            "patterns": [
216
                {
217
                    "include": "#all"
218
                }
219
            ]
220
        }
221
    }
222
}

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.