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