blob: ad8cd3a929777db04c2f2fc6f3c662dab63a07e0 (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
" Vim syntax file
" Language: Hare
if exists("b:current_syntax")
finish
endif
syn case match
syn keyword hareKeyword let const fn def type static export defer _
syn keyword hareBranch for return break continue yield
syn keyword hareConditional if else match switch
syn keyword hareLabel case
syn keyword hareBuiltin len offset free alloc assert append abort delete insert
syn keyword hareBuiltin vastart vaarg vaend
syn keyword hareOperator is as
syn match hareType "\vsize((\_\s|//.*)*\()@!"
syn match hareBuiltin "\vsize((\_\s|//.*)*\()@="
syn match harePreProc "^use .*;"
syn match harePreProc "@[a-z]*"
syn match hareOperator "\.\.\." "\.\."
syn region hareString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+
syn region hareString start=+`+ end=+`+
"adapted from c.vim
"integer number, or floating point number without a dot and with "f".
syn match hareNumbers display transparent "\v<\d" contains=hareNumber,hareOctal,hareBinary,hareFloat
syn match hareNumber display contained "\v\d+(e[-+]?\d+)?(z|[iu](8|16|32|64)?)?"
"hex number
syn match hareNumber display contained "\v0x\x+(z|[iu](8|16|32|64)?)?"
"octal number
syn match hareOctal display contained "\v0o\o+(z|[iu](8|16|32|64)?)?"
"binary number
syn match hareBinary display contained '\v0b[01]+(z|[iu](8|16|32|64)?)?'
syn match hareFloat display contained "\v\d+(e[-+]?\d+)?(f32|f64)"
"floating point number, with dot, optional exponent
syn match hareFloat display contained "\v\d+\.\d+(e[-+]?\d+)?(f32|f64)?"
syn match hareSpaceError display excludenl "\v\s+$"
syn match hareSpaceError display "\v +\t"me=e-1
syn keyword hareTodo contained TODO FIXME XXX
syn region hareComment start="//" end="$" contains=hareTodo,@Spell
syn keyword hareType u8 u16 u32 u64 i8 i16 i32 i64
syn keyword hareType uint int
syn keyword hareType uintptr
syn keyword hareType f32 f64
syn keyword hareType bool
syn keyword hareType char str
syn keyword hareType void
syn keyword hareType struct union
syn keyword hareType enum
syn keyword hareType nullable
syn keyword hareType rune
syn keyword hareType valist
syn keyword hareNull null
syn keyword hareBoolean true false
hi def link hareBinary Number
hi def link hareBoolean Boolean
hi def link hareBranch Repeat
hi def link hareBuiltin Function
hi def link hareComment Comment
hi def link hareConditional Conditional
hi def link hareFloat Number
hi def link hareKeyword Keyword
hi def link hareLabel Label
hi def link hareNull Constant
hi def link hareNumber Number
hi def link hareOctal Number
hi def link hareOperator Operator
hi def link harePreProc PreProc
hi def link hareString String
hi def link hareTodo Todo
hi def link hareType Type
hi def link hareSpaceError Error
" vim: tabstop=8 shiftwidth=2 expandtab
|