From 72f2c5a67b4a26f584104b9ff63e1f272f54c5df Mon Sep 17 00:00:00 2001 From: ptmcg Date: Tue, 7 Apr 2020 15:25:08 -0500 Subject: enable packrat parsing in all examples using infixNotation --- examples/simpleArith.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'examples/simpleArith.py') 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) -- cgit v1.2.1