| 1 |
filetype: cuda |
| 2 |
|
| 3 |
detect: |
| 4 |
filename: "(\\.cu[h]?$)" |
| 5 |
|
| 6 |
rules: |
| 7 |
- identifier: "\\b[A-Z_][0-9A-Z_]*\\b" |
| 8 |
- type: "\\b(float|double|bool|char|int|short|long|enum|void|struct|union|typedef|(un)?signed|inline)\\b" |
| 9 |
- type: "\\b(((s?size)|((u_?)?int(8|16|32|64|ptr))|char(8|16|32))_t|wchar_t)\\b" |
| 10 |
- type: "\\b[a-z_][0-9a-z_]+(_t|_T)\\b" |
| 11 |
- type: "\\b(final|override)\\b" |
| 12 |
- type.keyword: "\\b(auto|volatile|const(expr|eval|init)?|mutable|register|thread_local|static|extern|decltype|explicit|virtual)\\b" |
| 13 |
- statement: "\\b(class|namespace|template|typename|this|friend|using|public|protected|private|noexcept)\\b" |
| 14 |
- statement: "\\b(concept|requires)\\b" |
| 15 |
- statement: "\\b(import|export|module)\\b" |
| 16 |
- statement: "\\b(for|if|while|do|else|case|default|switch)\\b" |
| 17 |
- statement: "\\b(try|throw|catch|operator|new|delete|static_assert)\\b" |
| 18 |
- statement: "\\b(goto|continue|break|return)\\b" |
| 19 |
- preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)|_Pragma" |
| 20 |
|
| 21 |
# Conditionally-supported/extension keywords |
| 22 |
- statement: "\\b(asm|fortran)\\b" |
| 23 |
|
| 24 |
# GCC builtins |
| 25 |
- statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)" |
| 26 |
|
| 27 |
# CUDA specific keywords |
| 28 |
- statement: "__(global|device|host|shared)__" |
| 29 |
|
| 30 |
# Operator Color |
| 31 |
- symbol.operator: "[-+*/%=<>.:;,~&|^!?]|\\b(sizeof|alignof|typeid|(and|or|xor|not)(_eq)?|bitor|compl|bitand|(const|dynamic|reinterpret|static)_cast)\\b" |
| 32 |
# Parenthetical Color |
| 33 |
- symbol.brackets: "[(){}]|\\[|\\]" |
| 34 |
# Integer Literals |
| 35 |
- constant.number: "(\\b([1-9][0-9']*|0[0-7']*|0[Xx][0-9a-fA-F']+|0[Bb][01]+)([Uu]?[Ll][Ll]?|[Ll][Ll]?[Uu]?)?\\b)" |
| 36 |
# Decimal Floating-point Literals |
| 37 |
- constant.number: "(\\b(([0-9']*[.][0-9']+|[0-9']+[.][0-9']*)([Ee][+-]?[0-9']+)?|[0-9']+[Ee][+-]?[0-9']+)[FfLl]?\\b)" |
| 38 |
# Hexadecimal Floating-point Literals |
| 39 |
- constant.number: "(\\b0[Xx]([0-9a-zA-Z']*[.][0-9a-zA-Z']+|[0-9a-zA-Z']+[.][0-9a-zA-Z']*)[Pp][+-]?[0-9']+[FfLl]?\\b)" |
| 40 |
- constant.bool: "(\\b(true|false|NULL|nullptr)\\b)" |
| 41 |
|
| 42 |
- constant.string: |
| 43 |
start: "\"" |
| 44 |
end: "\"" |
| 45 |
skip: "\\\\." |
| 46 |
rules: |
| 47 |
- constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" |
| 48 |
|
| 49 |
- constant.string: |
| 50 |
start: "'" |
| 51 |
end: "'" |
| 52 |
skip: "\\\\." |
| 53 |
rules: |
| 54 |
- error: "..+" |
| 55 |
- constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" |
| 56 |
|
| 57 |
- comment: |
| 58 |
start: "//" |
| 59 |
end: "$" |
| 60 |
rules: |
| 61 |
- todo: "(TODO|XXX|FIXME):?" |
| 62 |
|
| 63 |
- comment: |
| 64 |
start: "/\\*" |
| 65 |
end: "\\*/" |
| 66 |
rules: |
| 67 |
- todo: "(TODO|XXX|FIXME):?" |
| 68 |
|