diff options
author | ptmcg <ptmcg@austin.rr.com> | 2021-09-05 10:13:56 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2021-09-08 09:11:20 -0500 |
commit | 64749ea4fe37ebbed263d1e3c4cfcc301d6c5b2b (patch) | |
tree | 76a4128666484d20841a766d47c317feb8297e6b /pyparsing/helpers.py | |
parent | e26b74e750b1444379a6881284ded51f8187ef43 (diff) | |
download | pyparsing-git-64749ea4fe37ebbed263d1e3c4cfcc301d6c5b2b.tar.gz |
Optimization in infixNotation
Diffstat (limited to 'pyparsing/helpers.py')
-rw-r--r-- | pyparsing/helpers.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pyparsing/helpers.py b/pyparsing/helpers.py index 1328a79..fde67a2 100644 --- a/pyparsing/helpers.py +++ b/pyparsing/helpers.py @@ -755,6 +755,7 @@ def infix_notation( def parseImpl(self, instring, loc, doActions=True): self.expr.try_parse(instring, loc) return loc, [] + _FB.__name__ = "FollowedBy>" ret = Forward() lpar = Suppress(lpar) @@ -783,7 +784,9 @@ def infix_notation( thisExpr = Forward().set_name(term_name) if rightLeftAssoc is OpAssoc.LEFT: if arity == 1: - matchExpr = _FB(lastExpr + opExpr) + Group(lastExpr + opExpr[1, ...]) + matchExpr = _FB(lastExpr + opExpr) + Group( + lastExpr + opExpr[1, ...] + ) elif arity == 2: if opExpr is not None: matchExpr = _FB(lastExpr + opExpr + lastExpr) + Group( @@ -791,7 +794,7 @@ def infix_notation( ) else: matchExpr = _FB(lastExpr + lastExpr) + Group( - lastExpr + lastExpr[1, ...] + lastExpr[2, ...] ) elif arity == 3: matchExpr = _FB( |