Update CS:GO team score gamedata.
9 #the header and footer strings come from naris' original SourcePawn syntax file
10 #skip way down below for actual code
11 my $header = <<'HEADER';
13 " Language: SourcePawn
14 " Generated by vimsyntax.pl
16 " Quit when a (custom) syntax file was already loaded
17 "if exists("b:current_syntax")
21 " A bunch of useful C keywords
22 syn keyword cStatement goto break return continue assert state sleep exit
23 syn keyword cLabel case default
24 syn keyword cConditional if else switch
25 syn keyword cRepeat while for do
27 syn keyword cTodo contained TODO FIXME XXX
29 " cCommentGroup allows adding matches for special things in comments
30 syn cluster cCommentGroup contains=cTodo
32 " String and Character constants
33 " Highlight special characters (those which have a backslash) differently
34 syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
35 if !exists("c_no_utf")
36 syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)"
38 if exists("c_no_cformat")
39 syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell
40 " cCppString: same as cString, but ends at end of line
41 syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,@Spell
43 if !exists("c_no_c99") " ISO C99
44 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
46 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
48 syn match cFormat display "%%" contained
49 syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell
50 " cCppString: same as cString, but ends at end of line
51 syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
54 syn match cCharacter "L\='[^\\]'"
55 syn match cCharacter "L'[^']*'" contains=cSpecial
57 syn match cSpecialError "L\='\\[^'\"?\\abefnrtv]'"
58 syn match cSpecialCharacter "L\='\\['\"?\\abefnrtv]'"
60 syn match cSpecialError "L\='\\[^'\"?\\abfnrtv]'"
61 syn match cSpecialCharacter "L\='\\['\"?\\abfnrtv]'"
63 syn match cSpecialCharacter display "L\='\\\o\{1,3}'"
64 syn match cSpecialCharacter display "'\\x\x\{1,2}'"
65 syn match cSpecialCharacter display "L'\\x\x\+'"
67 "when wanted, highlight trailing white space
68 if exists("c_space_errors")
69 if !exists("c_no_trail_space_error")
70 syn match cSpaceError display excludenl "\s\+$"
72 if !exists("c_no_tab_space_error")
73 syn match cSpaceError display " \+\t"me=e-1
77 " This should be before cErrInParen to avoid problems with #define ({ xxx })
78 syntax region cBlock start="{" end="}" transparent fold
80 "catch errors caused by wrong parenthesis and brackets
81 " also accept <% for {, %> for }, <: for [ and :> for ] (C99)
82 " But avoid matching <::.
83 syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cCommentSkip,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cNumbersCom
84 if exists("c_no_curly_error")
85 syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
86 " cCppParen: same as cParen but ends at end-of-line; used in cDefine
87 syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
88 syn match cParenError display ")"
89 syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
90 elseif exists("c_no_bracket_error")
91 syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
92 " cCppParen: same as cParen but ends at end-of-line; used in cDefine
93 syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
94 syn match cParenError display ")"
95 syn match cErrInParen display contained "[{}]\|<%\|%>"
97 syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
98 " cCppParen: same as cParen but ends at end-of-line; used in cDefine
99 syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
100 syn match cParenError display "[\])]"
101 syn match cErrInParen display contained "[\]{}]\|<%\|%>"
102 syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell
103 " cCppBracket: same as cParen but ends at end-of-line; used in cDefine
104 syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell
105 syn match cErrInBracket display contained "[);{}]\|<%\|%>"
108 "integer number, or floating point number without a dot and with "f".
110 syn match cNumbers display transparent "\<\d\|\.\d" contains=cNumber,cFloat
111 " Same (for comments)
112 syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumber,cFloat
113 syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
115 syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
116 syn match cFloat display contained "\d\+f"
117 "floating point number, with dot, optional exponent
118 syn match cFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
119 "floating point number, starting with a dot, optional exponent
120 syn match cFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
121 "floating point number, without dot, with exponent
122 syn match cFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"
123 if !exists("c_no_c99")
124 "hexadecimal floating point number, optional leading digits, with dot, with exponent
125 syn match cFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>"
126 "hexadecimal floating point number, with leading digits, optional dot, with exponent
127 syn match cFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>"
132 if exists("c_comment_strings")
133 " A comment can contain cString, cCharacter and cNumber.
134 " But a "*/" inside a cString in a cComment DOES end the comment! So we
135 " need to use a special type of cString: cCommentString, which also ends on
136 " "*/", and sees a "*" at the start of the line as comment again.
137 " Unfortunately this doesn't very well work for // type of comments :-(
138 syntax match cCommentSkip contained "^\s*\*\($\|\s\+\)"
139 syntax region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
140 syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
141 syntax region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell
142 if exists("c_no_comment_fold")
143 " Use "extend" here to have preprocessor lines not terminate halfway a
145 syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
147 syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend
150 syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell
151 if exists("c_no_comment_fold")
152 syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell
154 syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold
157 " keep a // comment separately, it terminates a preproc. conditional
158 syntax match cCommentError display "\*/"
159 syntax match cCommentStartError display "/\*"me=e-1 contained
161 syn keyword cOperator sizeof tagof state defined char
163 syn keyword cTag any bool Fixed Float String Function
165 syn keyword cStructure enum
166 syn keyword cStorageClass static const stock native forward
170 syn keyword cConstant cellbits cellmax cellmin charbits charmax charmin ucharmax __Pawn debug
171 syn keyword cConstant true false
174 my $footer = <<'FOOTER';
175 " Accept %: for # (C99)
176 syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
177 syn match cPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"
178 if !exists("c_no_if0")
179 if !exists("c_no_if0_fold")
180 syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2 fold
182 syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2
184 syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip
185 syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip
187 syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
188 syn match cIncluded display contained "<[^>]*>"
189 syn match cInclude display "^\s*\(%:\|#\)\s*\(include\>\|tryinclude\>\)\s*["<]" contains=cIncluded
190 "syn match cLineSkip "\\$"
191 syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti
192 syn region cDefine start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" end="//"me=s-1 keepend contains=ALLBUT,@cPreProcGroup,@Spell
193 syn region cPreProc start="^\s*\(%:\|#\)\s*\(assert\>\|emit\>\|endinput\>\|endscript\>\|pragma\>\|line\>\|section\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
195 " Highlight User Labels
196 syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cNumbersCom,cCppParen,cCppBracket,cCppString
197 syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell
198 " Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
199 syn cluster cLabelGroup contains=cUserLabel
200 syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup
201 syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup
202 syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
203 syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
205 syn match cUserLabel display "\I\i*" contained
208 syn keyword cppStatement new decl
209 syn keyword cppAccess public
210 syn keyword cppOperator operator
212 if exists("c_minlines")
213 let b:c_minlines = c_minlines
215 if !exists("c_no_if0")
216 let b:c_minlines = 50 " #if 0 constructs can be long
218 let b:c_minlines = 15 " mostly for () constructs
221 exec "syn sync ccomment cComment minlines=" . b:c_minlines
223 " Define the default highlighting.
224 " Only used when an item doesn't have highlighting yet
225 hi def link cFormat cSpecial
226 hi def link cCppString cString
227 hi def link cCommentL cComment
228 hi def link cCommentStart cComment
229 hi def link cLabel Label
230 hi def link cUserLabel Label
231 hi def link cConditional Conditional
232 hi def link cRepeat Repeat
233 hi def link cCharacter Character
234 hi def link cSpecialCharacter cSpecial
235 hi def link cNumber Number
236 hi def link cFloat Float
237 hi def link cParenError cError
238 hi def link cErrInParen cError
239 hi def link cErrInBracket cError
240 hi def link cCommentError cError
241 hi def link cCommentStartError cError
242 hi def link cSpaceError cError
243 hi def link cSpecialError cError
244 hi def link cOperator Operator
245 hi def link cStructure Structure
246 hi def link cStorageClass StorageClass
247 hi def link cInclude Include
248 hi def link cPreProc PreProc
249 hi def link cDefine Macro
250 hi def link cIncluded cString
251 hi def link cError Error
252 hi def link cStatement Statement
253 hi def link cPreCondit PreCondit
254 hi def link cTag Type
255 hi def link cConstant Constant
256 hi def link cCommentString cString
257 hi def link cComment2String cString
258 hi def link cCommentSkip cComment
259 hi def link cString String
260 hi def link cComment Comment
261 hi def link cSpecial SpecialChar
262 hi def link cTodo Todo
263 hi def link cCppSkip cCppOut
264 hi def link cCppOut2 cCppOut
265 hi def link cCppOut Comment
267 hi def link cppAccess cppStatement
268 hi def link cppOperator Operator
269 hi def link cppStatement Statement
271 hi def link cFunction Function
272 hi def link cForward Function
274 let b:current_syntax = "sourcepawn"
281 for my $file (@files)
289 open(FILE, $file) or die "couldn't open $file: $!";
295 if (/^\s*#define\s+([^_]\w+)\s+\S/) { push(@constants, $1); }
296 elsif (/^\s*public(?:\s+const)?\s+(?:\w+:)?([^_](?>\w+))(?!:)/) { push(@constants, $1); }
297 elsif (/^\s*(?:native|stock)\s+(?:\w+:)?(\w+)\(/) { push(@functions, $1); }
298 elsif (/^\s*functag public\s+(?:\w+:)?(\w+)/) { push(@tags, $1); }
299 elsif (/^\s*enum\s+(\w+)/) { push(@tags, $1); $inEnum = 1; }
300 elsif (/^\s*(?:struct|funcenum)\s+(\w+)/) { push(@tags, $1); }
301 elsif (/^\s*forward\s+(?:\w+:)?(\w+)\(/) { push(@forwards, $1); }
305 if (/^\s*}/) { $inEnum = 0; }
306 elsif (/^\t?(\w+)/) { push(@constants, $1); }
310 print "\n\" $file\n";
312 if (@constants % $group) { push @constants, ("") x ($group - (@constants % $group)); }
313 if (@tags % $group) { push @tags, ("") x ($group - (@tags % $group)); }
314 if (@functions % $group) { push @functions, ("") x ($group - (@functions % $group)); }
315 if (@forwards % $group) { push @forwards, ("") x ($group - (@forwards % $group)); }
318 for (my $i = 0; $i <= $#functions; $i += $group) { print "syn keyword\tcFunction\t@functions[$i .. $i + $group - 1]\n"; }
319 for (my $i = 0; $i <= $#constants; $i += $group) { print "syn keyword\tcConstant\t@constants[$i .. $i + $group - 1]\n"; }
320 for (my $i = 0; $i <= $#tags; $i += $group) { print "syn keyword\tcTag\t\t@tags[$i .. $i + $group - 1]\n"; }
321 for (my $i = 0; $i <= $#forwards; $i += $group) { print "syn keyword\tcForward\t@forwards[$i .. $i + $group - 1]\n"; }