blob: 2c34cb4f386a3ee7e321eef07a43578d0c6df590 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
Bram Moolenaar40962ec2018-01-28 22:47:25 +01002" Language: Pike
3" Maintainer: Stephen R. van den Berg <srb@cuci.nl>
4" Maintainer of previous implementation: Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it>
5" Last Change: 2018 Jan 28
6" Version: 2.9
7" Remark: Derived from the C-syntax; fixed several bugs in the C-syntax
8" Remark: and extended it with the Pike syntax.
9" Remark: Includes a highlighter for all Pike types of parenthesis errors.
10" Remark: Includes a highlighter for SQL on multiline strings.
11" Remark: Includes a highlighter for any embedded Autodoc format.
Bram Moolenaar071d4272004-06-13 20:20:40 +000012
Bram Moolenaar40962ec2018-01-28 22:47:25 +010013" Quit when a (custom) syntax file was already loaded
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020014if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +000015 finish
16endif
17
Bram Moolenaar40962ec2018-01-28 22:47:25 +010018let s:cpo_save = &cpo
19set cpo&vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000020
Bram Moolenaar40962ec2018-01-28 22:47:25 +010021" For multiline strings, try formatting them as SQL
22syn include @pikeSQL <sfile>:p:h/sqloracle.vim
23unlet b:current_syntax
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
Bram Moolenaar40962ec2018-01-28 22:47:25 +010025" For embedded Autodoc documentation (WIP)
26syn include @pikeAutodoc <sfile>:p:h/autodoc.vim
27unlet b:current_syntax
28
29syn case match
30
31" Supports array, multiset, mapping multi-character delimiter matching
32" Supports rotating amongst several same-level preprocessor conditionals
33packadd! matchit
34let b:match_words = "({:}\\@1<=),(\\[:]\\@1<=),(<:>\\@1<=),^\s*#\s*\%(if\%(n\?def\)\|else\|el\%(se\)\?if\|endif\)\>"
35
36" A bunch of useful Pike keywords
37syn keyword pikeDebug gauge backtrace describe_backtrace werror _Static_assert static_assert
38syn keyword pikeException error catch throw
39syn keyword pikeLabel case default break return continue
40syn keyword pikeConditional if else switch
41syn keyword pikeRepeat while for foreach do
42
43syn keyword pikePredef RegGetKeyNames RegGetValue RegGetValues
44syn keyword pikePredef __automap__ __empty_program
45syn keyword pikePredef __handle_sprintf_format __parse_pike_type _disable_threads
46syn keyword pikePredef _do_call_outs _exit _gdb_breakpoint
47syn keyword pikePredef abs access acos acosh add_constant alarm all_constants
48syn keyword pikePredef array_sscanf asin asinh atan atan2 atanh atexit
49syn keyword pikePredef basetype call_function call_out call_out_info cd ceil
50syn keyword pikePredef combine_path combine_path_nt
51syn keyword pikePredef combine_path_unix compile copy_value cos cosh cpp crypt
52syn keyword pikePredef ctime decode_value delay encode_value encode_value_canonic
53syn keyword pikePredef enumerate errno exece exit exp file_stat file_truncate
54syn keyword pikePredef filesystem_stat find_call_out floor fork function_name
55syn keyword pikePredef function_object function_program gc
56syn keyword pikePredef get_active_compilation_handler get_active_error_handler
57syn keyword pikePredef get_all_groups get_all_users get_dir get_groups_for_user
58syn keyword pikePredef get_iterator get_profiling_info get_weak_flag getcwd
59syn keyword pikePredef getgrgid getgrnam gethrdtime gethrtime gethrvtime getpid
60syn keyword pikePredef getpwnam getpwuid getxattr glob gmtime has_index has_prefix
61syn keyword pikePredef has_suffix has_value hash hash_7_0 hash_7_4 hash_8_0
62syn keyword pikePredef hash_value kill limit listxattr load_module localtime
63syn keyword pikePredef log lower_case master max min mkdir mktime mv
64syn keyword pikePredef object_program pow query_num_arg random_seed
65syn keyword pikePredef remove_call_out removexattr replace_master rm round
66syn keyword pikePredef set_priority set_weak_flag setxattr sgn signal signame
67syn keyword pikePredef signum sin sinh sleep sort sprintf sqrt sscanf strerror
68syn keyword pikePredef string_filter_non_unicode string_to_unicode string_to_utf8
69syn keyword pikePredef tan tanh time trace types ualarm unicode_to_string
70syn keyword pikePredef upper_case utf8_to_string version
71
72syn keyword pikePredef write lock try_lock
73syn keyword pikePredef MutexKey Timestamp Date Time TimeTZ Interval Inet Range
74syn keyword pikePredef Null null inf nan
75
76syn keyword pikeTodo contained TODO FIXME XXX
77
78" Match parengroups: allows for highlighting indices of mappings and
79" highlighting semicolons that are out of place due to a paren imbalance
80syn cluster pikePreShort contains=pikeDefine,pikePreProc,pikeCppOutWrapper,pikeCppInWrapper,pikePreCondit,pikePreConditMatch
81syn cluster pikeExprGroup contains=pikeMappIndex,@pikeStmt,pikeNest,@pikeBadGroup,pikeSoftCast
82syn match pikeWord transparent contained /[^()'"[\]{},;:]\+/ contains=ALLBUT,@pikePreProcGroup,@pikeExprGroup
83syn match pikeFirstWord transparent display contained /^\s*#[^()'"[\]{},;:]\+/ contains=@pikePreShort
84syn cluster pikeMappElm contains=pikeMappIndex,@pikeStmt
85syn cluster pikeStmt contains=pikeFirstWord,pikeCharacter,pikeString,pikeMlString,pikeWord,pikeNest
86syn cluster pikeBadGroup contains=pikeBadPClose,pikeBadAClose,pikeBadBClose,pikeBadSPClose,pikeBadSAClose,pikeBadSBClose,pikeBadSClose,pikeBadSPAClose,pikeBadSBAClose
87syn match pikeBadPClose display contained "[}\]]"
88syn match pikeBadAClose display contained "[)\]]"
89syn match pikeBadBClose display contained "[)}]"
90syn match pikeBadSPClose display contained "[;}\]]"
91syn match pikeBadSAClose display contained "[;)\]]"
92syn match pikeBadSPAClose display contained "[;\]]"
93syn match pikeBadSBAClose display contained "[;}]"
94syn match pikeBadSClose display contained "[;)}\]]"
95syn region pikeNest transparent start="(\@1<!{" end="}" contains=@pikeStmt,pikeUserLabel,pikeBadAClose
96syn region pikeNest transparent start="\%(\<for\%(each\)\?\s\?\)\@8<!([[{<]\@!" end=")" contains=@pikeStmt,pikeBadSPClose
97syn region pikeNest transparent start="\%(\<for\%(each\)\?\s\?\)\@8<=(" end=")" contains=@pikeStmt,pikeBadPClose
98syn region pikeNest transparent start="(\@1<!\[" end="]" contains=@pikeStmt,pikeBadSBClose
99syn region pikeNest transparent start="(\zs\[" end="])" contains=@pikeMappElm,pikeBadSBAClose
100" For some reason specifying a matchgroup on the pikeNest below makes it
101" override the shorter variant; consider it a kludge, no idea why it works
102syn region pikeNest transparent matchgroup=pikeSoftCast start=%(\zs\[[ \t\v\r\n.a-zA-Z0-9_():,|]\+])\@!% end=")" contains=@pikeStmt
103syn region pikeNest transparent start="(\zs{" end="})" contains=@pikeStmt,pikeBadSPAClose
104syn region pikeNest transparent start="(\zs<" end=">)" contains=@pikeStmt,pikeBadSPClose keepend
105
106" It's easy to accidentally add a space after a backslash that was intended
107" for line continuation. Some compilers allow it, which makes it
108" unpredictable and should be avoided.
109syn match pikeBadContinuation contained "\\\s\+$"
110
111" pikeCommentGroup allows adding matches for special things in comments
112syn cluster pikeCommentGroup contains=pikeTodo,pikeBadContinuation
Bram Moolenaar071d4272004-06-13 20:20:40 +0000113
114" String and Character constants
115" Highlight special characters (those which have a backslash) differently
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100116syn match pikeSpecial display contained "\\\%(x\x*\|d\d*\|\o\+\|u\x\{4}\|U\x\{8}\|[abefnrtv]\|$\)"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000117
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100118" ISO C11 or ISO C++ 11
119if !exists("c_no_cformat")
120 " Highlight % items in strings.
121 syn match pikeFormat display "%\%(\d\+\$\)\=[-+' #0*]*\%(\d*\|\*\|\*\d\+\$\)\%(\.\%(\d*\|\*\|\*\d\+\$\)\)\=\%([hlLjzt]\|ll\|hh\)\=\%([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
122 syn match pikeFormat display "%%" contained
123 syn region pikeString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=pikeSpecial,pikeDelimiterDQ,pikeFormat,@Spell keepend
124 syn region pikeMlString start=+#"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeSpecial,pikeFormat,pikeDelimiterDQ,@Spell,pikeEmbeddedString keepend
125else
126 syn region pikeString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=pikeSpecial,pikeDelimiterDQ,@Spell
127 syn region pikeMlString transparent start=+#"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeSpecial,pikeDelimiterDQ,@Spell,pikeEmbeddedString keepend
128endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000129
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100130" Use SQL-syntax highlighting in multiline string if it starts with
131" a standard SQL keyword
132syn case ignore
133" FIXME Use explicit newline match to cover up a bug in the regexp engine
134" If the kludge is not used, the match will only start unless at least a space
135" follows the initial doublequote on the first line (or the keyword is on
136" the first line).
137syn region pikeEmbeddedString contained start=+\%(#"\n\?\)\@2<=\_s*\%(SELECT\|INSERT\|UPDATE\|DELETE\|WITH\|CREATE\|DROP\|ALTER\)\>+ skip=+\\\\\|\\"+ end=+[\\#]\@1<!"+ contains=@pikeSQL,pikeBindings keepend
138syn case match
139
140syn match pikeBindings display contained ":\@1<!:\I\i*"
141
142syn match pikeCharacter "'[^\\']'" contains=pikeDelimiterSQ
143syn match pikeCharacter "'[^']*'" contains=pikeSpecial,pikeDelimiterSQ
144syn match pikeSpecialError "'\\[^'\"?\\abefnrtv]'"
145syn match pikeDelimiterDQ display +"+ contained
146syn match pikeDelimiterSQ display +'+ contained
147
148"when wanted, highlight trailing white space
149if exists("c_space_errors")
150 if !exists("c_no_trail_space_error")
151 syn match pikeSpaceError display excludenl "\s\+$"
152 endif
153 if !exists("c_no_tab_space_error")
154 syn match pikeSpaceError display " \+\ze\t"
155 endif
156endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000157
158"integer number, or floating point number without a dot and with "f".
159syn case ignore
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100160syn match pikeNumbers display transparent "\<\d\|\.\d" contains=pikeNumber,pikeFloat,pikeOctalError,pikeOctal
161" Same, but without octal error (for comments)
162syn match pikeNumbersCom display contained transparent "\<\d\|\.\d" contains=pikeNumber,pikeFloat,pikeOctal
163syn match pikeNumber display contained "\<\d\+\%(u\=l\{0,2}\|ll\=u\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000164"hex number
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100165syn match pikeNumber display contained "\<0x\x\+\%(u\=l\{0,2}\|ll\=u\)\>"
166" Flag the first zero of an octal number as something special
167syn match pikeOctal display contained "\<0\o\+\%(u\=l\{0,2}\|ll\=u\)\>" contains=pikeOctalZero
168syn match pikeOctalZero display contained "\<0"
169"floating point number, with dot, optional exponent
170syn match pikeFloat display contained "\<\d\+\%(f\|\.[0-9.]\@!\d*\%(e[-+]\=\d\+\)\=[fl]\=\)"
171"floating point number, starting with a dot, optional exponent
172syn match pikeFloat display contained "[0-9.]\@1<!\.\d\+\%(e[-+]\=\d\+\)\=[fl]\=\>"
173"floating point number, without dot, with exponent
174syn match pikeFloat display contained "\<\d\+e[-+]\=\d\+[fl]\=\>"
175
176"hexadecimal floating point number, two variants, with exponent
177syn match pikeFloat display contained "\<0x\%(\x\+\.\?\|\x*\.\x\+\)p[-+]\=\d\+[fl]\=\>"
178
Bram Moolenaar071d4272004-06-13 20:20:40 +0000179" flag an octal number with wrong digits
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100180syn match pikeOctalError display contained "\<0\o*[89]\d*"
181syn case match
Bram Moolenaar071d4272004-06-13 20:20:40 +0000182
183if exists("c_comment_strings")
184 " A comment can contain pikeString, pikeCharacter and pikeNumber.
185 " But a "*/" inside a pikeString in a pikeComment DOES end the comment! So we
186 " need to use a special type of pikeString: pikeCommentString, which also ends on
187 " "*/", and sees a "*" at the start of the line as comment again.
188 " Unfortunately this doesn't very well work for // type of comments :-(
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100189 syn match pikeCommentSkip contained "^\s*\*\%($\|\s\+\)"
190 syn region pikeCommentString contained start=+\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\ze\*/+ contains=pikeSpecial,pikeCommentSkip
191 syn region pikeComment2String contained start=+\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=pikeSpecial
192 syn region pikeCommentL start="//" skip="\\$" end="$" keepend contains=@pikeCommentGroup,pikeComment2String,pikeCharacter,pikeNumbersCom,pikeSpaceError,@Spell containedin=pikeWord,pikeFirstWord
193 if exists("c_no_comment_fold")
194 " Use "extend" here to have preprocessor lines not terminate halfway a
195 " comment.
196 syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeCommentString,pikeCharacter,pikeNumbersCom,pikeSpaceError,@Spell extend containedin=pikeWord,pikeFirstWord
197 else
198 syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeCommentString,pikeCharacter,pikeNumbersCom,pikeSpaceError,@Spell fold extend containedin=pikeWord,pikeFirstWord
199 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000200else
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100201 syn region pikeCommentL start="//" skip="\\$" end="$" keepend contains=@pikeCommentGroup,pikeSpaceError,@Spell containedin=pikeWord,pikeFirstWord
202 if exists("c_no_comment_fold")
203 syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeSpaceError,@Spell extend containedin=pikeWord,pikeFirstWord
204 else
205 syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeSpaceError,@Spell fold extend containedin=pikeWord,pikeFirstWord
206 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207endif
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100208" keep a // comment separately, it terminates a preproc. conditional
209syn match pikeCommentError display "\*/"
210syn match pikeCommentStartError display "/\ze\*" contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000211
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100212syn keyword pikeOperator sizeof
213syn keyword pikeOperator typeof _typeof _refs
214syn keyword pikeOperator zero_type intp stringp arrayp mappingp multisetp
215syn keyword pikeOperator objectp functionp programp callablep destructedp
216syn keyword pikeOperator object_variablep undefinedp
217syn keyword pikeOperator allocate equal
218syn keyword pikeOperator aggregate aggregate_mapping aggregate_multiset
219syn keyword pikeOperator map filter search replace reverse column rows
220syn keyword pikeOperator indices values mkmapping mkmultiset m_delete sort
221syn keyword pikeOperator m_delete destruct
222syn keyword pikeOperator create _destruct _sprintf cast _encode _decode
223syn keyword pikeOperator __hash _sizeof _values _indices __INIT _equal
224syn keyword pikeOperator _is_type _m_delete _get_iterator _search
225syn keyword pikeOperator _serialize _deserialize _sqrt _types _random
226syn keyword pikeOperator _size_object
Bram Moolenaar071d4272004-06-13 20:20:40 +0000227
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100228syn keyword pikeType int void
229syn keyword pikeType float
230syn keyword pikeType bool string array mapping multiset mixed
231syn keyword pikeType object function program auto
232
233syn keyword pikeType this this_object this_program
234syn keyword pikeType sprintf_args sprintf_format sprintf_result
235syn keyword pikeType strict_sprintf_format
236
237syn keyword pikeStructure class enum typedef inherit import
238syn keyword pikeTypedef typedef
239syn keyword pikeStorageClass private protected public constant final variant
240syn keyword pikeStorageClass optional inline extern static __deprecated__ lambda
241
242syn keyword pikeConstant __LINE__ __FILE__ __DIR__ __DATE__ __TIME__
243syn keyword pikeConstant __AUTO_BIGNUM__ __NT__
244syn keyword pikeConstant __BUILD__ __COUNTER__ _MAJOR__ __MINOR__ __VERSION__
245syn keyword pikeConstant __REAL_BUILD__ _REAL_MAJOR__ __REAL_MINOR__
246syn keyword pikeConstant __REAL_VERSION__ __PIKE__ UNDEFINED
247
248" These should actually only be parsed in preprocessor conditionals
249syn keyword pikeCppOperator contained defined constant efun _Pragma
250
251syn keyword pikeBoolean true false
252
253syn match pikeCppPrefix display "^\s*\zs#\s*[a-z]\+" contained
254syn region pikePreCondit start="^\s*#\s*\%(if\%(n\?def\)\?\|el\%(se\)\?if\)\>" skip="\\$" end="$" transparent keepend contains=pikeString,pikeCharacter,pikeNumbers,pikeCommentError,pikeSpaceError,pikeCppOperator,pikeCppPrefix
255syn match pikePreConditMatch display "^\s*\zs#\s*\%(else\|endif\)\>"
256if !exists("c_no_if0")
257 syn cluster pikeCppOutInGroup contains=pikeCppInIf,pikeCppInElse,pikeCppInElse2,pikeCppOutIf,pikeCppOutIf2,pikeCppOutElse,pikeCppInSkip,pikeCppOutSkip
258 syn region pikeCppOutWrapper start="^\s*\zs#\s*if\s\+0\+\s*\%($\|//\|/\*\|&\)" end=".\@=\|$" contains=pikeCppOutIf,pikeCppOutElse,@NoSpell fold
259 syn region pikeCppOutIf contained start="0\+" matchgroup=pikeCppOutWrapper end="^\s*#\s*endif\>" contains=pikeCppOutIf2,pikeCppOutElse
260 if !exists("c_no_if0_fold")
261 syn region pikeCppOutIf2 contained matchgroup=pikeCppOutWrapper start="0\+" end="^\ze\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)" contains=pikeSpaceError,pikeCppOutSkip,@Spell fold
262 else
263 syn region pikeCppOutIf2 contained matchgroup=pikeCppOutWrapper start="0\+" end="^\ze\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)" contains=pikeSpaceError,pikeCppOutSkip,@Spell
264 endif
265 syn region pikeCppOutElse contained matchgroup=pikeCppOutWrapper start="^\s*#\s*\%(else\|el\%(se\)\?if\)" end="^\s*#\s*endif\>" contains=TOP,pikePreCondit
266 syn region pikeCppInWrapper start="^\s*\zs#\s*if\s\+0*[1-9]\d*\s*\%($\|//\|/\*\||\)" end=".\@=\|$" contains=pikeCppInIf,pikeCppInElse fold
267 syn region pikeCppInIf contained matchgroup=pikeCppInWrapper start="\d\+" end="^\s*#\s*endif\>" contains=TOP,pikePreCondit
268 if !exists("c_no_if0_fold")
269 syn region pikeCppInElse contained start="^\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=pikeCppInIf contains=pikeCppInElse2 fold
270 else
271 syn region pikeCppInElse contained start="^\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=pikeCppInIf contains=pikeCppInElse2
272 endif
273 syn region pikeCppInElse2 contained matchgroup=pikeCppInWrapper start="^\s*#\s*\%(else\|el\%(se\)\?if\)\%([^/]\|/[^/*]\)*" end="^\ze\s*#\s*endif\>" contains=pikeSpaceError,pikeCppOutSkip,@Spell
274 syn region pikeCppOutSkip contained start="^\s*#\s*if\%(n\?def\)\?\>" skip="\\$" end="^\s*#\s*endif\>" contains=pikeSpaceError,pikeCppOutSkip
275 syn region pikeCppInSkip contained matchgroup=pikeCppInWrapper start="^\s*#\s*\%(if\s\+\%(\d\+\s*\%($\|//\|/\*\||\|&\)\)\@!\|ifn\?def\>\)" skip="\\$" end="^\s*#\s*endif\>" containedin=pikeCppOutElse,pikeCppInIf,pikeCppInSkip contains=TOP,pikePreProc
276endif
277syn region pikeIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeDelimiterDQ keepend
278syn match pikeIncluded display contained "<[^>]*>"
279syn match pikeInclude display "^\s*\zs#\s*include\>\s*["<]" contains=pikeIncluded
280syn cluster pikePreProcGroup contains=pikeIncluded,pikeInclude,pikeEmbeddedString,pikeCppOutWrapper,pikeCppInWrapper,@pikeCppOutInGroup,pikeFormat,pikeMlString,pikeCommentStartError,@pikeBadGroup,pikeWord
281syn region pikeDefine start="^\s*\zs#\s*\%(define\|undef\)\>" skip="\\$" end="$" keepend contains=@pikeStmt,@pikeBadGroup
282syn region pikePreProc start="^\s*\zs#\s*\%(pragma\|charset\|pike\|require\|string\|line\|warning\|error\)\>" skip="\\$" end="$" transparent keepend contains=pikeString,pikeCharacter,pikeNumbers,pikeCommentError,pikeSpaceError,pikeCppOperator,pikeCppPrefix,@Spell,pikeConstant
283
284syn match pikeAutodocReal display contained "\%(//\|[/ \t\v]\*\|^\*\)\@2<=!.*" contains=@pikeAutodoc containedin=pikeComment,pikeCommentL
285syn cluster pikeCommentGroup add=pikeAutodocReal
286syn cluster pikePreProcGroup add=pikeAutodocReal
Bram Moolenaar071d4272004-06-13 20:20:40 +0000287
288" Highlight User Labels
Bram Moolenaar071d4272004-06-13 20:20:40 +0000289" Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100290syn match pikeUserLabel display "\%(^\|[{};]\)\zs\I\i*\s*\ze:\%([^:]\|$\)" contained contains=NONE
291syn match pikeUserLabel display "\%(\<\%(break\|continue\)\_s\+\)\@10<=\I\i*" contained contains=NONE
292syn match pikeUserLabel display "\%(\<case\)\@5<=\s\+[^<()[\]{},;:]\+\ze::\@!" contained contains=pikeDelimiterDQ,pikeDelimiterSQ
Bram Moolenaar071d4272004-06-13 20:20:40 +0000293
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100294syn match pikeMappIndex display contained "[^<()[\]{},;:]\+\ze::\@!" contains=pikeDelimiterDQ,pikeDelimiterSQ
295syn match pikeSoftCast display contained "\[[ \t\v\r\n.a-zA-Z0-9_():,|\+]" contains=NONE
Bram Moolenaar071d4272004-06-13 20:20:40 +0000296
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100297if exists("c_minlines")
298 let b:c_minlines = c_minlines
299else
300 if !exists("c_no_if0")
301 let b:c_minlines = 400 " #if 0 constructs can be long
302 else
303 let b:c_minlines = 200 " mostly for multiline strings
304 endif
305endif
306exec "syn sync ccomment pikeComment minlines=" . b:c_minlines
307syn sync match pikeMlStringSync grouphere pikeMlString +^[^"#]\+#\"+
308syn sync match pikeAutodocSync grouphere pikeCommentL "^\s*//!"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000309
310" Define the default highlighting.
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100311" Only used when an item doesn't have highlighting yet
312hi def link pikeFormat SpecialChar
313hi def link pikeMlString String
314hi def link pikeCommentL Comment
315hi def link pikeCommentStart Comment
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200316hi def link pikeLabel Label
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100317hi def link pikeUserLabel Identifier
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200318hi def link pikeConditional Conditional
319hi def link pikeRepeat Repeat
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100320hi def link pikeCharacter Character
321hi def link pikeDelimiterDQ Delimiter
322hi def link pikeDelimiterSQ Delimiter
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200323hi def link pikeNumber Number
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100324hi def link pikeOctal Number
325hi def link pikeOctalZero PreProc " link this to Error if you want
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200326hi def link pikeFloat Float
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100327hi def link pikeOctalError Error
328hi def link pikeCommentError Error
329hi def link pikeCommentStartError Error
330hi def link pikeSpaceError Error
331hi def link pikeSpecialError Error
332hi def link pikeOperator Operator
333hi def link pikeCppOperator Operator
334hi def link pikeStructure Structure
335hi def link pikeTypedef Typedef
336hi def link pikeStorageClass StorageClass
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200337hi def link pikeInclude Include
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100338hi def link pikeCppPrefix PreCondit
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200339hi def link pikePreProc PreProc
340hi def link pikeDefine Macro
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100341hi def link pikeIncluded String
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200342hi def link pikeError Error
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100343hi def link pikeDebug Debug
344hi def link pikeException Exception
345hi def link pikeStatement Statement
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200346hi def link pikeType Type
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100347hi def link pikeConstant Constant
348hi def link pikeBoolean Boolean
349hi def link pikeCommentString String
350hi def link pikeComment2String String
351hi def link pikeCommentSkip Comment
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200352hi def link pikeString String
353hi def link pikeComment Comment
354hi def link pikeSpecial SpecialChar
355hi def link pikeTodo Todo
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100356hi def link pikeBadContinuation Error
Bram Moolenaar071d4272004-06-13 20:20:40 +0000357
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100358hi def link pikeCppInWrapper PreCondit
359hi def link pikeCppOutWrapper PreCondit
360hi def link pikePreConditMatch PreCondit
361
362hi def link pikeCppOutSkip Comment
363hi def link pikeCppInElse2 Comment
364hi def link pikeCppOutIf2 Comment
365hi def link pikeCppOut Comment
366
367hi def link pikePredef Statement
368hi def link pikeBindings Identifier
369hi def link pikeMappIndex Identifier
370hi def link pikeSoftCast Type
371hi def link pikeBadGroup Error
372hi def link pikeBadPClose Error
373hi def link pikeBadAClose Error
374hi def link pikeBadBClose Error
375hi def link pikeBadSPClose Error
376hi def link pikeBadSAClose Error
377hi def link pikeBadSBClose Error
378hi def link pikeBadSPAClose Error
379hi def link pikeBadSBAClose Error
380hi def link pikeBadSClose Error
Bram Moolenaar071d4272004-06-13 20:20:40 +0000381
382let b:current_syntax = "pike"
383
Bram Moolenaar40962ec2018-01-28 22:47:25 +0100384let &cpo = s:cpo_save
385unlet s:cpo_save
Bram Moolenaar071d4272004-06-13 20:20:40 +0000386" vim: ts=8