mirror of
https://github.com/cheat/cheat.git
synced 2024-12-25 14:09:44 +01:00
1790aec85d
Bump `alecthomas/chroma` to `v2`: https://github.com/cheat/cheat/issues/735
112 lines
3.8 KiB
XML
112 lines
3.8 KiB
XML
<lexer>
|
|
<config>
|
|
<name>Zig</name>
|
|
<alias>zig</alias>
|
|
<filename>*.zig</filename>
|
|
<mime_type>text/zig</mime_type>
|
|
</config>
|
|
<rules>
|
|
<state name="string">
|
|
<rule pattern="\\(x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{6}|[nr\\t\'"])">
|
|
<token type="LiteralStringEscape"/>
|
|
</rule>
|
|
<rule pattern="[^\\"\n]+">
|
|
<token type="LiteralString"/>
|
|
</rule>
|
|
<rule pattern=""">
|
|
<token type="LiteralString"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
</state>
|
|
<state name="root">
|
|
<rule pattern="\n">
|
|
<token type="TextWhitespace"/>
|
|
</rule>
|
|
<rule pattern="\s+">
|
|
<token type="TextWhitespace"/>
|
|
</rule>
|
|
<rule pattern="//.*?\n">
|
|
<token type="CommentSingle"/>
|
|
</rule>
|
|
<rule pattern="(unreachable|continue|errdefer|suspend|return|resume|cancel|break|catch|async|await|defer|asm|try)\b">
|
|
<token type="Keyword"/>
|
|
</rule>
|
|
<rule pattern="(threadlocal|linksection|allowzero|stdcallcc|volatile|comptime|noalias|nakedcc|inline|export|packed|extern|align|const|pub|var)\b">
|
|
<token type="KeywordReserved"/>
|
|
</rule>
|
|
<rule pattern="(struct|union|error|enum)\b">
|
|
<token type="Keyword"/>
|
|
</rule>
|
|
<rule pattern="(while|for)\b">
|
|
<token type="Keyword"/>
|
|
</rule>
|
|
<rule pattern="(comptime_float|comptime_int|c_longdouble|c_ulonglong|c_longlong|c_voidi8|noreturn|c_ushort|anyerror|promise|c_short|c_ulong|c_uint|c_long|isize|c_int|usize|void|f128|i128|type|bool|u128|u16|f64|f32|u64|i16|f16|i32|u32|i64|u8|i0|u0)\b">
|
|
<token type="KeywordType"/>
|
|
</rule>
|
|
<rule pattern="(undefined|false|true|null)\b">
|
|
<token type="KeywordConstant"/>
|
|
</rule>
|
|
<rule pattern="(switch|orelse|else|and|if|or)\b">
|
|
<token type="Keyword"/>
|
|
</rule>
|
|
<rule pattern="(usingnamespace|test|fn)\b">
|
|
<token type="Keyword"/>
|
|
</rule>
|
|
<rule pattern="0x[0-9a-fA-F]+\.[0-9a-fA-F]+([pP][\-+]?[0-9a-fA-F]+)?">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="0x[0-9a-fA-F]+\.?[pP][\-+]?[0-9a-fA-F]+">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="[0-9]+\.[0-9]+([eE][-+]?[0-9]+)?">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="[0-9]+\.?[eE][-+]?[0-9]+">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="0b(?:_?[01])+">
|
|
<token type="LiteralNumberBin"/>
|
|
</rule>
|
|
<rule pattern="0o(?:_?[0-7])+">
|
|
<token type="LiteralNumberOct"/>
|
|
</rule>
|
|
<rule pattern="0x(?:_?[0-9a-fA-F])+">
|
|
<token type="LiteralNumberHex"/>
|
|
</rule>
|
|
<rule pattern="(?:_?[0-9])+">
|
|
<token type="LiteralNumberInteger"/>
|
|
</rule>
|
|
<rule pattern="@[a-zA-Z_]\w*">
|
|
<token type="NameBuiltin"/>
|
|
</rule>
|
|
<rule pattern="[a-zA-Z_]\w*">
|
|
<token type="Name"/>
|
|
</rule>
|
|
<rule pattern="\'\\\'\'">
|
|
<token type="LiteralStringEscape"/>
|
|
</rule>
|
|
<rule pattern="\'\\(|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{6}|[nr\\t\'"])\'">
|
|
<token type="LiteralStringEscape"/>
|
|
</rule>
|
|
<rule pattern="\'[^\\\']\'">
|
|
<token type="LiteralString"/>
|
|
</rule>
|
|
<rule pattern="\\\\[^\n]*">
|
|
<token type="LiteralStringHeredoc"/>
|
|
</rule>
|
|
<rule pattern="c\\\\[^\n]*">
|
|
<token type="LiteralStringHeredoc"/>
|
|
</rule>
|
|
<rule pattern="c?"">
|
|
<token type="LiteralString"/>
|
|
<push state="string"/>
|
|
</rule>
|
|
<rule pattern="[+%=><|^!?/\-*&~:]">
|
|
<token type="Operator"/>
|
|
</rule>
|
|
<rule pattern="[{}()\[\],.;]">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
</state>
|
|
</rules>
|
|
</lexer> |