tartrazine/lexers/prolog.xml

116 lines
3.5 KiB
XML
Raw Permalink Normal View History

2024-08-02 20:03:49 +00:00
<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\&#39;.">
<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?\&#39;[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=":-|--&gt;">
<token type="Punctuation"/>
</rule>
<rule pattern="&#34;(?:\\x[0-9a-fA-F]+\\|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\[0-7]+\\|\\[&#34;\nabcefnrstv]|[^\\&#34;])*&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="&#39;(?:&#39;&#39;|[^&#39;])*&#39;">
<token type="LiteralStringAtom"/>
</rule>
<rule pattern="is\b">
<token type="Operator"/>
</rule>
<rule pattern="(&lt;|&gt;|=&lt;|&gt;=|==|=:=|=|/|//|\*|\+|-)(?=\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*)(:-|--&gt;)">
<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="[#&amp;*+\-./:&lt;=&gt;?@\\^~¡-¿‐-〿]+">
<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>
2024-08-26 23:18:28 +00:00
</lexer>