| 1 |
filetype: hare |
| 2 |
|
| 3 |
detect: |
| 4 |
filename: "\\.ha$" |
| 5 |
|
| 6 |
rules: |
| 7 |
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b" |
| 8 |
|
| 9 |
- type: "\\b(bool|char|str|rune|void)\\b" |
| 10 |
- type: "\\b(f32|f64|uint|int|u8|u16|u32|u64|i8|i16|i32|i64|uintptr)\\b" |
| 11 |
|
| 12 |
- statement: "\\b(case|else|for|if|switch)\\b" |
| 13 |
- statement: "\\b(continue|break|return)\\b" |
| 14 |
|
| 15 |
- special: "\\b(as|const|def|defer|enum|export|fn|is|let|match|static|struct|type|union|yield|_)\\b" |
| 16 |
- preproc: "\\b(abort|alloc|append|assert|delete|free|insert|len|nullable|offset|size)\\b" |
| 17 |
- preproc: "^use .+;" |
| 18 |
- preproc: "\\@([a-zA-Z_][0-9a-zA-Z_]+)\\b" |
| 19 |
|
| 20 |
- constant: "\\b(false|null|true)\\b" |
| 21 |
- constant.number: "\\b(0x[0-9A-Fa-f]+(i(8|16|32|64)?|u(8|16|32|64)?|z)?)\\b" |
| 22 |
- constant.number: "\\b(0o[0-7]+(i(8|16|32|64)?|u(8|16|32|64)?|z)?)\\b" |
| 23 |
- constant.number: "\\b(0b[01]+(i(8|16|32|64)?|u(8|16|32|64)?|z)?)\\b" |
| 24 |
|
| 25 |
- constant.specialChar: "\\\".*\\\"" |
| 26 |
- constant.specialChar: "`.*`" |
| 27 |
- constant.specialChar: "'([^'\\\\]|\\\\(0|a|b|f|n|r|t|v|\\\\|'|\\\"|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}))'" |
| 28 |
|
| 29 |
- symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)" |
| 30 |
- symbol.brackets: "[(){}]|\\[|\\]" |
| 31 |
|
| 32 |
- constant.string: |
| 33 |
start: "\"" |
| 34 |
end: "\"" |
| 35 |
skip: "\\\\." |
| 36 |
rules: |
| 37 |
- 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})" |
| 38 |
|
| 39 |
- constant.string: |
| 40 |
start: "'" |
| 41 |
end: "'" |
| 42 |
skip: "\\\\." |
| 43 |
rules: |
| 44 |
- error: "..+" |
| 45 |
- 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})" |
| 46 |
|
| 47 |
- comment: |
| 48 |
start: "//" |
| 49 |
end: "$" |
| 50 |
rules: |
| 51 |
- todo: "(TODO|XXX|FIXME):?" |
| 52 |
|