tartrazine/lexers/dylan.xml

177 lines
5.2 KiB
XML
Raw Normal View History

2024-08-02 20:03:49 +00:00
<lexer>
<config>
<name>Dylan</name>
<alias>dylan</alias>
<filename>*.dylan</filename>
<filename>*.dyl</filename>
<filename>*.intr</filename>
<mime_type>text/x-dylan</mime_type>
<case_insensitive>true</case_insensitive>
</config>
<rules>
<state name="string">
<rule pattern="&#34;">
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
<rule pattern="\\([\\abfnrtv&#34;\&#39;]|x[a-f0-9]{2,4}|[0-7]{1,3})">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="[^\\&#34;\n]+">
<token type="LiteralString"/>
</rule>
<rule pattern="\\\n">
<token type="LiteralString"/>
</rule>
<rule pattern="\\">
<token type="LiteralString"/>
</rule>
</state>
<state name="root">
<rule pattern="\s+">
<token type="TextWhitespace"/>
</rule>
<rule pattern="//.*?\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="([a-z0-9-]+:)([ \t]*)(.*(?:\n[ \t].+)*)">
<bygroups>
<token type="NameAttribute"/>
<token type="TextWhitespace"/>
<token type="LiteralString"/>
</bygroups>
</rule>
<rule>
<push state="code"/>
</rule>
</state>
<state name="code">
<rule pattern="\s+">
<token type="TextWhitespace"/>
</rule>
<rule pattern="//.*?\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="/\*">
<token type="CommentMultiline"/>
<push state="comment"/>
</rule>
<rule pattern="&#34;">
<token type="LiteralString"/>
<push state="string"/>
</rule>
<rule pattern="&#39;(\\.|\\[0-7]{1,3}|\\x[a-f0-9]{1,2}|[^\\\&#39;\n])&#39;">
<token type="LiteralStringChar"/>
</rule>
<rule pattern="#b[01]+">
<token type="LiteralNumberBin"/>
</rule>
<rule pattern="#o[0-7]+">
<token type="LiteralNumberOct"/>
</rule>
<rule pattern="[-+]?(\d*\.\d+([ed][-+]?\d+)?|\d+(\.\d*)?e[-+]?\d+)">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[-+]?\d+">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="#x[0-9a-f]+">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="(\?\\?)([\w!&amp;*&lt;&gt;|^$%@+~?/=-]+)(:)(token|name|variable|expression|body|case-body|\*)">
<bygroups>
<token type="Operator"/>
<token type="NameVariable"/>
<token type="Operator"/>
<token type="NameBuiltin"/>
</bygroups>
</rule>
<rule pattern="(\?)(:)(token|name|variable|expression|body|case-body|\*)">
<bygroups>
<token type="Operator"/>
<token type="Operator"/>
<token type="NameVariable"/>
</bygroups>
</rule>
<rule pattern="(\?\\?)([\w!&amp;*&lt;&gt;|^$%@+~?/=-]+)">
<bygroups>
<token type="Operator"/>
<token type="NameVariable"/>
</bygroups>
</rule>
<rule pattern="(=&gt;|::|#\(|#\[|##|\?\?|\?=|\?|[(){}\[\],.;])">
<token type="Punctuation"/>
</rule>
<rule pattern=":=">
<token type="Operator"/>
</rule>
<rule pattern="#[tf]">
<token type="Literal"/>
</rule>
<rule pattern="#&#34;">
<token type="LiteralStringSymbol"/>
<push state="symbol"/>
</rule>
<rule pattern="#[a-z0-9-]+">
<token type="Keyword"/>
</rule>
<rule pattern="#(all-keys|include|key|next|rest)">
<token type="Keyword"/>
</rule>
<rule pattern="[\w!&amp;*&lt;&gt;|^$%@+~?/=-]+:">
<token type="KeywordConstant"/>
</rule>
<rule pattern="&lt;[\w!&amp;*&lt;&gt;|^$%@+~?/=-]+&gt;">
<token type="NameClass"/>
</rule>
<rule pattern="\*[\w!&amp;*&lt;&gt;|^$%@+~?/=-]+\*">
<token type="NameVariableGlobal"/>
</rule>
<rule pattern="\$[\w!&amp;*&lt;&gt;|^$%@+~?/=-]+">
<token type="NameConstant"/>
</rule>
<rule pattern="(let|method|function)([ \t]+)([\w!&amp;*&lt;&gt;|^$%@+~?/=-]+)">
<bygroups>
<token type="NameBuiltin"/>
<token type="TextWhitespace"/>
<token type="NameVariable"/>
</bygroups>
</rule>
<rule pattern="(error|signal|return|break)">
<token type="NameException"/>
</rule>
<rule pattern="(\\?)([\w!&amp;*&lt;&gt;|^$%@+~?/=-]+)">
<bygroups>
<token type="Operator"/>
<token type="Name"/>
</bygroups>
</rule>
</state>
<state name="comment">
<rule pattern="[^*/]">
<token type="CommentMultiline"/>
</rule>
<rule pattern="/\*">
<token type="CommentMultiline"/>
<push/>
</rule>
<rule pattern="\*/">
<token type="CommentMultiline"/>
<pop depth="1"/>
</rule>
<rule pattern="[*/]">
<token type="CommentMultiline"/>
</rule>
</state>
<state name="symbol">
<rule pattern="&#34;">
<token type="LiteralStringSymbol"/>
<pop depth="1"/>
</rule>
<rule pattern="[^\\&#34;]+">
<token type="LiteralStringSymbol"/>
</rule>
</state>
</rules>
2024-08-26 23:18:28 +00:00
</lexer>