]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/c.yaml
Merge branch 'python-highlight-zero' of https://github.com/a11ce/micro into a11ce...
[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(volatile|register)\\b"
12     - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
13     - statement: "\\b(goto|continue|break|return)\\b"
14     - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
15       # GCC builtins
16     - statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)"
17     - statement: "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
18       # Operator Color
19     - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
20     - symbol.brackets: "[(){}]|\\[|\\]"
21     - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
22     - constant.number: "NULL"
23
24     - constant.string:
25         start: "\""
26         end: "\""
27         skip: "\\\\."
28         rules:
29             - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"
30
31     - constant.string:
32         start: "'"
33         end: "'"
34         skip: "\\\\."
35         rules:
36             - error: "..+"
37             - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"
38
39     - comment:
40         start: "//"
41         end: "$"
42         rules:
43             - todo: "(TODO|XXX|FIXME):?"
44
45     - comment:
46         start: "/\\*"
47         end: "\\*/"
48         rules:
49             - todo: "(TODO|XXX|FIXME):?"