diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | awkgram.c | 6 | ||||
-rw-r--r-- | awkgram.y | 8 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 7 | ||||
-rw-r--r-- | test/Makefile.in | 12 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/regexpbrack.awk | 2 | ||||
-rw-r--r-- | test/regexpbrack.in | 0 | ||||
-rw-r--r-- | test/regexpbrack.ok | 0 |
10 files changed, 34 insertions, 13 deletions
@@ -1,6 +1,8 @@ 2015-01-07 Arnold D. Robbins <arnold@skeeve.com> * configure.ac: Update debug flags if developing. + * awkgram.y (yylex): Regex parsing bug fix for bracket expressions. + Thanks to Mike Brennan for the report. 2014-12-10 Arnold D. Robbins <arnold@skeeve.com> @@ -5374,10 +5374,8 @@ yylex(void) pushback(); break; case ']': - if (tokstart[0] == '[' - && (tok == tokstart + 1 - || (tok == tokstart + 2 - && tokstart[1] == '^'))) + if (tok[-1] == '[' + || (tok[-2] == '[' && tok[-1] == '^')) /* do nothing */; else in_brack--; @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2014 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2015 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -3035,10 +3035,8 @@ yylex(void) pushback(); break; case ']': - if (tokstart[0] == '[' - && (tok == tokstart + 1 - || (tok == tokstart + 2 - && tokstart[1] == '^'))) + if (tok[-1] == '[' + || (tok[-2] == '[' && tok[-1] == '^')) /* do nothing */; else in_brack--; diff --git a/test/ChangeLog b/test/ChangeLog index 8d39af74..95134f6b 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2015-01-07 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (regexpbrack): New test. + * regexpbrack.awk, regexpbrack.in, regexpbrack.ok: New files. + 2014-12-24 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (badbuild): New test. diff --git a/test/Makefile.am b/test/Makefile.am index b93f851f..df0da10c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,7 +1,7 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2014 the Free Software Foundation, Inc. +# Copyright (C) 1988-2015 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -742,6 +742,9 @@ EXTRA_DIST = \ regeq.awk \ regeq.in \ regeq.ok \ + regexpbrack.awk \ + regexpbrack.in \ + regexpbrack.ok \ regexprange.awk \ regexprange.ok \ reginttrad.awk \ @@ -999,7 +1002,7 @@ BASIC_TESTS = \ paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \ pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \ prt1eval prtoeval \ - rand range1 rebt8b1 redfilnm regeq regexprange regrange reindops \ + rand range1 rebt8b1 redfilnm regeq regexpbrack regexprange regrange reindops \ reparse resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \ rstest3 rstest4 rstest5 rswhite \ scalar sclforin sclifin sortempty sortglos splitargv splitarr splitdef \ diff --git a/test/Makefile.in b/test/Makefile.in index 7a281eca..5bd39f45 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -17,7 +17,7 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2014 the Free Software Foundation, Inc. +# Copyright (C) 1988-2015 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -989,6 +989,9 @@ EXTRA_DIST = \ regeq.awk \ regeq.in \ regeq.ok \ + regexpbrack.awk \ + regexpbrack.in \ + regexpbrack.ok \ regexprange.awk \ regexprange.ok \ reginttrad.awk \ @@ -1245,7 +1248,7 @@ BASIC_TESTS = \ paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \ pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \ prt1eval prtoeval \ - rand range1 rebt8b1 redfilnm regeq regexprange regrange reindops \ + rand range1 rebt8b1 redfilnm regeq regexpbrack regexprange regrange reindops \ reparse resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \ rstest3 rstest4 rstest5 rswhite \ scalar sclforin sclifin sortempty sortglos splitargv splitarr splitdef \ @@ -3122,6 +3125,11 @@ regeq: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +regexpbrack: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + regexprange: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index e1b92bf9..4104f142 100644 --- a/test/Maketests +++ b/test/Maketests @@ -697,6 +697,11 @@ regeq: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +regexpbrack: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + regexprange: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/regexpbrack.awk b/test/regexpbrack.awk new file mode 100644 index 00000000..136cd194 --- /dev/null +++ b/test/regexpbrack.awk @@ -0,0 +1,2 @@ +/[]+()0-9.,$%/'"-]*$/ +/^[]+()0-9.,$%/'"-]*$/ diff --git a/test/regexpbrack.in b/test/regexpbrack.in new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/regexpbrack.in diff --git a/test/regexpbrack.ok b/test/regexpbrack.ok new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/regexpbrack.ok |