-
Added type annotations to remainder of
pyparsing
package, and addedmypy
run totox.ini
, so that type annotations are now run as part of pyparsing's CI. Addresses Issue #373, raised by Iwan Aucamp, thanks! -
Exception message format can now be customized, by overriding
ParseBaseException.format_message
:def custom_exception_message(exc) -> str: found_phrase = f", found {exc.found}" if exc.found else "" return f"{exc.lineno}:{exc.column} {exc.msg}{found_phrase}" ParseBaseException.formatted_message = custom_exception_message
(PR #571 submitted by Odysseyas Krystalakos, nice work!)
-
POSSIBLE BREAKING CHANGE: Fixed bug in
transform_string()
where whitespace in the input string was not properly preserved in the output string.If your code uses
transform_string
, this bugfix may require changes in your code. -
Fixed railroad diagrams that get generated with a parser containing a Regex element defined using a verbose pattern - the pattern gets flattened and comments removed before creating the corresponding diagram element.
-
Defined a more performant regular expression used internally by
common_html_entity
. -
Regex
instances can now be created using a callable that takes no arguments and just returns a string or a compiled regular expression, so that creating complex regular expression patterns can be deferred until they are actually used for the first time in the parser. -
Added optional
flatten
Boolean argument toParseResults.as_list()
, to return the parsed values in a flattened list.