KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

delphi.php 16KB

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