diff --git a/autotests/folding/highlight.awk.fold b/autotests/folding/highlight.awk.fold
index 1aeb187..2ad62f1 100644
--- a/autotests/folding/highlight.awk.fold
+++ b/autotests/folding/highlight.awk.fold
@@ -1,28 +1,52 @@
#!/usr
# AWK hl test
# BEGIN and END are also matched as patterns
BEGIN {
p = 0;
}
/some pattern/ {
p++;
}
# / inside brackets is not considered end of expression
# a loose division operator (/) is not mismatched as a pattern.
$1 =~ /[^abc/]def/ || b == 3 / 5 {
gsub ( FILENAME );
}
# TODO and FIXME also work in comments in Awk.
# Also backslash in patterns works.
/\/usr\/bin\/awk/ { print "This is me"; }
END {
print p;
}
+
+function myfunc()
+{
+ print 42
+}
+
+/abc/,/a[b]c/{
+ # parameter with a regex
+ if (match($0, /a/)) {}
+
+ "x\ax\nx\ex\zx\023x\2x\xffx\xFf\xax\12x"
+
+ a =~ /[[:alpha:]]/
+ a =~ /[xx[:alpha:]xx]/
+ a =~ /[a-z[:alpha:]xx-]/
+ a =~ /[]a]/
+ a =~ /[-a]/
+ a =~ /[^]a]/
+ a =~ /[^-a]/
+ a =~ /[a]a\/\n/
+ # incomplete regex
+ a =~ /[xx[:alph
+ a = 23.2
+}
diff --git a/autotests/html/highlight.awk.html b/autotests/html/highlight.awk.html
index 594a2d6..d92268a 100644
--- a/autotests/html/highlight.awk.html
+++ b/autotests/html/highlight.awk.html
@@ -1,35 +1,59 @@
highlight.awk
#!/usr
# AWK hl test
# BEGIN and END are also matched as patterns
-BEGIN {
+BEGIN {
p = 0;
-}
+}
-/some pattern/ {
+/some pattern/ {
p++;
-}
+}
# / inside brackets is not considered end of expression
# a loose division operator (/) is not mismatched as a pattern.
-$1 =~ /[^abc/]def/ || b == 3 / 5 {
+$1 =~ /[^abc/]def/ || b == 3 / 5 {
gsub ( FILENAME );
-}
+}
# TODO and FIXME also work in comments in Awk.
# Also backslash in patterns works.
-/\/usr\/bin\/awk/ { print "This is me"; }
+/\/usr\/bin\/awk/ { print "This is me"; }
-END {
+END {
print p;
-}
+}
+
+function myfunc()
+{
+ print 42
+}
+
+/abc/,/a[b]c/{
+ # parameter with a regex
+ if (match($0, /a/)) {}
+
+ "x\ax\nx\ex\zx\023x\2x\xffx\xFf\xax\12x"
+
+ a =~ /[[:alpha:]]/
+ a =~ /[xx[:alpha:]xx]/
+ a =~ /[a-z[:alpha:]xx-]/
+ a =~ /[]a]/
+ a =~ /[-a]/
+ a =~ /[^]a]/
+ a =~ /[^-a]/
+ a =~ /[a]a\/\n/
+ # incomplete regex
+ a =~ /[xx[:alph
+ a = 23.2
+}
diff --git a/autotests/input/highlight.awk b/autotests/input/highlight.awk
index 47f10cf..a80c86a 100644
--- a/autotests/input/highlight.awk
+++ b/autotests/input/highlight.awk
@@ -1,28 +1,52 @@
#!/usr
# AWK hl test
# BEGIN and END are also matched as patterns
BEGIN {
p = 0;
}
/some pattern/ {
p++;
}
# / inside brackets is not considered end of expression
# a loose division operator (/) is not mismatched as a pattern.
$1 =~ /[^abc/]def/ || b == 3 / 5 {
gsub ( FILENAME );
}
# TODO and FIXME also work in comments in Awk.
# Also backslash in patterns works.
/\/usr\/bin\/awk/ { print "This is me"; }
END {
print p;
}
+
+function myfunc()
+{
+ print 42
+}
+
+/abc/,/a[b]c/{
+ # parameter with a regex
+ if (match($0, /a/)) {}
+
+ "x\ax\nx\ex\zx\023x\2x\xffx\xFf\xax\12x"
+
+ a =~ /[[:alpha:]]/
+ a =~ /[xx[:alpha:]xx]/
+ a =~ /[a-z[:alpha:]xx-]/
+ a =~ /[]a]/
+ a =~ /[-a]/
+ a =~ /[^]a]/
+ a =~ /[^-a]/
+ a =~ /[a]a\/\n/
+ # incomplete regex
+ a =~ /[xx[:alph
+ a = 23.2
+}
diff --git a/autotests/reference/highlight.awk.ref b/autotests/reference/highlight.awk.ref
index 0cfac76..7e0d278 100644
--- a/autotests/reference/highlight.awk.ref
+++ b/autotests/reference/highlight.awk.ref
@@ -1,28 +1,52 @@
#!/usr
# AWK hl test
# BEGIN and END are also matched as patterns
-BEGIN {
- p = 0;
-}
+BEGIN {
+ p = 0;
+}
-/some pattern/ {
- p++;
-}
+/some pattern/ {
+ p++;
+}
# / inside brackets is not considered end of expression
# a loose division operator (/) is not mismatched as a pattern.
-$1 =~ /[^abc/]def/ || b == 3 / 5 {
+$1 =~ /[^abc/]def/ || b == 3 / 5 {
- gsub ( FILENAME );
+ gsub ( FILENAME );
-}
+}
# TODO and FIXME also work in comments in Awk.
# Also backslash in patterns works.
-/\/usr\/bin\/awk/ { print "This is me"; }
-
-END {
- print p;
-}
+/\/usr\/bin\/awk/ { print "This is me"; }
+
+END {
+ print p;
+}
+
+function myfunc()
+{
+ print 42
+}
+
+/abc/,/a[b]c/{
+ # parameter with a regex
+ if (match($0, /a/)) {}
+
+ "x\ax\nx\ex\zx\023x\2x\xffx\xFf\xax\12x"
+
+ a =~ /[[:alpha:]]/
+ a =~ /[xx[:alpha:]xx]/
+ a =~ /[a-z[:alpha:]xx-]/
+ a =~ /[]a]/
+ a =~ /[-a]/
+ a =~ /[^]a]/
+ a =~ /[^-a]/
+ a =~ /[a]a\/\n/
+ # incomplete regex
+ a =~ /[xx[:alph
+ a = 23.2
+}
diff --git a/data/syntax/awk.xml b/data/syntax/awk.xml
index ed40bb3..9288a13 100644
--- a/data/syntax/awk.xml
+++ b/data/syntax/awk.xml
@@ -1,236 +1,288 @@
-
-
+
- if
- else
- while
- do
- for
- - in
- - continue
- break
+ - continue
+ - return
+ - switch
+ - case
+ - default
+ - exit
+
+
+ - in
+ - delete
- print
- printf
- getline
- function
- - return
- next
- nextfile
- - exit
- - switch
- - case
- - default
- @include
- @load
- ARGC
+ - ARGIND
- ARGV
+ - BINMODE
- CONVFMT
- ENVIRON
- ERRNO
+ - FIELDWIDTHS
- FILENAME
- FNR
- FPAT
- FS
- FUNCTAB
- IGNORECASE
+ - LINT
- NF
- NR
- OFMT
- OFS
- ORS
+ - PREC
- PROCINFO
+ - ROUNDMODE
- RS
+ - RT
- RSTART
- RLENGTH
- SUBSEP
- SYMTAB
+ - TEXTDOMAIN
+
+ - close
+ - fflush
+ - system
+
+ - atan2
+ - cos
+ - exp
+ - int
+ - log
+ - rand
+ - sin
+ - sqrt
+ - srand
+
- asort
- asorti
- - gsub
- gensub
+ - gsub
- index
- - isarray
- length
- - lshift
- match
- - mktime
- patsplit
- - rshift
- split
- sprintf
- - sround
- - strftime
- strtonum
- sub
- substr
- - systime
- tolower
- toupper
- - typeof
+
+ - mktime
+ - strftime
+ - systime
+
+ - and
+ - compl
+ - lshift
+ - or
+ - rshift
- xor
- - atan2
- - cos
- - exp
- - int
- - log
- - rand
- - sin
- - sqrt
- - srand
- - close
- - fflush
- - system
+
+ - isarray
+ - typeof
+
+ - bindtextdomain
+ - dcgettext
+ - dcngettext
- BEGIN
- BEGINFILE
- END
- ENDFILE
+
+ - alpha
+ - alnum
+ - blank
+ - cntrl
+ - digit
+ - graph
+ - lower
+ - print
+ - punct
+ - space
+ - upper
+ - xdigit
+
-
+
+
-
+
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
+
+
+
-
-
+
-
+
+
-
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
-
-
+
+
-
+