annotate runtime/syntax/pike.vim @ 6735:f6021786b775 v7.4.691

patch 7.4.691 for Problem: Can't build with MzScheme. Solution: Change "cwd" into the global variable "start_dir".
author Bram Moolenaar <bram@vim.org>
date Fri, 03 Apr 2015 17:59:43 +0200
parents 3fc0f57ecb91
children 43efa4f5a8ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Pike
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 " Last Change: 2001 May 10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " For version 5.x: Clear all syntax items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " For version 6.x: Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " A bunch of useful C keywords
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 syn keyword pikeStatement goto break return continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 syn keyword pikeLabel case default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 syn keyword pikeConditional if else switch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 syn keyword pikeRepeat while for foreach do
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 syn keyword pikeStatement gauge destruct lambda inherit import typeof
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 syn keyword pikeException catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 syn keyword pikeType inline nomask private protected public static
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 syn keyword pikeTodo contained TODO FIXME XXX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " String and Character constants
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 " Highlight special characters (those which have a backslash) differently
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 syn match pikeSpecial contained "\\[0-7][0-7][0-7]\=\|\\."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 syn region pikeString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeSpecial
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 syn match pikeCharacter "'[^\\]'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 syn match pikeSpecialCharacter "'\\.'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 syn match pikeSpecialCharacter "'\\[0-7][0-7]'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 syn match pikeSpecialCharacter "'\\[0-7][0-7][0-7]'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " Compound data types
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 syn region pikeCompoundType start='({' contains=pikeString,pikeCompoundType,pikeNumber,pikeFloat end='})'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 syn region pikeCompoundType start='(\[' contains=pikeString,pikeCompoundType,pikeNumber,pikeFloat end='\])'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 syn region pikeCompoundType start='(<' contains=pikeString,pikeCompoundType,pikeNumber,pikeFloat end='>)'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 "catch errors caused by wrong parenthesis
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 syn region pikeParen transparent start='([^{[<(]' end=')' contains=ALLBUT,pikeParenError,pikeIncluded,pikeSpecial,pikeTodo,pikeUserLabel,pikeBitField
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 syn match pikeParenError ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 syn match pikeInParen contained "[^(][{}][^)]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 "integer number, or floating point number without a dot and with "f".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 syn case ignore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 syn match pikeNumber "\<\d\+\(u\=l\=\|lu\|f\)\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 "floating point number, with dot, optional exponent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 syn match pikeFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 "floating point number, starting with a dot, optional exponent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 syn match pikeFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 "floating point number, without dot, with exponent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 syn match pikeFloat "\<\d\+e[-+]\=\d\+[fl]\=\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 "hex number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 syn match pikeNumber "\<0x[0-9a-f]\+\(u\=l\=\|lu\)\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 "syn match pikeIdentifier "\<[a-z_][a-z0-9_]*\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 " flag an octal number with wrong digits
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 syn match pikeOctalError "\<0[0-7]*[89]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 if exists("c_comment_strings")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 " A comment can contain pikeString, pikeCharacter and pikeNumber.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 " But a "*/" inside a pikeString in a pikeComment DOES end the comment! So we
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 " need to use a special type of pikeString: pikeCommentString, which also ends on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 " "*/", and sees a "*" at the start of the line as comment again.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 " Unfortunately this doesn't very well work for // type of comments :-(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 syntax match pikeCommentSkip contained "^\s*\*\($\|\s\+\)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 syntax region pikeCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=pikeSpecial,pikeCommentSkip
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 syntax region pikeComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=pikeSpecial
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 syntax region pikeComment start="/\*" end="\*/" contains=pikeTodo,pikeCommentString,pikeCharacter,pikeNumber,pikeFloat
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 syntax match pikeComment "//.*" contains=pikeTodo,pikeComment2String,pikeCharacter,pikeNumber
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 syntax match pikeComment "#\!.*" contains=pikeTodo,pikeComment2String,pikeCharacter,pikeNumber
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 syn region pikeComment start="/\*" end="\*/" contains=pikeTodo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 syn match pikeComment "//.*" contains=pikeTodo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 syn match pikeComment "#!.*" contains=pikeTodo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 syntax match pikeCommentError "\*/"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 syn keyword pikeOperator sizeof
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 syn keyword pikeType int string void float mapping array multiset mixed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 syn keyword pikeType program object function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 syn region pikePreCondit start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=pikeComment,pikeString,pikeCharacter,pikeNumber,pikeCommentError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 syn region pikeIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 syn match pikeIncluded contained "<[^>]*>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 syn match pikeInclude "^\s*#\s*include\>\s*["<]" contains=pikeIncluded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 "syn match pikeLineSkip "\\$"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 syn region pikeDefine start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,pikePreCondit,pikeIncluded,pikeInclude,pikeDefine,pikeInParen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 syn region pikePreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,pikePreCondit,pikeIncluded,pikeInclude,pikeDefine,pikeInParen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 " Highlight User Labels
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 syn region pikeMulti transparent start='?' end=':' contains=ALLBUT,pikeIncluded,pikeSpecial,pikeTodo,pikeUserLabel,pikeBitField
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 " Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 syn match pikeUserLabel "^\s*\I\i*\s*:$"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 syn match pikeUserLabel ";\s*\I\i*\s*:$"ms=s+1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 syn match pikeUserLabel "^\s*\I\i*\s*:[^:]"me=e-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 syn match pikeUserLabel ";\s*\I\i*\s*:[^:]"ms=s+1,me=e-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 " Avoid recognizing most bitfields as labels
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 syn match pikeBitField "^\s*\I\i*\s*:\s*[1-9]"me=e-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 syn match pikeBitField ";\s*\I\i*\s*:\s*[1-9]"me=e-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 syn sync ccomment pikeComment minlines=10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 " Define the default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 " For version 5.8 and later: only when an item doesn't have highlighting yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 if version >= 508 || !exists("did_pike_syntax_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 let did_pike_syntax_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 HiLink pikeLabel Label
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 HiLink pikeUserLabel Label
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 HiLink pikeConditional Conditional
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 HiLink pikeRepeat Repeat
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 HiLink pikeCharacter Character
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 HiLink pikeSpecialCharacter pikeSpecial
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 HiLink pikeNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 HiLink pikeFloat Float
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 HiLink pikeOctalError pikeError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 HiLink pikeParenError pikeError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 HiLink pikeInParen pikeError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 HiLink pikeCommentError pikeError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 HiLink pikeOperator Operator
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 HiLink pikeInclude Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 HiLink pikePreProc PreProc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 HiLink pikeDefine Macro
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 HiLink pikeIncluded pikeString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 HiLink pikeError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 HiLink pikeStatement Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 HiLink pikePreCondit PreCondit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 HiLink pikeType Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 HiLink pikeCommentError pikeError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 HiLink pikeCommentString pikeString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 HiLink pikeComment2String pikeString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 HiLink pikeCommentSkip pikeComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 HiLink pikeString String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 HiLink pikeComment Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 HiLink pikeSpecial SpecialChar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 HiLink pikeTodo Todo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 HiLink pikeException pikeStatement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 HiLink pikeCompoundType Constant
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 "HiLink pikeIdentifier Identifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 let b:current_syntax = "pike"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 " vim: ts=8