Mercurial > vim
comparison runtime/syntax/pascal.vim @ 7:3fc0f57ecb91 v7.0001
updated for version 7.0001
author | vimboss |
---|---|
date | Sun, 13 Jun 2004 20:20:40 +0000 |
parents | |
children | f6033dcbaf31 |
comparison
equal
deleted
inserted
replaced
6:c2daee826b8f | 7:3fc0f57ecb91 |
---|---|
1 " Vim syntax file | |
2 " Language: Pascal | |
3 " Version: 2.7 | |
4 " Last Change: 2003 May 11 | |
5 " Maintainer: Xavier Crégut <xavier.cregut@enseeiht.fr> | |
6 " Previous Maintainer: Mario Eusebio <bio@dq.fct.unl.pt> | |
7 | |
8 " Contributors: Tim Chase <tchase@csc.com>, Stas Grabois <stsi@vtrails.com>, | |
9 " Mazen NEIFER <mazen.neifer.2001@supaero.fr>, | |
10 " Klaus Hast <Klaus.Hast@arcor.net> | |
11 | |
12 " For version 5.x: Clear all syntax items | |
13 " For version 6.x: Quit when a syntax file was already loaded | |
14 if version < 600 | |
15 syntax clear | |
16 elseif exists("b:current_syntax") | |
17 finish | |
18 endif | |
19 | |
20 | |
21 syn case ignore | |
22 syn sync lines=250 | |
23 | |
24 syn keyword pascalBoolean true false | |
25 syn keyword pascalConditional if else then | |
26 syn keyword pascalConstant nil maxint | |
27 syn keyword pascalLabel case goto label | |
28 syn keyword pascalOperator and div downto in mod not of or packed with | |
29 syn keyword pascalRepeat do for do repeat while to until | |
30 syn keyword pascalStatement procedure function | |
31 syn keyword pascalStatement program begin end const var type | |
32 syn keyword pascalStruct record | |
33 syn keyword pascalType array boolean char integer file pointer real set | |
34 syn keyword pascalType string text variant | |
35 | |
36 | |
37 syn keyword pascalTodo contained TODO | |
38 | |
39 | |
40 " String | |
41 if !exists("pascal_one_line_string") | |
42 syn region pascalString matchgroup=pascalString start=+'+ end=+'+ contains=pascalStringEscape | |
43 if exists("pascal_gpc") | |
44 syn region pascalString matchgroup=pascalString start=+"+ end=+"+ contains=pascalStringEscapeGPC | |
45 else | |
46 syn region pascalStringError matchgroup=pascalStringError start=+"+ end=+"+ contains=pascalStringEscape | |
47 endif | |
48 else | |
49 "wrong strings | |
50 syn region pascalStringError matchgroup=pascalStringError start=+'+ end=+'+ end=+$+ contains=pascalStringEscape | |
51 if exists("pascal_gpc") | |
52 syn region pascalStringError matchgroup=pascalStringError start=+"+ end=+"+ end=+$+ contains=pascalStringEscapeGPC | |
53 else | |
54 syn region pascalStringError matchgroup=pascalStringError start=+"+ end=+"+ end=+$+ contains=pascalStringEscape | |
55 endif | |
56 | |
57 "right strings | |
58 syn region pascalString matchgroup=pascalString start=+'+ end=+'+ oneline contains=pascalStringEscape | |
59 " To see the start and end of strings: | |
60 " syn region pascalString matchgroup=pascalStringError start=+'+ end=+'+ oneline contains=pascalStringEscape | |
61 if exists("pascal_gpc") | |
62 syn region pascalString matchgroup=pascalString start=+"+ end=+"+ oneline contains=pascalStringEscapeGPC | |
63 else | |
64 syn region pascalStringError matchgroup=pascalStringError start=+"+ end=+"+ oneline contains=pascalStringEscape | |
65 endif | |
66 end | |
67 syn match pascalStringEscape contained "''" | |
68 syn match pascalStringEscapeGPC contained '""' | |
69 | |
70 | |
71 " syn match pascalIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>" | |
72 | |
73 | |
74 if exists("pascal_symbol_operator") | |
75 syn match pascalSymbolOperator "[+\-/*=]" | |
76 syn match pascalSymbolOperator "[<>]=\=" | |
77 syn match pascalSymbolOperator "<>" | |
78 syn match pascalSymbolOperator ":=" | |
79 syn match pascalSymbolOperator "[()]" | |
80 syn match pascalSymbolOperator "\.\." | |
81 syn match pascalSymbolOperator "[\^.]" | |
82 syn match pascalMatrixDelimiter "[][]" | |
83 "if you prefer you can highlight the range | |
84 "syn match pascalMatrixDelimiter "[\d\+\.\.\d\+]" | |
85 endif | |
86 | |
87 syn match pascalNumber "-\=\<\d\+\>" | |
88 syn match pascalFloat "-\=\<\d\+\.\d\+\>" | |
89 syn match pascalFloat "-\=\<\d\+\.\d\+[eE]-\=\d\+\>" | |
90 syn match pascalHexNumber "\$[0-9a-fA-F]\+\>" | |
91 | |
92 if exists("pascal_no_tabs") | |
93 syn match pascalShowTab "\t" | |
94 endif | |
95 | |
96 syn region pascalComment start="(\*" end="\*)" contains=pascalTodo | |
97 syn region pascalComment start="{" end="}" contains=pascalTodo | |
98 | |
99 | |
100 if !exists("pascal_no_functions") | |
101 " array functions | |
102 syn keyword pascalFunction pack unpack | |
103 | |
104 " memory function | |
105 syn keyword pascalFunction Dispose New | |
106 | |
107 " math functions | |
108 syn keyword pascalFunction Abs Arctan Cos Exp Ln Sin Sqr Sqrt | |
109 | |
110 " file functions | |
111 syn keyword pascalFunction Eof Eoln Write Writeln | |
112 syn keyword pascalPredefined Input Output | |
113 | |
114 if exists("pascal_traditional") | |
115 " These functions do not seem to be defined in Turbo Pascal | |
116 syn keyword pascalFunction Get Page Put | |
117 endif | |
118 | |
119 " ordinal functions | |
120 syn keyword pascalFunction Odd Pred Succ | |
121 | |
122 " transfert functions | |
123 syn keyword pascalFunction Chr Ord Round Trunc | |
124 endif | |
125 | |
126 | |
127 if !exists("pascal_traditional") | |
128 | |
129 syn keyword pascalStatement constructor destructor implementation inherited | |
130 syn keyword pascalStatement interface unit uses | |
131 syn keyword pascalModifier absolute assembler external far forward inline | |
132 syn keyword pascalModifier interrupt near virtual | |
133 syn keyword pascalAcces private public | |
134 syn keyword pascalStruct object | |
135 syn keyword pascalOperator shl shr xor | |
136 | |
137 syn region pascalPreProc start="(\*\$" end="\*)" contains=pascalTodo | |
138 syn region pascalPreProc start="{\$" end="}" | |
139 | |
140 syn region pascalAsm matchgroup=pascalAsmKey start="\<asm\>" end="\<end\>" contains=pascalComment,pascalPreProc | |
141 | |
142 syn keyword pascalType ShortInt LongInt Byte Word | |
143 syn keyword pascalType ByteBool WordBool LongBool | |
144 syn keyword pascalType Cardinal LongWord | |
145 syn keyword pascalType Single Double Extended Comp | |
146 syn keyword pascalType PChar | |
147 | |
148 | |
149 if !exists ("pascal_fpc") | |
150 syn keyword pascalPredefined Result | |
151 endif | |
152 | |
153 if exists("pascal_fpc") | |
154 syn region pascalComment start="//" end="$" | |
155 syn keyword pascalStatement fail otherwise operator | |
156 syn keyword pascalDirective popstack | |
157 syn keyword pascalPredefined self | |
158 syn keyword pascalType ShortString AnsiString WideString | |
159 endif | |
160 | |
161 if exists("pascal_gpc") | |
162 syn keyword pascalType SmallInt | |
163 syn keyword pascalType AnsiChar | |
164 syn keyword pascalType PAnsiChar | |
165 endif | |
166 | |
167 if exists("pascal_delphi") | |
168 syn region pascalComment start="//" end="$" contains=pascalTodo | |
169 syn keyword pascalType SmallInt Int64 | |
170 syn keyword pascalType Real48 Currency | |
171 syn keyword pascalType AnsiChar WideChar | |
172 syn keyword pascalType ShortString AnsiString WideString | |
173 syn keyword pascalType PAnsiChar PWideChar | |
174 syn match pascalFloat "-\=\<\d\+\.\d\+[dD]-\=\d\+\>" | |
175 syn match pascalStringEscape contained "#[12][0-9]\=[0-9]\=" | |
176 syn keyword pascalStruct class dispinterface | |
177 syn keyword pascalException try except raise at on finally | |
178 syn keyword pascalStatement out | |
179 syn keyword pascalStatement library package | |
180 syn keyword pascalStatement initialization finalization uses exports | |
181 syn keyword pascalStatement property out resourcestring threadvar | |
182 syn keyword pascalModifier contains | |
183 syn keyword pascalModifier overridden reintroduce abstract | |
184 syn keyword pascalModifier override export dynamic name message | |
185 syn keyword pascalModifier dispid index stored default nodefault readonly | |
186 syn keyword pascalModifier writeonly implements overload requires resident | |
187 syn keyword pascalAcces protected published automated | |
188 syn keyword pascalDirective register pascal cvar cdecl stdcall safecall | |
189 syn keyword pascalOperator as is | |
190 endif | |
191 | |
192 if exists("pascal_no_functions") | |
193 "syn keyword pascalModifier read write | |
194 "may confuse with Read and Write functions. Not easy to handle. | |
195 else | |
196 " control flow functions | |
197 syn keyword pascalFunction Break Continue Exit Halt RunError | |
198 | |
199 " ordinal functions | |
200 syn keyword pascalFunction Dec Inc High Low | |
201 | |
202 " math functions | |
203 syn keyword pascalFunction Frac Int Pi | |
204 | |
205 " string functions | |
206 syn keyword pascalFunction Concat Copy Delete Insert Length Pos Str Val | |
207 | |
208 " memory function | |
209 syn keyword pascalFunction FreeMem GetMem MaxAvail MemAvail | |
210 | |
211 " pointer and address functions | |
212 syn keyword pascalFunction Addr Assigned CSeg DSeg Ofs Ptr Seg SPtr SSeg | |
213 | |
214 " misc functions | |
215 syn keyword pascalFunction Exclude FillChar Hi Include Lo Move ParamCount | |
216 syn keyword pascalFunction ParamStr Random Randomize SizeOf Swap TypeOf | |
217 syn keyword pascalFunction UpCase | |
218 | |
219 " predefined variables | |
220 syn keyword pascalPredefined ErrorAddr ExitCode ExitProc FileMode FreeList | |
221 syn keyword pascalPredefined FreeZero HeapEnd HeapError HeapOrg HeapPtr | |
222 syn keyword pascalPredefined InOutRes OvrCodeList OvrDebugPtr OvrDosHandle | |
223 syn keyword pascalPredefined OvrEmsHandle OvrHeapEnd OvrHeapOrg OvrHeapPtr | |
224 syn keyword pascalPredefined OvrHeapSize OvrLoadList PrefixSeg RandSeed | |
225 syn keyword pascalPredefined SaveInt00 SaveInt02 SaveInt1B SaveInt21 | |
226 syn keyword pascalPredefined SaveInt23 SaveInt24 SaveInt34 SaveInt35 | |
227 syn keyword pascalPredefined SaveInt36 SaveInt37 SaveInt38 SaveInt39 | |
228 syn keyword pascalPredefined SaveInt3A SaveInt3B SaveInt3C SaveInt3D | |
229 syn keyword pascalPredefined SaveInt3E SaveInt3F SaveInt75 SegA000 SegB000 | |
230 syn keyword pascalPredefined SegB800 SelectorInc StackLimit Test8087 | |
231 | |
232 " file functions | |
233 syn keyword pascalFunction Append Assign BlockRead BlockWrite ChDir Close | |
234 syn keyword pascalFunction Erase FilePos FileSize Flush GetDir IOResult | |
235 syn keyword pascalFunction MkDir Read Readln Rename Reset Rewrite RmDir | |
236 syn keyword pascalFunction Seek SeekEof SeekEoln SetTextBuf Truncate | |
237 | |
238 " crt unit | |
239 syn keyword pascalFunction AssignCrt ClrEol ClrScr Delay DelLine GotoXY | |
240 syn keyword pascalFunction HighVideo InsLine KeyPressed LowVideo NormVideo | |
241 syn keyword pascalFunction NoSound ReadKey Sound TextBackground TextColor | |
242 syn keyword pascalFunction TextMode WhereX WhereY Window | |
243 syn keyword pascalPredefined CheckBreak CheckEOF CheckSnow DirectVideo | |
244 syn keyword pascalPredefined LastMode TextAttr WindMin WindMax | |
245 syn keyword pascalFunction BigCursor CursorOff CursorOn | |
246 syn keyword pascalConstant Black Blue Green Cyan Red Magenta Brown | |
247 syn keyword pascalConstant LightGray DarkGray LightBlue LightGreen | |
248 syn keyword pascalConstant LightCyan LightRed LightMagenta Yellow White | |
249 syn keyword pascalConstant Blink ScreenWidth ScreenHeight bw40 | |
250 syn keyword pascalConstant co40 bw80 co80 mono | |
251 syn keyword pascalPredefined TextChar | |
252 | |
253 " DOS unit | |
254 syn keyword pascalFunction AddDisk DiskFree DiskSize DosExitCode DosVersion | |
255 syn keyword pascalFunction EnvCount EnvStr Exec Expand FindClose FindFirst | |
256 syn keyword pascalFunction FindNext FSearch FSplit GetCBreak GetDate | |
257 syn keyword pascalFunction GetEnv GetFAttr GetFTime GetIntVec GetTime | |
258 syn keyword pascalFunction GetVerify Intr Keep MSDos PackTime SetCBreak | |
259 syn keyword pascalFunction SetDate SetFAttr SetFTime SetIntVec SetTime | |
260 syn keyword pascalFunction SetVerify SwapVectors UnPackTime | |
261 syn keyword pascalConstant FCarry FParity FAuxiliary FZero FSign FOverflow | |
262 syn keyword pascalConstant Hidden Sysfile VolumeId Directory Archive | |
263 syn keyword pascalConstant AnyFile fmClosed fmInput fmOutput fmInout | |
264 syn keyword pascalConstant TextRecNameLength TextRecBufSize | |
265 syn keyword pascalType ComStr PathStr DirStr NameStr ExtStr SearchRec | |
266 syn keyword pascalType FileRec TextBuf TextRec Registers DateTime | |
267 syn keyword pascalPredefined DosError | |
268 | |
269 "Graph Unit | |
270 syn keyword pascalFunction Arc Bar Bar3D Circle ClearDevice ClearViewPort | |
271 syn keyword pascalFunction CloseGraph DetectGraph DrawPoly Ellipse | |
272 syn keyword pascalFunction FillEllipse FillPoly FloodFill GetArcCoords | |
273 syn keyword pascalFunction GetAspectRatio GetBkColor GetColor | |
274 syn keyword pascalFunction GetDefaultPalette GetDriverName GetFillPattern | |
275 syn keyword pascalFunction GetFillSettings GetGraphMode GetImage | |
276 syn keyword pascalFunction GetLineSettings GetMaxColor GetMaxMode GetMaxX | |
277 syn keyword pascalFunction GetMaxY GetModeName GetModeRange GetPalette | |
278 syn keyword pascalFunction GetPaletteSize GetPixel GetTextSettings | |
279 syn keyword pascalFunction GetViewSettings GetX GetY GraphDefaults | |
280 syn keyword pascalFunction GraphErrorMsg GraphResult ImageSize InitGraph | |
281 syn keyword pascalFunction InstallUserDriver InstallUserFont Line LineRel | |
282 syn keyword pascalFunction LineTo MoveRel MoveTo OutText OutTextXY | |
283 syn keyword pascalFunction PieSlice PutImage PutPixel Rectangle | |
284 syn keyword pascalFunction RegisterBGIDriver RegisterBGIFont | |
285 syn keyword pascalFunction RestoreCRTMode Sector SetActivePage | |
286 syn keyword pascalFunction SetAllPallette SetAspectRatio SetBkColor | |
287 syn keyword pascalFunction SetColor SetFillPattern SetFillStyle | |
288 syn keyword pascalFunction SetGraphBufSize SetGraphMode SetLineStyle | |
289 syn keyword pascalFunction SetPalette SetRGBPalette SetTextJustify | |
290 syn keyword pascalFunction SetTextStyle SetUserCharSize SetViewPort | |
291 syn keyword pascalFunction SetVisualPage SetWriteMode TextHeight TextWidth | |
292 syn keyword pascalType ArcCoordsType FillPatternType FillSettingsType | |
293 syn keyword pascalType LineSettingsType PaletteType PointType | |
294 syn keyword pascalType TextSettingsType ViewPortType | |
295 | |
296 " string functions | |
297 syn keyword pascalFunction StrAlloc StrBufSize StrCat StrComp StrCopy | |
298 syn keyword pascalFunction StrDispose StrECopy StrEnd StrFmt StrIComp | |
299 syn keyword pascalFunction StrLCat StrLComp StrLCopy StrLen StrLFmt | |
300 syn keyword pascalFunction StrLIComp StrLower StrMove StrNew StrPas | |
301 syn keyword pascalFunction StrPCopy StrPLCopy StrPos StrRScan StrScan | |
302 syn keyword pascalFunction StrUpper | |
303 endif | |
304 | |
305 endif | |
306 | |
307 " Define the default highlighting. | |
308 " For version 5.7 and earlier: only when not done already | |
309 " For version 5.8 and later: only when an item doesn't have highlighting yet | |
310 if version >= 508 || !exists("did_pascal_syn_inits") | |
311 if version < 508 | |
312 let did_pascal_syn_inits = 1 | |
313 command -nargs=+ HiLink hi link <args> | |
314 else | |
315 command -nargs=+ HiLink hi def link <args> | |
316 endif | |
317 | |
318 HiLink pascalAcces pascalStatement | |
319 HiLink pascalBoolean Boolean | |
320 HiLink pascalComment Comment | |
321 HiLink pascalConditional Conditional | |
322 HiLink pascalConstant Constant | |
323 HiLink pascalDelimiter Identifier | |
324 HiLink pascalDirective pascalStatement | |
325 HiLink pascalException Exception | |
326 HiLink pascalFloat Float | |
327 HiLink pascalFunction Function | |
328 HiLink pascalLabel Label | |
329 HiLink pascalMatrixDelimiter Identifier | |
330 HiLink pascalModifier Type | |
331 HiLink pascalNumber Number | |
332 HiLink pascalOperator Operator | |
333 HiLink pascalPredefined pascalStatement | |
334 HiLink pascalPreProc PreProc | |
335 HiLink pascalRepeat Repeat | |
336 HiLink pascalStatement Statement | |
337 HiLink pascalString String | |
338 HiLink pascalStringEscape Special | |
339 HiLink pascalStringEscapeGPC Special | |
340 HiLink pascalStringError Error | |
341 HiLink pascalStruct pascalStatement | |
342 HiLink pascalSymbolOperator pascalOperator | |
343 HiLink pascalTodo Todo | |
344 HiLink pascalType Type | |
345 HiLink pascalUnclassified pascalStatement | |
346 " HiLink pascalAsm Assembler | |
347 HiLink pascalError Error | |
348 HiLink pascalAsmKey pascalStatement | |
349 HiLink pascalShowTab Error | |
350 | |
351 delcommand HiLink | |
352 endif | |
353 | |
354 | |
355 let b:current_syntax = "pascal" | |
356 | |
357 " vim: ts=8 sw=2 |