2017-02-18 23:17:07 +03:00
|
|
|
filetype: c
|
|
|
|
|
2017-03-21 22:07:39 +03:00
|
|
|
detect:
|
|
|
|
filename: "(\\.(c|C)$|\\.(h|H)$|\\.ii?$|\\.(def)$)"
|
2017-02-18 23:17:07 +03:00
|
|
|
|
|
|
|
rules:
|
2018-08-07 15:44:53 +03:00
|
|
|
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
2017-02-18 23:17:07 +03:00
|
|
|
- type: "\\b(float|double|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\\b"
|
|
|
|
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
|
2017-03-21 21:55:22 +03:00
|
|
|
- type.extended: "\\b(bool)\\b"
|
2018-08-07 15:44:53 +03:00
|
|
|
- statement: "\\b(volatile|register)\\b"
|
2017-02-18 23:17:07 +03:00
|
|
|
- statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
|
2017-03-21 22:07:39 +03:00
|
|
|
- statement: "\\b(goto|continue|break|return)\\b"
|
2017-02-18 23:17:07 +03:00
|
|
|
- preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
2017-03-21 22:07:39 +03:00
|
|
|
- constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'"
|
|
|
|
- constant: "'\\\\(([0-3]?[0-7]{1,2}))'"
|
|
|
|
- constant: "'\\\\x[0-9A-Fa-f]{1,2}'"
|
|
|
|
# GCC builtins
|
|
|
|
- statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)"
|
|
|
|
- statement: "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
|
|
|
# Operator Color
|
2018-08-07 15:44:53 +03:00
|
|
|
- symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
|
2017-03-21 21:55:22 +03:00
|
|
|
- symbol.brackets: "[(){}]|\\[|\\]"
|
2017-03-21 22:07:39 +03:00
|
|
|
- constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
|
2017-02-18 23:17:07 +03:00
|
|
|
- constant.number: "NULL"
|
2017-03-21 22:07:39 +03:00
|
|
|
|
|
|
|
- constant.string:
|
|
|
|
start: "\""
|
2017-03-28 03:53:08 +03:00
|
|
|
end: "\""
|
2017-03-29 16:45:16 +03:00
|
|
|
skip: "\\\\."
|
2017-03-21 22:07:39 +03:00
|
|
|
rules:
|
|
|
|
- constant.specialChar: "\\\\."
|
|
|
|
|
|
|
|
- constant.string:
|
|
|
|
start: "'"
|
2017-03-28 03:53:08 +03:00
|
|
|
end: "'"
|
2017-03-29 16:45:16 +03:00
|
|
|
skip: "\\\\."
|
2017-03-21 22:07:39 +03:00
|
|
|
rules:
|
|
|
|
- preproc: "..+"
|
|
|
|
- constant.specialChar: "\\\\."
|
|
|
|
|
|
|
|
- comment:
|
|
|
|
start: "//"
|
|
|
|
end: "$"
|
|
|
|
rules:
|
|
|
|
- todo: "(TODO|XXX|FIXME):?"
|
|
|
|
|
2017-02-18 23:17:07 +03:00
|
|
|
- comment:
|
|
|
|
start: "/\\*"
|
|
|
|
end: "\\*/"
|
2017-03-21 22:07:39 +03:00
|
|
|
rules:
|
|
|
|
- todo: "(TODO|XXX|FIXME):?"
|