summaryrefslogtreecommitdiff
path: root/example/calc
diff options
context:
space:
mode:
authorDavid Beazley <dave@dabeaz.com>2007-02-28 19:00:59 +0000
committerDavid Beazley <dave@dabeaz.com>2007-02-28 19:00:59 +0000
commite4989423fb06998f9e5c0011332469320597ec64 (patch)
tree87b66e72e637fc6ee18a67627be7a5ced36a1723 /example/calc
parente012665bc2b9f1593145a043cfbe27ed6d618208 (diff)
downloadply-e4989423fb06998f9e5c0011332469320597ec64.tar.gz
Fixed examples for EOF condition in p_error
Diffstat (limited to 'example/calc')
-rw-r--r--example/calc/calc.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/example/calc/calc.py b/example/calc/calc.py
index 5bf5d5d..1df0aeb 100644
--- a/example/calc/calc.py
+++ b/example/calc/calc.py
@@ -91,7 +91,10 @@ def p_expression_name(p):
p[0] = 0
def p_error(p):
- print "Syntax error at '%s'" % p.value
+ if p:
+ print "Syntax error at '%s'" % p.value
+ else:
+ print "Syntax error at EOF"
import ply.yacc as yacc
yacc.yacc()