Skip Menu |

This queue is for tickets about the Regexp-Optimizer CPAN distribution.

Report information
The Basics
Id: 4937
Status: resolved
Priority: 0/
Queue: Regexp-Optimizer

People
Owner: Nobody in particular
Requestors: yoz [...] yoz.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.10
Fixed in: (no value)



Subject: Deep recursion in _trie_regex
Am getting this error: Deep recursion on subroutine "Regexp::List::_trie_regex" at C:/Perl58/site/lib/Regexp/List.pm line 342. ... with this test code: use Regexp::Optimizer; @res = ( '^[A-Z]\.\(\d\)$', '^[A-Z]\.\(\d\d\)$' ); my $o = new Regexp::Optimizer; my $re = $o->list2re(@res); I'm using an ActivePerl build of 5.8.0 on WinXP. Thanks for any help you can give!
From: yoz [...] yoz.com
[guest - Wed Jan 14 13:47:48 2004]: Show quoted text
> @res = ( '^[A-Z]\.\(\d\)$', '^[A-Z]\.\(\d\d\)$' );
I've done a little more investigation and there appears to be a problem in the tokenisation used to split up regexps. _prefix() and the code it calls ends up producing this as the prefix: ^[A-Z]\.\ and then sends this list to _trie_regex(): ( '(\d\)$', '(\d\d\)$' ) In other words, the open-parens char is being separated from its escaping backslash, which changes the meaning of the regexp. Furthermore, when I've tweaked it to actually get some output, the $ is getting escaped in the final result.
From: yoz [...] yoz.com
A simpler test case: @res = ( '\.e', '\$e' ); produces (?-xism:\.e)
From: yoz [...] yoz.com
Okay, I've done something that seems to have fixed it. Changed line 36 of List.pm: \\[^0xclupPNLUQEXC] | # ordinary escaped character to [^0xclupPNLUQEXC] | # ordinary escaped character and now it seems to be producing correct results with no deep recursion.