2020-04-20 17:15:43 +00:00
|
|
|
## Syntax highlighting for AWK scripts.
|
2014-05-16 20:21:34 +00:00
|
|
|
|
2018-02-07 10:25:46 +00:00
|
|
|
syntax awk "\.awk$"
|
2018-08-15 18:12:20 +00:00
|
|
|
header "^#!.*awk"
|
2017-11-19 10:10:53 +00:00
|
|
|
magic "awk script"
|
2016-05-25 20:13:50 +00:00
|
|
|
comment "#"
|
2014-05-16 20:21:34 +00:00
|
|
|
|
|
|
|
# Records.
|
2019-08-17 15:01:19 +00:00
|
|
|
color brightred "\$[0-9A-Za-z_!@#$*?-]+"
|
2014-05-16 20:21:34 +00:00
|
|
|
# Awk-set variables.
|
2008-05-31 21:55:21 +00: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-16 20:21:34 +00:00
|
|
|
# Function declarations and special patterns.
|
2008-05-31 21:55:21 +00:00
|
|
|
color brightgreen "\<(function|extension|BEGIN|END)\>"
|
2014-05-16 20:21:34 +00:00
|
|
|
# Operators.
|
2020-04-21 10:47:08 +00:00
|
|
|
color green "\{|\}|\(|\)|\;|\[|\]|\\|<|>|!|=|&|\+|-|\*|%|/|\?:|\^|\|"
|
2014-05-16 20:21:34 +00:00
|
|
|
# Flow control.
|
2008-05-31 21:55:21 +00:00
|
|
|
color brightyellow "\<(for|if|while|do|else|in|delete|exit)\>"
|
|
|
|
color brightyellow "\<(break|continue|return)\>"
|
2014-05-16 20:21:34 +00:00
|
|
|
# I/O statements.
|
2018-11-03 20:20:06 +00:00
|
|
|
color brightgreen "\<(close|fflush|getline|next|nextfile|print|printf|system)\>"
|
2014-05-16 20:21:34 +00:00
|
|
|
# Standard functions.
|
2008-05-31 21:55:21 +00: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-16 20:21:34 +00:00
|
|
|
# Strings.
|
2008-05-31 21:55:21 +00:00
|
|
|
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
|
2014-05-16 20:21:34 +00:00
|
|
|
# Comments.
|
2008-05-31 21:55:21 +00:00
|
|
|
color brightblue "(^|[[:space:]])#.*$"
|
|
|
|
|
2014-05-16 20:21:34 +00:00
|
|
|
# Trailing whitespace.
|
2008-05-31 21:55:21 +00:00
|
|
|
color ,green "[[:space:]]+$"
|