mirror of
https://github.com/cheat/cheat.git
synced 2024-11-24 06:51:36 +01:00
1790aec85d
Bump `alecthomas/chroma` to `v2`: https://github.com/cheat/cheat/issues/735
145 lines
4.5 KiB
XML
145 lines
4.5 KiB
XML
<lexer>
|
|
<config>
|
|
<name>OCaml</name>
|
|
<alias>ocaml</alias>
|
|
<filename>*.ml</filename>
|
|
<filename>*.mli</filename>
|
|
<filename>*.mll</filename>
|
|
<filename>*.mly</filename>
|
|
<mime_type>text/x-ocaml</mime_type>
|
|
</config>
|
|
<rules>
|
|
<state name="escape-sequence">
|
|
<rule pattern="\\[\\"\'ntbr]">
|
|
<token type="LiteralStringEscape"/>
|
|
</rule>
|
|
<rule pattern="\\[0-9]{3}">
|
|
<token type="LiteralStringEscape"/>
|
|
</rule>
|
|
<rule pattern="\\x[0-9a-fA-F]{2}">
|
|
<token type="LiteralStringEscape"/>
|
|
</rule>
|
|
</state>
|
|
<state name="root">
|
|
<rule pattern="\s+">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern="false|true|\(\)|\[\]">
|
|
<token type="NameBuiltinPseudo"/>
|
|
</rule>
|
|
<rule pattern="\b([A-Z][\w\']*)(?=\s*\.)">
|
|
<token type="NameNamespace"/>
|
|
<push state="dotted"/>
|
|
</rule>
|
|
<rule pattern="\b([A-Z][\w\']*)">
|
|
<token type="NameClass"/>
|
|
</rule>
|
|
<rule pattern="\(\*(?![)])">
|
|
<token type="Comment"/>
|
|
<push state="comment"/>
|
|
</rule>
|
|
<rule pattern="\b(as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|false|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|object|of|open|private|raise|rec|sig|struct|then|to|true|try|type|value|val|virtual|when|while|with)\b">
|
|
<token type="Keyword"/>
|
|
</rule>
|
|
<rule pattern="(~|\}|\|]|\||\{<|\{|`|_|]|\[\||\[>|\[<|\[|\?\?|\?|>\}|>]|>|=|<-|<|;;|;|:>|:=|::|:|\.\.|\.|->|-\.|-|,|\+|\*|\)|\(|&&|&|#|!=)">
|
|
<token type="Operator"/>
|
|
</rule>
|
|
<rule pattern="([=<>@^|&+\*/$%-]|[!?~])?[!$%&*+\./:<=>?@^|~-]">
|
|
<token type="Operator"/>
|
|
</rule>
|
|
<rule pattern="\b(and|asr|land|lor|lsl|lxor|mod|or)\b">
|
|
<token type="OperatorWord"/>
|
|
</rule>
|
|
<rule pattern="\b(unit|int|float|bool|string|char|list|array)\b">
|
|
<token type="KeywordType"/>
|
|
</rule>
|
|
<rule pattern="[^\W\d][\w']*">
|
|
<token type="Name"/>
|
|
</rule>
|
|
<rule pattern="-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="0[xX][\da-fA-F][\da-fA-F_]*">
|
|
<token type="LiteralNumberHex"/>
|
|
</rule>
|
|
<rule pattern="0[oO][0-7][0-7_]*">
|
|
<token type="LiteralNumberOct"/>
|
|
</rule>
|
|
<rule pattern="0[bB][01][01_]*">
|
|
<token type="LiteralNumberBin"/>
|
|
</rule>
|
|
<rule pattern="\d[\d_]*">
|
|
<token type="LiteralNumberInteger"/>
|
|
</rule>
|
|
<rule pattern="'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'">
|
|
<token type="LiteralStringChar"/>
|
|
</rule>
|
|
<rule pattern="'.'">
|
|
<token type="LiteralStringChar"/>
|
|
</rule>
|
|
<rule pattern="'">
|
|
<token type="Keyword"/>
|
|
</rule>
|
|
<rule pattern=""">
|
|
<token type="LiteralStringDouble"/>
|
|
<push state="string"/>
|
|
</rule>
|
|
<rule pattern="[~?][a-z][\w\']*:">
|
|
<token type="NameVariable"/>
|
|
</rule>
|
|
</state>
|
|
<state name="comment">
|
|
<rule pattern="[^(*)]+">
|
|
<token type="Comment"/>
|
|
</rule>
|
|
<rule pattern="\(\*">
|
|
<token type="Comment"/>
|
|
<push/>
|
|
</rule>
|
|
<rule pattern="\*\)">
|
|
<token type="Comment"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule pattern="[(*)]">
|
|
<token type="Comment"/>
|
|
</rule>
|
|
</state>
|
|
<state name="string">
|
|
<rule pattern="[^\\"]+">
|
|
<token type="LiteralStringDouble"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="escape-sequence"/>
|
|
</rule>
|
|
<rule pattern="\\\n">
|
|
<token type="LiteralStringDouble"/>
|
|
</rule>
|
|
<rule pattern=""">
|
|
<token type="LiteralStringDouble"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
</state>
|
|
<state name="dotted">
|
|
<rule pattern="\s+">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern="\.">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
<rule pattern="[A-Z][\w\']*(?=\s*\.)">
|
|
<token type="NameNamespace"/>
|
|
</rule>
|
|
<rule pattern="[A-Z][\w\']*">
|
|
<token type="NameClass"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule pattern="[a-z_][\w\']*">
|
|
<token type="Name"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
</state>
|
|
</rules>
|
|
</lexer> |