[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, master, updated. 6cda3c5e16cd67ed01c2bfb
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, master, updated. 6cda3c5e16cd67ed01c2bfb97e8463236bbcf069 |
Date: |
Tue, 31 May 2011 20:11:55 +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, master has been updated
via 6cda3c5e16cd67ed01c2bfb97e8463236bbcf069 (commit)
via 7c21fd7d7528b0be01ff030f820c5fe7fc242a41 (commit)
via c2efba1b80559c475a74622d16aa7361fa566251 (commit)
from 2c126c4972966714e2c3af8826c4161c30570041 (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=6cda3c5e16cd67ed01c2bfb97e8463236bbcf069
commit 6cda3c5e16cd67ed01c2bfb97e8463236bbcf069
Author: Arnold D. Robbins <address@hidden>
Date: Tue May 31 23:11:02 2011 +0300
Update pc and vms test suites.
diff --git a/pc/ChangeLog b/pc/ChangeLog
index c2ed1f0..e411a5f 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,11 @@
+Tue May 31 23:09:13 2011 Arnold D. Robbins <address@hidden>
+
+ * Makefile.tst: Sync with mainline version.
+
+Tue May 31 23:07:20 2011 Scott Deifik <address@hidden>
+
+ * Makefile.tst (fpat2): Fix the test.
+
Thu May 26 22:12:28 2011 Arnold D. Robbins <address@hidden>
* Makefile.tst: Sync with mainline version.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 920fa1a..825974e 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -140,7 +140,7 @@ BASIC_TESTS = \
ofmta ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf paramdup \
paramres paramtyp parse1 parsefld parseme pcntplus posix2008sub \
prdupval prec printf0 printf1 prmarscl prmreuse prt1eval prtoeval \
- rand range1 rebt8b1 redfilnm regeq reindops reparse resplit rs \
+ rand range1 rebt8b1 redfilnm regeq regrange reindops reparse resplit rs
\
rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 rstest3 rstest4 \
rstest5 rswhite scalar sclforin sclifin sortempty splitargv \
splitarr splitdef splitvar splitwht strcat1 strnum1 strtod subamp \
@@ -1398,6 +1398,11 @@ regeq:
@AWKPATH=$(srcdir) $(AWK) -f address@hidden < $(srcdir)/address@hidden
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+regrange:
+ @echo regrange
+ @AWKPATH=$(srcdir) $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
reindops:
@echo reindops
@AWKPATH=$(srcdir) $(AWK) -f address@hidden < $(srcdir)/address@hidden
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -1663,7 +1668,7 @@ fpat1:
fpat2:
@echo fpat2
- @AWKPATH=$(srcdir) $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
+ @AWKPATH=$(srcdir) $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
@-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
fpatnull:
diff --git a/vms/ChangeLog b/vms/ChangeLog
index e12be78..9cb0bf6 100644
--- a/vms/ChangeLog
+++ b/vms/ChangeLog
@@ -1,3 +1,7 @@
+Tue May 31 23:10:35 2011 Arnold D. Robbins <address@hidden>
+
+ * vmstest.com (regrange): New test.
+
Thu May 26 22:14:06 2011 Arnold D. Robbins <address@hidden>
* vmstest.com (fpat2): New test.
diff --git a/vms/vmstest.com b/vms/vmstest.com
index 717f8b9..5a2078a 100644
--- a/vms/vmstest.com
+++ b/vms/vmstest.com
@@ -69,7 +69,7 @@ $ list = "nfset nlfldsep nlinstr nlstrina
noeffect nofile" -
+ " posix2008sub prdupval prec printf0 printf1 prmarscl"
$ gosub list_of_tests
$ list = "prmreuse prt1eval prtoeval rand range1 rebt8b1" -
- + " redfilnm regeq reindops reparse resplit rs rsnul1nl" -
+ + " redfilnm regeq regrange reindops reparse resplit rs
rsnul1nl" -
+ " rsnulbig rsnulbig2 rstest1 rstest2 rstest3 rstest4" -
+ " rstest5 rswhite scalar sclforin sclifin sortempty" -
+ " splitargv splitarr splitdef splitvar splitwht" -
@@ -317,6 +317,7 @@ $procinfs:
$prt1eval:
$rebt8b1:
$rebt8b2:
+$regrange:
$regx8bit:
$sort1:
$sortu:
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=7c21fd7d7528b0be01ff030f820c5fe7fc242a41
commit 7c21fd7d7528b0be01ff030f820c5fe7fc242a41
Author: Arnold D. Robbins <address@hidden>
Date: Tue May 31 23:05:18 2011 +0300
Disallow gawk builtin/keyword as variable assignment.
diff --git a/ChangeLog b/ChangeLog
index 28603ed..1772c68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue May 31 23:01:00 2011 John Haque <address@hidden>
+
+ * re.c (check_bracket_exp): Use mem* routines instead of str*
+ for searching.
+ * main.c (arg_assign): Disallow builtin or user-defined function
+ as the name of a variable.
+ * awkgram.y (check_special): Rework so can be called from
+ arg_assign.
+
Tue May 31 22:23:41 2011 Arnold D. Robbins <address@hidden>
In order to attain the goal of having ranges act like they are
diff --git a/awkgram.c b/awkgram.c
index b588bc8..4edec57 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -6180,9 +6180,6 @@ retry:
break_allowed++;
if (tokentab[mid].flags & CONTINUE)
continue_allowed++;
- if ((do_traditional && (tokentab[mid].flags & GAWKX))
- || (do_posix && (tokentab[mid].flags & NOT_POSIX)))
- goto out;
switch (class) {
case LEX_INCLUDE:
@@ -8646,8 +8643,12 @@ check_special(const char *name)
high = mid - 1;
else if (i > 0) /* token > mid */
low = mid + 1;
- else
+ else {
+ if ((do_traditional && (tokentab[mid].flags & GAWKX))
+ || (do_posix && (tokentab[mid].flags &
NOT_POSIX)))
+ return -1;
return mid;
+ }
}
return -1;
}
diff --git a/awkgram.y b/awkgram.y
index d5b2a29..6b28b52 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -3490,9 +3490,6 @@ retry:
break_allowed++;
if (tokentab[mid].flags & CONTINUE)
continue_allowed++;
- if ((do_traditional && (tokentab[mid].flags & GAWKX))
- || (do_posix && (tokentab[mid].flags & NOT_POSIX)))
- goto out;
switch (class) {
case LEX_INCLUDE:
@@ -5956,8 +5953,12 @@ check_special(const char *name)
high = mid - 1;
else if (i > 0) /* token > mid */
low = mid + 1;
- else
+ else {
+ if ((do_traditional && (tokentab[mid].flags & GAWKX))
+ || (do_posix && (tokentab[mid].flags &
NOT_POSIX)))
+ return -1;
return mid;
+ }
}
return -1;
}
diff --git a/main.c b/main.c
index 034de70..b30924b 100644
--- a/main.c
+++ b/main.c
@@ -1137,6 +1137,7 @@ arg_assign(char *arg, int initing)
NODE *var;
NODE *it;
NODE **lhs;
+ long save_FNR;
if (! initing && disallow_var_assigns)
return FALSE; /* --exec */
@@ -1155,6 +1156,12 @@ arg_assign(char *arg, int initing)
*cp++ = '\0';
+ /* avoid false source indications in a fatal message */
+ source = NULL;
+ sourceline = 0;
+ save_FNR = FNR;
+ FNR = 0;
+
/* first check that the variable name has valid syntax */
badvar = FALSE;
if (! isalpha((unsigned char) arg[0]) && arg[0] != '_')
@@ -1174,6 +1181,15 @@ arg_assign(char *arg, int initing)
lintwarn(_("`%s' is not a variable name, looking for
file `%s=%s'"),
arg, arg, cp);
} else {
+ if (check_special(arg) >= 0)
+ fatal(_("cannot use gawk builtin `%s' as variable
name"), arg);
+
+ if (! initing) {
+ var = lookup(arg);
+ if (var != NULL && var->type == Node_func)
+ fatal(_("cannot use function `%s' as variable
name"), arg);
+ }
+
/*
* BWK awk expands escapes inside assignments.
* This makes sense, so we do it too.
@@ -1214,7 +1230,7 @@ arg_assign(char *arg, int initing)
if (! initing)
*--cp = '='; /* restore original text of ARGV */
-
+ FNR = save_FNR;
return ! badvar;
}
diff --git a/re.c b/re.c
index 1f220b3..a617831 100644
--- a/re.c
+++ b/re.c
@@ -541,16 +541,20 @@ check_bracket_exp(char *s, size_t length)
int i;
int found = FALSE;
char save;
- char *sp, *sp2;
+ char *sp, *sp2, *end;
int len;
int count = 0;
+ if (length == 0)
+ return;
+
+ end = s + length;
save = s[length];
s[length] = '\0';
sp = s;
again:
- sp = sp2 = strchr(sp, '[');
+ sp = sp2 = memchr(sp, '[', (end - sp));
if (sp == NULL)
goto done;
@@ -569,8 +573,10 @@ again:
warning(_("range of the form `[%c-%c]' is locale
dependant"),
sp[-1], sp[1]);
}
- if (count == 0)
+ if (count == 0) {
+ sp++; /* skip past ']' */
break;
+ }
}
if (count > 0) { /* bad regex, give up */
@@ -580,8 +586,11 @@ again:
/* sp2 has start */
for (i = 0; classes[i].name != NULL; i++) {
+ if (classes[i].warned)
+ continue;
len = classes[i].len;
- if (strncmp(sp2, classes[i].name, len) == 0) {
+ if ( len == (sp - sp2)
+ && memcmp(sp2, classes[i].name, len) == 0) {
found = TRUE;
break;
}
@@ -593,9 +602,7 @@ again:
classes[i].warned = TRUE;
}
- if (*sp != '\0') {
- if (*sp == ']')
- sp++;
+ if (*sp < end) {
found = FALSE;
goto again;
}
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=c2efba1b80559c475a74622d16aa7361fa566251
commit c2efba1b80559c475a74622d16aa7361fa566251
Author: Arnold D. Robbins <address@hidden>
Date: Tue May 31 22:52:23 2011 +0300
Rationalize range expansion in regexps.
diff --git a/ChangeLog b/ChangeLog
index d3ae5eb..28603ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+Tue May 31 22:23:41 2011 Arnold D. Robbins <address@hidden>
+
+ In order to attain the goal of having ranges act like they are
+ always in the C locale, bit the bullet and did the work in
+ the regex and dfa engines. The pre-processing routine was not
+ handling too many cases that a full regexp parser would catch.
+
+ * regex.h [RE_RANGES_IGNORE_LOCALES]: New syntax bit.
+ (RE_SYNTAX_GNU_AWK): Use it.
+ * dfa.c (parse_bracket_exp): If the RE_RANGES_IGNORE_LOCALES
+ is set, ignore locales when building a range.
+ * re.c (expand_range): Remove function and declaration.
+ (add_char): Remove function and declaration.
+ (make_regexp): Remove use of expand_range.
+ (resetup): Add RE_RANGES_IGNORE_LOCALES if --traditional.
+ * regcomp.c (build_range_exp): Add syntax variable as last argument.
+ Add code to check for RE_RANGES_IGNORE_LOCALES and do the right thing.
+ Adjust all calls.
+
Sun May 29 22:48:41 2011 Arnold D. Robbins <address@hidden>
* re.c (expand_range): Handle cases where expanded range
diff --git a/dfa.c b/dfa.c
index 7dbc4e9..02f3291 100644
--- a/dfa.c
+++ b/dfa.c
@@ -993,7 +993,8 @@ parse_bracket_exp (void)
c1 = tolower (c1);
c2 = tolower (c2);
}
- if (!hard_LC_COLLATE)
+ if (!hard_LC_COLLATE
+ || (syntax_bits & RE_RANGES_IGNORE_LOCALES))
for (c = c1; c <= c2; c++)
setbit_case_fold (c, ccl);
else
diff --git a/re.c b/re.c
index b317b09..1f220b3 100644
--- a/re.c
+++ b/re.c
@@ -27,7 +27,6 @@
static reg_syntax_t syn;
static void check_bracket_exp(char *s, size_t len);
-static char *expand_range(char *s, size_t *len);
/* make_regexp --- generate compiled regular expressions */
@@ -46,8 +45,6 @@ make_regexp(const char *s, size_t len, int ignorecase, int
dfa, int canfatal)
static short no_dfa = FALSE;
int has_anchor = FALSE;
int may_have_range = 0;
- char *newbuf;
- size_t newlen;
reg_syntax_t dfa_syn;
/*
@@ -176,24 +173,6 @@ make_regexp(const char *s, size_t len, int ignorecase, int
dfa, int canfatal)
*dest = '\0';
len = dest - buf;
- if ( ! do_posix
- && may_have_range >= 3
- && memchr(buf, '-', len) != NULL) {
- newlen = len;
- newbuf = expand_range(buf, & newlen);
-
- /* song and dance since buf & buflen are static */
- if (newlen > buflen) {
- free(buf);
- buf = newbuf;
- buflen = newlen;
- } else {
- memcpy(buf, newbuf, newlen);
- free(newbuf);
- }
- len = newlen;
- }
-
emalloc(rp, Regexp *, sizeof(*rp), "make_regexp");
memset((char *) rp, 0, sizeof(*rp));
rp->dfareg = NULL;
@@ -403,9 +382,10 @@ resetup()
{
if (do_posix)
syn = RE_SYNTAX_POSIX_AWK; /* strict POSIX re's */
- else if (do_traditional)
+ else if (do_traditional) {
syn = RE_SYNTAX_AWK; /* traditional Unix awk re's */
- else
+ syn |= RE_RANGES_IGNORE_LOCALES;
+ } else
syn = RE_SYNTAX_GNU_AWK; /* POSIX re's + GNU ops */
/*
@@ -622,142 +602,3 @@ again:
done:
s[length] = save;
}
-
-/* add_char --- add a character to the buffer, grow it if needed */
-
-static void
-add_char(char **bufp, size_t *lenp, char ch, char **ptr)
-{
- size_t newlen;
- size_t offset;
-
- if (*ptr - *bufp < *lenp) {
- **ptr = ch;
- (*ptr)++;
- return;
- }
-
- /* have to grow the buffer and adjust the pointers */
- offset = (*ptr - *bufp);
- newlen = offset * 2;
- erealloc(*bufp, char *, newlen + 2, "add_char");
- *ptr = *bufp + offset;
- **ptr = ch;
- *lenp = newlen + 2;
- (*ptr)++;
-}
-
-/* expand_range --- turn [b-e] into [bcde] */
-
-static char *
-expand_range(char *s, size_t *lenp)
-{
- char *sp, *sp2, *newbuf;
- size_t len;
- int count = 0;
- size_t newbuf_len = *lenp * 2;
-
- emalloc(newbuf, char *, newbuf_len, "expand_range");
-
- sp = s;
- sp2 = newbuf;
- len = *lenp;
-#define copy() (add_char(& newbuf, & newbuf_len, *sp++, & sp2), len--)
-#define copych(ch) (add_char(& newbuf, & newbuf_len, ch, & sp2))
-again:
- while (len > 0) {
- if (*sp == '\\') {
- copy();
- copy();
- }
- else if (*sp == '[') {
- count++;
- break;
- }
- else
- copy();
- }
- if (len == 0)
- goto done;
-
- copy(); /* copy in the [ */
- if (*sp == '^') /* allow for negation of range */
- copy();
-
- /*
- * Minus as first character after [ or ^ is literal,
- * just copy it and skip over.
- */
- if (*sp == '-')
- copy();
-
- while (count > 0 && len > 0) {
- if (*sp == '\\') {
- copy();
- copy();
- continue;
- }
- if (*sp == '[') {
- count++;
- copy();
- continue;
- }
- if (*sp == ']') {
- count--;
- copy();
- if (count == 0)
- goto again;
- else
- continue;
- }
-
- if (count == 1) {
- /* inside [...] but not inside [[:...:]] */
- if (*sp == '-') {
- int start, end;
- int i;
-
- if (sp[1] == ']') { /* also literal */
- copy();
- continue;
- }
-
- /* It's a range, expand it. */
- start = sp[-1];
- if (sp[1] == '\\') {
- sp++;
- len--;
- }
- end = sp[1];
- if (end < start)
- fatal(_("Invalid range end: /%.*s/"),
- *lenp, s);
- for (i = start + 1; i < end; i++) {
- /*
- * Will the special cases never end?
- */
- if (i == '\\' || i == ']') {
- copych('\\');
- }
- copych(i);
- }
- sp++;
- len--;
- continue;
- }
- else
- copy();
- } else {
- copy();
- }
- }
-
- if (len > 0)
- goto again;
-
-done:
- *lenp = sp2 - newbuf;
- return newbuf;
-}
-#undef copy
-#undef copych
diff --git a/regcomp.c b/regcomp.c
index ab37a6f..e0b158d 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2643,13 +2643,15 @@ static reg_errcode_t
internal_function
# ifdef RE_ENABLE_I18N
build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc,
- bracket_elem_t *start_elem, bracket_elem_t *end_elem)
+ bracket_elem_t *start_elem, bracket_elem_t *end_elem,
reg_syntax_t syntax)
# else /* not RE_ENABLE_I18N */
build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
- bracket_elem_t *end_elem)
+ bracket_elem_t *end_elem, reg_syntax_t syntax)
# endif /* not RE_ENABLE_I18N */
{
unsigned int start_ch, end_ch;
+ int ignore_locales = (syntax & RE_RANGES_IGNORE_LOCALES) != 0;
+
/* Equivalence Classes and Character Classes can't be a range start/end. */
if (BE (start_elem->type == EQUIV_CLASS || start_elem->type == CHAR_CLASS
|| end_elem->type == EQUIV_CLASS || end_elem->type == CHAR_CLASS,
@@ -2697,7 +2699,9 @@ build_range_exp (bitset_t sbcset, bracket_elem_t
*start_elem,
return REG_ECOLLATE;
cmp_buf[0] = start_wc;
cmp_buf[4] = end_wc;
- if (wcscoll (cmp_buf, cmp_buf + 4) > 0)
+ if (ignore_locales && start_wc > end_wc)
+ return REG_ERANGE;
+ else if (wcscoll (cmp_buf, cmp_buf + 4) > 0)
return REG_ERANGE;
/* Got valid collation sequence values, add them as a new entry.
@@ -2736,12 +2740,23 @@ build_range_exp (bitset_t sbcset, bracket_elem_t
*start_elem,
}
/* Build the table for single byte characters. */
- for (wc = 0; wc < SBC_MAX; ++wc)
+ if (ignore_locales)
+ {
+ for (wc = 0; wc < SBC_MAX; ++wc)
+ {
+ if (start_wc <= wc && wc <= end_wc)
+ bitset_set (sbcset, wc);
+ }
+ }
+ else
{
- cmp_buf[2] = wc;
- if (wcscoll (cmp_buf, cmp_buf + 2) <= 0
- && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0)
- bitset_set (sbcset, wc);
+ for (wc = 0; wc < SBC_MAX; ++wc)
+ {
+ cmp_buf[2] = wc;
+ if (wcscoll (cmp_buf, cmp_buf + 2) <= 0
+ && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0)
+ bitset_set (sbcset, wc);
+ }
}
}
# else /* not RE_ENABLE_I18N */
@@ -3201,14 +3216,14 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa,
re_token_t *token,
#ifdef _LIBC
*err = build_range_exp (sbcset, mbcset, &range_alloc,
- &start_elem, &end_elem);
+ &start_elem, &end_elem, syntax);
#else
# ifdef RE_ENABLE_I18N
*err = build_range_exp (sbcset,
dfa->mb_cur_max > 1 ? mbcset : NULL,
- &range_alloc, &start_elem, &end_elem);
+ &range_alloc, &start_elem, &end_elem, syntax);
# else
- *err = build_range_exp (sbcset, &start_elem, &end_elem);
+ *err = build_range_exp (sbcset, &start_elem, &end_elem, syntax);
# endif
#endif /* RE_ENABLE_I18N */
if (BE (*err != REG_NOERROR, 0))
diff --git a/regex.h b/regex.h
index 6bc503b..a2d120f 100644
--- a/regex.h
+++ b/regex.h
@@ -184,6 +184,10 @@ typedef unsigned long int reg_syntax_t;
/* If this bit is set, then no_sub will be set to 1 during
re_compile_pattern. */
# define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
+
+/* If this bit is set, then ranges act like they are in
+ the "C" locale. */
+# define RE_RANGES_IGNORE_LOCALES (RE_NO_SUB << 1)
#endif
/* This global variable defines the particular regexp syntax to use (for
@@ -209,6 +213,7 @@ extern reg_syntax_t re_syntax_options;
#define RE_SYNTAX_GNU_AWK \
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
+ | RE_RANGES_IGNORE_LOCALES \
| RE_INVALID_INTERVAL_ORD) \
& ~(RE_DOT_NOT_NULL | RE_CONTEXT_INDEP_OPS \
| RE_CONTEXT_INVALID_OPS ))
diff --git a/test/ChangeLog b/test/ChangeLog
index f28153a..764fd90 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+Tue May 31 22:50:28 2011 Arnold D. Robbins <address@hidden>
+
+ * regrange.awk, regrange.ok: New files.
+ * Makefile.am (regrange): New test.
+
Thu May 26 22:08:27 2011 Arnold D. Robbins <address@hidden>
* fpat2.awk, fpat2.ok: New files. Thanks to Pat Rankin for the cases.
diff --git a/test/Makefile.am b/test/Makefile.am
index 065bff1..e3dbce0 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -579,6 +579,8 @@ EXTRA_DIST = \
regeq.awk \
regeq.in \
regeq.ok \
+ regrange.awk \
+ regrange.ok \
regtest.sh \
regx8bit.awk \
regx8bit.ok \
@@ -771,8 +773,8 @@ BASIC_TESTS = \
ofmta ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf paramdup \
paramres paramtyp parse1 parsefld parseme pcntplus posix2008sub \
prdupval prec printf0 printf1 prmarscl prmreuse prt1eval prtoeval \
- rand range1 rebt8b1 redfilnm regeq reindops reparse resplit rs \
- rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 rstest3 rstest4 \
+ rand range1 rebt8b1 redfilnm regeq regrange reindops reparse resplit \
+ rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 rstest3 rstest4 \
rstest5 rswhite scalar sclforin sclifin sortempty splitargv \
splitarr splitdef splitvar splitwht strcat1 strnum1 strtod subamp \
subi18n subsepnm subslash substr swaplns synerr1 synerr2 tradanch \
diff --git a/test/Makefile.in b/test/Makefile.in
index 1fa42e3..3de264e 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -764,6 +764,8 @@ EXTRA_DIST = \
regeq.awk \
regeq.in \
regeq.ok \
+ regrange.awk \
+ regrange.ok \
regtest.sh \
regx8bit.awk \
regx8bit.ok \
@@ -956,8 +958,8 @@ BASIC_TESTS = \
ofmta ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf paramdup \
paramres paramtyp parse1 parsefld parseme pcntplus posix2008sub \
prdupval prec printf0 printf1 prmarscl prmreuse prt1eval prtoeval \
- rand range1 rebt8b1 redfilnm regeq reindops reparse resplit rs \
- rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 rstest3 rstest4 \
+ rand range1 rebt8b1 redfilnm regeq regrange reindops reparse resplit \
+ rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 rstest3 rstest4 \
rstest5 rswhite scalar sclforin sclifin sortempty splitargv \
splitarr splitdef splitvar splitwht strcat1 strnum1 strtod subamp \
subi18n subsepnm subslash substr swaplns synerr1 synerr2 tradanch \
@@ -2367,6 +2369,11 @@ regeq:
@AWKPATH=$(srcdir) $(AWK) -f address@hidden < $(srcdir)/address@hidden
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+regrange:
+ @echo regrange
+ @AWKPATH=$(srcdir) $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
reindops:
@echo reindops
@AWKPATH=$(srcdir) $(AWK) -f address@hidden < $(srcdir)/address@hidden
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 7577b89..243d07b 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -645,6 +645,11 @@ regeq:
@AWKPATH=$(srcdir) $(AWK) -f address@hidden < $(srcdir)/address@hidden
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+regrange:
+ @echo regrange
+ @AWKPATH=$(srcdir) $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
reindops:
@echo reindops
@AWKPATH=$(srcdir) $(AWK) -f address@hidden < $(srcdir)/address@hidden
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/regrange.awk b/test/regrange.awk
new file mode 100644
index 0000000..7187931
--- /dev/null
+++ b/test/regrange.awk
@@ -0,0 +1,30 @@
+# Tests due to John Haque, May 2011
+#
+# The following should be fatal; can't catch them inside awk, though
+# $> echo 'a' | ./gawk '/[z-a]/ { print }'
+# $> echo 'A' | ./gawk '/[+-[:digit:]]/'
+
+BEGIN {
+ char[1] = "."
+ pat[1] = "[--\\/]"
+
+ char[2] = "a"
+ pat[2] = "[]-c]"
+
+ char[3] = "c"
+ pat[3] = "[[a-d]"
+
+ char[4] = "\\"
+ pat[4] = "[\\[-\\]]"
+
+ char[5] = "[.c.]"
+ pat[5] = "[a-[.e.]]"
+
+ char[6] = "[.d.]"
+ pat[6] = "[[.c.]-[.z.]]"
+
+ for (i = 1; i in char; i++) {
+ printf("\"%s\" ~ /%s/ --> %d\n", char[i], pat[i],
+ char[i] ~ pat[i])
+ }
+}
diff --git a/test/regrange.ok b/test/regrange.ok
new file mode 100644
index 0000000..1fa00c7
--- /dev/null
+++ b/test/regrange.ok
@@ -0,0 +1,6 @@
+"." ~ /[--\/]/ --> 1
+"a" ~ /[]-c]/ --> 1
+"c" ~ /[[a-d]/ --> 1
+"\" ~ /[\[-\]]/ --> 1
+"[.c.]" ~ /[a-[.e.]]/ --> 1
+"[.d.]" ~ /[[.c.]-[.z.]]/ --> 0
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 28 ++++++++
awkgram.c | 9 ++-
awkgram.y | 9 ++-
dfa.c | 3 +-
main.c | 18 +++++-
pc/ChangeLog | 8 ++
pc/Makefile.tst | 9 ++-
re.c | 186 +++++------------------------------------------------
regcomp.c | 37 ++++++++---
regex.h | 5 ++
test/ChangeLog | 5 ++
test/Makefile.am | 6 +-
test/Makefile.in | 11 +++-
test/Maketests | 5 ++
test/regrange.awk | 30 +++++++++
test/regrange.ok | 6 ++
vms/ChangeLog | 4 +
vms/vmstest.com | 3 +-
18 files changed, 185 insertions(+), 197 deletions(-)
create mode 100644 test/regrange.awk
create mode 100644 test/regrange.ok
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, master, updated. 6cda3c5e16cd67ed01c2bfb97e8463236bbcf069,
Arnold Robbins <=