pyparsing 3.0.0rc2
Pre-release-
Added
url
expression topyparsing_common
. (Sample code posted by Wolfgang Fahl, very nice!)This new expression has been added to the
urlExtractorNew.py
example, to show how it extracts URL fields into separate results names. -
Added method to
pyparsing_testing
to help debugging,with_line_numbers
. Returns a string with line and column numbers corresponding to values shown when parsing with expr.set_debug():data = """\ A 100""" expr = pp.Word(pp.alphanums).set_name("word").set_debug() print(ppt.with_line_numbers(data)) expr[...].parseString(data)
prints:
1 1234567890 1: A 2: 100 Match word at loc 3(1,4) A ^ Matched word -> ['A'] Match word at loc 11(2,7) 100 ^ Matched word -> ['100']
-
Added new example
cuneiform_python.py
to demonstrate creating a new Unicode range, and writing a Cuneiform->Python transformer (inspired by zhpy). -
Fixed issue #272, reported by PhasecoreX, when LineStart() expressions would match expressions that were not necessarily at the beginning of a line.
As part of this fix, two new classes have been added: AtLineStart and AtStringStart.
The following expressions are equivalent:LineStart() + expr and AtLineStart(expr) StringStart() + expr and AtStringStart(expr)
-
Fixed ParseFatalExceptions failing to override normal exceptions or expression matches in MatchFirst expressions. Addresses issue #251, reported by zyp-rgb.
-
Fixed bug in which ParseResults replaces a collection type value with an invalid type annotation (changed behavior in Python 3.9). Addresses issue #276, reported by Rob Shuler, thanks.
-
Fixed bug in ParseResults when calling
__getattr__
for special double-underscored methods. Now raises AttributeError for non-existent results when accessing a name starting with '__'. Addresses issue #208, reported by Joachim Metz. -
Modified debug fail messages to include the expression name to make it easier to sync up match vs success/fail debug messages.