Re: Parse::RecDescent and catenating (no skip match)

[email protected] (Ted Zlatanov) Tue, 23 Jul 2002 12:46:15 -0400
Newsgroups perl.recdescent
Organization Теодор Златанов @ Cienfuegos
Message-ID <[email protected]>
On Tue, 23 Jul 2002, [email protected] wrote:
> I assume you are saying to convert all catenated tokens such as 100F
> to 100,F?  That would be real nasty, requiring knowledge of where
> catenated tokens exist, as well as all possible catenated tokens.
> It could be done if I parsed the grammar to pull that information
> out, but that doesn't seem like a very good thing.

I assumed you wouldn't need to parse tokens to know where to insert
commas in your original post, sorry.

Sean's $skip=qr/,?/ suggestion is better, I think.  But if your
protocol specifies that the comma is optional, I'd either remove all
commas, or allow the parser to accept optional commas and ignore
them.  There are advantages to each of the three approaches.

> The reason why I have tokens such as 100F is for readability of the
> protocol.  Why subvert the protocol for the sake of the parser?

I'm not sure why the protocol has to be readable, that's a user
requirement probably.  For parsing it's always easier to have
consistent input, of course, even if it looks ugly.

Ted