tartrazine/lexers/cue.xml

86 lines
2.5 KiB
XML
Raw Normal View History

2024-08-02 20:03:49 +00:00
<lexer>
<config>
<name>CUE</name>
<alias>cue</alias>
<filename>*.cue</filename>
<mime_type>text/x-cue</mime_type>
<dot_all>true</dot_all>
<ensure_nl>true</ensure_nl>
</config>
<rules>
<state name="root">
<rule pattern="[^\S\n]+">
<token type="Text"/>
</rule>
<rule pattern="\\\n">
<token type="Text"/>
</rule>
<rule pattern="//[^\n\r]+">
<token type="CommentSingle"/>
</rule>
<rule pattern="\n">
<token type="Text"/>
</rule>
<rule pattern="(\+|&amp;&amp;|==|&lt;|=|-|\|\||!=|&gt;|:|\*|&amp;|=~|&lt;=|\?|\[|\]|,|/|\||!~|&gt;=|!|_\|_|\.\.\.)">
<token type="Operator"/>
</rule>
<rule pattern="#*&#34;+">
<token type="LiteralString"/>
<push state="string"/>
</rule>
<rule pattern="'(\\\\|\\'|[^'\n])*['\n]">
<token type="LiteralString"/>
</rule>
<rule pattern="0[boxX][0-9a-fA-F][_0-9a-fA-F]*|(\.\d+|\d[_\d]*(\.\d*)?)([eE][+-]?\d+)?[KMGTP]?i?">
<token type="LiteralNumber"/>
</rule>
<rule pattern="[~!%^&amp;*()+=|\[\]:;,.&lt;&gt;/?-]">
<token type="Punctuation"/>
</rule>
<rule pattern="[{}]">
<token type="Punctuation"/>
</rule>
<rule pattern="(import|for|if|in|let|package)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(bool|float|int|string|uint|ulong|ushort)\b\??">
<token type="KeywordType"/>
</rule>
<rule pattern="(true|false|null|_)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="[@#]?[_a-zA-Z$]\w*">
<token type="Name"/>
</rule>
</state>
<state name="string">
<rule pattern="\\#*\(">
<token type="LiteralStringInterpol"/>
<push state="string-intp"/>
</rule>
<rule pattern="&#34;+#*">
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
<rule pattern="\\[&#39;&#34;\\nrt]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="[^\\&#34;]+">
<token type="LiteralString"/>
</rule>
<rule pattern="\\">
<token type="LiteralString"/>
</rule>
</state>
<state name="string-intp">
<rule pattern="\)">
<token type="LiteralStringInterpol"/>
<pop depth="1"/>
</rule>
<rule>
<include state="root"/>
</rule>
</state>
</rules>
</lexer>