mirror of
https://github.com/cheat/cheat.git
synced 2024-11-18 01:40:39 +01:00
115 lines
3.5 KiB
XML
115 lines
3.5 KiB
XML
|
<lexer>
|
|||
|
<config>
|
|||
|
<name>Prolog</name>
|
|||
|
<alias>prolog</alias>
|
|||
|
<filename>*.ecl</filename>
|
|||
|
<filename>*.prolog</filename>
|
|||
|
<filename>*.pro</filename>
|
|||
|
<filename>*.pl</filename>
|
|||
|
<mime_type>text/x-prolog</mime_type>
|
|||
|
</config>
|
|||
|
<rules>
|
|||
|
<state name="root">
|
|||
|
<rule pattern="/\*">
|
|||
|
<token type="CommentMultiline"/>
|
|||
|
<push state="nested-comment"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="%.*">
|
|||
|
<token type="CommentSingle"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="0\'.">
|
|||
|
<token type="LiteralStringChar"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="0b[01]+">
|
|||
|
<token type="LiteralNumberBin"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="0o[0-7]+">
|
|||
|
<token type="LiteralNumberOct"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="0x[0-9a-fA-F]+">
|
|||
|
<token type="LiteralNumberHex"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="\d\d?\'[a-zA-Z0-9]+">
|
|||
|
<token type="LiteralNumberInteger"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?">
|
|||
|
<token type="LiteralNumberFloat"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="\d+">
|
|||
|
<token type="LiteralNumberInteger"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="[\[\](){}|.,;!]">
|
|||
|
<token type="Punctuation"/>
|
|||
|
</rule>
|
|||
|
<rule pattern=":-|-->">
|
|||
|
<token type="Punctuation"/>
|
|||
|
</rule>
|
|||
|
<rule pattern=""(?:\\x[0-9a-fA-F]+\\|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\[0-7]+\\|\\["\nabcefnrstv]|[^\\"])*"">
|
|||
|
<token type="LiteralStringDouble"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="'(?:''|[^'])*'">
|
|||
|
<token type="LiteralStringAtom"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="is\b">
|
|||
|
<token type="Operator"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="(<|>|=<|>=|==|=:=|=|/|//|\*|\+|-)(?=\s|[a-zA-Z0-9\[])">
|
|||
|
<token type="Operator"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="(mod|div|not)\b">
|
|||
|
<token type="Operator"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="_">
|
|||
|
<token type="Keyword"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="([a-z]+)(:)">
|
|||
|
<bygroups>
|
|||
|
<token type="NameNamespace"/>
|
|||
|
<token type="Punctuation"/>
|
|||
|
</bygroups>
|
|||
|
</rule>
|
|||
|
<rule pattern="([a-zÀ---][\w$À---]*)(\s*)(:-|-->)">
|
|||
|
<bygroups>
|
|||
|
<token type="NameFunction"/>
|
|||
|
<token type="Text"/>
|
|||
|
<token type="Operator"/>
|
|||
|
</bygroups>
|
|||
|
</rule>
|
|||
|
<rule pattern="([a-zÀ---][\w$À---]*)(\s*)(\()">
|
|||
|
<bygroups>
|
|||
|
<token type="NameFunction"/>
|
|||
|
<token type="Text"/>
|
|||
|
<token type="Punctuation"/>
|
|||
|
</bygroups>
|
|||
|
</rule>
|
|||
|
<rule pattern="[a-zÀ---][\w$À---]*">
|
|||
|
<token type="LiteralStringAtom"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="[#&*+\-./:<=>?@\\^~¡-¿‐-〿]+">
|
|||
|
<token type="LiteralStringAtom"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="[A-Z_]\w*">
|
|||
|
<token type="NameVariable"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="\s+|[ --<2D>]">
|
|||
|
<token type="Text"/>
|
|||
|
</rule>
|
|||
|
</state>
|
|||
|
<state name="nested-comment">
|
|||
|
<rule pattern="\*/">
|
|||
|
<token type="CommentMultiline"/>
|
|||
|
<pop depth="1"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="/\*">
|
|||
|
<token type="CommentMultiline"/>
|
|||
|
<push/>
|
|||
|
</rule>
|
|||
|
<rule pattern="[^*/]+">
|
|||
|
<token type="CommentMultiline"/>
|
|||
|
</rule>
|
|||
|
<rule pattern="[*/]">
|
|||
|
<token type="CommentMultiline"/>
|
|||
|
</rule>
|
|||
|
</state>
|
|||
|
</rules>
|
|||
|
</lexer>
|