diff options
| author | David Beazley <dave@dabeaz.com> | 2007-02-28 19:00:59 +0000 |
|---|---|---|
| committer | David Beazley <dave@dabeaz.com> | 2007-02-28 19:00:59 +0000 |
| commit | e4989423fb06998f9e5c0011332469320597ec64 (patch) | |
| tree | 87b66e72e637fc6ee18a67627be7a5ced36a1723 /example/classcalc/calc.py | |
| parent | e012665bc2b9f1593145a043cfbe27ed6d618208 (diff) | |
| download | ply-e4989423fb06998f9e5c0011332469320597ec64.tar.gz | |
Fixed examples for EOF condition in p_error
Diffstat (limited to 'example/classcalc/calc.py')
| -rwxr-xr-x | example/classcalc/calc.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/example/classcalc/calc.py b/example/classcalc/calc.py index 7ec09a6..2af8d60 100755 --- a/example/classcalc/calc.py +++ b/example/classcalc/calc.py @@ -145,7 +145,10 @@ class Calc(Parser): p[0] = 0 def p_error(self, p): - print "Syntax error at '%s'" % p.value + if p: + print "Syntax error at '%s'" % p.value + else: + print "Syntax error at EOF" if __name__ == '__main__': calc = Calc() |
