Error messages less than helpful

Bug #1069108 reported by Kef Schecter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PyMeta
Confirmed
Undecided
Unassigned

Bug Description

I tried this code:

grammar = pymeta.grammar.OMeta.makeGrammar("""

symbol ::= <letterOrDigit>+:sym => ''.join(sym)
symbol-list ::= <symbol> (',' <symbol>)*

""", globals())

I got this traceback:

Traceback (most recent call last):
  File "<pyshell#13>", line 6, in <module>
    """, globals())
  File "C:\Python27\lib\site-packages\pymeta\grammar.py", line 26, in makeGrammar
    tree = g.parseGrammar(name, TreeBuilder)
  File "C:\Python27\lib\site-packages\pymeta\grammar.py", line 210, in parseGrammar
    raise err
ParseError: (57, [('expected', None, '0'), ('expected', 'digit', None)])

This does not tell me what went wrong or on what line. After some guesswork, I found that it didn't like the hyphen in symbol-list and instead I should use symbolList or symbol_list. Not really a problem in a two-line grammar, but it could be really hair-pulling in a real grammar.

Revision history for this message
Allen Short (washort) wrote :

I've released the successor to PyMeta, Parsley. See http://pypi.python.org/pypi/Parsley and http://launchpad.net/parsley for details. Among other things, it gives nicely formatted parse error messages.

Changed in pymeta:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers