Comment 0 for bug 602847

Revision history for this message
Eike (eike-welk) wrote :

Currently most syntax errors produce an error message like "Expecting unindent ...." or "Expecting end of file ..." which is not very helpful.

The cause is IMHO that Pyparsing's backtracking. When the rules for all statements have failed Pyparsing tries to match rules from the indentation logic. The error message is then generated in/for the last rule (parser in Pyparsing's terminology) that was tried.

Therefore I propose to introduce an additional rule on the level of the statements, that comes last. I matches any word and any punctuation. The parser's parse action then raises a ParseFatalException with the message "Unknown keyword ..." or "Unknown operator ...". This would improve the error messages much.