"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/langDefs/delphi.lang" (12 May 2020, 6330 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "delphi.lang": 3.53_vs_3.54.

    1 --[[ delphi.lang v0.0.1 | 2019/01/05 | Highlight v3.48
    2 ********************************************************************************
    3 *                                                                              *
    4 *                         Delphi Syntax for Highlight                          *
    5 *                                                                              *
    6 ********************************************************************************
    7 Adapted by Tristano Ajmone. Original author unknown (maybe André Simon?).
    8 License: GNU GPL v3.
    9 
   10 This is a readaptation of the Pascal syntax definition ("pas.lang") that ships
   11 with Highlight; it was tweaked to cover Delphi native types and keywords.
   12 Being a derivative work from a file taken from the Highlight project, it falls
   13 under the same license of Highlight (GNU GPL v3).
   14 --------------------------------------------------------------------------------
   15 ** MAINTAINER NEEDED! **
   16 
   17 This langDef doesn't fully cover the Delphi syntax -- I've just updated the list
   18 of native data types keywords, as a way of "patching holes", but no effort was
   19 taken to systematically go over the full syntax definition to make it fully
   20 compliant to Delphi.
   21 
   22 It should be considered an Alpha version and won't reach v1.0 until someone with
   23 better knwoledge of Delphi than I have revises the whole syntax to ensure it's
   24 compliant to the Delphi language.
   25 
   26 Keywords lists are left as one-keyword-for-line to simplify reading and editing.
   27 ------------------------------------------------------------------------------]]
   28 Description="delphi"
   29 
   30 Categories = {"source"}
   31 
   32 Digits=[[ (?:0x|0X|\$)[0-9a-fA-F]+|\d*[\.\_]?\d+(?:[eE][\-\+]\d+)?[lLuUbfdm]* ]]
   33 
   34 Keywords={
   35   -- ===========================================================================
   36   --                              Delphi Keywords
   37   -- ===========================================================================
   38   -- Keywords list is the same as the original Pascal langDef.
   39   -- ---------------------------------------------------------------------------
   40   { Id=1,
   41     List={
   42       "absolute",
   43       "abstract",
   44       "and",
   45       "array",
   46       "as",
   47       "asm",
   48       "assembler",
   49       "automated",
   50       "begin",
   51       "case",
   52       "cdecl",
   53       "class",
   54       "const",
   55       "constructor",
   56       "destructor",
   57       "dispid",
   58       "dispinterface",
   59       "div",
   60       "do",
   61       "downto",
   62       "dynamic",
   63       "else",
   64       "end",
   65       "except",
   66       "export",
   67       "exports",
   68       "external",
   69       "far",
   70       "file",
   71       "finalization",
   72       "finally",
   73       "for",
   74       "forward",
   75       "function",
   76       "goto",
   77       "if",
   78       "implementation",
   79       "in",
   80       "inherited",
   81       "initialization",
   82       "inline",
   83       "interface",
   84       "is",
   85       "label",
   86       "library",
   87       "message",
   88       "mod",
   89       "near",
   90       "nil",
   91       "not",
   92       "object",
   93       "of",
   94       "or",
   95       "out",
   96       "override",
   97       "packed",
   98       "pascal",
   99       "private",
  100       "procedure",
  101       "program",
  102       "property",
  103       "protected",
  104       "public",
  105       "published",
  106       "raise",
  107       "record",
  108       "register",
  109       "repeat",
  110       "resourcestring",
  111       "safecall",
  112       "set",
  113       "shl",
  114       "shr",
  115       "stdcall",
  116       "then",
  117       "threadvar",
  118       "to",
  119       "try",
  120       "type",
  121       "unit",
  122       "until",
  123       "uses",
  124       "var",
  125       "virtual",
  126       "while",
  127       "with",
  128       "xor",
  129     },
  130   },
  131   -- ===========================================================================
  132   --                             Delphi Data Types
  133   -- ===========================================================================
  134   -- Keywords list updated based on:
  135   -- http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Delphi_Data_Types_for_API_Integration
  136   -- ---------------------------------------------------------------------------
  137   { Id=2,
  138     List={
  139       "ansichar",
  140       "ansistring",
  141       "array",
  142       "boolean",
  143       "byte",
  144       "bytebool",
  145       "cardinal",
  146       "char",
  147       "currency",
  148       "double",
  149       "false",
  150       "fixedint",
  151       "fixeduint",
  152       "int64",
  153       "integer",
  154       "longbool",
  155       "longint",
  156       "longword",
  157       "nativeint",
  158       "nativeuint",
  159       "pansichar",
  160       "pansistring",
  161       "pboolean",
  162       "pbyte",
  163       "pcardinal",
  164       "pchar",
  165       "pcurrency",
  166       "pdouble",
  167       "pfixedint",
  168       "pfixeduint",
  169       "pint64",
  170       "pinteger",
  171       "plongbool",
  172       "plongint",
  173       "plongword",
  174       "pnativeint",
  175       "pnativeuint",
  176       "pointer",
  177       "ppointer",
  178       "prawbytestring",
  179       "pshortint",
  180       "pshortstring",
  181       "psingle",
  182       "psmallint",
  183       "pstring",
  184       "puint64",
  185       "punicodestring",
  186       "pvariant",
  187       "pwidechar",
  188       "pwidestring",
  189       "pword",
  190       "pwordbool",
  191       "rawbytestring",
  192       "real",
  193       "record",
  194       "shortint",
  195       "shortstring",
  196       "single",
  197       "smallint",
  198       "string",
  199       "tdoublerec",
  200       "text",
  201       "true",
  202       "tsinglerec",
  203       "type",
  204       "uint64",
  205       "unicodestring",
  206       "variant",
  207       "widechar",
  208       "widestring",
  209       "word",
  210       "wordbool",
  211     },
  212   },
  213   { Id=4,
  214     Regex=[[(\w+)\s*\(]],
  215   },
  216 }
  217 
  218 Strings={
  219   Delimiter=[["|']],
  220   Escape="#[[:digit:]]+"
  221 }
  222 
  223 IgnoreCase=true
  224 
  225 Comments={
  226   { Block=false,
  227     Delimiter= { [[//]] },
  228   },
  229   { Block=true,
  230     Nested=false,
  231     Delimiter= { [[\{(?!\$)]],[[\}]] }
  232   },
  233   { Block=true,
  234     Nested=false,
  235     Delimiter= { [[\(\*]],[[\*\)]] }
  236   }
  237 }
  238 
  239 PreProcessor = {
  240   Prefix=[[{]],
  241   Continuation="\x13",
  242 }
  243 
  244 NestedSections = {
  245   {
  246     Lang="assembler",
  247     Delimiter= { [[asm]], [[end;]] }
  248   }
  249 }
  250 
  251 Operators=[[\(|\)|\[|\]|,|;|:|&|<|>|\!|\=|\/|\*|\%|\+|\-|\@|\.|\^]]
  252 
  253 function OnStateChange(oldState, newState, token)
  254   if token=="}" and oldState==HL_PREPROC then
  255     return HL_PREPROC_END
  256   end
  257   return newState
  258 end
  259 --[[============================================================================
  260                                   CHANGELOG
  261 ================================================================================
  262 v0.0.1  - 2019/01/05 (Highlight v3.48)
  263         - First release. Adapted from the Pascal syntax definition ("pas.lang").
  264         - Updated keywords Id2 list to include the Delphi native Data Types.
  265 --]]