2 # Loosely based on the csharp.yaml definition
3 # (?i) on everything because ZScript isn't case sensitive
6 filename: "(?i)\\.z(c|sc)$"
10 # ZScript only has one preprocessor directive and a required engine version declaration
11 - preproc: "(?i)#include"
12 - preproc: "(?i)version"
14 # State labels ("goto" word overridden by state logic rule below)
15 - symbol.tag: "(?i)[a-z0-9.]+:"
16 - symbol.tag: "(?i)goto [a-z0-9]+[\\+0-9]*"
19 - identifier.class: "(?i)class +[a-z0-9_]+ *((:) +[a-z0-9.]+)?"
21 # Functions (open paren overridden by symbol.brackets rule because perl regex apparently doesn't support postive lookahead)
22 - identifier: "(?i)[\\.]*[a-z0-9_]+[ ]*[(]+"
25 - type: "(?i)\\b(actor|object|vector2|vector3|name|string|color|sound|void|double|bool|int|float|float64|uint8|uint16|uint|int8|int16|TextureID|SpriteID|Array|voidptr|short|action|state|statelabel)\\b"
28 - statement: "(?i)\\b(class|default|private|static|native|return|if|else|for|while|do|deprecated|null|readonly|true|false|struct|extend|clearscope|vararg|ui|play|virtual|virtualscope|meta|Property|in|out|states|override|super|is|let|const|replaces|protected|self|abstract|enum|switch|case)\\b"
30 # State logic keywords
31 - special: "(?i)\\b(goto|loop|stop|break|continue|fail)\\b"
34 - symbol.operator: "[\\-+/*=<>?:!~%&|]"
35 - symbol.brackets: "[(){}]|\\[|\\]"
38 - constant.bool: "(?i)(\\b(true|false)\\b|NULL)"
39 - constant.number: "(?i)\\b([0-9][.]*[0-9]*)+?\\b"
40 - constant.number: "(?i)\\b(0x[A-Fa-f0-9_]+)?\\b"
41 - constant.number: "(?i)\\b(0b[0-1_]+)[FL]?\\b"
42 #- constant.number: "(?i)\\b(([0-9][.]*[0-9]*)+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b"
50 - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
51 - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
58 - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
59 - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
66 - todo: "(TODO|XXX|FIXME):?"
72 - todo: "(TODO|XXX|FIXME):?"