From 68c2b32b49f0c25d67b5a2e91ef0d1039f287e8b Mon Sep 17 00:00:00 2001 From: ptmcg Date: Sat, 24 Sep 2016 17:04:13 +0000 Subject: Fixed bug in ParseResults.dump when keys were not strings. Also changed display of string values to show them in quotes, to help distinguish parsed numeric strings from parsed integers that have been converted to Python ints. git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/trunk@443 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b --- src/CHANGES | 5 +++++ src/pyparsing.py | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/CHANGES b/src/CHANGES index d5f59a2..b8530b2 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -6,6 +6,11 @@ Version 2.1.10 - ------------------------------- - Added support for multiline test strings in runTests. +- Fixed bug in ParseResults.dump when keys were not strings. + Also changed display of string values to show them in quotes, + to help distinguish parsed numeric strings from parsed integers + that have been converted to Python ints. + Version 2.1.9 - September, 2016 ------------------------------- diff --git a/src/pyparsing.py b/src/pyparsing.py index 5517d02..e3b014e 100644 --- a/src/pyparsing.py +++ b/src/pyparsing.py @@ -61,7 +61,7 @@ The pyparsing module handles some of the problems that are typically vexing when """ __version__ = "2.1.10" -__versionTime__ = "11 Sep 2016 16:20 UTC" +__versionTime__ = "17 Sep 2016 16:37 UTC" __author__ = "Paul McGuire " import string @@ -868,7 +868,7 @@ class ParseResults(object): out.append( indent+_ustr(self.asList()) ) if full: if self.haskeys(): - items = sorted(self.items()) + items = sorted((str(k), v) for k,v in self.items()) for k,v in items: if out: out.append(NL) @@ -879,7 +879,7 @@ class ParseResults(object): else: out.append(_ustr(v)) else: - out.append(_ustr(v)) + out.append(repr(v)) elif any(isinstance(vv,ParseResults) for vv in self): v = self for i,vv in enumerate(v): @@ -4993,6 +4993,10 @@ def infixNotation( baseExpr, opList, lpar=Suppress('('), rpar=Suppress(')') ): binary, left- or right-associative. Parse actions can also be attached to operator expressions. The generated parser will also recognize the use of parentheses to override operator precedences (see example below). + + Note: if you define a deep operator list, you may see performance issues + when using infixNotation. See L{ParserElement.enablePackrat} for a + mechanism to potentially improve your parser performance. Parameters: - baseExpr - expression representing the most basic element for the nested -- cgit v1.2.1