mirror of
https://github.com/cheat/cheat.git
synced 2024-11-30 01:36:53 +01:00
1790aec85d
Bump `alecthomas/chroma` to `v2`: https://github.com/cheat/cheat/issues/735
95 lines
3.2 KiB
XML
95 lines
3.2 KiB
XML
<lexer>
|
|
<config>
|
|
<name>Awk</name>
|
|
<alias>awk</alias>
|
|
<alias>gawk</alias>
|
|
<alias>mawk</alias>
|
|
<alias>nawk</alias>
|
|
<filename>*.awk</filename>
|
|
<mime_type>application/x-awk</mime_type>
|
|
</config>
|
|
<rules>
|
|
<state name="root">
|
|
<rule pattern="^(?=\s|/)">
|
|
<token type="Text"/>
|
|
<push state="slashstartsregex"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="commentsandwhitespace"/>
|
|
</rule>
|
|
<rule pattern="\+\+|--|\|\||&&|in\b|\$|!?~|\|&|(\*\*|[-<>+*%\^/!=|])=?">
|
|
<token type="Operator"/>
|
|
<push state="slashstartsregex"/>
|
|
</rule>
|
|
<rule pattern="[{(\[;,]">
|
|
<token type="Punctuation"/>
|
|
<push state="slashstartsregex"/>
|
|
</rule>
|
|
<rule pattern="[})\].]">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
<rule pattern="(break|continue|do|while|exit|for|if|else|return|switch|case|default)\b">
|
|
<token type="Keyword"/>
|
|
<push state="slashstartsregex"/>
|
|
</rule>
|
|
<rule pattern="function\b">
|
|
<token type="KeywordDeclaration"/>
|
|
<push state="slashstartsregex"/>
|
|
</rule>
|
|
<rule pattern="(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gensub|gsub|index|length|match|split|patsplit|sprintf|sub|substr|tolower|toupper|close|fflush|getline|next(file)|print|printf|strftime|systime|mktime|delete|system|strtonum|and|compl|lshift|or|rshift|asorti?|isarray|bindtextdomain|dcn?gettext|@(include|load|namespace))\b">
|
|
<token type="KeywordReserved"/>
|
|
</rule>
|
|
<rule pattern="(ARGC|ARGIND|ARGV|BEGIN(FILE)?|BINMODE|CONVFMT|ENVIRON|END(FILE)?|ERRNO|FIELDWIDTHS|FILENAME|FNR|FPAT|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS|PROCINFO|RLENGTH|RS|RSTART|RT|SUBSEP|TEXTDOMAIN)\b">
|
|
<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"/>
|
|
</rule>
|
|
<rule pattern="'(\\\\|\\'|[^'])*'">
|
|
<token type="LiteralStringSingle"/>
|
|
</rule>
|
|
</state>
|
|
<state name="commentsandwhitespace">
|
|
<rule pattern="\s+">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern="#.*$">
|
|
<token type="CommentSingle"/>
|
|
</rule>
|
|
</state>
|
|
<state name="slashstartsregex">
|
|
<rule>
|
|
<include state="commentsandwhitespace"/>
|
|
</rule>
|
|
<rule pattern="/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/\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>
|
|
</rules>
|
|
</lexer> |