Home | History | Annotate | Download | only in geshi
      1 <?php
      2 /*************************************************************************************
      3  * delphi.php
      4  * ----------
      5  * Author: Jrja Norbert (jnorbi (at) vipmail.hu), Benny Baumann (BenBE (at) omorphia.de)
      6  * Copyright: (c) 2004 Jrja Norbert, Benny Baumann (BenBE (at) omorphia.de), Nigel McNie (http://qbnz.com/highlighter)
      7  * Release Version: 1.0.8.3
      8  * Date Started: 2004/07/26
      9  *
     10  * Delphi (Object Pascal) language file for GeSHi.
     11  *
     12  * CHANGES
     13  * -------
     14  * 2008/05/23 (1.0.7.22)
     15  *   -  Added description of extra language features (SF#1970248)
     16  * 2005/11/19 (1.0.3)
     17  *   -  Updated the very incomplete keyword and type lists
     18  * 2005/09/03 (1.0.2)
     19  *   -  Added support for hex numbers and string entities
     20  * 2004/11/27 (1.0.1)
     21  *   -  Added support for multiple object splitters
     22  * 2004/10/27 (1.0.0)
     23  *   -  First Release
     24  *
     25  * TODO (updated 2004/11/27)
     26  * -------------------------
     27  *
     28  *************************************************************************************
     29  *
     30  *   This file is part of GeSHi.
     31  *
     32  *   GeSHi is free software; you can redistribute it and/or modify
     33  *   it under the terms of the GNU General Public License as published by
     34  *   the Free Software Foundation; either version 2 of the License, or
     35  *   (at your option) any later version.
     36  *
     37  *   GeSHi is distributed in the hope that it will be useful,
     38  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     39  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     40  *   GNU General Public License for more details.
     41  *
     42  *   You should have received a copy of the GNU General Public License
     43  *   along with GeSHi; if not, write to the Free Software
     44  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     45  *
     46  ************************************************************************************/
     47 
     48 $language_data = array (
     49     'LANG_NAME' => 'Delphi',
     50     'COMMENT_SINGLE' => array(1 => '//'),
     51     'COMMENT_MULTI' => array('(*' => '*)', '{' => '}'),
     52     //Compiler directives
     53     'COMMENT_REGEXP' => array(2 => '/{\\$.*?}|\\(\\*\\$.*?\\*\\)/U'),
     54     'CASE_KEYWORDS' => 0,
     55     'QUOTEMARKS' => array("'"),
     56     'ESCAPE_CHAR' => '',
     57     'KEYWORDS' => array(
     58         1 => array(
     59             'Abstract', 'And', 'Array', 'As', 'Asm', 'At', 'Begin', 'Case',
     60             'Class', 'Const', 'Constructor', 'Contains', 'Destructor',
     61             'DispInterface', 'Div', 'Do', 'DownTo', 'Else', 'End', 'Except',
     62             'Export', 'Exports', 'External', 'File', 'Finalization', 'Finally',
     63             'For', 'Function', 'Goto', 'If', 'Implementation', 'In', 'Inherited',
     64             'Initialization', 'Inline', 'Interface', 'Is', 'Label', 'Library',
     65             'Mod', 'Not', 'Object', 'Of', 'On', 'Or', 'Overload', 'Override',
     66             'Package', 'Packed', 'Private', 'Procedure', 'Program', 'Property',
     67             'Protected', 'Public', 'Published', 'Raise', 'Record', 'Register',
     68             'Repeat', 'Requires', 'Resourcestring', 'Set', 'Shl', 'Shr', 'Then',
     69             'ThreadVar', 'To', 'Try', 'Type', 'Unit', 'Until', 'Uses', 'Var',
     70             'Virtual', 'While', 'With', 'Xor', 'assembler', 'far',
     71             'near', 'pascal', 'register', 'cdecl', 'safecall', 'stdcall', 'varargs'
     72             ),
     73         2 => array(
     74             'nil', 'false', 'self', 'true', 'var', 'type', 'const'
     75             ),
     76         3 => array(
     77             'Abs', 'AcquireExceptionObject', 'Addr', 'AnsiToUtf8', 'Append', 'ArcTan',
     78             'Assert', 'AssignFile', 'Assigned', 'BeginThread', 'BlockRead',
     79             'BlockWrite', 'Break', 'ChDir', 'Chr', 'Close', 'CloseFile',
     80             'CompToCurrency', 'CompToDouble', 'Concat', 'Continue', 'Copy', 'Cos',
     81             'Dec', 'Delete', 'Dispose', 'DoubleToComp', 'EndThread', 'EnumModules',
     82             'EnumResourceModules', 'Eof', 'Eoln', 'Erase', 'ExceptAddr',
     83             'ExceptObject', 'Exclude', 'Exit', 'Exp', 'FilePos', 'FileSize',
     84             'FillChar', 'Finalize', 'FindClassHInstance', 'FindHInstance',
     85             'FindResourceHInstance', 'Flush', 'Frac', 'FreeMem', 'Get8087CW',
     86             'GetDir', 'GetLastError', 'GetMem', 'GetMemoryManager',
     87             'GetModuleFileName', 'GetVariantManager', 'Halt', 'Hi', 'High',
     88             'IOResult', 'Inc', 'Include', 'Initialize', 'Insert', 'Int',
     89             'IsMemoryManagerSet', 'IsVariantManagerSet', 'Length', 'Ln', 'Lo', 'Low',
     90             'MkDir', 'Move', 'New', 'Odd', 'OleStrToStrVar', 'OleStrToString', 'Ord',
     91             'PUCS4Chars', 'ParamCount', 'ParamStr', 'Pi', 'Pos', 'Pred', 'Ptr',
     92             'Random', 'Randomize', 'Read', 'ReadLn', 'ReallocMem',
     93             'ReleaseExceptionObject', 'Rename', 'Reset', 'Rewrite', 'RmDir', 'Round',
     94             'RunError', 'Seek', 'SeekEof', 'SeekEoln', 'Set8087CW', 'SetLength',
     95             'SetLineBreakStyle', 'SetMemoryManager', 'SetString', 'SetTextBuf',
     96             'SetVariantManager', 'Sin', 'SizeOf', 'Slice', 'Sqr', 'Sqrt', 'Str',
     97             'StringOfChar', 'StringToOleStr', 'StringToWideChar', 'Succ', 'Swap',
     98             'Trunc', 'Truncate', 'TypeInfo', 'UCS4StringToWideString', 'UTF8Decode',
     99             'UTF8Encode', 'UnicodeToUtf8', 'UniqueString', 'UpCase', 'Utf8ToAnsi',
    100             'Utf8ToUnicode', 'Val', 'VarArrayRedim', 'VarClear',
    101             'WideCharLenToStrVar', 'WideCharLenToString', 'WideCharToStrVar',
    102             'WideCharToString', 'WideStringToUCS4String', 'Write', 'WriteLn',
    103 
    104             'Abort', 'AddExitProc', 'AddTerminateProc', 'AdjustLineBreaks', 'AllocMem',
    105             'AnsiCompareFileName', 'AnsiCompareStr', 'AnsiCompareText',
    106             'AnsiDequotedStr', 'AnsiExtractQuotedStr', 'AnsiLastChar',
    107             'AnsiLowerCase', 'AnsiLowerCaseFileName', 'AnsiPos', 'AnsiQuotedStr',
    108             'AnsiSameStr', 'AnsiSameText', 'AnsiStrComp', 'AnsiStrIComp',
    109             'AnsiStrLComp', 'AnsiStrLIComp', 'AnsiStrLastChar', 'AnsiStrLower',
    110             'AnsiStrPos', 'AnsiStrRScan', 'AnsiStrScan', 'AnsiStrUpper',
    111             'AnsiUpperCase', 'AnsiUpperCaseFileName', 'AppendStr', 'AssignStr',
    112             'Beep', 'BoolToStr', 'ByteToCharIndex', 'ByteToCharLen', 'ByteType',
    113             'CallTerminateProcs', 'ChangeFileExt', 'CharLength', 'CharToByteIndex',
    114             'CharToByteLen', 'CompareMem', 'CompareStr', 'CompareText', 'CreateDir',
    115             'CreateGUID', 'CurrToStr', 'CurrToStrF', 'CurrentYear', 'Date',
    116             'DateTimeToFileDate', 'DateTimeToStr', 'DateTimeToString',
    117             'DateTimeToSystemTime', 'DateTimeToTimeStamp', 'DateToStr', 'DayOfWeek',
    118             'DecodeDate', 'DecodeDateFully', 'DecodeTime', 'DeleteFile',
    119             'DirectoryExists', 'DiskFree', 'DiskSize', 'DisposeStr', 'EncodeDate',
    120             'EncodeTime', 'ExceptionErrorMessage', 'ExcludeTrailingBackslash',
    121             'ExcludeTrailingPathDelimiter', 'ExpandFileName', 'ExpandFileNameCase',
    122             'ExpandUNCFileName', 'ExtractFileDir', 'ExtractFileDrive',
    123             'ExtractFileExt', 'ExtractFileName', 'ExtractFilePath',
    124             'ExtractRelativePath', 'ExtractShortPathName', 'FileAge', 'FileClose',
    125             'FileCreate', 'FileDateToDateTime', 'FileExists', 'FileGetAttr',
    126             'FileGetDate', 'FileIsReadOnly', 'FileOpen', 'FileRead', 'FileSearch',
    127             'FileSeek', 'FileSetAttr', 'FileSetDate', 'FileSetReadOnly', 'FileWrite',
    128             'FinalizePackage', 'FindClose', 'FindCmdLineSwitch', 'FindFirst',
    129             'FindNext', 'FloatToCurr', 'FloatToDateTime', 'FloatToDecimal',
    130             'FloatToStr', 'FloatToStrF', 'FloatToText', 'FloatToTextFmt',
    131             'FmtLoadStr', 'FmtStr', 'ForceDirectories', 'Format', 'FormatBuf',
    132             'FormatCurr', 'FormatDateTime', 'FormatFloat', 'FreeAndNil',
    133             'GUIDToString', 'GetCurrentDir', 'GetEnvironmentVariable',
    134             'GetFileVersion', 'GetFormatSettings', 'GetLocaleFormatSettings',
    135             'GetModuleName', 'GetPackageDescription', 'GetPackageInfo', 'GetTime',
    136             'IncAMonth', 'IncMonth', 'IncludeTrailingBackslash',
    137             'IncludeTrailingPathDelimiter', 'InitializePackage', 'IntToHex',
    138             'IntToStr', 'InterlockedDecrement', 'InterlockedExchange',
    139             'InterlockedExchangeAdd', 'InterlockedIncrement', 'IsDelimiter',
    140             'IsEqualGUID', 'IsLeapYear', 'IsPathDelimiter', 'IsValidIdent',
    141             'Languages', 'LastDelimiter', 'LoadPackage', 'LoadStr', 'LowerCase',
    142             'MSecsToTimeStamp', 'NewStr', 'NextCharIndex', 'Now', 'OutOfMemoryError',
    143             'QuotedStr', 'RaiseLastOSError', 'RaiseLastWin32Error', 'RemoveDir',
    144             'RenameFile', 'ReplaceDate', 'ReplaceTime', 'SafeLoadLibrary',
    145             'SameFileName', 'SameText', 'SetCurrentDir', 'ShowException', 'Sleep',
    146             'StrAlloc', 'StrBufSize', 'StrByteType', 'StrCat', 'StrCharLength',
    147             'StrComp', 'StrCopy', 'StrDispose', 'StrECopy', 'StrEnd', 'StrFmt',
    148             'StrIComp', 'StrLCat', 'StrLComp', 'StrLCopy', 'StrLFmt', 'StrLIComp',
    149             'StrLen', 'StrLower', 'StrMove', 'StrNew', 'StrNextChar', 'StrPCopy',
    150             'StrPLCopy', 'StrPas', 'StrPos', 'StrRScan', 'StrScan', 'StrToBool',
    151             'StrToBoolDef', 'StrToCurr', 'StrToCurrDef', 'StrToDate', 'StrToDateDef',
    152             'StrToDateTime', 'StrToDateTimeDef', 'StrToFloat', 'StrToFloatDef',
    153             'StrToInt', 'StrToInt64', 'StrToInt64Def', 'StrToIntDef', 'StrToTime',
    154             'StrToTimeDef', 'StrUpper', 'StringReplace', 'StringToGUID', 'Supports',
    155             'SysErrorMessage', 'SystemTimeToDateTime', 'TextToFloat', 'Time',
    156             'TimeStampToDateTime', 'TimeStampToMSecs', 'TimeToStr', 'Trim',
    157             'TrimLeft', 'TrimRight', 'TryEncodeDate', 'TryEncodeTime',
    158             'TryFloatToCurr', 'TryFloatToDateTime', 'TryStrToBool', 'TryStrToCurr',
    159             'TryStrToDate', 'TryStrToDateTime', 'TryStrToFloat', 'TryStrToInt',
    160             'TryStrToInt64', 'TryStrToTime', 'UnloadPackage', 'UpperCase',
    161             'WideCompareStr', 'WideCompareText', 'WideFmtStr', 'WideFormat',
    162             'WideFormatBuf', 'WideLowerCase', 'WideSameStr', 'WideSameText',
    163             'WideUpperCase', 'Win32Check', 'WrapText',
    164 
    165             'ActivateClassGroup', 'AllocateHwnd', 'BinToHex', 'CheckSynchronize',
    166             'CollectionsEqual', 'CountGenerations', 'DeallocateHwnd', 'EqualRect',
    167             'ExtractStrings', 'FindClass', 'FindGlobalComponent', 'GetClass',
    168             'GroupDescendantsWith', 'HexToBin', 'IdentToInt',
    169             'InitInheritedComponent', 'IntToIdent', 'InvalidPoint',
    170             'IsUniqueGlobalComponentName', 'LineStart', 'ObjectBinaryToText',
    171             'ObjectResourceToText', 'ObjectTextToBinary', 'ObjectTextToResource',
    172             'PointsEqual', 'ReadComponentRes', 'ReadComponentResEx',
    173             'ReadComponentResFile', 'Rect', 'RegisterClass', 'RegisterClassAlias',
    174             'RegisterClasses', 'RegisterComponents', 'RegisterIntegerConsts',
    175             'RegisterNoIcon', 'RegisterNonActiveX', 'SmallPoint', 'StartClassGroup',
    176             'TestStreamFormat', 'UnregisterClass', 'UnregisterClasses',
    177             'UnregisterIntegerConsts', 'UnregisterModuleClasses',
    178             'WriteComponentResFile',
    179 
    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: #9ac;',
    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]+',
    278         //Characters
    279         1 => '\#\$?[0-9]{1,3}'
    280         ),
    281     'STRICT_MODE_APPLIES' => GESHI_NEVER,
    282     'SCRIPT_DELIMITERS' => array(
    283         ),
    284     'HIGHLIGHT_STRICT_BLOCK' => array(
    285         ),
    286     'TAB_WIDTH' => 2
    287 );
    288 
    289 ?>
    290