mirror of
https://github.com/cheat/cheat.git
synced 2024-12-26 06:29:45 +01:00
99 lines
3.3 KiB
XML
99 lines
3.3 KiB
XML
|
<lexer>
|
||
|
<config>
|
||
|
<name>Hare</name>
|
||
|
<alias>hare</alias>
|
||
|
<filename>*.ha</filename>
|
||
|
<mime_type>text/x-hare</mime_type>
|
||
|
</config>
|
||
|
<rules>
|
||
|
<state name="string">
|
||
|
<rule pattern=""">
|
||
|
<token type="LiteralString"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\([\\0abfnrtv"']|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8})">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="[^\\"\n]+">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="root">
|
||
|
<rule pattern="[\s\n]+">
|
||
|
<token type="TextWhitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="@[a-z]+">
|
||
|
<token type="NameDecorator"/>
|
||
|
</rule>
|
||
|
<rule pattern="//.*\n">
|
||
|
<token type="CommentSingle"/>
|
||
|
</rule>
|
||
|
<rule pattern=""">
|
||
|
<token type="LiteralString"/>
|
||
|
<push state="string"/>
|
||
|
</rule>
|
||
|
<rule pattern="`[^`]*`">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern="'(\\[\\0abfnrtv"']||\\(x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8})|[^\\'])'">
|
||
|
<token type="LiteralStringChar"/>
|
||
|
</rule>
|
||
|
<rule pattern="(0|[1-9]\d*)\.\d+([eE][+-]?\d+)?(f32|f64)?">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="(0|[1-9]\d*)([eE][+-]?\d+)?(f32|f64)">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="0x[0-9a-fA-F]+\.[0-9a-fA-F]+([pP][+-]?\d+(f32|f64)?)?">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="0x[0-9a-fA-F]+[pP][+-]?\d+(f32|f64)">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="0x[0-9a-fA-F]+(z|[iu](8|16|32|64)?)?">
|
||
|
<token type="LiteralNumberHex"/>
|
||
|
</rule>
|
||
|
<rule pattern="0o[0-7]+(z|[iu](8|16|32|64)?)?">
|
||
|
<token type="LiteralNumberOct"/>
|
||
|
</rule>
|
||
|
<rule pattern="0b[01]+(z|[iu](8|16|32|64)?)?">
|
||
|
<token type="LiteralNumberBin"/>
|
||
|
</rule>
|
||
|
<rule pattern="(0|[1-9]\d*)([eE][+-]?\d+)?(z|[iu](8|16|32|64)?)?">
|
||
|
<token type="LiteralNumberInteger"/>
|
||
|
</rule>
|
||
|
<rule pattern="[~!%^&*+=|?:<>/-]|[ai]s\b|\.\.\.">
|
||
|
<token type="Operator"/>
|
||
|
</rule>
|
||
|
<rule pattern="[()\[\],.{};]">
|
||
|
<token type="Punctuation"/>
|
||
|
</rule>
|
||
|
<rule pattern="use\b">
|
||
|
<token type="KeywordNamespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="(_|align|break|const|continue|else|enum|export|for|if|return|static|struct|offset|union|fn|free|assert|abort|alloc|let|len|def|type|match|switch|case|append|delete|insert|defer|yield|vastart|vaarg|vaend)\b">
|
||
|
<token type="Keyword"/>
|
||
|
</rule>
|
||
|
<rule pattern="(size)([\s\n]*)(\()">
|
||
|
<bygroups>
|
||
|
<token type="Keyword" />
|
||
|
<token type="TextWhitespace" />
|
||
|
<token type="Punctuation" />
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="(str|size|rune|bool|int|uint|uintptr|u8|u16|u32|u64|i8|i16|i32|i64|f32|f64|null|void|nullable|valist|opaque|never)\b">
|
||
|
<token type="KeywordType"/>
|
||
|
</rule>
|
||
|
<rule pattern="(true|false)\b">
|
||
|
<token type="NameBuiltin"/>
|
||
|
</rule>
|
||
|
<rule pattern="[a-zA-Z_]\w*">
|
||
|
<token type="Name"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
</rules>
|
||
|
</lexer>
|