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