cheat/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/prql.xml
Christopher Allen Lane 1790aec85d chore(deps): bump chroma to v2 #735
Bump `alecthomas/chroma` to `v2`:
https://github.com/cheat/cheat/issues/735
2023-12-13 12:54:32 -05:00

161 lines
11 KiB
XML

<lexer>
<config>
<name>PRQL</name>
<alias>prql</alias>
<filename>*.prql</filename>
<mime_type>application/prql</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="#!.*"><token type="LiteralStringDoc"/></rule>
<rule pattern="#.*"><token type="CommentSingle"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="^(\s*)(module)(\s*)"><bygroups><token type="TextWhitespace"/><token type="KeywordNamespace"/><token type="TextWhitespace"/></bygroups><push state="imports"/></rule>
<rule pattern="(bool|int|int8|int16|int32|int64|int128|float|text|set)\b"><token type="KeywordType"/></rule>
<rule pattern="^prql "><token type="KeywordReserved"/></rule>
<rule pattern="let"><token type="KeywordDeclaration"/></rule>
<rule><include state="keywords"/></rule>
<rule><include state="expr"/></rule>
<rule pattern="^[A-Za-z_][a-zA-Z0-9_]*"><token type="Keyword"/></rule>
</state>
<state name="expr">
<rule pattern="(f)(&quot;&quot;&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="fstringescape" state="tdqf"/></rule>
<rule pattern="(f)(&#x27;&#x27;&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="fstringescape" state="tsqf"/></rule>
<rule pattern="(f)(&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="fstringescape" state="dqf"/></rule>
<rule pattern="(f)(&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="fstringescape" state="sqf"/></rule>
<rule pattern="(s)(&quot;&quot;&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="stringescape" state="tdqf"/></rule>
<rule pattern="(s)(&#x27;&#x27;&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="stringescape" state="tsqf"/></rule>
<rule pattern="(s)(&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="stringescape" state="dqf"/></rule>
<rule pattern="(s)(&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="stringescape" state="sqf"/></rule>
<rule pattern="(?i)(r)(&quot;&quot;&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><push state="tdqs"/></rule>
<rule pattern="(?i)(r)(&#x27;&#x27;&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><push state="tsqs"/></rule>
<rule pattern="(?i)(r)(&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><push state="dqs"/></rule>
<rule pattern="(?i)(r)(&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><push state="sqs"/></rule>
<rule pattern="&quot;&quot;&quot;"><token type="LiteralStringDouble"/><combined state="stringescape" state="tdqs"/></rule>
<rule pattern="&#x27;&#x27;&#x27;"><token type="LiteralStringSingle"/><combined state="stringescape" state="tsqs"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><combined state="stringescape" state="dqs"/></rule>
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><combined state="stringescape" state="sqs"/></rule>
<rule pattern="@\d{4}-\d{2}-\d{2}T\d{2}(:\d{2})?(:\d{2})?(\.\d{1,6})?(Z|[+-]\d{1,2}(:\d{1,2})?)?"><token type="LiteralDate"/></rule>
<rule pattern="@\d{4}-\d{2}-\d{2}"><token type="LiteralDate"/></rule>
<rule pattern="@\d{2}(:\d{2})?(:\d{2})?(\.\d{1,6})?(Z|[+-]\d{1,2}(:\d{1,2})?)?"><token type="LiteralDate"/></rule>
<rule pattern="[^\S\n]+"><token type="Text"/></rule>
<rule><include state="numbers"/></rule>
<rule pattern="-&gt;|=&gt;|==|!=|&gt;=|&lt;=|~=|&amp;&amp;|\|\||\?\?|\/\/"><token type="Operator"/></rule>
<rule pattern="[-~+/*%=&lt;&gt;&amp;^|.@]"><token type="Operator"/></rule>
<rule pattern="[]{}:(),;[]"><token type="Punctuation"/></rule>
<rule><include state="functions"/></rule>
<rule pattern="[A-Za-z_][a-zA-Z0-9_]*"><token type="NameVariable"/></rule>
</state>
<state name="numbers">
<rule pattern="(\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)([eE][+-]?\d(?:_?\d)*)?"><token type="LiteralNumberFloat"/></rule>
<rule pattern="\d(?:_?\d)*[eE][+-]?\d(?:_?\d)*j?"><token type="LiteralNumberFloat"/></rule>
<rule pattern="0[oO](?:_?[0-7])+"><token type="LiteralNumberOct"/></rule>
<rule pattern="0[bB](?:_?[01])+"><token type="LiteralNumberBin"/></rule>
<rule pattern="0[xX](?:_?[a-fA-F0-9])+"><token type="LiteralNumberHex"/></rule>
<rule pattern="\d(?:_?\d)*"><token type="LiteralNumberInteger"/></rule>
</state>
<state name="fstringescape">
<rule><include state="stringescape"/></rule>
</state>
<state name="bytesescape">
<rule pattern="\\([\\bfnrt&quot;\&#x27;]|\n|x[a-fA-F0-9]{2}|[0-7]{1,3})"><token type="LiteralStringEscape"/></rule>
</state>
<state name="stringescape">
<rule pattern="\\(N\{.*?\}|u\{[a-fA-F0-9]{1,6}\})"><token type="LiteralStringEscape"/></rule>
<rule><include state="bytesescape"/></rule>
</state>
<state name="fstrings-single">
<rule pattern="\}"><token type="LiteralStringInterpol"/></rule>
<rule pattern="\{"><token type="LiteralStringInterpol"/><push state="expr-inside-fstring"/></rule>
<rule pattern="[^\\\&#x27;&quot;{}\n]+"><token type="LiteralStringSingle"/></rule>
<rule pattern="[\&#x27;&quot;\\]"><token type="LiteralStringSingle"/></rule>
</state>
<state name="fstrings-double">
<rule pattern="\}"><token type="LiteralStringInterpol"/></rule>
<rule pattern="\{"><token type="LiteralStringInterpol"/><push state="expr-inside-fstring"/></rule>
<rule pattern="[^\\\&#x27;&quot;{}\n]+"><token type="LiteralStringDouble"/></rule>
<rule pattern="[\&#x27;&quot;\\]"><token type="LiteralStringDouble"/></rule>
</state>
<state name="strings-single">
<rule pattern="\{((\w+)((\.\w+)|(\[[^\]]+\]))*)?(\:(.?[&lt;&gt;=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?\}"><token type="LiteralStringInterpol"/></rule>
<rule pattern="[^\\\&#x27;&quot;%{\n]+"><token type="LiteralStringSingle"/></rule>
<rule pattern="[\&#x27;&quot;\\]"><token type="LiteralStringSingle"/></rule>
<rule pattern="%|(\{{1,2})"><token type="LiteralStringSingle"/></rule>
</state>
<state name="strings-double">
<rule pattern="\{((\w+)((\.\w+)|(\[[^\]]+\]))*)?(\:(.?[&lt;&gt;=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?\}"><token type="LiteralStringInterpol"/></rule>
<rule pattern="[^\\\&#x27;&quot;%{\n]+"><token type="LiteralStringDouble"/></rule>
<rule pattern="[\&#x27;&quot;\\]"><token type="LiteralStringDouble"/></rule>
<rule pattern="%|(\{{1,2})"><token type="LiteralStringDouble"/></rule>
</state>
<state name="dqf">
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule pattern="\\\\|\\&quot;|\\\n"><token type="LiteralStringEscape"/></rule>
<rule><include state="fstrings-double"/></rule>
</state>
<state name="sqf">
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
<rule pattern="\\\\|\\&#x27;|\\\n"><token type="LiteralStringEscape"/></rule>
<rule><include state="fstrings-single"/></rule>
</state>
<state name="dqs">
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule pattern="\\\\|\\&quot;|\\\n"><token type="LiteralStringEscape"/></rule>
<rule><include state="strings-double"/></rule>
</state>
<state name="sqs">
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
<rule pattern="\\\\|\\&#x27;|\\\n"><token type="LiteralStringEscape"/></rule>
<rule><include state="strings-single"/></rule>
</state>
<state name="tdqf">
<rule pattern="&quot;&quot;&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule><include state="fstrings-double"/></rule>
<rule pattern="\n"><token type="LiteralStringDouble"/></rule>
</state>
<state name="tsqf">
<rule pattern="&#x27;&#x27;&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
<rule><include state="fstrings-single"/></rule>
<rule pattern="\n"><token type="LiteralStringSingle"/></rule>
</state>
<state name="tdqs">
<rule pattern="&quot;&quot;&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule><include state="strings-double"/></rule>
<rule pattern="\n"><token type="LiteralStringDouble"/></rule>
</state>
<state name="tsqs">
<rule pattern="&#x27;&#x27;&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
<rule><include state="strings-single"/></rule>
<rule pattern="\n"><token type="LiteralStringSingle"/></rule>
</state>
<state name="expr-inside-fstring">
<rule pattern="[{([]"><token type="Punctuation"/><push state="expr-inside-fstring-inner"/></rule>
<rule pattern="(=\s*)?\}"><token type="LiteralStringInterpol"/><pop depth="1"/></rule>
<rule pattern="(=\s*)?:"><token type="LiteralStringInterpol"/><pop depth="1"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule><include state="expr"/></rule>
</state>
<state name="expr-inside-fstring-inner">
<rule pattern="[{([]"><token type="Punctuation"/><push state="expr-inside-fstring-inner"/></rule>
<rule pattern="[])}]"><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule><include state="expr"/></rule>
</state>
<state name="keywords">
<rule pattern="(into|case|type|module|internal)\b"><token type="Keyword"/></rule>
<rule pattern="(true|false|null)\b"><token type="KeywordConstant"/></rule>
</state>
<state name="functions">
<rule pattern="(min|max|sum|average|stddev|every|any|concat_array|count|lag|lead|first|last|rank|rank_dense|row_number|round|as|in|tuple_every|tuple_map|tuple_zip|_eq|_is_null|from_text|lower|upper|read_parquet|read_csv)\b"><token type="NameFunction"/></rule>
</state>
<state name="comment">
<rule pattern="-(?!\})"><token type="CommentMultiline"/></rule>
<rule pattern="\{-"><token type="CommentMultiline"/><push state="comment"/></rule>
<rule pattern="[^-}]"><token type="CommentMultiline"/></rule>
<rule pattern="-\}"><token type="CommentMultiline"/><pop depth="1"/></rule>
</state>
<state name="imports">
<rule pattern="\w+(\.\w+)*"><token type="NameClass"/><pop depth="1"/></rule>
</state>
</rules>
</lexer>