[Python-Dev] Adding a token (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Sun Aug 8 04:43:48 CEST 2010
- Previous message: [Python-Dev] Adding a token
- Next message: [Python-Dev] Adding a token
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Benjamin Peterson wrote:
Why do you even have to add a new token? You can just put the literal '?' in the grammar.
I don't see how that can be sufficient. All the other tokens have entries in the three places I mentioned, and there's no way that pgen can generate those automatically just from seeing a '?' in the grammar.
I just tried an experiment -- I changed the grammar to accept '?' as an alternative to '+', and tried to use the parser module to parse "1?2". It reported a SyntaxError.
-- Greg
- Previous message: [Python-Dev] Adding a token
- Next message: [Python-Dev] Adding a token
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]