mirror of
https://github.com/cheat/cheat.git
synced 2024-12-18 18:55:06 +01:00
1790aec85d
Bump `alecthomas/chroma` to `v2`: https://github.com/cheat/cheat/issues/735
134 lines
3.8 KiB
XML
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="\$\{[^"}]+?\}">
|
|
<token type="LiteralStringInterpol"/>
|
|
</rule>
|
|
<rule pattern="\$">
|
|
<token type="LiteralStringDouble"/>
|
|
</rule>
|
|
<rule pattern="\\\\">
|
|
<token type="LiteralStringDouble"/>
|
|
</rule>
|
|
<rule pattern="\\"">
|
|
<token type="LiteralStringDouble"/>
|
|
</rule>
|
|
<rule pattern="[^\\"$]+">
|
|
<token type="LiteralStringDouble"/>
|
|
</rule>
|
|
<rule pattern=""">
|
|
<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="\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|\.\.(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?">
|
|
<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=""">
|
|
<token type="LiteralStringDouble"/>
|
|
<push state="dqstring"/>
|
|
</rule>
|
|
<rule pattern="'(\\\\|\\'|[^'])*'">
|
|
<token type="LiteralStringSingle"/>
|
|
</rule>
|
|
</state>
|
|
</rules>
|
|
</lexer> |