* src/regex-emacs.c (analyze_first): Fix incorrect optimization
The optimization was incorrect in a particular corner case. In this fix I just disable it conservatively for more cases because it's not obvious how to fix it while preserving the "good" cases. We may find a better fix by using an approach like the one in `mutually_exhaustive_aux`, but for now this is good enough, especially since \{..\} repetitions are not used very frequently. * test/src/regex-resources/PTESTS: New test.
This commit is contained in:
parent
9a67540e51
commit
bc52fdd1d1
2 changed files with 5 additions and 2 deletions
|
@ -3086,8 +3086,10 @@ analyze_first (re_char *p, re_char *pend, char *fastmap, bool multibyte)
|
|||
/* We only care about one iteration of the loop, so we don't
|
||||
need to consider the case where this behaves like an
|
||||
on_failure_jump. */
|
||||
continue;
|
||||
|
||||
/* FIXME: Sadly, the above is not true when the loop's body
|
||||
can match the empty string :-( */
|
||||
/* continue; */
|
||||
return -1;
|
||||
|
||||
case set_number_at:
|
||||
p += 4;
|
||||
|
|
|
@ -269,6 +269,7 @@
|
|||
#W the expected result for \([a-c]*\)\{2,\} is failure which isn't correct
|
||||
1¦3¦\([a-c]*\)\{2,\}¦abcdefg¦
|
||||
1¦3¦\([a-c]*\)\{1,\}¦abcdefg¦
|
||||
0¦0¦\([a-c]*\)\{2,\}¦gabcdefg¦
|
||||
-1¦-1¦a\{64,\}¦aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa¦
|
||||
# GA142
|
||||
1¦3¦a\{2,3\}¦aaaa¦
|
||||
|
|
Loading…
Add table
Reference in a new issue