{ "name": "VSCode GCode Syntax", "scopeName": "source.gcode", "patterns": [ { "include": "#comments" }, { "include": "#speedsfeeds" }, { "include": "#prognumbers" }, { "include": "#coords" }, { "include": "#tools" }, { "include": "#modifiers" }, { "include": "#macrovars" }, { "include": "#keywords" }, { "include": "#operators" } ], "repository": { "comments": { "patterns": [ { "name": "comment.gcode", "match": "(\\(.+\\))" }, { "name": "comment.gcode", "begin": ";", "end": "\\n" } ] }, "coords": { "patterns": [ { "name": "string.gcode", "match": "([xX])(?=-|\\d|\\[|#)-?(?:\\d+(?:\\.\\d*)?)?" }, { "name": "string.gcode", "match": "([yY])(?=-|\\d|\\[|#)-?(?:\\d+(?:\\.\\d*)?)?" }, { "name": "invalid.gcode", "match": "([zZ])(?=-|\\d|\\[|#)-?(?:\\d+(?:\\.\\d*)?)?" }, { "name": "constant.character.escape.gcode", "match": "([aAbBcC])(?=-|\\d|\\[|#)-?(?:\\d+(?:\\.\\d*)?)?" } ] }, "keywords": { "patterns": [ { "name": "markup.bold.gcode", "match": "[gG][0-9]{1,3}" }, { "name": "keyword.operator.quantifier.regexp.gcode", "match": "[mM][0-9]{1,3}" }, { "name": "string.gcode", "match": "([\\%])" }, { "name": "keyword.control.gcode", "match": "(GOTO)|(IF)|(EQ)|(NE)|(LT)|(GT)|(LE)|(GE)|(DO)|(WHILE)|(END)|(AND)|(OR)|(XOR)" } ] }, "macrovars": { "patterns": [ { "name": "variable.other.gcode", "match": "[#][0-9]+" }, { "name": "variable.other.gcode", "match": "[#][\\[].+[\\]]" } ] }, "modifiers": { "patterns": [ { "name": "constant.character.escape.gcode", "match": "([iIjJkK])(?=-|\\d|\\[|#)-?(?:\\d+(?:\\.\\d*)?)?" }, { "name": "support.constant.math.gcode", "match": "([qQrR])(?=-|\\d|\\[|#)-?(?:\\d+(?:\\.\\d*)?)?" } ] }, "operators": { "patterns": [ { "name": "support.constant.math.gcode", "match": "(SIN)|(COS)|(TAN)|(ASIN)|(ACOS)|(ATAN)|(FIX)|(FUP)|(LN)|(ROUND)|(SQRT)" }, { "name": "support.constant.math.gcode", "match": "(FIX)|(FUP)|(ROUND)|(ABS)|(MOD)" }, { "name": "support.constant.math.gcode", "match": "(\\+)|(\\*)|(\\/)|(\\*\\*)" }, { "name": "invalid.gcode", "match": "(\\-)" } ] }, "prognumbers": { "patterns": [ { "name": "constant.numeric.gcode", "match": "[nN][0-9]+" }, { "name": "string.regexp.gcode", "match": "[oO][0-9]{1,5}" }, { "name": "string.regexp.gcode", "match": "[pP][0-9]{0,5}" } ] }, "speedsfeeds": { "patterns": [ { "name": "constant.language.gcode", "match": "([sS])(?=-|\\d|\\[|#)-?(?:\\d+(?:\\.\\d*)?)?" }, { "name": "constant.language.gcode", "match": "([fF])(?=-|\\d|\\[|#)-?(?:\\d+(?:\\.\\d*)?)?" } ] }, "tools": { "patterns": [ { "name": "constant.character.gcode", "match": "([dD])(?=-|\\d|\\[|#)-?(?:\\d+(?:\\.\\d*)?)?" }, { "name": "constant.character.gcode", "match": "([hH])(?=-|\\d|\\[|#)-?(?:\\d+(?:\\.\\d*)?)?" }, { "name": "constant.character.gcode", "match": "([tT])(?=-|\\d|\\[|#)-?(?:\\d+(?:\\.\\d*)?)?" } ] } } }