-
Discontinued support for Python 3.6, 3.7, and 3.8. Adopted new Python features from Python versions 3.7-3.9:
- Updated type annotations to use built-in container types instead of names imported from the
typing
module (e.g.,list[str]
vsList[str]
). - Reworked portions of the packrat cache to leverage insertion-preserving ordering in dicts.
- Changed
pdb.set_trace()
call inParserElement.set_break()
tobreakpoint()
. - Converted
typing.NamedTuple
todataclasses.dataclass
in railroad diagramming code. - Added
from __future__ import annotations
to clean up some type annotations.
- Updated type annotations to use built-in container types instead of names imported from the
-
POSSIBLE BREAKING CHANGE: Fixed code in
ParseElementEnhance
subclasses that replaced detailed exception messages raised in contained expressions with a less-specific and less-informative generic exception message and location.If your code has conditional logic based on the message content in raised
ParseExceptions
, this bugfix may require changes in your code. -
Fixed the displayed output of
Regex
terms to deduplicate repeated backslashes, for easier reading in debugging, printing, and railroad diagrams. -
Fixed (or at least reduced) elusive bug when generating railroad diagrams, where some diagram elements were just empty blocks. Fix submitted by RoDuth, thanks a ton!
-
Added
indent
andbase_1
arguments topyparsing.testing.with_line_numbers
. When usingwith_line_numbers
inside a parse action, setbase_1
=False, since the reportedloc
value is 0-based.indent
can be a leading string (typically of spaces or tabs) to indent the numbered string passed towith_line_numbers
. Added while working on #557, reported by Bernd Wechner. -
Added query syntax to
mongodb_query_expression.py
with better support for array fields ("contains", "contains all", "contains any", and "contains none"); and "like" and "not like" operators to support SQL "%" wildcard matching and "=~" operator to support regex matching. Also:- added support for dates and datetimes as query values
- added support for
a[0]
style array referencing
-
Added
lox_parser.py
example, a parser for the Lox language used as a tutorial in Robert Nystrom's "Crafting Interpreters" (http://craftinginterpreters.com/). With helpful corrections from RoDuth. -
Added
complex_chemical_formulas.py
example, to add parsing capability for formulas such as "3(C₆H₅OH)₂".