pyparsing v2.4.0 Release Notes

Release Date: 2019-04-01 // about 5 years ago
    • Well, it looks like the API change that was introduced in 2.3.1 was more drastic than expected, so for a friendlier forward upgrade path, this release: . Bumps the current version number to 2.4.0, to reflect this incompatible change. . Adds a pyparsing.compat object for specifying compatibility with future breaking changes. . Conditionalizes the API-breaking behavior, based on the value pyparsing.compat.collect_all_And_tokens. By default, this value will be set to True, reflecting the new bugfixed behavior. To set this value to False, add to your code:

      import pyparsing
      pyparsing.__compat__.collect_all_And_tokens = False
      

    . User code that is dependent on the pre-bugfix behavior can restore it by setting this value to False.

    In 2.5 and later versions, the conditional code will be removed and setting the flag to True or False in these later versions will have no effect.

    • Updated unitTests.py and simple_unit_tests.py to be compatible with "python setup.py test". To run tests using setup, do:

      python setup.py test python setup.py test -s unitTests.suite python setup.py test -s simple_unit_tests.suite

    Prompted by issue #83 and PR submitted by bdragon28, thanks.

    • ๐Ÿ›  Fixed bug in runTests handling '\n' literals in quoted strings.

    • โž• Added tag_body attribute to the start tag expressions generated by makeHTMLTags, so that you can avoid using SkipTo to roll your own tag body expression:

      a, aEnd = pp.makeHTMLTags('a') link = a + a.tag_body("displayed_text") + aEnd for t in s.searchString(html_page): print(t.displayed_text, '->', t.startA.href)

    • indentedBlock failure handling was improved; PR submitted by TMiguelT, thanks!

    • โž• Address Py2 incompatibility in simpleUnitTests, plus explain() and Forward str() cleanup; PRs graciously provided by eswald.

    • ๐Ÿ›  Fixed docstring with embedded '\w', which creates SyntaxWarnings in Py3.8, issue #80.

    • Examples:

      • Added example parser for rosettacode.org tutorial compiler.
      • Added example to show how an HTML table can be parsed into a collection of Python lists or dicts, one per row.
      • Updated SimpleSQL.py example to handle nested selects, reworked 'where' expression to use infixNotation.
      • Added include_preprocessor.py, similar to macroExpander.py.
      • Examples using makeHTMLTags use new tag_body expression when retrieving a tag's body text.
      • Updated examples that are runnable as unit tests:

        python setup.py test -s examples.antlr_grammar_tests python setup.py test -s examples.test_bibparse