The "optional" below crashes my Pharo 1.2.2 image, and user interrupt has no effect...
categoryName := $- asParser negate plus flatten, ($- asParser, #any asParser star flatten) optional star. categoryName parse: 'SuperMe'.
Sean
-- View this message in context: http://forum.world.st/PetitParser-crash-tp3725129p3725129.html Sent from the Moose mailing list archive at Nabble.com.
This is a bug in your parser, causing a direct recursion with "optional star".
Also this is a bug in Pharo causing direct recursion to hang the image.
#optional is a parser that always succeeds. #star is an parser that parsers 0 or more times eagerly. Thus #star loops forever.
Thus, you should remove the #optional parser in your grammar, #star alone already makes the receiver optional.
Lukas
On 7 August 2011 18:08, Sean P. DeNigris sean@clipperadams.com wrote:
The "optional" below crashes my Pharo 1.2.2 image, and user interrupt has no effect...
categoryName := $- asParser negate plus flatten, ($- asParser, #any asParser star flatten) optional star. categoryName parse: 'SuperMe'.
Sean
-- View this message in context: http://forum.world.st/PetitParser-crash-tp3725129p3725129.html Sent from the Moose mailing list archive at Nabble.com. _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Lukas Renggli wrote:
Also this is a bug in Pharo causing direct recursion to hang the image.
I'll report it.
Lukas Renggli wrote:
#optional is a parser that always succeeds. #star is an parser that parsers 0 or more times eagerly. Thus #star loops forever.
Thanks, so "optional" is like the ? in other regex systems, meaning 0 or 1 times.
-- View this message in context: http://forum.world.st/PetitParser-crash-tp3725129p3728026.html Sent from the Moose mailing list archive at Nabble.com.
#optional is a parser that always succeeds. #star is an parser that parsers 0 or more times eagerly. Thus #star loops forever.
Thanks, so "optional" is like the ? in other regex systems, meaning 0 or 1 times.
Yes, 'x?*' is illegal in most regex engines. I guess PetitParser could also try to prevent it, at least in simple cases.
Lukas