aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--support/ChangeLog5
-rw-r--r--support/dfa.c35
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am5
-rw-r--r--test/Makefile.in10
-rw-r--r--test/Maketests5
-rw-r--r--test/dfacheck1.awk1
-rw-r--r--test/dfacheck1.in1
-rw-r--r--test/dfacheck1.ok1
9 files changed, 61 insertions, 7 deletions
diff --git a/support/ChangeLog b/support/ChangeLog
index 00753047..424dbdd5 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ * dfa.c; Sync with GNULIB, bugfix for \b (\y in gawk)
+ in the C locale.
+
2018-12-18 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (distclean-local): Remove .deps directory.
diff --git a/support/dfa.c b/support/dfa.c
index 612faa10..7687aca0 100644
--- a/support/dfa.c
+++ b/support/dfa.c
@@ -2345,6 +2345,26 @@ epsclosure (struct dfa const *d)
free (tmp.elems);
}
+/* Returns the set of contexts for which there is at least one
+ character included in C. */
+
+static int
+charclass_context (struct dfa const *dfa, charclass const *c)
+{
+ int context = 0;
+
+ for (unsigned int j = 0; j < CHARCLASS_WORDS; ++j)
+ {
+ if (c->w[j] & dfa->syntax.newline.w[j])
+ context |= CTX_NEWLINE;
+ if (c->w[j] & dfa->syntax.letters.w[j])
+ context |= CTX_LETTER;
+ if (c->w[j] & ~(dfa->syntax.letters.w[j] | dfa->syntax.newline.w[j]))
+ context |= CTX_NONE;
+ }
+
+ return context;
+}
/* Returns the contexts on which the position set S depends. Each context
in the set of returned contexts (let's call it SC) may have a different
follow set than other contexts in SC, and also different from the
@@ -3137,17 +3157,22 @@ build_state (state_num s, struct dfa *d, unsigned char uc)
/* Find out if the new state will want any context information,
by calculating possible contexts that the group can match,
and separate contexts that the new state wants to know. */
+ int possible_contexts = charclass_context (d, &label);
int separate_contexts = state_separate_contexts (d, &group);
/* Find the state(s) corresponding to the union of the follows. */
- if (d->syntax.sbit[uc] & separate_contexts & CTX_NEWLINE)
- state = state_index (d, &group, CTX_NEWLINE);
- else if (d->syntax.sbit[uc] & separate_contexts & CTX_LETTER)
- state = state_index (d, &group, CTX_LETTER);
- else
+ if (possible_contexts & ~separate_contexts)
state = state_index (d, &group, separate_contexts ^ CTX_ANY);
+ else
+ state = -1;
+ if (separate_contexts & possible_contexts & CTX_NEWLINE)
+ state_newline = state_index (d, &group, CTX_NEWLINE);
+ else
state_newline = state;
+ if (separate_contexts & possible_contexts & CTX_LETTER)
+ state_letter = state_index (d, &group, CTX_LETTER);
+ else
state_letter = state;
/* Reallocate now, to reallocate any newline transition properly. */
diff --git a/test/ChangeLog b/test/ChangeLog
index 96375390..d8620b98 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): New test: dfacheck1.
+ * dfacheck1.awk, dfacheck1.in, dfacheck1.ok: New files.
+
2018-11-25 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (GAWK_EXT_TESTS): Fix layout of the list.
diff --git a/test/Makefile.am b/test/Makefile.am
index e1ecc649..fd2b9402 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -241,6 +241,9 @@ EXTRA_DIST = \
devfd1.awk \
devfd1.ok \
devfd2.ok \
+ dfacheck.awk \
+ dfacheck.in \
+ dfacheck.ok \
dfamb1.awk \
dfamb1.in \
dfamb1.ok \
@@ -1293,7 +1296,7 @@ GAWK_EXT_TESTS = \
charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
clos1way6 crlf \
dbugeval dbugeval2 dbugtypedre1 dbugtypedre2 delsub \
- devfd devfd1 devfd2 dumpvars \
+ devfd devfd1 devfd2 dfacheck1 dumpvars \
errno exit \
fieldwdth forcenum fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 fpatnull fsfwfs \
funlen functab1 functab2 functab3 fwtest fwtest2 fwtest3 fwtest4 \
diff --git a/test/Makefile.in b/test/Makefile.in
index 1e3fe2ee..a22373ef 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -499,6 +499,9 @@ EXTRA_DIST = \
devfd1.awk \
devfd1.ok \
devfd2.ok \
+ dfacheck.awk \
+ dfacheck.in \
+ dfacheck.ok \
dfamb1.awk \
dfamb1.in \
dfamb1.ok \
@@ -1551,7 +1554,7 @@ GAWK_EXT_TESTS = \
charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
clos1way6 crlf \
dbugeval dbugeval2 dbugtypedre1 dbugtypedre2 delsub \
- devfd devfd1 devfd2 dumpvars \
+ devfd devfd1 devfd2 dfacheck1 dumpvars \
errno exit \
fieldwdth forcenum fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 fpatnull fsfwfs \
funlen functab1 functab2 functab3 fwtest fwtest2 fwtest3 fwtest4 \
@@ -4002,6 +4005,11 @@ delsub:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+dfacheck1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
exit:
@echo $@
@-$(LOCALES) AWK="$(AWKPROG)" "$(srcdir)"/$@.sh > _$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 65f0197c..05804988 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1330,6 +1330,11 @@ delsub:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+dfacheck1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
exit:
@echo $@
@-$(LOCALES) AWK="$(AWKPROG)" "$(srcdir)"/$@.sh > _$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/dfacheck1.awk b/test/dfacheck1.awk
new file mode 100644
index 00000000..e7c812d1
--- /dev/null
+++ b/test/dfacheck1.awk
@@ -0,0 +1 @@
+/.\<x/
diff --git a/test/dfacheck1.in b/test/dfacheck1.in
new file mode 100644
index 00000000..b85da3c9
--- /dev/null
+++ b/test/dfacheck1.in
@@ -0,0 +1 @@
+123-x
diff --git a/test/dfacheck1.ok b/test/dfacheck1.ok
new file mode 100644
index 00000000..b85da3c9
--- /dev/null
+++ b/test/dfacheck1.ok
@@ -0,0 +1 @@
+123-x