On Jul 12, 2006, at 10:53 PM, Patrick R. Michaud wrote:
On Wed, Jul 12, 2006 at 08:04:01PM -0700, Chris Dolan wrote:
As simple token containing ":i" causes PGE to crash with an attempted
method call on Undef.
Steps to reproduce:
1) Create a grammar file called "foo.pg" that has one line:
token foo { :i a }
As I read S05, a modifier has to occur at the *very* beginning
of a regex (or group) in order to work. In other words, no whitespace
before modifiers in a regex (because whitespace may have some
other meta-syntactic meaning with :sigspace). Thus
token foo {:i a }
works, while
token foo { :i a }
is an error, since the ':' acts as a cut operator that doesn't
have anything to cut.
But I admit that since we've gone to regex/token/rule, then perhaps
leading whitespace prior to a modifier should be ignored. That
probably needs a ruling from p6l or @Larry.
Pm
Ahh, that makes sense. So it's possibly just an uncaught syntax
error, and definitely a syntax error under :sigspace. I propose that
P6Regex.pir gets something like:
parse_error(mob, pos, "Too late for modifier")
but I have not yet figured out where it belongs in P6Regex.pir.
On a related note, I don't see any regression tests for syntactically
incorrect regexps. I'm good at writing invalid regexps :-) so if
someone starts a stub .t file for syntax errors, I'd be happy to
populate it with TODO tests like the above.
Chris
--
Chris Dolan, Software Developer, http://www.chrisdolan.net/
Public key: http://www.chrisdolan.net/public.key
vCard: http://www.chrisdolan.net/ChrisDolan.vcf