All Versions
Latest Version
Avg Release Cycle
48 days
Latest Release
1086 days ago

Changelog History
Page 5

  • v2.0.2 Changes

    April 01, 2014
    • Extended "expr(name)" shortcut (same as "expr.setResultsName(name)") to accept "expr()" as a shortcut for "expr.copy()".

    • โž• Added "locatedExpr(expr)" helper, to decorate any returned tokens with their location within the input string. Adds the results names locn_start and locn_end to the output parse results.

    • โž• Added "pprint()" method to ParseResults, to simplify troubleshooting and prettified output. Now instead of importing the pprint module and then writing "pprint.pprint(result)", you can just write "result.pprint()". This method also accepts addtional positional and keyword arguments (such as indent, width, etc.), which get passed through directly to the pprint method (see

    • โœ‚ Removed deprecation warnings when using '<<' for Forward expression assignment. '<<=' is still preferred, but '<<' will be retained for cases where '<<=' operator is not suitable (such as in defining lambda expressions).

    • Expanded argument compatibility for classes and functions that take list arguments, to now accept generators as well.

    • ๐Ÿ“œ Extended list-like behavior of ParseResults, adding support for append and extend. NOTE: if you have existing applications using these names as results names, you will have to access them using dict-style syntax: res["append"] and res["extend"]

    • ๐Ÿ“œ ParseResults emulates the change in list vs. iterator semantics for methods like keys(), values(), and items(). Under Python 2.x, these methods will return lists, under Python 3.x, these methods will return iterators.

    • ๐Ÿ“œ ParseResults now has a method haskeys() which returns True or False depending on whether any results names have been defined. This simplifies testing for the existence of results names under Python 3.x, which returns keys() as an iterator, not a list.

    • ๐Ÿ“œ ParseResults now supports both list and dict semantics for pop(). If passed no argument or an integer argument, it will use list semantics and pop tokens from the list of parsed tokens. If passed a non-integer argument (most likely a string), it will use dict semantics and pop the corresponding value from any defined results names. A second default return value argument is supported, just as in dict.pop().

    • ๐Ÿ›  Fixed bug in markInputline, thanks for reporting this, Matt Grant!

    • โœ… Cleaned up my unit test environment, now runs with Python 2.6 and 3.3.

  • v2.0.1 Changes

    July 01, 2013
    • โœ‚ Removed use of "nonlocal" that prevented using this version of pyparsing with Python 2.6 and 2.7. This will make it easier to install for packages that depend on pyparsing, under Python versions 2.6 and later. Those using older versions of Python will have to manually install pyparsing 1.5.7.

    • ๐Ÿ›  Fixed implementation of <<= operator to return self; reported by Luc J. Bourhis, with patch fix by Mathias Mamsch - thanks, Luc and Mathias!

  • v2.0.0 Changes

    November 01, 2012
    • ๐Ÿš€ Rather than release another combined Python 2.x/3.x release I've decided to start a new major version that is only compatible with Python 3.x (and consequently Python 2.7 as well due to backporting of key features). This version will be the main development path from now on, with little follow-on development on the 1.5.x path.

    • ๐Ÿ—„ Operator '<<' is now deprecated, in favor of operator '<<=' for attaching parsing expressions to Forward() expressions. This is being done to address precedence of operations problems with '<<'. Operator '<<' will be removed in a future version of pyparsing.

  • v1.5.7 Changes

    November 01, 2012
    • ๐Ÿš€ NOTE: This is the last release of pyparsing that will try to maintain compatibility with Python versions < 2.6. The next release of pyparsing will be version 2.0.0, using new Python syntax that will not be compatible for Python version 2.5 or older.

    • ๐Ÿš€ An awesome new example is included in this release, submitted by Luca DellOlio, for parsing ANTLR grammar definitions, nice work Luca!

    • Fixed implementation of ParseResults.str to use Pythonic ''.join() instead of repeated string concatenation. This purportedly has been a performance issue under PyPy.

    • Fixed bug in ParseResults.dir under Python 3, reported by Thomas Kluyver, thank you Thomas!

    • โž• Added ParserElement.inlineLiteralsUsing static method, to override pyparsing's default behavior of converting string literals to Literal instances, to use other classes (such as Suppress or CaselessLiteral).

    • โž• Added new operator '<<=', which will eventually replace '<<' for storing the contents of a Forward(). '<<=' does not have the same operator precedence problems that '<<' does.

    • ๐Ÿ‘ 'operatorPrecedence' is being renamed 'infixNotation' as a better description of what this helper function creates. 'operatorPrecedence' is deprecated, and will be dropped entirely in a future release.

    • โž• Added optional arguments lpar and rpar to operatorPrecedence, so that expressions that use it can override the default suppression of the grouping characters.

    • โž• Added support for using single argument builtin functions as parse actions. Now you can write 'expr.setParseAction(len)' and get back the length of the list of matched tokens. Supported builtins are: sum, len, sorted, reversed, list, tuple, set, any, all, min, and max. A script demonstrating this feature is included in the examples directory.

    • ๐Ÿ‘Œ Improved linking in generated docs, proposed on the pyparsing wiki by techtonik, thanks!

    • ๐Ÿ›  Fixed a bug in the definition of 'alphas', which was based on the string.uppercase and string.lowercase "constants", which in fact aren't constant, but vary with locale settings. This could make parsers locale-sensitive in a subtle way. Thanks to Kef Schecter for his diligence in following through on reporting and monitoring this bugfix!

    • ๐Ÿ›  Fixed a bug in the Py3 version of pyparsing, during exception handling with packrat parsing enabled, reported by Catherine Devlin - thanks Catherine!

    • Fixed typo in ParseBaseException.dir, reported anonymously on the SourceForge bug tracker, thank you Pyparsing User With No Name.

    • ๐Ÿ›  Fixed bug in srange when using '\x###' hex character codes.

    • โž• Addeed optional 'intExpr' argument to countedArray, so that you can define your own expression that will evaluate to an integer, to be used as the count for the following elements. Allows you to define a countedArray with the count given in hex, for example, by defining intExpr as "Word(hexnums).setParseAction(int(t[0],16))".

  • v1.5.6 Changes

    June 01, 2011
    • ๐Ÿ“œ Cleanup of parse action normalizing code, to be more version-tolerant, and robust in the face of future Python versions - much thanks to Raymond Hettinger for this rewrite!

    • ๐Ÿ‘ป Removal of exception cacheing, addressing a memory leak condition in Python 3. Thanks to Michael Droettboom and the Cape Town PUG for their analysis and work on this problem!

    • ๐Ÿ›  Fixed bug when using packrat parsing, where a previously parsed expression would duplicate subsequent tokens - reported by Frankie Ribery on stackoverflow, thanks!

    • โž• Added 'ungroup' helper method, to address token grouping done implicitly by And expressions, even if only one expression in the And actually returns any text - also inspired by stackoverflow discussion with Frankie Ribery!

    • ๐Ÿ›  Fixed bug in srange, which accepted escaped hex characters of the form '\0x##', but should be '\x##'. Both forms will be supported for backwards compatibility.

    • โœจ Enhancement to countedArray, accepting an optional expression to be used for matching the leading integer count - proposed by Mathias on the pyparsing mailing list, good idea!

    • โž• Added the Verilog parser to the provided set of examples, under the MIT license. While this frees up this parser for any use, if you find yourself using it in a commercial purpose, please consider making a charitable donation as described in the parser's header.

    • โž• Added the excludeChars argument to the Word class, to simplify defining a word composed of all characters in a large range except for one or two. Suggested by JesterEE on the pyparsing wiki.

    • โž• Added optional overlap parameter to scanString, to return overlapping matches found in the source text.

    • โšก๏ธ Updated oneOf internal regular expression generation, with improved parse time performance.

    • ๐ŸŽ Slight performance improvement in transformString, removing empty strings from the list of string fragments built while scanning the source text, before calling ''.join. Especially useful when using transformString to strip out selected text.

    • โœจ Enhanced form of using the "expr('name')" style of results naming, in lieu of calling setResultsName. If name ends with an '*', then this is equivalent to expr.setResultsName('name',listAllMatches=True).

    • ๐Ÿ›  Fixed up internal list flattener to use iteration instead of recursion, to avoid stack overflow when transforming large files.

    • โž• Added other new examples: . protobuf parser - parses Google's protobuf language . btpyparse - a BibTex parser contributed by Matthew Brett, with test suite (thanks, Matthew!) . - demo using trailing '*' for results names

  • v1.5.5 Changes

    August 01, 2010
    • ๐Ÿ“œ Typo in Python3 version of pyparsing, "builtin" should be "builtins". (sigh)
  • v1.5.4 Changes

    August 01, 2010
    • Fixed builtins and file references in Python 3 code, thanks to Greg Watson, saulspatz, sminos, and Mark Summerfield for reporting their Python 3 experiences.

    • โž• Added new example,, as a sample of scanning a Tcl-like language for functions with incorrect number of arguments (difficult to track down in Tcl languages). This example uses some interesting methods for capturing exceptions while scanning through source code.

    • โž• Added new example, that takes everyday time references like "an hour from now", "2 days ago", "next Sunday at 2pm".

  • v1.5.3 Changes

    June 01, 2010
    • ======= NOTE: API CHANGE!!!!!!! =============== With this release, and henceforward, the pyparsing module is imported as "pyparsing" on both Python 2.x and Python 3.x versions.

    • ๐Ÿ›  Fixed up to auto-detect Python version and install the correct version of pyparsing - suggested by Alex Martelli, thanks, Alex! (and my apologies to all those who struggled with those spurious installation errors caused by my earlier fumblings!)

    • ๐Ÿ›  Fixed bug on Python3 when using parseFile, getting bytes instead of a str from the input file.

    • ๐Ÿ›  Fixed subtle bug in originalTextFor, if followed by significant whitespace (like a newline) - discovered by Francis Vidal, thanks!

    • ๐Ÿ›  Fixed very sneaky bug in Each, in which Optional elements were not completely recognized as optional - found by Tal Weiss, thanks for your patience.

    • ๐Ÿ›  Fixed off-by-1 bug in line() method when the first line of the input text was an empty line. Thanks to John Krukoff for submitting a patch!

    • ๐Ÿ›  Fixed bug in transformString if grammar contains Group expressions, thanks to patch submitted by barnabas79, nice work!

    • ๐Ÿ›  Fixed bug in originalTextFor in which trailing comments or otherwised ignored text got slurped in with the matched expression. Thanks to michael_ramirez44 on the pyparsing wiki for reporting this just in time to get into this release!

    • โž• Added better support for summing ParseResults, see the new example,

    • โž• Added support for composing a Regex using a compiled RE object; thanks to my new colleague, Mike Thornton!

    • In version 1.5.2, I changed the way exceptions are raised in order to simplify the stacktraces reported during parsing. An anonymous user posted a bug report on SF that this behavior makes it difficult to debug some complex parsers, or parsers nested within parsers. In this release I've added a class attribute ParserElement.verbose_stacktrace, with a default value of False. If you set this to True, pyparsing will report stacktraces using the pre-1.5.2 behavior.

    • ๐Ÿ†• New examples:

    ., a MicroC compiler submitted by Zarko Zivanov. (Note: this example is separately licensed under the GPLv3, and requires Python 2.6 or higher.) Thank you, Zarko!

    ., a subset C parser, using the BNF from the 1996 Obfuscated C Contest.

    ., a modified version of submitted by Matt Anderson, that is compatible with Python versions 2.7 and above - thanks so much, Matt!

    ., a parser for reading SQLite SELECT statements, as specified at this goes into much more detail than the simple SQL parser included in pyparsing's source code

    ., a simplistic first-cut at a parser for Excel expressions, which I originally posted on comp.lang.python in January, 2010; beware, this parser omits many common Excel cases (addition of numbers represented as strings, references to named ranges)

    ., a nice little parser posted my Mark Tolonen on comp.lang.python in August, 2009 (redistributed here with Mark's permission). Thanks a bunch, Mark!

    ., a sample I posted to, implementing a special variation on Literal that does "close" matching, up to a given number of allowed mismatches. The application was to find matching gene sequences, with allowance for one or two mismatches.

    ., a sample showing how to use a Forward placeholder to enforce matching of text parsed in a previous expression.

    ., simple demo showing how the matchPreviousLiteral helper method is used to match a previously parsed token.

  • v1.5.2 Changes

    April 01, 2009
    • โž• Added module, so that Python 3 users can use pyparsing by changing their pyparsing import statement to:

      import pyparsing_py3

    Thanks for help from Patrick Laban and his friend Geremy Condra on the pyparsing wiki.

    • Removed slots declaration on ParseBaseException, for compatibility with IronPython 2.0.1. Raised by David Lawler on the pyparsing wiki, thanks David!

    • ๐Ÿ›  Fixed bug in SkipTo/failOn handling - caught by eagle eye cpennington on the pyparsing wiki!

    • ๐Ÿ›  Fixed second bug in SkipTo when using the ignore constructor argument, reported by Catherine Devlin, thanks!

    • ๐Ÿ›  Fixed obscure bug reported by Eike Welk when using a class as a ParseAction with an errant getitem method.

    • ๐Ÿ“œ Simplified exception stack traces when reporting parse exceptions back to caller of parseString or parseFile - thanks to a tip from Peter Otten on comp.lang.python.

    • ๐Ÿ”„ Changed behavior of scanString to avoid infinitely looping on expressions that match zero-length strings. Prompted by a question posted by ellisonbg on the wiki.

    • โœจ Enhanced classes that take a list of expressions (And, Or, MatchFirst, and Each) to accept generator expressions also. This can be useful when generating lists of alternative expressions, as in this case, where the user wanted to match any repetitions of '+', '*', '#', or '.', but not mixtures of them (that is, match '+++', but not '+-+'):

      codes = "+*#." format = MatchFirst(Word(c) for c in codes)

    Based on a problem posed by Denis Spir on the Python tutor list.

    • โž• Added new example, which extends the example to actually evaluate the parsed expressions.
  • v1.5.1 Changes

    October 01, 2008
    • โž• Added new helper method originalTextFor, to replace the use of the current keepOriginalText parse action. Now instead of using the parse action, as in:

      fullName = Word(alphas) + Word(alphas) fullName.setParseAction(keepOriginalText)

    (in this example, we used keepOriginalText to restore any white space that may have been skipped between the first and last names) You can now write:

      fullName = originalTextFor(Word(alphas) + Word(alphas))

    The implementation of originalTextFor is simpler and faster than keepOriginalText, and does not depend on using the inspect or imp modules.

    • โž• Added optional parseAll argument to parseFile, to be consistent with parseAll argument to parseString. Posted by pboucher on the pyparsing wiki, thanks!

    • โž• Added failOn argument to SkipTo, so that grammars can define literal strings or pyparsing expressions which, if found in the skipped text, will cause SkipTo to fail. Useful to prevent SkipTo from reading past terminating expression. Instigated by question posed by Aki Niimura on the pyparsing wiki.

    • ๐Ÿ›  Fixed bug in nestedExpr if multi-character expressions are given for nesting delimiters. Patch provided by new pyparsing user, Hans-Martin Gaudecker - thanks, H-M!

    • โœ‚ Removed dependency on xml.sax.saxutils.escape, and included internal implementation instead - proposed by Mike Droettboom on the pyparsing mailing list, thanks Mike! Also fixed erroneous mapping in replaceHTMLEntity of " to ', now correctly maps to ". (Also added support for mapping ' to '.)

    • ๐Ÿ›  Fixed typo in ParseResults.insert, found by Alejandro Dubrovsky, good catch!

    • Added dir() methods to ParseBaseException and ParseResults, to support new dir() behavior in Py2.6 and Py3.0. If dir() is called on a ParseResults object, the returned list will include the base set of attribute names, plus any results names that are defined.

    • ๐Ÿ›  Fixed bug in ParseResults.asXML(), in which the first named item within a ParseResults gets reported with an tag instead of with the correct results name.

    • ๐Ÿ›  Fixed bug in '-' error stop, when '-' operator is used inside a Combine expression.

    • โช Reverted generator expression to use list comprehension, for better compatibility with old versions of Python. Reported by jester/artixdesign on the SourceForge pyparsing discussion list.

    • ๐Ÿ›  Fixed bug in parseString(parseAll=True), when the input string ends with a comment or whitespace.

    • ๐Ÿ›  Fixed bug in LineStart and LineEnd that did not recognize any special whitespace chars defined using ParserElement.setDefault- WhitespaceChars, found while debugging an issue for Marek Kubica, thanks for the new test case, Marek!

    • Made Forward class more tolerant of subclassing.