mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-18 14:57:18 +09:00
Use new syntax highlighting engine from zyedidia/highlight
This changes all the syntax files in the runtime directory and also changes how syntax highlighting is done from inside micro.
This commit is contained in:
51
runtime/syntax/cpp.yaml
Normal file
51
runtime/syntax/cpp.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
filetype: c++
|
||||
|
||||
detect:
|
||||
filename: "(\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$)"
|
||||
|
||||
rules:
|
||||
|
||||
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
||||
- type: "\\b(auto|float|double|bool|char|int|short|long|sizeof|enum|void|static|const|constexpr|struct|union|typedef|extern|(un)?signed|inline)\\b"
|
||||
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
|
||||
- statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
|
||||
- statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
|
||||
- statement: "\\b(try|throw|catch|operator|new|delete)\\b"
|
||||
- statement: "\\b(goto|continue|break|return)\\b"
|
||||
- preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||
- constant: "('([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'|'\\\\(([0-3]?[0-7]{1,2}))'|'\\\\x[0-9A-Fa-f]{1,2}')"
|
||||
|
||||
##
|
||||
## GCC builtins
|
||||
- statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
|
||||
|
||||
#Operator Color
|
||||
- statement: "([.:;,+*|=!\\%]|<|>|/|-|&)"
|
||||
|
||||
- constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
|
||||
- constant.number: "(\\b(true|false)\\b|NULL)"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "'"
|
||||
rules:
|
||||
- preproc: "..+"
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
Reference in New Issue
Block a user