]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/c.yaml
Add skip statements to all strings
[micro.git] / runtime / syntax / c.yaml
1 filetype: c
2
3 detect:
4     filename: "(\\.(c|C)$|\\.(h|H)$|\\.ii?$|\\.(def)$)"
5
6 rules:
7     - identifier: "\\b[A-Z_][0-9A-Z_]+\\b" 
8     - type: "\\b(float|double|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\\b"
9     - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
10     - type.extended: "\\b(bool)\\b"
11     - statement: "\\b(typename|mutable|volatile|register|explicit)\\b"
12     - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
13     - statement: "\\b(try|throw|catch|operator|new|delete)\\b"
14     - statement: "\\b(goto|continue|break|return)\\b"
15     - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
16     - constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'"
17     - constant: "'\\\\(([0-3]?[0-7]{1,2}))'"
18     - constant: "'\\\\x[0-9A-Fa-f]{1,2}'"
19       # GCC builtins
20     - statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)"
21     - statement: "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
22       # Operator Color
23     - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)" 
24     - symbol.brackets: "[(){}]|\\[|\\]"
25     - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
26     - constant.number: "NULL"
27
28     - constant.string:
29         start: "\""
30         end: "\""
31         skip: "\\\\."
32         rules:
33             - constant.specialChar: "\\\\."
34
35     - constant.string:
36         start: "'"
37         end: "'"
38         skip: "\\\\."
39         rules:
40             - preproc: "..+"
41             - constant.specialChar: "\\\\."
42
43     - comment:
44         start: "//"
45         end: "$"
46         rules:
47             - todo: "(TODO|XXX|FIXME):?"
48
49     - comment:
50         start: "/\\*"
51         end: "\\*/"
52         rules:
53             - todo: "(TODO|XXX|FIXME):?"
54