1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-09 13:23:51 +02:00

added: rule to objectpascal lexer (#888)

* added: another rule for objectpascal lexer

* updated: objectpascal lexer testdata

* fixed: processing of control (escape) characters

* updated: test data for objectpascal lexer
This commit is contained in:
codiacdev 2023-11-23 20:53:33 +01:00 committed by GitHub
parent c5948a61b1
commit d9f6ed634e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 6 deletions

View File

@ -28,7 +28,7 @@
<token type="Text"/> <token type="Text"/>
</rule> </rule>
<!-- Compiler Directive --> <!-- Compiler Directive -->
<rule pattern="\{[$].*?\}|\{[-](NOD|EXT|OBJ).*?\}"> <rule pattern="\{[$].*?\}|\{[-](NOD|EXT|OBJ).*?\}|\([*][$].*?[*]\)">
<token type="CommentPreproc" /> <token type="CommentPreproc" />
</rule> </rule>
<!-- Comment Single --> <!-- Comment Single -->
@ -50,8 +50,12 @@
<rule pattern="(?i:(\.\.))"> <rule pattern="(?i:(\.\.))">
<token type="Operator" /> <token type="Operator" />
</rule> </rule>
<!-- Control Character -->
<rule pattern="[\#][0-9a-fA-F]*|[0-9]+[xX][0-9a-fA-F]*">
<token type="LiteralStringEscape" />
</rule>
<!-- Numbers --> <!-- Numbers -->
<rule pattern="[\$][0-9a-fA-F]*[xX][0-9a-fA-F]*|[\$][0-9a-fA-F]*|[\#][0-9a-fA-F]*|[0-9]+[xX][0-9a-fA-F]*|([0-9]+[0-9a-fA-F]+(?=[hH]))"> <rule pattern="[\$][0-9a-fA-F]*[xX][0-9a-fA-F]*|[\$][0-9a-fA-F]*|([0-9]+[0-9a-fA-F]+(?=[hH]))">
<token type="LiteralNumberHex" /> <token type="LiteralNumberHex" />
</rule> </rule>
<rule pattern="[0-9]+(\&#39;[0-9]+)*\.[0-9]+(\&#39;[0-9]+)*[eE][+-]?[0-9]+(\&#39;[0-9]+)*|[0-9]+(\&#39;[0-9]+)*\.[0-9]+(\&#39;[0-9]+)*|\d+[eE][+-]?[0-9]+"> <rule pattern="[0-9]+(\&#39;[0-9]+)*\.[0-9]+(\&#39;[0-9]+)*[eE][+-]?[0-9]+(\&#39;[0-9]+)*|[0-9]+(\&#39;[0-9]+)*\.[0-9]+(\&#39;[0-9]+)*|\d+[eE][+-]?[0-9]+">

View File

@ -83,6 +83,8 @@ var
{-NODEFINE string 'String' } {$OBJTYPENAME string 'NUnicodeString'} { defined in ustring.h } {-NODEFINE string 'String' } {$OBJTYPENAME string 'NUnicodeString'} { defined in ustring.h }
{-EXTERNALSYM ShortInt 'signed char' } {-OBJTYPENAME ShortInt 'Bzc'} {-EXTERNALSYM ShortInt 'signed char' } {-OBJTYPENAME ShortInt 'Bzc'}
(*$hints off*) // another valid compiler directive
const const
CLineBreak = {$IFDEF POSIX} _AnsiStr(#10) {$ENDIF} CLineBreak = {$IFDEF POSIX} _AnsiStr(#10) {$ENDIF}
{$IFDEF MSWINDOWS} _AnsiStr(#13#10) {$ENDIF}; {$IFDEF MSWINDOWS} _AnsiStr(#13#10) {$ENDIF};

View File

@ -409,6 +409,11 @@
{"type":"TextWhitespace","value":" "}, {"type":"TextWhitespace","value":" "},
{"type":"CommentPreproc","value":"{-OBJTYPENAME ShortInt 'Bzc'}"}, {"type":"CommentPreproc","value":"{-OBJTYPENAME ShortInt 'Bzc'}"},
{"type":"Text","value":"\n\n"}, {"type":"Text","value":"\n\n"},
{"type":"CommentPreproc","value":"(*$hints off*)"},
{"type":"TextWhitespace","value":" "},
{"type":"CommentSingle","value":"// another valid compiler directive"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Text","value":"\n"},
{"type":"KeywordReserved","value":"const"}, {"type":"KeywordReserved","value":"const"},
{"type":"Text","value":"\n"}, {"type":"Text","value":"\n"},
{"type":"TextWhitespace","value":" "}, {"type":"TextWhitespace","value":" "},
@ -420,7 +425,7 @@
{"type":"TextWhitespace","value":" "}, {"type":"TextWhitespace","value":" "},
{"type":"Text","value":"_AnsiStr"}, {"type":"Text","value":"_AnsiStr"},
{"type":"Operator","value":"("}, {"type":"Operator","value":"("},
{"type":"LiteralNumberHex","value":"#10"}, {"type":"LiteralStringEscape","value":"#10"},
{"type":"Operator","value":")"}, {"type":"Operator","value":")"},
{"type":"TextWhitespace","value":" "}, {"type":"TextWhitespace","value":" "},
{"type":"CommentPreproc","value":"{$ENDIF}"}, {"type":"CommentPreproc","value":"{$ENDIF}"},
@ -430,7 +435,7 @@
{"type":"TextWhitespace","value":" "}, {"type":"TextWhitespace","value":" "},
{"type":"Text","value":"_AnsiStr"}, {"type":"Text","value":"_AnsiStr"},
{"type":"Operator","value":"("}, {"type":"Operator","value":"("},
{"type":"LiteralNumberHex","value":"#13#10"}, {"type":"LiteralStringEscape","value":"#13#10"},
{"type":"Operator","value":")"}, {"type":"Operator","value":")"},
{"type":"TextWhitespace","value":" "}, {"type":"TextWhitespace","value":" "},
{"type":"CommentPreproc","value":"{$ENDIF}"}, {"type":"CommentPreproc","value":"{$ENDIF}"},
@ -1725,7 +1730,7 @@
{"type":"TextWhitespace","value":" "}, {"type":"TextWhitespace","value":" "},
{"type":"Text","value":"Ord"}, {"type":"Text","value":"Ord"},
{"type":"Operator","value":"("}, {"type":"Operator","value":"("},
{"type":"LiteralNumberHex","value":"#10"}, {"type":"LiteralStringEscape","value":"#10"},
{"type":"Operator","value":")"}, {"type":"Operator","value":")"},
{"type":"Punctuation","value":"."}, {"type":"Punctuation","value":"."},
{"type":"Text","value":"ToExtended"}, {"type":"Text","value":"ToExtended"},
@ -1947,7 +1952,7 @@
{"type":"Operator","value":"%"}, {"type":"Operator","value":"%"},
{"type":"Text","value":"fs"}, {"type":"Text","value":"fs"},
{"type":"Operator","value":":("}, {"type":"Operator","value":":("},
{"type":"LiteralNumberHex","value":"0x2c"}, {"type":"LiteralStringEscape","value":"0x2c"},
{"type":"Operator","value":")"}, {"type":"Operator","value":")"},
{"type":"Punctuation","value":","}, {"type":"Punctuation","value":","},
{"type":"Operator","value":"%"}, {"type":"Operator","value":"%"},