On Tue, Apr 05, 2005 at 10:33:00AM -0700, Larry Wall wrote:
> : Aye.  Is there an idea on how the two forms of `if` would be defined
> : using plain Perl 6?
> 
> That's exactly what the syntactic category syntax is for, and why
> parsing has to be done indirectly in terms of syntactic categories,
> if you'll recall my message of some weeks ago on parser states.

Hrm, sorry if it has been covered before, but I was asking for
the code that defines statement_modifier:<if> itself, something like
this:.

    sub statement_modifier:<> ($x) is parsed(rx:p/[if|unless]/) {...}
    sub statement_modifier:<if> (Expression $body, Expression $cond) {
        ...
    }

except I'm not quite sure of the syntax above, and what to fill in the
"..." part.

> declaration.  On the other hand, maybe we could allow the split
> interpration if "if" is defined as a macro, which is less likely to
> happen accidentally than "sub if".  But that seems a bit hacky.  I
> think if people really want to override statement modifiers, they
> should do it with an explicit grammar munge that elevates prefix:<foo>
> to hide statement_modifier:<foo>.  By default statement modifiers
> are true reserved words, I think.

Okay, then I'll make prefix:<if> invisible. :)

Thanks,
/Autrijus/

Attachment: pgpEkJmgJBSRs.pgp
Description: PGP signature

Reply via email to