86 lines
2.5 KiB
XML
86 lines
2.5 KiB
XML
<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="(\+|&&|==|<|=|-|\|\||!=|>|:|\*|&|=~|<=|\?|\[|\]|,|/|\||!~|>=|!|_\|_|\.\.\.)">
|
|
<token type="Operator"/>
|
|
</rule>
|
|
<rule pattern="#*"+">
|
|
<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="[~!%^&*()+=|\[\]:;,.<>/?-]">
|
|
<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=""+#*">
|
|
<token type="LiteralString"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule pattern="\\['"\\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="[^\\"]+">
|
|
<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>
|