[pypy-dev] undefined symbol in ParserGenerator
Terrence Cole
list-sink at trainedmonkeystudios.org
Mon Apr 19 04:42:17 CEST 2010
On Sun, 2010-04-18 at 21:13 -0500, Benjamin Peterson wrote:
> 2010/4/18 Terrence Cole <list-sink at trainedmonkeystudios.org>:
> > In pypy/interpreter/pyparser/metaparser.py in get_first on line 233:
> > the name 'symbol' is undefined.
> >
> > I hit this when parsing the python grammar from the 3.1.2 release.
> > Oddly, the current py3k trunk does not hit this. I'll dig more to see
> > if I can figure out why the grammar is causing this, but the error
> > handling here is obviously bogus, so I thought I'd go ahead and report
> > it.
>
> This is because the 3.1.2 grammar is incorrect, and CPython's parser
> generator accepts it. See
> http://svn.python.org/view?view=rev&revision=75080. It's safe to use
> the py3k branch one, since it hasn't changed.
Awesome! You've just saved me a lot of difficult, pointless work.
Below is the svn diff I ended up with when testing.
-Terrence
Index: pypy/interpreter/pyparser/metaparser.py
===================================================================
--- pypy/interpreter/pyparser/metaparser.py (revision 73878)
+++ pypy/interpreter/pyparser/metaparser.py (working copy)
@@ -230,7 +230,8 @@
for label, their_first in overlap_check.iteritems():
for sub_label in their_first:
if sub_label in inverse:
- raise PgenError("ambiguous symbol %s" % (symbol,))
+ raise PgenError("ambiguous symbol at '%s': %s" % (label,
+ sub_label))
inverse[sub_label] = label
self.first[name] = all_labels
return all_labels
More information about the Pypy-dev
mailing list