[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk-4.0-stable, updated. a7c502a756732e
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk-4.0-stable, updated. a7c502a756732ec9a1773d6169376bb7b25f4308 |
Date: |
Mon, 11 Mar 2013 20:46:43 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-4.0-stable has been updated
via a7c502a756732ec9a1773d6169376bb7b25f4308 (commit)
from 2b02c5c64a93608c347ffaa312d88d52f93888da (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=a7c502a756732ec9a1773d6169376bb7b25f4308
commit a7c502a756732ec9a1773d6169376bb7b25f4308
Author: Arnold D. Robbins <address@hidden>
Date: Mon Mar 11 22:45:22 2013 +0200
Fix a bug with ] as real char in regexps.
diff --git a/ChangeLog b/ChangeLog
index 2ebb6eb..dc2af7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-03-11 Arnold D. Robbins <address@hidden>
+
+ * re.c (check_bracket_exp): Make handling of embedded ] in
+ regexp smarter. Thanks to Ed Morton <address@hidden>
+ for reporting the bug.
+
2013-02-26 Arnold D. Robbins <address@hidden>
* parse.y (expression_list): In case of error return the list
diff --git a/re.c b/re.c
index 711b53e..4c03177 100644
--- a/re.c
+++ b/re.c
@@ -564,8 +564,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 bd78c51..9774277 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-11 Arnold D. Robbins <address@hidden>
+
+ * Makefile.am (colonwarn): New test.
+ * colonwarn.awk, colonwarn.in, colonwarn.ok: New files.
+
2013-02-26 Arnold D. Robbins <address@hidden>
* parseme.ok: Update after change in grammar. Now with new and
diff --git a/test/Makefile.am b/test/Makefile.am
index f59aa52..ee57bdd 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 \
@@ -848,7 +851,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 \
fwtest fwtest2 fwtest3 \
gensub gensub2 getlndir gnuops2 gnuops3 gnureops \
@@ -1487,6 +1490,13 @@ reginttrad:
@$(AWK) --traditional -r -f address@hidden > _$@
@-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+colonwarn:
+ @echo $@
+ @for i in 1 2 3 ; \
+ do $(AWK) -f $(srcdir)/address@hidden $$i < $(srcdir)/address@hidden ; \
+ done > _$@
+ @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
# Targets generated for other tests:
include Maketests
diff --git a/test/Makefile.in b/test/Makefile.in
index 3066c31..b6aa3f6 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -338,6 +338,9 @@ EXTRA_DIST = \
clsflnam.awk \
clsflnam.in \
clsflnam.ok \
+ colonwarn.awk \
+ colonwarn.in \
+ colonwarn.ok \
compare.awk \
compare.in \
compare.ok \
@@ -1052,7 +1055,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 \
fwtest fwtest2 fwtest3 \
gensub gensub2 getlndir gnuops2 gnuops3 gnureops \
@@ -1863,6 +1866,13 @@ reginttrad:
@echo $@
@$(AWK) --traditional -r -f address@hidden > _$@
@-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
+colonwarn:
+ @echo $@
+ @for i in 1 2 3 ; \
+ do $(AWK) -f $(srcdir)/address@hidden $$i < $(srcdir)/address@hidden ; \
+ done > _$@
+ @-$(CMP) $(srcdir)/address@hidden _$@ && 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 0000000..0b0650e
--- /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 0000000..d34368d
--- /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 0000000..d084ee3
--- /dev/null
+++ b/test/colonwarn.ok
@@ -0,0 +1,3 @@
+ab
+ab
+]b
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 ++++++
re.c | 18 ++++++++++++++++--
test/ChangeLog | 5 +++++
test/Makefile.am | 12 +++++++++++-
test/Makefile.in | 12 +++++++++++-
test/colonwarn.awk | 4 ++++
test/colonwarn.in | 1 +
test/colonwarn.ok | 3 +++
8 files changed, 57 insertions(+), 4 deletions(-)
create mode 100644 test/colonwarn.awk
create mode 100644 test/colonwarn.in
create mode 100644 test/colonwarn.ok
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk-4.0-stable, updated. a7c502a756732ec9a1773d6169376bb7b25f4308,
Arnold Robbins <=