blob: 1a7a485e6fa2962f802f69d666226b6dde200f31 [file] [log] [blame]
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +02001" Vim syntax file
2" Language: Zimbu
3" Maintainer: Bram Moolenaar
Bram Moolenaared32d942014-12-06 23:33:00 +01004" Last Change: 2014 Nov 23
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +02005
6if exists("b:current_syntax")
7 finish
8endif
9
10syn include @Ccode syntax/c.vim
11
12syn keyword zimbuTodo TODO FIXME XXX contained
13syn match zimbuNoBar "|" contained
14syn match zimbuParam "|[^| ]\+|" contained contains=zimbuNoBar
Bram Moolenaared32d942014-12-06 23:33:00 +010015syn match zimbuNoBacktick "`" contained
16syn match zimbuCode "`[^`]\+`" contained contains=zimbuNoBacktick
17syn match zimbuComment "#.*$" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell
18syn match zimbuComment "/\*.\{-}\*/" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020019
20syn match zimbuChar "'\\\=.'"
21
22syn keyword zimbuBasicType bool status
23syn keyword zimbuBasicType int1 int2 int3 int4 int5 int6 int7
24syn keyword zimbuBasicType int9 int10 int11 int12 int13 int14 int15
25syn keyword zimbuBasicType int int8 int16 int32 int64 bigInt
26syn keyword zimbuBasicType nat nat8 byte nat16 nat32 nat64 bigNat
27syn keyword zimbuBasicType nat1 nat2 nat3 nat4 nat5 nat6 nat7
28syn keyword zimbuBasicType nat9 nat10 nat11 nat12 nat13 nat14 nat15
29syn keyword zimbuBasicType float float32 float64 float80 float128
30syn keyword zimbuBasicType fixed1 fixed2 fixed3 fixed4 fixed5 fixed6
31syn keyword zimbuBasicType fixed7 fixed8 fixed9 fixed10 fixed11 fixed12
32syn keyword zimbuBasicType fixed13 fixed14 fixed15
33
Bram Moolenaared32d942014-12-06 23:33:00 +010034syn keyword zimbuCompType string varString
35syn keyword zimbuCompType byteString varByteString
36syn keyword zimbuCompType tuple array list dict dictList set callback
37syn keyword zimbuCompType sortedList multiDict multiDictList multiSet
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020038syn keyword zimbuCompType complex complex32 complex64 complex80 complex128
39syn keyword zimbuCompType proc func def thread evalThread lock cond pipe
40
Bram Moolenaared32d942014-12-06 23:33:00 +010041syn keyword zimbuType VAR dyn type USE GET
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020042syn match zimbuType "IO.File"
43syn match zimbuType "IO.Stat"
44
Bram Moolenaared32d942014-12-06 23:33:00 +010045syn keyword zimbuStatement IF ELSE ELSEIF IFNIL WHILE REPEAT FOR IN TO STEP
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020046syn keyword zimbuStatement DO UNTIL SWITCH WITH
47syn keyword zimbuStatement TRY CATCH FINALLY
48syn keyword zimbuStatement GENERATE_IF GENERATE_ELSE GENERATE_ELSEIF
Bram Moolenaared32d942014-12-06 23:33:00 +010049syn keyword zimbuStatement GENERATE_ERROR
50syn keyword zimbuStatement BUILD_IF BUILD_ELSE BUILD_ELSEIF
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020051syn keyword zimbuStatement CASE DEFAULT FINAL ABSTRACT VIRTUAL DEFINE REPLACE
52syn keyword zimbuStatement IMPLEMENTS EXTENDS PARENT LOCAL
Bram Moolenaared32d942014-12-06 23:33:00 +010053syn keyword zimbuStatement PART ALIAS TYPE CONNECT WRAP
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020054syn keyword zimbuStatement BREAK CONTINUE PROCEED
Bram Moolenaared32d942014-12-06 23:33:00 +010055syn keyword zimbuStatement RETURN EXIT THROW DEFER
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020056syn keyword zimbuStatement IMPORT AS OPTIONS MAIN
Bram Moolenaared32d942014-12-06 23:33:00 +010057syn keyword zimbuStatement INTERFACE PIECE INCLUDE MODULE ENUM BITS
58syn keyword zimbuStatement SHARED STATIC
59syn keyword zimbuStatement LAMBDA
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020060syn match zimbuStatement "\<\(FUNC\|PROC\|DEF\)\>"
61syn match zimbuStatement "\<CLASS\>"
62syn match zimbuStatement "}"
63
64syn match zimbuAttribute "@backtrace=no\>"
65syn match zimbuAttribute "@backtrace=yes\>"
66syn match zimbuAttribute "@abstract\>"
67syn match zimbuAttribute "@earlyInit\>"
68syn match zimbuAttribute "@default\>"
69syn match zimbuAttribute "@define\>"
70syn match zimbuAttribute "@replace\>"
71syn match zimbuAttribute "@final\>"
Bram Moolenaared32d942014-12-06 23:33:00 +010072syn match zimbuAttribute "@primitive\>"
73syn match zimbuAttribute "@notOnExit\>"
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020074
75syn match zimbuAttribute "@private\>"
76syn match zimbuAttribute "@protected\>"
77syn match zimbuAttribute "@public\>"
Bram Moolenaared32d942014-12-06 23:33:00 +010078syn match zimbuAttribute "@local\>"
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020079syn match zimbuAttribute "@file\>"
80syn match zimbuAttribute "@directory\>"
81syn match zimbuAttribute "@read=private\>"
82syn match zimbuAttribute "@read=protected\>"
83syn match zimbuAttribute "@read=public\>"
84syn match zimbuAttribute "@read=file\>"
85syn match zimbuAttribute "@read=directory\>"
86syn match zimbuAttribute "@items=private\>"
87syn match zimbuAttribute "@items=protected\>"
88syn match zimbuAttribute "@items=public\>"
89syn match zimbuAttribute "@items=file\>"
90syn match zimbuAttribute "@items=directory\>"
91
Bram Moolenaared32d942014-12-06 23:33:00 +010092syn keyword zimbuMethod NEW EQUAL COPY COMPARE SIZE GET SET INIT EARLYINIT
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020093
94syn keyword zimbuOperator IS ISNOT ISA ISNOTA
95
Bram Moolenaared32d942014-12-06 23:33:00 +010096syn keyword zimbuModule ARG CHECK E GC IO LOG PROTO SYS HTTP ZC ZWT T TIME THREAD
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020097
Bram Moolenaared32d942014-12-06 23:33:00 +010098syn match zimbuImport "\.\zsPROTO"
99syn match zimbuImport "\.\zsCHEADER"
100
101"syn match zimbuString +"\([^"\\]\|\\.\)*\("\|$\)+ contains=zimbuStringExpr
102syn region zimbuString start=+"+ skip=+[^"\\]\|\\.+ end=+"\|$+ contains=zimbuStringExpr
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200103syn match zimbuString +R"\([^"]\|""\)*\("\|$\)+
Bram Moolenaared32d942014-12-06 23:33:00 +0100104syn region zimbuLongString start=+''"+ end=+"''+
105syn match zimbuStringExpr +\\([^)]*)+hs=s+2,he=e-1 contained contains=zimbuString,zimbuParenPairOuter
106syn region zimbuParenPairOuter start=+(+ms=s+1 end=+)+me=e-1 contained contains=zimbuString,zimbuParenPair
107syn region zimbuParenPair start=+(+ end=+)+ contained contains=zimbuString,zimbuParenPair
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200108
109syn keyword zimbuFixed TRUE FALSE NIL THIS THISTYPE FAIL OK
110syn keyword zimbuError NULL
111
112" trailing whitespace
113syn match zimbuSpaceError display excludenl "\S\s\+$"ms=s+1
114" mixed tabs and spaces
115syn match zimbuSpaceError display " \+\t"
116syn match zimbuSpaceError display "\t\+ "
117
Bram Moolenaared32d942014-12-06 23:33:00 +0100118syn match zimbuUses contained "\<uses([a-zA-Z_ ,]*)"
119syn match zimbuBlockgc contained "blockgc"
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200120syn match zimbuBlockComment contained " #.*"
121
Bram Moolenaared32d942014-12-06 23:33:00 +0100122syn region zimbuCregion matchgroup=zimbuCblock start="^>>>" end="^<<<.*" contains=@Ccode,zimbuUses,zimbuBlockgc,zimbuBlockComment keepend
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200123
Bram Moolenaared32d942014-12-06 23:33:00 +0100124" Assume long strings and C regions don't take more than 200 lines.
125syn sync minlines=200
126
127" When we find the start of a long string, without a # or " before it, we are
128" sure to be inside a long string.
129syn sync match zimbuLongStringSync grouphere zimbuLongString +^[^"#]*''\"+
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200130
131hi def link zimbuBasicType Type
132hi def link zimbuCompType Type
133hi def link zimbuType Type
134hi def link zimbuStatement Statement
135hi def link zimbuOperator Statement
136hi def link zimbuMethod PreProc
137hi def link zimbuModule PreProc
Bram Moolenaared32d942014-12-06 23:33:00 +0100138hi def link zimbuImport PreProc
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200139hi def link zimbuUses PreProc
Bram Moolenaared32d942014-12-06 23:33:00 +0100140hi def link zimbuBlockgc PreProc
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200141hi def link zimbuAttribute PreProc
142hi def link zimbuString Constant
Bram Moolenaared32d942014-12-06 23:33:00 +0100143hi def link zimbuLongString Special
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200144hi def link zimbuChar Constant
145hi def link zimbuFixed Constant
146hi def link zimbuComment Comment
Bram Moolenaared32d942014-12-06 23:33:00 +0100147hi def link zimbuCommentStart zimbuComment
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200148hi def link zimbuBlockComment Comment
149hi def link zimbuCblock Comment
150hi def link zimbuTodo Todo
151hi def link zimbuParam Constant
Bram Moolenaared32d942014-12-06 23:33:00 +0100152hi def link zimbuCode Statement
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200153hi def link zimbuNoBar Ignore
Bram Moolenaared32d942014-12-06 23:33:00 +0100154hi def link zimbuNoBacktick Ignore
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +0200155hi def link zimbuSpaceError Error
156hi def link zimbuError Error
157
158let b:current_syntax = "zimbu"
159
160" vim: ts=8