[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: make lpeg.P(table) recursive?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 6 Apr 2011 18:54:16 -0300
> [...]
>
> makes lpeg.P(table) recursive ie it applies P to anything that's not already
> a pattern.
>
> I only made some rudimentary tests, but I don't see any drawback so far.
> This makes grammar composition a bit easier, which is useful for a project
> I'm working on, and allows to get rid of calls to P that don't add much,
> semantically...
>
> Assuming it is indeed harmless, would you mind making the change?
The problem is that this conflicts with the rule for the initial symbol.
Currently, P[1] = "S" means that "S" is the initial symbol. With this
change, it would mean that "S" is the initial pattern (that is, the
grammar would recognize the string "S" only).
We could apply lpeg.P to all entries but the key 1, but that does not
sound good.
-- Roberto