summaryrefslogtreecommitdiff
path: root/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/awk.xml
blob: 07476ff745ada7c75d6360db579b2b324a9cbfc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<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>