On May 8, 2:26 pm, David Beazley <
d...@dabeaz.com> wrote:
> The token objects used in a lex/yacc are really meant to be an internal implementation detail---not something that you would ever directly work
> with.
OK, I won't use LexToken instances then.
> As such, the .value attribute of a symbol (which is returned by p[1], p[2], etc.) is really the only safe thing to use..
Well, p.lineno(1) etc is safe as well, is it not?
> I suppose it would be
> easy to add a method that returns the token, but I'm not sure I would advise anyone to use it for anything other than debugging. One reason I
> would be cautious about this is that I'm planning to make some pretty big implementation changes in a future PLY version. The parser interface
> will stay the same, but the underlying representation of tokens/symbols is going to change.
OK, but I assume p.lineno(1) etc will remain available, in one way or
another?