Closed calfeld-zz closed 11 years ago
Thanks for the report, but I'm not sure that I understand the problem.
The regexp is not matching "prefixa", "prefixb", and "prefixc". It is actually matching "prefixa", or "b", or "c". Try printing the match data ($~) to see what is happening, like this:
p "prefixa" =~ re, $~
p "prefixb" =~ re, $~
p "prefixc" =~ re, $~
That seems to match what the parser is doing. Or am I missing something?
Cheers!
Thank you for the prompt reply. You are quite right. I need to go fix some of our regexps.
Example code:
Note that the regexp does match "prefixa", "prefixb", and "prefixc". However, the parse constructs an alternation node containing "prefix(?x)", "b", and "c" as the three alternatives.
The code in question is at parser.rb:94
The code
is too greedy. Would it be correct to execute only absorb the last expression rather than all previous expressions?