DFA was merging similar nodes when it should not. For example,
it would convert a+a+a to a+a. Now, a sequence of similar nodes
is not merged.
Problem reported by Gonzalo Padrino in https://bugs.gnu.org/44351
* lib/dfa.c (merge_nfa_state): Skip the follow for repetition in
optimization.
+2020-11-01 Norihiro Tanaka <noritnk@kcn.ne.jp>
+
+ dfa: retain sequences of similar nodes in optimization
+ DFA was merging similar nodes when it should not. For example,
+ it would convert a+a+a to a+a. Now, a sequence of similar nodes
+ is not merged. Problem reported by Gonzalo Padrino in
+ https://bugs.gnu.org/44351
+ * lib/dfa.c (merge_nfa_state): Skip the follow for repetition in
+ optimization.
+
2020-11-01 Jim Meyering <meyering@fb.com>
test-dfa-match-aux.c: accept EREs, not BREs
continue;
}
- if (!(flags[sindex] & (OPT_LPAREN | OPT_RPAREN)))
+ if (sindex != tindex && !(flags[sindex] & (OPT_LPAREN | OPT_RPAREN)))
{
idx_t j;
{
idx_t dindex = follows[tindex].elems[j].index;
+ if (dindex == tindex)
+ continue;
+
if (follows[tindex].elems[j].constraint != iconstraint)
continue;