mirror of
https://github.com/cheat/cheat.git
synced 2024-12-26 06:29:45 +01:00
253 lines
7.5 KiB
XML
253 lines
7.5 KiB
XML
|
<lexer>
|
||
|
<config>
|
||
|
<name>HolyC</name>
|
||
|
<alias>holyc</alias>
|
||
|
<filename>*.HC</filename>
|
||
|
<filename>*.hc</filename>
|
||
|
<filename>*.HH</filename>
|
||
|
<filename>*.hh</filename>
|
||
|
<filename>*.hc.z</filename>
|
||
|
<filename>*.HC.Z</filename>
|
||
|
<mime_type>text/x-chdr</mime_type>
|
||
|
<mime_type>text/x-csrc</mime_type>
|
||
|
<mime_type>image/x-xbitmap</mime_type>
|
||
|
<mime_type>image/x-xpixmap</mime_type>
|
||
|
<ensure_nl>true</ensure_nl>
|
||
|
</config>
|
||
|
<rules>
|
||
|
<state name="statement">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="statements"/>
|
||
|
</rule>
|
||
|
<rule pattern="[{}]">
|
||
|
<token type="Punctuation"/>
|
||
|
</rule>
|
||
|
<rule pattern=";">
|
||
|
<token type="Punctuation"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="function">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="statements"/>
|
||
|
</rule>
|
||
|
<rule pattern=";">
|
||
|
<token type="Punctuation"/>
|
||
|
</rule>
|
||
|
<rule pattern="\{">
|
||
|
<token type="Punctuation"/>
|
||
|
<push/>
|
||
|
</rule>
|
||
|
<rule pattern="\}">
|
||
|
<token type="Punctuation"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="string">
|
||
|
<rule pattern=""">
|
||
|
<token type="LiteralString"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="[^\\"\n]+">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\\n">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="macro">
|
||
|
<rule pattern="(include)(\s*(?:/[*].*?[*]/\s*)?)([^\n]+)">
|
||
|
<bygroups>
|
||
|
<token type="CommentPreproc"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="CommentPreprocFile"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="[^/\n]+">
|
||
|
<token type="CommentPreproc"/>
|
||
|
</rule>
|
||
|
<rule pattern="/[*](.|\n)*?[*]/">
|
||
|
<token type="CommentMultiline"/>
|
||
|
</rule>
|
||
|
<rule pattern="//.*?\n">
|
||
|
<token type="CommentSingle"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="/">
|
||
|
<token type="CommentPreproc"/>
|
||
|
</rule>
|
||
|
<rule pattern="(?<=\\)\n">
|
||
|
<token type="CommentPreproc"/>
|
||
|
</rule>
|
||
|
<rule pattern="\n">
|
||
|
<token type="CommentPreproc"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="if0">
|
||
|
<rule pattern="^\s*#if.*?(?<!\\)\n">
|
||
|
<token type="CommentPreproc"/>
|
||
|
<push/>
|
||
|
</rule>
|
||
|
<rule pattern="^\s*#el(?:se|if).*\n">
|
||
|
<token type="CommentPreproc"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="^\s*#endif.*?(?<!\\)\n">
|
||
|
<token type="CommentPreproc"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern=".*?\n">
|
||
|
<token type="Comment"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="whitespace">
|
||
|
<rule pattern="^#if\s+0">
|
||
|
<token type="CommentPreproc"/>
|
||
|
<push state="if0"/>
|
||
|
</rule>
|
||
|
<rule pattern="^#">
|
||
|
<token type="CommentPreproc"/>
|
||
|
<push state="macro"/>
|
||
|
</rule>
|
||
|
<rule pattern="^(\s*(?:/[*].*?[*]/\s*)?)(#if\s+0)">
|
||
|
<bygroups>
|
||
|
<usingself state="root"/>
|
||
|
<token type="CommentPreproc"/>
|
||
|
</bygroups>
|
||
|
<push state="if0"/>
|
||
|
</rule>
|
||
|
<rule pattern="^(\s*(?:/[*].*?[*]/\s*)?)(#)">
|
||
|
<bygroups>
|
||
|
<usingself state="root"/>
|
||
|
<token type="CommentPreproc"/>
|
||
|
</bygroups>
|
||
|
<push state="macro"/>
|
||
|
</rule>
|
||
|
<rule pattern="\n">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="\s+">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\\n">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="//(\n|[\w\W]*?[^\\]\n)">
|
||
|
<token type="CommentSingle"/>
|
||
|
</rule>
|
||
|
<rule pattern="/(\\\n)?[*][\w\W]*?[*](\\\n)?/">
|
||
|
<token type="CommentMultiline"/>
|
||
|
</rule>
|
||
|
<rule pattern="/(\\\n)?[*][\w\W]*">
|
||
|
<token type="CommentMultiline"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="statements">
|
||
|
<rule pattern="(L?)(")">
|
||
|
<bygroups>
|
||
|
<token type="LiteralStringAffix"/>
|
||
|
<token type="LiteralString"/>
|
||
|
</bygroups>
|
||
|
<push state="string"/>
|
||
|
</rule>
|
||
|
<rule pattern="(L?)(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')">
|
||
|
<bygroups>
|
||
|
<token type="LiteralStringAffix"/>
|
||
|
<token type="LiteralStringChar"/>
|
||
|
<token type="LiteralStringChar"/>
|
||
|
<token type="LiteralStringChar"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="(\d+\.\d*|\.\d+|\d+[fF])[fF]?">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="0x[0-9a-fA-F]+[LlUu]*">
|
||
|
<token type="LiteralNumberHex"/>
|
||
|
</rule>
|
||
|
<rule pattern="0[0-7]+[LlUu]*">
|
||
|
<token type="LiteralNumberOct"/>
|
||
|
</rule>
|
||
|
<rule pattern="\d+[LlUu]*">
|
||
|
<token type="LiteralNumberInteger"/>
|
||
|
</rule>
|
||
|
<rule pattern="\*/">
|
||
|
<token type="Error"/>
|
||
|
</rule>
|
||
|
<rule pattern="[~!%^&*+=|?:<>/-]">
|
||
|
<token type="Operator"/>
|
||
|
</rule>
|
||
|
<rule pattern="[()\[\],.]">
|
||
|
<token type="Punctuation"/>
|
||
|
</rule>
|
||
|
<rule pattern="(break|case|continue|default|do|else|for|goto|if|return|switch|while|throw|try|catch|extern|MOV|CALL|PUSH|LEAVE|RET|SUB|SHR|ADD|RETF|CMP|JNE|BTS|INT|XOR|JC|JZ|LOOP|POP|TEST|SHL|ADC|SBB|JMP|INC)\b">
|
||
|
<token type="Keyword"/>
|
||
|
</rule>
|
||
|
<rule pattern="(U0|I8|U8|I16|U16|I32|U32|I64|U64|F64|Bool|class|union|DU8|DU16|DU32|DU64|RAX|RCX|RDX|RBX|RSP|RBP|RSI|RDI|EAX|ECX|EDX|EBX|ESP|EBP|ESI|EDI|AX|CX|DX|BX|SP|BP|SI|DI|SS|CS|DS|ES|FS|GS|CH|asm|const|extern|register|restrict|static|volatile|inline|_extern|_import|IMPORT|public)\b">
|
||
|
<token type="KeywordType"/>
|
||
|
</rule>
|
||
|
<rule pattern="__()\b">
|
||
|
<token type="KeywordReserved"/>
|
||
|
</rule>
|
||
|
<rule pattern="(NULL|TRUE|FALSE|ON|OFF)\b">
|
||
|
<token type="NameBuiltin"/>
|
||
|
</rule>
|
||
|
<rule pattern="([a-zA-Z_]\w*)(\s*)(:)(?!:)">
|
||
|
<bygroups>
|
||
|
<token type="NameLabel"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="Punctuation"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="\b[A-Za-z_]\w*(?=\s*\()">
|
||
|
<token type="NameFunction"/>
|
||
|
</rule>
|
||
|
<rule pattern="[a-zA-Z_]\w*">
|
||
|
<token type="Name"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="root">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;{]*)(\{)">
|
||
|
<bygroups>
|
||
|
<usingself state="root"/>
|
||
|
<token type="NameFunction"/>
|
||
|
<usingself state="root"/>
|
||
|
<usingself state="root"/>
|
||
|
<token type="Punctuation"/>
|
||
|
</bygroups>
|
||
|
<push state="function"/>
|
||
|
</rule>
|
||
|
<rule pattern="((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;]*)(;)">
|
||
|
<bygroups>
|
||
|
<usingself state="root"/>
|
||
|
<token type="NameFunction"/>
|
||
|
<usingself state="root"/>
|
||
|
<usingself state="root"/>
|
||
|
<token type="Punctuation"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<push state="statement"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
</rules>
|
||
|
</lexer>
|