diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-03-11 22:50:11 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-03-11 22:50:11 +0200 |
commit | 891b30a5417f93c3fc5e5aa4d54e270282bea380 (patch) | |
tree | 149a8e67e1df432845988a04669f677a77392d25 | |
parent | 840661815d5063942b4475a908af423cf6bc813c (diff) | |
parent | a7c502a756732ec9a1773d6169376bb7b25f4308 (diff) | |
download | egawk-891b30a5417f93c3fc5e5aa4d54e270282bea380.tar.gz egawk-891b30a5417f93c3fc5e5aa4d54e270282bea380.tar.bz2 egawk-891b30a5417f93c3fc5e5aa4d54e270282bea380.zip |
Merge branch 'gawk-4.0-stable'
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | re.c | 18 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 12 | ||||
-rw-r--r-- | test/Makefile.in | 12 | ||||
-rw-r--r-- | test/colonwarn.awk | 4 | ||||
-rw-r--r-- | test/colonwarn.in | 1 | ||||
-rw-r--r-- | test/colonwarn.ok | 3 |
8 files changed, 57 insertions, 4 deletions
@@ -1,3 +1,9 @@ +2013-03-11 Arnold D. Robbins <arnold@skeeve.com> + + * re.c (check_bracket_exp): Make handling of embedded ] in + regexp smarter. Thanks to Ed Morton <mortoneccc@comcast.net> + for reporting the bug. + 2013-02-28 Arnold D. Robbins <arnold@skeeve.com> Cause profiling / pretty printing to include a list of @@ -559,8 +559,22 @@ again: if (*sp == '[') count++; - else if (*sp == ']') - count--; + /* + * ] as first char after open [ is skipped + * \] is skipped + * [^]] is skipped + */ + if (*sp == ']' && sp > sp2) { + if (sp[-1] != '[' + && sp[-1] != '\\') + ; + else if ((sp - sp2) >= 2 + && sp[-1] == '^' && sp[-2] == '[') + ; + else + count--; + } + if (*sp == '-' && do_lint && ! range_warned && count == 1 && sp[-1] != '[' && sp[1] != ']' && ! isdigit((unsigned char) sp[-1]) && ! isdigit((unsigned char) sp[1]) diff --git a/test/ChangeLog b/test/ChangeLog index 652480b2..031bbd1d 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2013-03-11 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (colonwarn): New test. + * colonwarn.awk, colonwarn.in, colonwarn.ok: New files. + 2013-02-26 Arnold D. Robbins <arnold@skeeve.com> * parseme.ok: Update after change in grammar. Now with new and diff --git a/test/Makefile.am b/test/Makefile.am index c45be575..1859932e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -134,6 +134,9 @@ EXTRA_DIST = \ clsflnam.awk \ clsflnam.in \ clsflnam.ok \ + colonwarn.awk \ + colonwarn.in \ + colonwarn.ok \ compare.awk \ compare.in \ compare.ok \ @@ -953,7 +956,7 @@ UNIX_TESTS = \ GAWK_EXT_TESTS = \ aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \ backw badargs beginfile1 beginfile2 binmode1 charasbytes \ - clos1way delsub devfd devfd1 devfd2 dumpvars exit \ + colonwarn clos1way delsub devfd devfd1 devfd2 dumpvars exit \ fieldwdth fpat1 fpat2 fpat3 fpatnull fsfwfs funlen \ functab1 functab2 functab3 \ fwtest fwtest2 fwtest3 \ @@ -1787,6 +1790,13 @@ reginttrad: @$(AWK) --traditional -r -f $(srcdir)/$@.awk > _$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +colonwarn: + @echo $@ + @for i in 1 2 3 ; \ + do $(AWK) -f $(srcdir)/$@.awk $$i < $(srcdir)/$@.in ; \ + done > _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # Targets generated for other tests: include Maketests diff --git a/test/Makefile.in b/test/Makefile.in index e1a44a5a..f320a720 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -346,6 +346,9 @@ EXTRA_DIST = \ clsflnam.awk \ clsflnam.in \ clsflnam.ok \ + colonwarn.awk \ + colonwarn.in \ + colonwarn.ok \ compare.awk \ compare.in \ compare.ok \ @@ -1164,7 +1167,7 @@ UNIX_TESTS = \ GAWK_EXT_TESTS = \ aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \ backw badargs beginfile1 beginfile2 binmode1 charasbytes \ - clos1way delsub devfd devfd1 devfd2 dumpvars exit \ + colonwarn clos1way delsub devfd devfd1 devfd2 dumpvars exit \ fieldwdth fpat1 fpat2 fpat3 fpatnull fsfwfs funlen \ functab1 functab2 functab3 \ fwtest fwtest2 fwtest3 \ @@ -2165,6 +2168,13 @@ reginttrad: @echo $@ @$(AWK) --traditional -r -f $(srcdir)/$@.awk > _$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +colonwarn: + @echo $@ + @for i in 1 2 3 ; \ + do $(AWK) -f $(srcdir)/$@.awk $$i < $(srcdir)/$@.in ; \ + done > _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: diff --git a/test/colonwarn.awk b/test/colonwarn.awk new file mode 100644 index 00000000..0b0650e0 --- /dev/null +++ b/test/colonwarn.awk @@ -0,0 +1,4 @@ +BEGIN { pattern = ARGV[1] + 0; delete ARGV } +pattern == 1 { sub(/[][:space:]]/,""); print } +pattern == 2 { sub(/[\][:space:]]/,""); print } +pattern == 3 { sub(/[^][:space:]]/,""); print } diff --git a/test/colonwarn.in b/test/colonwarn.in new file mode 100644 index 00000000..d34368d7 --- /dev/null +++ b/test/colonwarn.in @@ -0,0 +1 @@ +a]b diff --git a/test/colonwarn.ok b/test/colonwarn.ok new file mode 100644 index 00000000..d084ee3d --- /dev/null +++ b/test/colonwarn.ok @@ -0,0 +1,3 @@ +ab +ab +]b |