mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-13 23:12:24 +00:00
177 lines
5.2 KiB
XML
177 lines
5.2 KiB
XML
<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=""">
|
|
<token type="LiteralString"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule pattern="\\([\\abfnrtv"\']|x[a-f0-9]{2,4}|[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="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=""">
|
|
<token type="LiteralString"/>
|
|
<push state="string"/>
|
|
</rule>
|
|
<rule pattern="'(\\.|\\[0-7]{1,3}|\\x[a-f0-9]{1,2}|[^\\\'\n])'">
|
|
<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!&*<>|^$%@+~?/=-]+)(:)(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!&*<>|^$%@+~?/=-]+)">
|
|
<bygroups>
|
|
<token type="Operator"/>
|
|
<token type="NameVariable"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="(=>|::|#\(|#\[|##|\?\?|\?=|\?|[(){}\[\],.;])">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
<rule pattern=":=">
|
|
<token type="Operator"/>
|
|
</rule>
|
|
<rule pattern="#[tf]">
|
|
<token type="Literal"/>
|
|
</rule>
|
|
<rule pattern="#"">
|
|
<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!&*<>|^$%@+~?/=-]+:">
|
|
<token type="KeywordConstant"/>
|
|
</rule>
|
|
<rule pattern="<[\w!&*<>|^$%@+~?/=-]+>">
|
|
<token type="NameClass"/>
|
|
</rule>
|
|
<rule pattern="\*[\w!&*<>|^$%@+~?/=-]+\*">
|
|
<token type="NameVariableGlobal"/>
|
|
</rule>
|
|
<rule pattern="\$[\w!&*<>|^$%@+~?/=-]+">
|
|
<token type="NameConstant"/>
|
|
</rule>
|
|
<rule pattern="(let|method|function)([ \t]+)([\w!&*<>|^$%@+~?/=-]+)">
|
|
<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!&*<>|^$%@+~?/=-]+)">
|
|
<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=""">
|
|
<token type="LiteralStringSymbol"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule pattern="[^\\"]+">
|
|
<token type="LiteralStringSymbol"/>
|
|
</rule>
|
|
</state>
|
|
</rules>
|
|
</lexer>
|