1<?php 2/************************************************************************************* 3 * delphi.php 4 * ---------- 5 * Author: J�rja Norbert (jnorbi@vipmail.hu), Benny Baumann (BenBE@omorphia.de) 6 * Copyright: (c) 2004 J�rja Norbert, Benny Baumann (BenBE@omorphia.de), Nigel McNie (http://qbnz.com/highlighter) 7 * Release Version: 1.0.9.1 8 * Date Started: 2004/07/26 9 * 10 * Delphi (Object Pascal) language file for GeSHi. 11 * 12 * CHANGES 13 * ------- 14 * 2012/06/27 (1.0.8.11) 15 * - Added some keywords 16 * - fixed hex numbers and hex char literals (including WideChar) 17 * - Added support for FPC-Style generics 18 * 2008/05/23 (1.0.7.22) 19 * - Added description of extra language features (SF#1970248) 20 * 2005/11/19 (1.0.3) 21 * - Updated the very incomplete keyword and type lists 22 * 2005/09/03 (1.0.2) 23 * - Added support for hex numbers and string entities 24 * 2004/11/27 (1.0.1) 25 * - Added support for multiple object splitters 26 * 2004/10/27 (1.0.0) 27 * - First Release 28 * 29 * TODO (updated 2004/11/27) 30 * ------------------------- 31 * 32 ************************************************************************************* 33 * 34 * This file is part of GeSHi. 35 * 36 * GeSHi is free software; you can redistribute it and/or modify 37 * it under the terms of the GNU General Public License as published by 38 * the Free Software Foundation; either version 2 of the License, or 39 * (at your option) any later version. 40 * 41 * GeSHi is distributed in the hope that it will be useful, 42 * but WITHOUT ANY WARRANTY; without even the implied warranty of 43 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 44 * GNU General Public License for more details. 45 * 46 * You should have received a copy of the GNU General Public License 47 * along with GeSHi; if not, write to the Free Software 48 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 49 * 50 ************************************************************************************/ 51 52$language_data = array ( 53 'LANG_NAME' => 'Delphi', 54 'COMMENT_SINGLE' => array(1 => '//'), 55 'COMMENT_MULTI' => array('(*' => '*)', '{' => '}'), 56 //Compiler directives 57 'COMMENT_REGEXP' => array(2 => '/\\{\\$.*?}|\\(\\*\\$.*?\\*\\)/U'), 58 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, 59 'QUOTEMARKS' => array("'"), 60 'ESCAPE_CHAR' => '', 61 62 'KEYWORDS' => array( 63 1 => array( 64 'Abstract', 'And', 'Array', 'As', 'Asm', 'At', 'Begin', 'Case', 65 'Class', 'Const', 'Constructor', 'Contains', 'Default', 'delayed', 'Destructor', 66 'DispInterface', 'Div', 'Do', 'DownTo', 'Else', 'End', 'Except', 67 'Export', 'Exports', 'External', 'File', 'Finalization', 'Finally', 'For', 68 'Function', 'Generic', 'Goto', 'If', 'Implementation', 'In', 'Inherited', 69 'Initialization', 'Inline', 'Interface', 'Is', 'Label', 'Library', 'Message', 70 'Mod', 'Nil', 'Not', 'Object', 'Of', 'On', 'Or', 'Overload', 'Override', 71 'Package', 'Packed', 'Private', 'Procedure', 'Program', 'Property', 72 'Protected', 'Public', 'Published', 'Read', 'Raise', 'Record', 'Register', 73 'Repeat', 'Requires', 'Resourcestring', 'Set', 'Shl', 'Shr', 'Specialize', 'Stored', 74 'Then', 'ThreadVar', 'To', 'Try', 'Type', 'Unit', 'Until', 'Uses', 'Var', 75 'Virtual', 'While', 'With', 'Write', 'Xor', 'assembler', 'far', 76 'near', 'pascal', 'cdecl', 'safecall', 'stdcall', 'varargs' 77 ), 78 2 => array( 79 'false', 'self', 'true', 80 ), 81 3 => array( 82 'Abs', 'AcquireExceptionObject', 'Addr', 'AnsiToUtf8', 'Append', 'ArcTan', 83 'Assert', 'AssignFile', 'Assigned', 'BeginThread', 'BlockRead', 84 'BlockWrite', 'Break', 'ChDir', 'Chr', 'Close', 'CloseFile', 85 'CompToCurrency', 'CompToDouble', 'Concat', 'Continue', 'Copy', 'Cos', 86 'Dec', 'Delete', 'Dispose', 'DoubleToComp', 'EndThread', 'EnumModules', 87 'EnumResourceModules', 'Eof', 'Eoln', 'Erase', 'ExceptAddr', 88 'ExceptObject', 'Exclude', 'Exit', 'Exp', 'FilePos', 'FileSize', 89 'FillChar', 'Finalize', 'FindClassHInstance', 'FindHInstance', 90 'FindResourceHInstance', 'Flush', 'Frac', 'FreeMem', 'Get8087CW', 91 'GetDir', 'GetLastError', 'GetMem', 'GetMemoryManager', 92 'GetModuleFileName', 'GetVariantManager', 'Halt', 'Hi', 'High', 93 'IOResult', 'Inc', 'Include', 'Initialize', 'Insert', 'Int', 94 'IsMemoryManagerSet', 'IsVariantManagerSet', 'Length', 'Ln', 'Lo', 'Low', 95 'MkDir', 'Move', 'New', 'Odd', 'OleStrToStrVar', 'OleStrToString', 'Ord', 96 'PUCS4Chars', 'ParamCount', 'ParamStr', 'Pi', 'Pos', 'Pred', 'Ptr', 97 'Random', 'Randomize', 'Read', 'ReadLn', 'ReallocMem', 98 'ReleaseExceptionObject', 'Rename', 'Reset', 'Rewrite', 'RmDir', 'Round', 99 'RunError', 'Seek', 'SeekEof', 'SeekEoln', 'Set8087CW', 'SetLength', 100 'SetLineBreakStyle', 'SetMemoryManager', 'SetString', 'SetTextBuf', 101 'SetVariantManager', 'Sin', 'SizeOf', 'Slice', 'Sqr', 'Sqrt', 'Str', 102 'StringOfChar', 'StringToOleStr', 'StringToWideChar', 'Succ', 'Swap', 103 'Trunc', 'Truncate', 'TypeInfo', 'UCS4StringToWideString', 'UTF8Decode', 104 'UTF8Encode', 'UnicodeToUtf8', 'UniqueString', 'UpCase', 'Utf8ToAnsi', 105 'Utf8ToUnicode', 'Val', 'VarArrayRedim', 'VarClear', 106 'WideCharLenToStrVar', 'WideCharLenToString', 'WideCharToStrVar', 107 'WideCharToString', 'WideStringToUCS4String', 'Write', 'WriteLn', 108 109 'Abort', 'AddExitProc', 'AddTerminateProc', 'AdjustLineBreaks', 'AllocMem', 110 'AnsiCompareFileName', 'AnsiCompareStr', 'AnsiCompareText', 111 'AnsiDequotedStr', 'AnsiExtractQuotedStr', 'AnsiLastChar', 112 'AnsiLowerCase', 'AnsiLowerCaseFileName', 'AnsiPos', 'AnsiQuotedStr', 113 'AnsiSameStr', 'AnsiSameText', 'AnsiStrComp', 'AnsiStrIComp', 114 'AnsiStrLComp', 'AnsiStrLIComp', 'AnsiStrLastChar', 'AnsiStrLower', 115 'AnsiStrPos', 'AnsiStrRScan', 'AnsiStrScan', 'AnsiStrUpper', 116 'AnsiUpperCase', 'AnsiUpperCaseFileName', 'AppendStr', 'AssignStr', 117 'Beep', 'BoolToStr', 'ByteToCharIndex', 'ByteToCharLen', 'ByteType', 118 'CallTerminateProcs', 'ChangeFileExt', 'CharLength', 'CharToByteIndex', 119 'CharToByteLen', 'CompareMem', 'CompareStr', 'CompareText', 'CreateDir', 120 'CreateGUID', 'CurrToStr', 'CurrToStrF', 'CurrentYear', 'Date', 121 'DateTimeToFileDate', 'DateTimeToStr', 'DateTimeToString', 122 'DateTimeToSystemTime', 'DateTimeToTimeStamp', 'DateToStr', 'DayOfWeek', 123 'DecodeDate', 'DecodeDateFully', 'DecodeTime', 'DeleteFile', 124 'DirectoryExists', 'DiskFree', 'DiskSize', 'DisposeStr', 'EncodeDate', 125 'EncodeTime', 'ExceptionErrorMessage', 'ExcludeTrailingBackslash', 126 'ExcludeTrailingPathDelimiter', 'ExpandFileName', 'ExpandFileNameCase', 127 'ExpandUNCFileName', 'ExtractFileDir', 'ExtractFileDrive', 128 'ExtractFileExt', 'ExtractFileName', 'ExtractFilePath', 129 'ExtractRelativePath', 'ExtractShortPathName', 'FileAge', 'FileClose', 130 'FileCreate', 'FileDateToDateTime', 'FileExists', 'FileGetAttr', 131 'FileGetDate', 'FileIsReadOnly', 'FileOpen', 'FileRead', 'FileSearch', 132 'FileSeek', 'FileSetAttr', 'FileSetDate', 'FileSetReadOnly', 'FileWrite', 133 'FinalizePackage', 'FindClose', 'FindCmdLineSwitch', 'FindFirst', 134 'FindNext', 'FloatToCurr', 'FloatToDateTime', 'FloatToDecimal', 135 'FloatToStr', 'FloatToStrF', 'FloatToText', 'FloatToTextFmt', 136 'FmtLoadStr', 'FmtStr', 'ForceDirectories', 'Format', 'FormatBuf', 137 'FormatCurr', 'FormatDateTime', 'FormatFloat', 'FreeAndNil', 138 'GUIDToString', 'GetCurrentDir', 'GetEnvironmentVariable', 139 'GetFileVersion', 'GetFormatSettings', 'GetLocaleFormatSettings', 140 'GetModuleName', 'GetPackageDescription', 'GetPackageInfo', 'GetTime', 141 'IncAMonth', 'IncMonth', 'IncludeTrailingBackslash', 142 'IncludeTrailingPathDelimiter', 'InitializePackage', 'IntToHex', 143 'IntToStr', 'InterlockedDecrement', 'InterlockedExchange', 144 'InterlockedExchangeAdd', 'InterlockedIncrement', 'IsDelimiter', 145 'IsEqualGUID', 'IsLeapYear', 'IsPathDelimiter', 'IsValidIdent', 146 'Languages', 'LastDelimiter', 'LoadPackage', 'LoadStr', 'LowerCase', 147 'MSecsToTimeStamp', 'NewStr', 'NextCharIndex', 'Now', 'OutOfMemoryError', 148 'QuotedStr', 'RaiseLastOSError', 'RaiseLastWin32Error', 'RemoveDir', 149 'RenameFile', 'ReplaceDate', 'ReplaceTime', 'SafeLoadLibrary', 150 'SameFileName', 'SameText', 'SetCurrentDir', 'ShowException', 'Sleep', 151 'StrAlloc', 'StrBufSize', 'StrByteType', 'StrCat', 'StrCharLength', 152 'StrComp', 'StrCopy', 'StrDispose', 'StrECopy', 'StrEnd', 'StrFmt', 153 'StrIComp', 'StrLCat', 'StrLComp', 'StrLCopy', 'StrLFmt', 'StrLIComp', 154 'StrLen', 'StrLower', 'StrMove', 'StrNew', 'StrNextChar', 'StrPCopy', 155 'StrPLCopy', 'StrPas', 'StrPos', 'StrRScan', 'StrScan', 'StrToBool', 156 'StrToBoolDef', 'StrToCurr', 'StrToCurrDef', 'StrToDate', 'StrToDateDef', 157 'StrToDateTime', 'StrToDateTimeDef', 'StrToFloat', 'StrToFloatDef', 158 'StrToInt', 'StrToInt64', 'StrToInt64Def', 'StrToIntDef', 'StrToTime', 159 'StrToTimeDef', 'StrUpper', 'StringReplace', 'StringToGUID', 'Supports', 160 'SysErrorMessage', 'SystemTimeToDateTime', 'TextToFloat', 'Time', 161 'TimeStampToDateTime', 'TimeStampToMSecs', 'TimeToStr', 'Trim', 162 'TrimLeft', 'TrimRight', 'TryEncodeDate', 'TryEncodeTime', 163 'TryFloatToCurr', 'TryFloatToDateTime', 'TryStrToBool', 'TryStrToCurr', 164 'TryStrToDate', 'TryStrToDateTime', 'TryStrToFloat', 'TryStrToInt', 165 'TryStrToInt64', 'TryStrToTime', 'UnloadPackage', 'UpperCase', 166 'WideCompareStr', 'WideCompareText', 'WideFmtStr', 'WideFormat', 167 'WideFormatBuf', 'WideLowerCase', 'WideSameStr', 'WideSameText', 168 'WideUpperCase', 'Win32Check', 'WrapText', 169 170 'ActivateClassGroup', 'AllocateHwnd', 'BinToHex', 'CheckSynchronize', 171 'CollectionsEqual', 'CountGenerations', 'DeallocateHwnd', 'EqualRect', 172 'ExtractStrings', 'FindClass', 'FindGlobalComponent', 'GetClass', 173 'GroupDescendantsWith', 'HexToBin', 'IdentToInt', 174 'InitInheritedComponent', 'IntToIdent', 'InvalidPoint', 175 'IsUniqueGlobalComponentName', 'LineStart', 'ObjectBinaryToText', 176 'ObjectResourceToText', 'ObjectTextToBinary', 'ObjectTextToResource', 177 'PointsEqual', 'ReadComponentRes', 'ReadComponentResEx', 178 'ReadComponentResFile', 'Rect', 'RegisterClass', 'RegisterClassAlias', 179 'RegisterClasses', 'RegisterComponents', 'RegisterIntegerConsts', 180 'RegisterNoIcon', 'RegisterNonActiveX', 'SmallPoint', 'StartClassGroup', 181 'TestStreamFormat', 'UnregisterClass', 'UnregisterClasses', 182 'UnregisterIntegerConsts', 'UnregisterModuleClasses', 183 'WriteComponentResFile', 184 185 'ArcCos', 'ArcCosh', 'ArcCot', 'ArcCotH', 'ArcCsc', 'ArcCscH', 'ArcSec', 186 'ArcSecH', 'ArcSin', 'ArcSinh', 'ArcTan2', 'ArcTanh', 'Ceil', 187 'CompareValue', 'Cosecant', 'Cosh', 'Cot', 'CotH', 'Cotan', 'Csc', 'CscH', 188 'CycleToDeg', 'CycleToGrad', 'CycleToRad', 'DegToCycle', 'DegToGrad', 189 'DegToRad', 'DivMod', 'DoubleDecliningBalance', 'EnsureRange', 'Floor', 190 'Frexp', 'FutureValue', 'GetExceptionMask', 'GetPrecisionMode', 191 'GetRoundMode', 'GradToCycle', 'GradToDeg', 'GradToRad', 'Hypot', 192 'InRange', 'IntPower', 'InterestPayment', 'InterestRate', 193 'InternalRateOfReturn', 'IsInfinite', 'IsNan', 'IsZero', 'Ldexp', 'LnXP1', 194 'Log10', 'Log2', 'LogN', 'Max', 'MaxIntValue', 'MaxValue', 'Mean', 195 'MeanAndStdDev', 'Min', 'MinIntValue', 'MinValue', 'MomentSkewKurtosis', 196 'NetPresentValue', 'Norm', 'NumberOfPeriods', 'Payment', 'PeriodPayment', 197 'Poly', 'PopnStdDev', 'PopnVariance', 'Power', 'PresentValue', 198 'RadToCycle', 'RadToDeg', 'RadToGrad', 'RandG', 'RandomRange', 'RoundTo', 199 'SLNDepreciation', 'SYDDepreciation', 'SameValue', 'Sec', 'SecH', 200 'Secant', 'SetExceptionMask', 'SetPrecisionMode', 'SetRoundMode', 'Sign', 201 'SimpleRoundTo', 'SinCos', 'Sinh', 'StdDev', 'Sum', 'SumInt', 202 'SumOfSquares', 'SumsAndSquares', 'Tan', 'Tanh', 'TotalVariance', 203 'Variance' 204 ), 205 4 => array( 206 'AnsiChar', 'AnsiString', 'Bool', 'Boolean', 'Byte', 'ByteBool', 'Cardinal', 'Char', 207 'Comp', 'Currency', 'DWORD', 'Double', 'Extended', 'Int64', 'Integer', 'IUnknown', 208 'LongBool', 'LongInt', 'LongWord', 'PAnsiChar', 'PAnsiString', 'PBool', 'PBoolean', 'PByte', 209 'PByteArray', 'PCardinal', 'PChar', 'PComp', 'PCurrency', 'PDWORD', 'PDate', 'PDateTime', 210 'PDouble', 'PExtended', 'PInt64', 'PInteger', 'PLongInt', 'PLongWord', 'Pointer', 'PPointer', 211 'PShortInt', 'PShortString', 'PSingle', 'PSmallInt', 'PString', 'PHandle', 'PVariant', 'PWord', 212 'PWordArray', 'PWordBool', 'PWideChar', 'PWideString', 'Real', 'Real48', 'ShortInt', 'ShortString', 213 'Single', 'SmallInt', 'String', 'TClass', 'TDate', 'TDateTime', 'TextFile', 'THandle', 214 'TObject', 'TTime', 'Variant', 'WideChar', 'WideString', 'Word', 'WordBool' 215 ), 216 ), 217 'CASE_SENSITIVE' => array( 218 GESHI_COMMENTS => false, 219 1 => false, 220 2 => false, 221 3 => false, 222 4 => false, 223 ), 224 'SYMBOLS' => array( 225 0 => array('(', ')', '[', ']'), 226 1 => array('.', ',', ':', ';'), 227 2 => array('@', '^'), 228 3 => array('=', '+', '-', '*', '/') 229 ), 230 'STYLES' => array( 231 'KEYWORDS' => array( 232 1 => 'color: #000000; font-weight: bold;', 233 2 => 'color: #000000; font-weight: bold;', 234 3 => 'color: #000066;', 235 4 => 'color: #000066; font-weight: bold;' 236 ), 237 'COMMENTS' => array( 238 1 => 'color: #808080; font-style: italic;', 239 2 => 'color: #008000; font-style: italic;', 240 'MULTI' => 'color: #808080; font-style: italic;' 241 ), 242 'ESCAPE_CHAR' => array( 243 0 => 'color: #ff0000; font-weight: bold;' 244 ), 245 'BRACKETS' => array( 246 0 => 'color: #000066;' 247 ), 248 'STRINGS' => array( 249 0 => 'color: #ff0000;' 250 ), 251 'NUMBERS' => array( 252 0 => 'color: #0000ff;' 253 ), 254 'METHODS' => array( 255 1 => 'color: #006600;' 256 ), 257 'REGEXPS' => array( 258 0 => 'color: #0000cc;', 259 1 => 'color: #ff0000;' 260 ), 261 'SYMBOLS' => array( 262 0 => 'color: #000066;', 263 1 => 'color: #000066;', 264 2 => 'color: #000066;', 265 3 => 'color: #000066;' 266 ), 267 'SCRIPT' => array( 268 ) 269 ), 270 'URLS' => array( 271 1 => '', 272 2 => '', 273 3 => '', 274 4 => '' 275 ), 276 'OOLANG' => true, 277 'OBJECT_SPLITTERS' => array( 278 1 => '.' 279 ), 280 'REGEXPS' => array( 281 //Hex numbers 282 0 => '(?<!\#)\$[0-9a-fA-F]+(?!\w)', 283 //Characters 284 1 => '\#(?:\$[0-9a-fA-F]{1,4}|\d{1,5})' 285 ), 286 'STRICT_MODE_APPLIES' => GESHI_NEVER, 287 'SCRIPT_DELIMITERS' => array( 288 ), 289 'HIGHLIGHT_STRICT_BLOCK' => array( 290 ), 291 'TAB_WIDTH' => 2, 292 'PARSER_CONTROL' => array( 293 'KEYWORDS' => array( 294 3 => array( 295 'DISALLOWED_AFTER' => '(?=\s*[(;])' 296 ) 297 ) 298 ) 299); 300