On Wed, Dec 07, 2005 at 03:17:10PM -0800, Allison Randal wrote:
> On Oct 17, 2005, at 14:15, Patrick R. Michaud wrote:
> 
> >I've just added a <PGE::Text::bracketed> subrule to PGE,
> >which is roughly analogous to the "bracketed" function in
> >Perl 5's Text::Balanced.
> >
> 
> Shouldn't it contain C<this quoted string>? That is, shouldn't it  
> remove the bracketing characters? Or at least hold the string without  
> the brackets somewhere within the PGE::Text object? 

For this I was following the design of "extract_bracketed" in
Perl 5's Text::Balanced, which returns the delimiters as part 
of the string.  I agree it would be nice for PGE::Text::bracketed
to also return the string without the outer delimiters somewhere.
But this begs a larger design issue -- should it be able to return
all nested and balanced substrings without their delims (and if so,
what should the resulting Match object structure look like)?

Anyway, it's no problem for me to update PGE::Text::bracketed to
return a sub-match of the string without its outer delimiters, if
we want to go that way.

> >At the moment there's not a mechanism to specify an alternate set
> >of delimiters from within a subrule, but this should be available in
> >the near future as a subrule parameter:
> >
> >     <PGE::Text::balanced: {}()[]>     # delimited by {}, (), []
> >     <PGE::Text::balanced("<'\"")>     # delimited by <>, ", '
> 
> I have a use for this as soon as its done (or is it already done?)

It's already "done", but only using the colon+string argument version 
above, and I have this nagging suspicious that syntax is going to be
removed from the spec (if it hasn't been removed already).

But at the moment, a string can be matched based on balanced and
nested parentheses using

    <PGE::Text::balanced: ()>

> And thanks very much for adding this feature. It's a big help!

You're welcome.  I like adding helpful features.  :-)

Pm

Reply via email to