summaryrefslogtreecommitdiff
path: root/examples/simpleArith.py
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2020-04-07 15:25:08 -0500
committerptmcg <ptmcg@austin.rr.com>2020-04-07 15:25:08 -0500
commit72f2c5a67b4a26f584104b9ff63e1f272f54c5df (patch)
tree029f9fbacee8f4b378d3a9759979c5d2c60826d9 /examples/simpleArith.py
parent1881e43c10c34c0d24a6e3ecea7b4da710f9c790 (diff)
downloadpyparsing-git-72f2c5a67b4a26f584104b9ff63e1f272f54c5df.tar.gz
enable packrat parsing in all examples using infixNotation
Diffstat (limited to 'examples/simpleArith.py')
-rw-r--r--examples/simpleArith.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/examples/simpleArith.py b/examples/simpleArith.py
index af3f904..4539018 100644
--- a/examples/simpleArith.py
+++ b/examples/simpleArith.py
@@ -6,9 +6,12 @@
#
# Copyright 2006, by Paul McGuire
#
-
+import sys
from pyparsing import *
+ParserElement.enablePackrat()
+sys.setrecursionlimit(3000)
+
integer = Word(nums).setParseAction(lambda t: int(t[0]))
variable = Word(alphas, exact=1)
operand = integer | variable
@@ -64,6 +67,11 @@ test = [
"M*X + B",
"M*(X + B)",
"1+2*-3^4*5+-+-6",
+ "(a + b)",
+ "((a + b))",
+ "(((a + b)))",
+ "((((a + b))))",
+ "((((((((((((((a + b))))))))))))))",
]
for t in test:
print(t)