chroma-markdown/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/awk.xml

95 lines
3.2 KiB
XML
Raw Normal View History

2023-11-26 06:32:49 +01:00
<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="\+\+|--|\|\||&amp;&amp;|in\b|\$|!?~|\|&amp;|(\*\*|[-&lt;&gt;+*%\^/!=|])=?">
<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="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<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>