-
Notifications
You must be signed in to change notification settings - Fork 0
/
hare.nanorc
36 lines (29 loc) · 1.18 KB
/
hare.nanorc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Syntax highlighting for hare files.
syntax hare "\.ha$"
comment "//"
# Keywords and types
color blue "\<(as|break|case|const|continue|def|defer|else|enum|export|fn|for|if|is|let|match|return|static|struct|switch|type|union|yield|_)\>"
color blue "\<(abort|alloc|append|assert|delete|free|insert|len|offset|vastart|vaarg|vaend)\>"
color lightyellow "@(fini|init|noreturn|offset|symbol|test)\>"
color cyan "\<(bool|char|f32|f64|false|i16|i32|i64|i8|int|null|nullable|rune|size|str|true|u16|u32|u64|u8|uint|uintptr|valist|void)\>"
# Numbers
## hex
color slate "\<0x[0-9A-Fa-f]+(i(8|16|32|64)?|u(8|16|32|64)?|z)?\>"
## oct
color slate "\<0o[0-7]+(i(8|16|32|64)?|u(8|16|32|64)?|z)?\>"
## bin
color slate "\<0b[01]+(i(8|16|32|64)?|u(8|16|32|64)?|z)?\>"
## dec
color slate "\<[0-9]+([eE][\+\-]?[0-9]+)?(i(8|16|32|64)?|u(8|16|32|64)?|z)?\>"
## float
color slate "\<[0-9]+(\.[0-9]+)?([eE][\+\-]?[0-9]+)?(f(32|64))?\>"
# Strings and runes
color italic,pink ""([^"\]|\\.)*""
color italic,pink "`.*`"
color pink "'([^'\\]|\\(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}))'"
# Imports
color yellow "^use .+;"
# Comments
color grey "//.*"
# Trailing whitespace
color ,red "[[:space:]]+$"