Add highlighting for user-defined types (#2107)

* Added highlighting for user-defined types

Provides automatic highlighting of user-defined types ending with either "_t" or "_T", as is seen in editors such as Nano, or within GitHub itself.

* Update cpp.yaml
This commit is contained in:
Rosetta H&S
2021-06-02 07:33:40 +08:00
committed by GitHub
parent 2dc2cabe0e
commit b66ec2bf7a
2 changed files with 2 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ rules:
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
- type: "\\b(auto|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"
- type: "\\b[a-z_][0-9a-z_]+(_t|_T)\\b"
- type.extended: "\\b(bool)\\b"
- statement: "\\b(volatile|register)\\b"
- statement: "\\b(for|if|while|do|else|case|default|switch)\\b"

View File

@@ -7,6 +7,7 @@ rules:
- identifier: "\\b[A-Z_][0-9A-Z_]*\\b"
- type: "\\b(float|double|bool|char|int|short|long|enum|void|struct|union|typedef|(un)?signed|inline)\\b"
- type: "\\b(((s?size)|((u_?)?int(8|16|32|64|ptr))|char(8|16|32))_t|wchar_t)\\b"
- type: "\\b[a-z_][0-9a-z_]+(_t|_T)\\b"
- type: "\\b(final|override)\\b"
- type.keyword: "\\b(auto|volatile|const(expr|eval|init)?|mutable|register|thread_local|static|extern|decltype|explicit|virtual)\\b"
- statement: "\\b(class|namespace|template|typename|this|friend|using|public|protected|private|noexcept)\\b"