]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/cpp.yaml
Merge pull request #1315 from matbesancon/patch-1
[micro.git] / runtime / syntax / cpp.yaml
1 filetype: c++
2
3 detect:
4     filename: "(\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$)"
5
6 rules:
7
8     - identifier: "\\b[A-Z_][0-9A-Z_]+\\b" 
9     - type: "\\b(auto|float|double|bool|char|int|short|long|sizeof|enum|void|static|const|constexpr|struct|union|typedef|extern|(un)?signed|inline)\\b"
10     - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
11     - statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|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\\\\]))'|'\\\\(([0-3]?[0-7]{1,2}))'|'\\\\x[0-9A-Fa-f]{1,2}')"
17
18       # GCC builtins
19     - statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
20
21       # Operator Color
22     - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)" 
23       # Parenthetical Color
24     - symbol.brackets: "[(){}]|\\[|\\]"
25
26     - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
27     - constant.bool: "(\\b(true|false)\\b|NULL)"
28
29     - constant.string:
30         start: "\""
31         end: "\""
32         skip: "\\\\."
33         rules:
34             - constant.specialChar: "\\\\."
35
36     - constant.string:
37         start: "'"
38         end: "'"
39         skip: "\\\\."
40         rules:
41             - preproc: "..+"
42             - constant.specialChar: "\\\\."
43
44     - comment:
45         start: "//"
46         end: "$"
47         rules:
48             - todo: "(TODO|XXX|FIXME):?"
49
50     - comment:
51         start: "/\\*"
52         end: "\\*/"
53         rules:
54             - todo: "(TODO|XXX|FIXME):?"
55