On Tue, Mar 01, 2005 at 09:32:28PM -0800, Larry Wall wrote:
> On Tue, Mar 01, 2005 at 11:06:17PM -0600, Rod Adams wrote:
> : Since the line between rules and subs is already blurring significantly, 
> : I want to blur it a little more. I want to write rules which can take 
> : parameters.
> 
> No problem.  That's how the arguments to rules like <before foo> are
> already passed.  If I recall, we originally specified three basic forms:
>     <foo bar> # bar is pattern
>     <foo: bar>        # bar is string
>     <foo(bar)>        # bar is Perl expression

Yes, this is written in A05, although it's often hard to spot and
easy to overlook.  They're in the large table under "Metacharacter reform":

    <name(expr)>          # call rule, passing Perl args
    { .name(expr) }       # same thing.

    <$var(expr)>          # call rule indirectly by name
    { .$var(expr) }       # same thing.

    <name pat>            # call rule, passing regex arg
    { .name(/pat/) }      # same thing.

    # maybe...
    <name: text>          # call rule, passing string
    { .name(q<text>) }    # same thing.

The argument form of subrules is not currently mentioned in S05.

I've been designing and implementing PGE consistent with the
above syntaxes.

Pm

Reply via email to