diff options
Diffstat (limited to 'example/optcalc/calc.py')
-rw-r--r-- | example/optcalc/calc.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/example/optcalc/calc.py b/example/optcalc/calc.py index 325f67c..2b1db77 100644 --- a/example/optcalc/calc.py +++ b/example/optcalc/calc.py @@ -99,7 +99,10 @@ def p_expression_name(t): t[0] = 0 def p_error(t): - print "Syntax error at '%s'" % t.value + if t: + print "Syntax error at '%s'" % t.value + else: + print "Syntax error at EOF" import ply.yacc as yacc yacc.yacc(optimize=1) |