cheat/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/chaiscript.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

134 lines
3.8 KiB
XML

<lexer>
<config>
<name>ChaiScript</name>
<alias>chai</alias>
<alias>chaiscript</alias>
<filename>*.chai</filename>
<mime_type>text/x-chaiscript</mime_type>
<mime_type>application/x-chaiscript</mime_type>
<dot_all>true</dot_all>
</config>
<rules>
<state name="dqstring">
<rule pattern="\$\{[^&#34;}]+?\}">
<token type="LiteralStringInterpol"/>
</rule>
<rule pattern="\$">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="\\\\">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="\\&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="[^\\&#34;$]+">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="&#34;">
<token type="LiteralStringDouble"/>
<pop depth="1"/>
</rule>
</state>
<state name="commentsandwhitespace">
<rule pattern="\s+">
<token type="Text"/>
</rule>
<rule pattern="//.*?\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="/\*.*?\*/">
<token type="CommentMultiline"/>
</rule>
<rule pattern="^\#.*?\n">
<token type="CommentSingle"/>
</rule>
</state>
<state name="slashstartsregex">
<rule>
<include state="commentsandwhitespace"/>
</rule>
<rule pattern="/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
</rule>
<rule pattern="(?=/)">
<token type="Text"/>
<push state="#pop" state="badregex"/>
</rule>
<rule>
<pop depth="1"/>
</rule>
</state>
<state name="badregex">
<rule pattern="\n">
<token type="Text"/>
<pop depth="1"/>
</rule>
</state>
<state name="root">
<rule>
<include state="commentsandwhitespace"/>
</rule>
<rule pattern="\n">
<token type="Text"/>
</rule>
<rule pattern="[^\S\n]+">
<token type="Text"/>
</rule>
<rule pattern="\+\+|--|~|&amp;&amp;|\?|:|\|\||\\(?=\n)|\.\.(&lt;&lt;|&gt;&gt;&gt;?|==?|!=?|[-&lt;&gt;+*%&amp;|^/])=?">
<token type="Operator"/>
<push state="slashstartsregex"/>
</rule>
<rule pattern="[{(\[;,]">
<token type="Punctuation"/>
<push state="slashstartsregex"/>
</rule>
<rule pattern="[})\].]">
<token type="Punctuation"/>
</rule>
<rule pattern="[=+\-*/]">
<token type="Operator"/>
</rule>
<rule pattern="(for|in|while|do|break|return|continue|if|else|throw|try|catch)\b">
<token type="Keyword"/>
<push state="slashstartsregex"/>
</rule>
<rule pattern="(var)\b">
<token type="KeywordDeclaration"/>
<push state="slashstartsregex"/>
</rule>
<rule pattern="(attr|def|fun)\b">
<token type="KeywordReserved"/>
</rule>
<rule pattern="(true|false)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="(eval|throw)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="`\S+`">
<token type="NameBuiltin"/>
</rule>
<rule pattern="[$a-zA-Z_]\w*">
<token type="NameOther"/>
</rule>
<rule pattern="[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="0x[0-9a-fA-F]+">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="[0-9]+">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="&#34;">
<token type="LiteralStringDouble"/>
<push state="dqstring"/>
</rule>
<rule pattern="&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralStringSingle"/>
</rule>
</state>
</rules>
</lexer>