tartrazine/lexers/modula-2.xml

246 lines
6.4 KiB
XML
Raw Normal View History

2024-08-02 20:03:49 +00:00
<lexer>
<config>
<name>Modula-2</name>
<alias>modula2</alias>
<alias>m2</alias>
<filename>*.def</filename>
<filename>*.mod</filename>
<mime_type>text/x-modula2</mime_type>
<dot_all>true</dot_all>
</config>
<rules>
<state name="dialecttags">
<rule pattern="\(\*!m2pim\*\)">
<token type="CommentSpecial"/>
</rule>
<rule pattern="\(\*!m2iso\*\)">
<token type="CommentSpecial"/>
</rule>
<rule pattern="\(\*!m2r10\*\)">
<token type="CommentSpecial"/>
</rule>
<rule pattern="\(\*!objm2\*\)">
<token type="CommentSpecial"/>
</rule>
<rule pattern="\(\*!m2iso\+aglet\*\)">
<token type="CommentSpecial"/>
</rule>
<rule pattern="\(\*!m2pim\+gm2\*\)">
<token type="CommentSpecial"/>
</rule>
<rule pattern="\(\*!m2iso\+p1\*\)">
<token type="CommentSpecial"/>
</rule>
<rule pattern="\(\*!m2iso\+xds\*\)">
<token type="CommentSpecial"/>
</rule>
</state>
<state name="unigraph_operators">
<rule pattern="[+-]">
<token type="Operator"/>
</rule>
<rule pattern="[*/]">
<token type="Operator"/>
</rule>
<rule pattern="\\">
<token type="Operator"/>
</rule>
<rule pattern="[=#&lt;&gt;]">
<token type="Operator"/>
</rule>
<rule pattern="\^">
<token type="Operator"/>
</rule>
<rule pattern="@">
<token type="Operator"/>
</rule>
<rule pattern="&amp;">
<token type="Operator"/>
</rule>
<rule pattern="~">
<token type="Operator"/>
</rule>
<rule pattern="`">
<token type="Operator"/>
</rule>
</state>
<state name="string_literals">
<rule pattern="&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralString"/>
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralString"/>
</rule>
</state>
<state name="identifiers">
<rule pattern="([a-zA-Z_$][\w$]*)">
<token type="Name"/>
</rule>
</state>
<state name="pragmas">
<rule pattern="&lt;\*.*?\*&gt;">
<token type="CommentPreproc"/>
</rule>
<rule pattern="\(\*\$.*?\*\)">
<token type="CommentPreproc"/>
</rule>
</state>
<state name="comments">
<rule pattern="^//.*?\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="\(\*([^$].*?)\*\)">
<token type="CommentMultiline"/>
</rule>
<rule pattern="/\*(.*?)\*/">
<token type="CommentMultiline"/>
</rule>
</state>
<state name="whitespace">
<rule pattern="\n+">
<token type="Text"/>
</rule>
<rule pattern="\s+">
<token type="Text"/>
</rule>
</state>
<state name="suffixed_number_literals">
<rule pattern="[0-7]+B">
<token type="LiteralNumberOct"/>
</rule>
<rule pattern="[0-7]+C">
<token type="LiteralNumberOct"/>
</rule>
<rule pattern="[0-9A-F]+H">
<token type="LiteralNumberHex"/>
</rule>
</state>
<state name="plain_number_literals">
<rule pattern="[0-9]+(\&#39;[0-9]+)*\.[0-9]+(\&#39;[0-9]+)*[eE][+-]?[0-9]+(\&#39;[0-9]+)*">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[0-9]+(\&#39;[0-9]+)*\.[0-9]+(\&#39;[0-9]+)*">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[0-9]+(\&#39;[0-9]+)*">
<token type="LiteralNumberInteger"/>
</rule>
</state>
<state name="digraph_punctuation">
<rule pattern="\.\.">
<token type="Punctuation"/>
</rule>
<rule pattern="&lt;&lt;">
<token type="Punctuation"/>
</rule>
<rule pattern="&gt;&gt;">
<token type="Punctuation"/>
</rule>
<rule pattern="-&gt;">
<token type="Punctuation"/>
</rule>
<rule pattern="\|#">
<token type="Punctuation"/>
</rule>
<rule pattern="##">
<token type="Punctuation"/>
</rule>
<rule pattern="\|\*">
<token type="Punctuation"/>
</rule>
</state>
<state name="unigraph_punctuation">
<rule pattern="[()\[\]{},.:;|]">
<token type="Punctuation"/>
</rule>
<rule pattern="!">
<token type="Punctuation"/>
</rule>
<rule pattern="\?">
<token type="Punctuation"/>
</rule>
</state>
<state name="root">
<rule>
<include state="whitespace"/>
</rule>
<rule>
<include state="dialecttags"/>
</rule>
<rule>
<include state="pragmas"/>
</rule>
<rule>
<include state="comments"/>
</rule>
<rule>
<include state="identifiers"/>
</rule>
<rule>
<include state="suffixed_number_literals"/>
</rule>
<rule>
<include state="prefixed_number_literals"/>
</rule>
<rule>
<include state="plain_number_literals"/>
</rule>
<rule>
<include state="string_literals"/>
</rule>
<rule>
<include state="digraph_punctuation"/>
</rule>
<rule>
<include state="digraph_operators"/>
</rule>
<rule>
<include state="unigraph_punctuation"/>
</rule>
<rule>
<include state="unigraph_operators"/>
</rule>
</state>
<state name="prefixed_number_literals">
<rule pattern="0b[01]+(\&#39;[01]+)*">
<token type="LiteralNumberBin"/>
</rule>
<rule pattern="0[ux][0-9A-F]+(\&#39;[0-9A-F]+)*">
<token type="LiteralNumberHex"/>
</rule>
</state>
<state name="digraph_operators">
<rule pattern="\*\.">
<token type="Operator"/>
</rule>
<rule pattern="\+&gt;">
<token type="Operator"/>
</rule>
<rule pattern="&lt;&gt;">
<token type="Operator"/>
</rule>
<rule pattern="&lt;=">
<token type="Operator"/>
</rule>
<rule pattern="&gt;=">
<token type="Operator"/>
</rule>
<rule pattern="==">
<token type="Operator"/>
</rule>
<rule pattern="::">
<token type="Operator"/>
</rule>
<rule pattern=":=">
<token type="Operator"/>
</rule>
<rule pattern="\+\+">
<token type="Operator"/>
</rule>
<rule pattern="--">
<token type="Operator"/>
</rule>
</state>
</rules>
2024-08-26 23:18:28 +00:00
</lexer>