On Wed, Apr 6, 2011 at 23:54, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
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).
How come this is working then?
pat = P{
"e";
e = "r" + V"t",
t = {
"y",
y = "y"
}
}
pat:match"r" -->2
pat:match"y" -->2
pat:match"u" --> nil
We could apply lpeg.P to all entries but the key 1, but that does not
sound good.
Is there a known, useful purpose for non-string keys? If not, keys could be restricted to strings, leaving P[1] as a convention for the initial rule...
-- Roberto