On Mon, Apr 17, 2006 at 07:25:27PM +0100, Nicholas Clark wrote:
> On Mon, Apr 17, 2006 at 10:15:40AM -0700, [EMAIL PROTECTED] wrote:
> > * grammar_rules.pge - support for POD sections.
> >  ## This rule handles whitespace and comments between tokens.
> > -## XXX:  Add pod directive handling
> >  
> > -rule ws { [ \# \N+ | \s+ ]* ::: }
> > +rule ws {
> > +    [ \# \N+
> > +    | \s+
> > +    | ^^ =cut \s* $$
> > +    | ^^ =for \s* \N+ .*? ^^$$
> > +    | ^^ =\w\N* .*? ^^ =cut $$
> > +    ]* :::
> > +}
> 
> [People not reading the commit list should note that this wasn't the final
> form]
> 
> I see you've taken out the XXX. However, isn't the plan for Perl 6 that all
> the POD is going to be available as <DATA>-like streams? Whereas whitespace
> does get eaten. So surely they should be 2 different rules?

Since we can embed closures and subroutines in rules, we can capture 
the POD as we eat it.  :-)  In the long-run it will likely end up as:

    rule ws {
        [ \# \N+
        | \s+
        | \. \# <PGE::Text::bracketed: <({[>
        | ^^ <pod>
        ]* :::

where the <pod> subrule can keep track of the appropriate things
to make the <DATA>-like streams.

Audrey originally had some of the pod elements separated out
into subrules, but I decided to switch to the single <ws> rule
for the time being since I'm starting to re-use this particular
pattern in a few other tools.

Pm

Reply via email to