31383
|
1 " Vim syntax file
|
|
2 " Language: Zir
|
|
3 " Upstream: https://github.com/ziglang/zig.vim
|
|
4
|
|
5 if exists("b:current_syntax")
|
|
6 finish
|
|
7 endif
|
|
8 let b:current_syntax = "zir"
|
|
9
|
|
10 syn region zirCommentLine start=";" end="$" contains=zirTodo,@Spell
|
|
11
|
|
12 syn region zirBlock start="{" end="}" transparent fold
|
|
13
|
|
14 syn keyword zirKeyword primitive fntype int str as ptrtoint fieldptr deref asm unreachable export ref fn
|
|
15
|
|
16 syn keyword zirTodo contained TODO
|
|
17
|
|
18 syn region zirString start=+c\?"+ skip=+\\\\\|\\"+ end=+"+ oneline contains=zirEscape,zirEscapeUnicode,zirEscapeError,@Spell
|
|
19
|
|
20 syn match zirEscapeError display contained /\\./
|
|
21 syn match zirEscape display contained /\\\([nrt\\'"]\|x\x\{2}\)/
|
|
22 syn match zirEscapeUnicode display contained /\\\(u\x\{4}\|U\x\{6}\)/
|
|
23
|
|
24 syn match zirDecNumber display "\<[0-9]\+\%(.[0-9]\+\)\=\%([eE][+-]\?[0-9]\+\)\="
|
|
25 syn match zirHexNumber display "\<0x[a-fA-F0-9]\+\%([a-fA-F0-9]\+\%([pP][+-]\?[0-9]\+\)\?\)\="
|
|
26 syn match zirOctNumber display "\<0o[0-7]\+"
|
|
27 syn match zirBinNumber display "\<0b[01]\+\%(.[01]\+\%([eE][+-]\?[0-9]\+\)\?\)\="
|
|
28
|
|
29 syn match zirGlobal display "[^a-zA-Z0-9_]\?\zs@[a-zA-Z0-9_]\+"
|
|
30 syn match zirLocal display "[^a-zA-Z0-9_]\?\zs%[a-zA-Z0-9_]\+"
|
|
31
|
|
32 hi def link zirCommentLine Comment
|
|
33 hi def link zirTodo Todo
|
|
34
|
|
35 hi def link zirKeyword Keyword
|
|
36
|
|
37 hi def link zirString Constant
|
|
38
|
|
39 hi def link zirEscape Special
|
|
40 hi def link zirEscapeUnicode zirEscape
|
|
41 hi def link zirEscapeError Error
|
|
42
|
|
43 hi def link zirDecNumber Constant
|
|
44 hi def link zirHexNumber Constant
|
|
45 hi def link zirOctNumber Constant
|
|
46 hi def link zirBinNumber Constant
|
|
47
|
|
48 hi def link zirGlobal Identifier
|
|
49 hi def link zirLocal Identifier
|