This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dmalcolm
Recipients ajaksu2, dmalcolm, oliver_gramberg, sean_gillespie
Date 2010-01-13.19:28:31
SpamBayes Score 1.110223e-16
Marked as misclassified No
Message-id <1263410915.53.0.335463011366.issue1634034@psf.upfronthosting.co.za>
In-reply-to
Content
I'm attaching a new version of the patch, based on Oliver's (from 3 years ago).  This patch is against the py3k branch.

I've introduced a new table of (const) strings: _PyParser_TokenDescs, giving descriptions of each token type, so that you get e.g. "')'" rather than "RPAR"

The patch of pythonrun.c is unchanged other than using the description table, rather than the name table.

I've patched the expected results for the doctests in test_genexps and test_syntax.py so that these files pass: this gives the code the beginnings of a test suite.

The existing patch adds this compiler warning for me (gcc 4.4.2, on Fedora 12):
  Python/pythonrun.c: In function ‘err_input’:
  Python/pythonrun.c:1923: warning: embedded ‘\0’ in format
However I believe that snprintf isn't guaranteed to NUL-terminate the string under all conditions on all platforms, so the '\0' seems a sane failsafe.

How does this look?

I haven't attempted to deal with places where multiple token types are permitted, and it does sometimes simply emit "invalid syntax".
History
Date User Action Args
2010-01-13 19:28:36dmalcolmsetrecipients: + dmalcolm, sean_gillespie, ajaksu2, oliver_gramberg
2010-01-13 19:28:35dmalcolmsetmessageid: <1263410915.53.0.335463011366.issue1634034@psf.upfronthosting.co.za>
2010-01-13 19:28:34dmalcolmlinkissue1634034 messages
2010-01-13 19:28:33dmalcolmcreate