robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqvim-patch:62d8f3d: runtime: Revert several "mark invalid contact addresses" commits (#37192)ab20681c52

master
5.2 KiB157 linesraw
1" Vim syntax file.
2" Language:    Hare
3" Maintainer:  Amelia Clarke <selene@perilune.dev>
4" Last Change: 2024-05-10
5" Upstream:    https://git.sr.ht/~sircmpwn/hare.vim
6
7if exists('b:current_syntax')
8  finish
9endif
10syn include @haredoc syntax/haredoc.vim
11let b:current_syntax = 'hare'
12
13" Syntax {{{1
14syn case match
15syn iskeyword @,48-57,@-@,_
16
17" Keywords {{{2
18syn keyword hareConditional else if match switch
19syn keyword hareDefine def
20syn keyword hareInclude use
21syn keyword hareKeyword break continue return yield
22syn keyword hareKeyword case
23syn keyword hareKeyword const let
24syn keyword hareKeyword defer
25syn keyword hareKeyword export static
26syn keyword hareKeyword fn
27syn keyword hareOperator as is
28syn keyword hareRepeat for
29syn keyword hareTypedef type
30
31" Attributes.
32syn keyword hareAttribute @fini @init @test
33syn keyword hareAttribute @offset @packed
34syn keyword hareAttribute @symbol
35syn keyword hareAttribute @threadlocal
36
37" Builtins.
38syn keyword hareBuiltin abort assert
39syn keyword hareBuiltin align len offset
40syn keyword hareBuiltin alloc free
41syn keyword hareBuiltin append delete insert
42syn keyword hareBuiltin vaarg vaend vastart
43
44" Types {{{2
45syn keyword hareType bool
46syn keyword hareType done
47syn keyword hareType f32 f64
48syn keyword hareType i8 i16 i32 i64 int
49syn keyword hareType never
50syn keyword hareType opaque
51syn keyword hareType rune str
52syn keyword hareType u8 u16 u32 u64 uint
53syn keyword hareType uintptr
54syn keyword hareType valist
55syn keyword hareType void
56
57" Other types.
58syn keyword hareStorageClass nullable
59syn keyword hareStructure enum struct union
60
61" Literals {{{2
62syn keyword hareBoolean false true
63syn keyword hareConstant null
64
65" Integer literals.
66syn match hareNumber '\v<%(0|[1-9]%(_?\d)*)%([Ee]\+?\d+)?%([iu]%(8|16|32|64)?|z)?>' display
67syn match hareNumber '\v<0b[01]%(_?[01])*%([iu]%(8|16|32|64)?|z)?>' display
68syn match hareNumber '\v<0o\o%(_?\o)*%([iu]%(8|16|32|64)?|z)?>' display
69syn match hareNumber '\v<0x\x%(_?\x)*%([iu]%(8|16|32|64)?|z)?>' display
70
71" Floating-point literals.
72syn match hareFloat '\v<%(0|[1-9]%(_?\d)*)\.\d%(_?\d)*%([Ee][+-]?\d+)?%(f32|f64)?>' display
73syn match hareFloat '\v<%(0|[1-9]%(_?\d)*)%([Ee][+-]?\d+)?%(f32|f64)>' display
74syn match hareFloat '\v<0x\x%(_?\x)*%(\.\x%(_?\x)*)?[Pp][+-]?\d+%(f32|f64)?>' display
75
76" Rune and string literals.
77syn region hareRune start="'" skip="\\'" end="'" contains=hareEscape
78syn region hareString start='"' skip='\\"' end='"' contains=hareEscape,hareFormat
79syn region hareString start='`' end='`' contains=hareFormat
80
81" Escape sequences.
82syn match hareEscape '\\[0abfnrtv\\'"]' contained
83syn match hareEscape '\v\\%(x\x{2}|u\x{4}|U\x{8})' contained display
84
85" Format sequences.
86syn match hareFormat '\v\{\d*%(:%(\.?\d+|[ +\-=Xbefgox]|F[.2ESUs]|_%(.|\\%([0abfnrtv\\'"]|x\x{2}|u\x{4}|U\x{8})))*)?}' contained contains=hareEscape display
87syn match hareFormat '{\d*%\d*}' contained display
88syn match hareFormat '{{\|}}' contained display
89
90" Miscellaneous {{{2
91
92" Comments.
93syn region hareComment start='//' end='$' contains=hareTodo,@haredoc,@Spell display
94syn keyword hareTodo FIXME TODO XXX contained
95
96" Identifiers.
97syn match hareDelimiter '::' display
98syn match hareName '\<\h\w*\>' nextgroup=@harePostfix skipempty skipwhite transparent
99
100" Labels.
101syn match hareLabel ':\h\w*\>' display
102
103" Match `size` as a type unless it is followed by an open paren.
104syn match hareType '\<size\>' display
105syn match hareBuiltin '\<size\ze(' display
106
107" Postfix expressions.
108syn cluster harePostfix contains=hareErrorTest,hareField,hareIndex,hareParens
109syn match hareErrorTest '!=\@!' contained nextgroup=@harePostfix skipempty skipwhite
110syn match hareErrorTest '?' nextgroup=@harePostfix skipempty skipwhite
111syn match hareField '\.\w*\>'hs=s+1 contained contains=hareNumber nextgroup=@harePostfix skipempty skipwhite
112syn region hareIndex start='\[' end=']' contained nextgroup=@harePostfix skipempty skipwhite transparent
113syn region hareParens start='(' end=')' nextgroup=@harePostfix skipempty skipwhite transparent
114
115" Whitespace errors.
116syn match hareSpaceError '^ \+\ze\t' display
117syn match hareSpaceError excludenl '\s\+$' containedin=ALL display
118
119" Folding {{{3
120syn region hareBlock start='{' end='}' fold transparent
121
122" Default highlighting {{{1
123hi def link hareAttribute PreProc
124hi def link hareBoolean Boolean
125hi def link hareBuiltin Operator
126hi def link hareComment Comment
127hi def link hareConditional Conditional
128hi def link hareConstant Constant
129hi def link hareDefine Define
130hi def link hareDelimiter Delimiter
131hi def link hareErrorTest Special
132hi def link hareEscape SpecialChar
133hi def link hareFloat Float
134hi def link hareFormat SpecialChar
135hi def link hareInclude Include
136hi def link hareKeyword Keyword
137hi def link hareLabel Special
138hi def link hareNumber Number
139hi def link hareOperator Operator
140hi def link hareRepeat Repeat
141hi def link hareRune Character
142hi def link hareStorageClass StorageClass
143hi def link hareString String
144hi def link hareStructure Structure
145hi def link hareTodo Todo
146hi def link hareType Type
147hi def link hareTypedef Typedef
148
149" Highlight embedded haredoc references.
150hi! def link haredocRefValid SpecialComment
151
152" Highlight whitespace errors by default.
153if get(g:, 'hare_space_error', 1)
154  hi def link hareSpaceError Error
155endif
156
157" vim: et sts=2 sw=2 ts=8