2020-04-20 20:15:43 +03:00
|
|
|
## Syntax highlighting for AWK scripts.
|
2014-05-17 00:21:34 +04:00
|
|
|
|
2018-02-07 13:25:46 +03:00
|
|
|
syntax awk "\.awk$"
|
2018-08-15 21:12:20 +03:00
|
|
|
header "^#!.*awk"
|
2017-11-19 13:10:53 +03:00
|
|
|
magic "awk script"
|
2016-05-25 23:13:50 +03:00
|
|
|
comment "#"
|
2014-05-17 00:21:34 +04:00
|
|
|
|
|
|
|
# Records.
|
2019-08-17 18:01:19 +03:00
|
|
|
color brightred "\$[0-9A-Za-z_!@#$*?-]+"
|
2014-05-17 00:21:34 +04:00
|
|
|
# Awk-set variables.
|
2008-06-01 01:55:21 +04:00
|
|
|
color red "\<(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\>"
|
|
|
|
color red "\<(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\>"
|
|
|
|
color red "\<(PROCINFO|RS|RT|RSTART|RLENGTH|SUBSEP|TEXTDOMAIN)\>"
|
2014-05-17 00:21:34 +04:00
|
|
|
# Function declarations and special patterns.
|
2008-06-01 01:55:21 +04:00
|
|
|
color brightgreen "\<(function|extension|BEGIN|END)\>"
|
2014-05-17 00:21:34 +04:00
|
|
|
# Operators.
|
2020-04-21 13:47:08 +03:00
|
|
|
color green "\{|\}|\(|\)|\;|\[|\]|\\|<|>|!|=|&|\+|-|\*|%|/|\?:|\^|\|"
|
2014-05-17 00:21:34 +04:00
|
|
|
# Flow control.
|
2008-06-01 01:55:21 +04:00
|
|
|
color brightyellow "\<(for|if|while|do|else|in|delete|exit)\>"
|
|
|
|
color brightyellow "\<(break|continue|return)\>"
|
2014-05-17 00:21:34 +04:00
|
|
|
# I/O statements.
|
2018-11-03 23:20:06 +03:00
|
|
|
color brightgreen "\<(close|fflush|getline|next|nextfile|print|printf|system)\>"
|
2014-05-17 00:21:34 +04:00
|
|
|
# Standard functions.
|
2008-06-01 01:55:21 +04:00
|
|
|
color magenta "\<(atan2|cos|exp|int|log|rand|sin|sqrt|srand)\>"
|
|
|
|
color magenta "\<(asort|asorti|gensub|gsub|index|length|match)\>"
|
|
|
|
color magenta "\<(split|sprintf|strtonum|sub|substr|tolower|toupper)\>"
|
|
|
|
color magenta "\<(mktime|strftime|systime)\>"
|
|
|
|
color magenta "\<(and|compl|lshift|or|rshift|xor)\>"
|
|
|
|
color magenta "\<(bindtextdomain|dcgettext|dcngettext)\>"
|
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# Strings.
|
2008-06-01 01:55:21 +04:00
|
|
|
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
|
2014-05-17 00:21:34 +04:00
|
|
|
# Comments.
|
2008-06-01 01:55:21 +04:00
|
|
|
color brightblue "(^|[[:space:]])#.*$"
|
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# Trailing whitespace.
|
2008-06-01 01:55:21 +04:00
|
|
|
color ,green "[[:space:]]+$"
|