]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/cpp.yaml
Merge branch 'master' of https://github.com/zyedidia/micro into build_tools
[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         rules:
33             - constant.specialChar: "\\\\."
34
35     - constant.string:
36         start: "'"
37         end: "'"
38         rules:
39             - preproc: "..+"
40             - constant.specialChar: "\\\\."
41
42     - comment:
43         start: "//"
44         end: "$"
45         rules:
46             - todo: "(TODO|XXX|FIXME):?"
47
48     - comment:
49         start: "/\\*"
50         end: "\\*/"
51         rules:
52             - todo: "(TODO|XXX|FIXME):?"
53