]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/zscript.yaml
add more types for nim (#2284)
[micro.git] / runtime / syntax / zscript.yaml
1 filetype: zscript
2 # Loosely based on the csharp.yaml definition
3 # (?i) on everything because ZScript isn't case sensitive
4
5 detect:
6     filename: "(?i)\\.z(c|sc)$"
7
8 rules:
9
10     # ZScript only has one preprocessor directive and a required engine version declaration
11     - preproc: "(?i)#include"
12     - preproc: "(?i)version"
13
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]*"
17
18     # Classes
19     - identifier.class: "(?i)class +[a-z0-9_]+ *((:) +[a-z0-9.]+)?"
20
21     # Functions (open paren overridden by symbol.brackets rule because perl regex apparently doesn't support postive lookahead)
22     - identifier: "(?i)[\\.]*[a-z0-9_]+[ ]*[(]+"
23
24     # Variable types
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"
26
27     # Keywords
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"
29
30     # State logic keywords
31     - special: "(?i)\\b(goto|loop|stop|break|continue|fail)\\b"
32
33     # Symbols
34     - symbol.operator: "[\\-+/*=<>?:!~%&|]"
35     - symbol.brackets: "[(){}]|\\[|\\]"
36
37     # Constants
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"
43
44     # Strings
45     - constant.string:
46         start: "\""
47         end: "\""
48         skip: "\\\\."
49         rules:
50             - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
51             - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
52
53     - constant.string:
54         start: "'"
55         end: "'"
56         skip: "\\\\."
57         rules:
58             - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
59             - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
60
61     # Comments
62     - comment:
63         start: "//"
64         end: "$"
65         rules:
66             - todo: "(TODO|XXX|FIXME):?"
67
68     - comment:
69         start: "/\\*"
70         end: "\\*/"
71         rules:
72             - todo: "(TODO|XXX|FIXME):?"