From 6faeff915e961443d66b10caf9af4cbed6fb8451 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 1 Nov 2020 19:58:47 +0200 Subject: Fix a bug in dfa.c, add test case. --- support/dfa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'support/dfa.c') diff --git a/support/dfa.c b/support/dfa.c index 8aef2f37..df32dd90 100644 --- a/support/dfa.c +++ b/support/dfa.c @@ -2437,7 +2437,7 @@ merge_nfa_state (struct dfa *d, idx_t tindex, char *flags, continue; } - if (!(flags[sindex] & (OPT_LPAREN | OPT_RPAREN))) + if (sindex != tindex && !(flags[sindex] & (OPT_LPAREN | OPT_RPAREN))) { idx_t j; @@ -2445,6 +2445,9 @@ merge_nfa_state (struct dfa *d, idx_t tindex, char *flags, { idx_t dindex = follows[tindex].elems[j].index; + if (dindex == tindex) + continue; + if (follows[tindex].elems[j].constraint != iconstraint) continue; -- cgit v1.2.3