enthought/enaml — Issue #70: Parse error handling fails sometimes
Author: rkern
Created: 2012-01-11 16:37:16+00:00
State: open

When converting an old example, I ran into `defn MainWindow:` which should now be `defn MainWindow():`. The parser has an internal error:

```
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/Current/bin/enaml-run", line 8, in
main()
File "/Users/rkern/git/et/enaml/enaml/runner.py", line 31, in main
ast = parse(enaml_code, filename=args.enaml_file)
File "/Users/rkern/git/et/enaml/enaml/parsing/parser.py", line 2063, in parse
return _parser.parse(enaml_source, lexer=_lexer)
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/ply/yacc.py", line 265, in parse
return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/ply/yacc.py", line 1047, in parseopt_notrack
tok = self.errorfunc(errtoken)
File "/Users/rkern/git/et/enaml/enaml/parsing/parser.py", line 2053, in p_error
fn = t.lexer._py_lexer().filename
AttributeError: 'EnamlLexer' object has no attribute '_py_lexer'
```

Some other syntax errors do result in a proper `SyntaxError`, though.