1========== 2Change Log 3========== 4 5Version 2.4.7 - March, 2020 6--------------------------- 7- Backport of selected fixes from 3.0.0 work: 8 . Each bug with Regex expressions 9 . And expressions not properly constructing with generator 10 . Traceback abbreviation 11 . Bug in delta_time example 12 . Fix regexen in pyparsing_common.real and .sci_real 13 . Avoid FutureWarning on Python 3.7 or later 14 . Cleanup output in runTests if comments are embedded in test string 15 16 17Version 2.4.6 - December, 2019 18------------------------------ 19- Fixed typos in White mapping of whitespace characters, to use 20 correct "\u" prefix instead of "u\". 21 22- Fix bug in left-associative ternary operators defined using 23 infixNotation. First reported on StackOverflow by user Jeronimo. 24 25- Backport of pyparsing_test namespace from 3.0.0, including 26 TestParseResultsAsserts mixin class defining unittest-helper 27 methods: 28 . def assertParseResultsEquals( 29 self, result, expected_list=None, expected_dict=None, msg=None) 30 . def assertParseAndCheckList( 31 self, expr, test_string, expected_list, msg=None, verbose=True) 32 . def assertParseAndCheckDict( 33 self, expr, test_string, expected_dict, msg=None, verbose=True) 34 . def assertRunTestResults( 35 self, run_tests_report, expected_parse_results=None, msg=None) 36 . def assertRaisesParseException(self, exc_type=ParseException, msg=None) 37 38 To use the methods in this mixin class, declare your unittest classes as: 39 40 from pyparsing import pyparsing_test as ppt 41 class MyParserTest(ppt.TestParseResultsAsserts, unittest.TestCase): 42 ... 43 44 45Version 2.4.5 - November, 2019 46------------------------------ 47- Fixed encoding when setup.py reads README.rst to include the 48 project long description when uploading to PyPI. A stray 49 unicode space in README.rst prevented the source install on 50 systems whose default encoding is not 'utf-8'. 51 52 53Version 2.4.4 - November, 2019 54-------------------------------- 55- Unresolved symbol reference in 2.4.3 release was masked by stdout 56 buffering in unit tests, thanks for the prompt heads-up, Ned 57 Batchelder! 58 59 60Version 2.4.3 - November, 2019 61------------------------------ 62- Fixed a bug in ParserElement.__eq__ that would for some parsers 63 create a recursion error at parser definition time. Thanks to 64 Michael Clerx for the assist. (Addresses issue #123) 65 66- Fixed bug in indentedBlock where a block that ended at the end 67 of the input string could cause pyaprsing to loop forever. Raised 68 as part of discussion on StackOverflow with geckos. 69 70- Backports from pyparsing 3.0.0: 71 . __diag__.enable_all_warnings() 72 . Fixed bug in PrecededBy which caused infinite recursion, issue #127 73 . support for using regex-compiled RE to construct Regex expressions 74 75 76Version 2.4.2 - July, 2019 77-------------------------- 78- Updated the shorthand notation that has been added for repetition 79 expressions: expr[min, max], with '...' valid as a min or max value: 80 - expr[...] and expr[0, ...] are equivalent to ZeroOrMore(expr) 81 - expr[1, ...] is equivalent to OneOrMore(expr) 82 - expr[n, ...] or expr[n,] is equivalent 83 to expr*n + ZeroOrMore(expr) 84 (read as "n or more instances of expr") 85 - expr[..., n] is equivalent to expr*(0, n) 86 - expr[m, n] is equivalent to expr*(m, n) 87 Note that expr[..., n] and expr[m, n] do not raise an exception 88 if more than n exprs exist in the input stream. If this 89 behavior is desired, then write expr[..., n] + ~expr. 90 91 Better interpretation of [...] as ZeroOrMore raised by crowsonkb, 92 thanks for keeping me in line! 93 94 If upgrading from 2.4.1 or 2.4.1.1 and you have used `expr[...]` 95 for `OneOrMore(expr)`, it must be updated to `expr[1, ...]`. 96 97- The defaults on all the `__diag__` switches have been set to False, 98 to avoid getting alarming warnings. To use these diagnostics, set 99 them to True after importing pyparsing. 100 101 Example: 102 103 import pyparsing as pp 104 pp.__diag__.warn_multiple_tokens_in_named_alternation = True 105 106- Fixed bug introduced by the use of __getitem__ for repetition, 107 overlooking Python's legacy implementation of iteration 108 by sequentially calling __getitem__ with increasing numbers until 109 getting an IndexError. Found during investigation of problem 110 reported by murlock, merci! 111 112 113Version 2.4.2a1 - July, 2019 114---------------------------- 115It turns out I got the meaning of `[...]` absolutely backwards, 116so I've deleted 2.4.1 and am repushing this release as 2.4.2a1 117for people to give it a try before I can call it ready to go. 118 119The `expr[...]` notation was pushed out to be synonymous with 120`OneOrMore(expr)`, but this is really counter to most Python 121notations (and even other internal pyparsing notations as well). 122It should have been defined to be equivalent to ZeroOrMore(expr). 123 124- Changed [...] to emit ZeroOrMore instead of OneOrMore. 125 126- Removed code that treats ParserElements like iterables. 127 128- Change all __diag__ switches to False. 129 130 131Version 2.4.1.1 - July 24, 2019 132------------------------------- 133This is a re-release of version 2.4.1 to restore the release history 134in PyPI, since the 2.4.1 release was deleted. 135 136There are 3 known issues in this release, which are fixed in 137the upcoming 2.4.2: 138 139- API change adding support for `expr[...]` - the original 140 code in 2.4.1 incorrectly implemented this as OneOrMore. 141 Code using this feature under this relase should explicitly 142 use `expr[0, ...]` for ZeroOrMore and `expr[1, ...]` for 143 OneOrMore. In 2.4.2 you will be able to write `expr[...]` 144 equivalent to `ZeroOrMore(expr)`. 145 146- Bug if composing And, Or, MatchFirst, or Each expressions 147 using an expression. This only affects code which uses 148 explicit expression construction using the And, Or, etc. 149 classes instead of using overloaded operators '+', '^', and 150 so on. If constructing an And using a single expression, 151 you may get an error that "cannot multiply ParserElement by 152 0 or (0, 0)" or a Python `IndexError`. Change code like 153 154 cmd = Or(Word(alphas)) 155 156 to 157 158 cmd = Or([Word(alphas)]) 159 160 (Note that this is not the recommended style for constructing 161 Or expressions.) 162 163- Some newly-added `__diag__` switches are enabled by default, 164 which may give rise to noisy user warnings for existing parsers. 165 You can disable them using: 166 167 import pyparsing as pp 168 pp.__diag__.warn_multiple_tokens_in_named_alternation = False 169 pp.__diag__.warn_ungrouped_named_tokens_in_collection = False 170 pp.__diag__.warn_name_set_on_empty_Forward = False 171 pp.__diag__.warn_on_multiple_string_args_to_oneof = False 172 pp.__diag__.enable_debug_on_named_expressions = False 173 174 In 2.4.2 these will all be set to False by default. 175 176 177Version 2.4.1 - July, 2019 178-------------------------- 179- NOTE: Deprecated functions and features that will be dropped 180 in pyparsing 2.5.0 (planned next release): 181 182 . support for Python 2 - ongoing users running with 183 Python 2 can continue to use pyparsing 2.4.1 184 185 . ParseResults.asXML() - if used for debugging, switch 186 to using ParseResults.dump(); if used for data transfer, 187 use ParseResults.asDict() to convert to a nested Python 188 dict, which can then be converted to XML or JSON or 189 other transfer format 190 191 . operatorPrecedence synonym for infixNotation - 192 convert to calling infixNotation 193 194 . commaSeparatedList - convert to using 195 pyparsing_common.comma_separated_list 196 197 . upcaseTokens and downcaseTokens - convert to using 198 pyparsing_common.upcaseTokens and downcaseTokens 199 200 . __compat__.collect_all_And_tokens will not be settable to 201 False to revert to pre-2.3.1 results name behavior - 202 review use of names for MatchFirst and Or expressions 203 containing And expressions, as they will return the 204 complete list of parsed tokens, not just the first one. 205 Use __diag__.warn_multiple_tokens_in_named_alternation 206 (described below) to help identify those expressions 207 in your parsers that will have changed as a result. 208 209- A new shorthand notation has been added for repetition 210 expressions: expr[min, max], with '...' valid as a min 211 or max value: 212 - expr[...] is equivalent to OneOrMore(expr) 213 - expr[0, ...] is equivalent to ZeroOrMore(expr) 214 - expr[1, ...] is equivalent to OneOrMore(expr) 215 - expr[n, ...] or expr[n,] is equivalent 216 to expr*n + ZeroOrMore(expr) 217 (read as "n or more instances of expr") 218 - expr[..., n] is equivalent to expr*(0, n) 219 - expr[m, n] is equivalent to expr*(m, n) 220 Note that expr[..., n] and expr[m, n] do not raise an exception 221 if more than n exprs exist in the input stream. If this 222 behavior is desired, then write expr[..., n] + ~expr. 223 224- '...' can also be used as short hand for SkipTo when used 225 in adding parse expressions to compose an And expression. 226 227 Literal('start') + ... + Literal('end') 228 And(['start', ..., 'end']) 229 230 are both equivalent to: 231 232 Literal('start') + SkipTo('end')("_skipped*") + Literal('end') 233 234 The '...' form has the added benefit of not requiring repeating 235 the skip target expression. Note that the skipped text is 236 returned with '_skipped' as a results name, and that the contents of 237 `_skipped` will contain a list of text from all `...`s in the expression. 238 239- '...' can also be used as a "skip forward in case of error" expression: 240 241 expr = "start" + (Word(nums).setName("int") | ...) + "end" 242 243 expr.parseString("start 456 end") 244 ['start', '456', 'end'] 245 246 expr.parseString("start 456 foo 789 end") 247 ['start', '456', 'foo 789 ', 'end'] 248 - _skipped: ['foo 789 '] 249 250 expr.parseString("start foo end") 251 ['start', 'foo ', 'end'] 252 - _skipped: ['foo '] 253 254 expr.parseString("start end") 255 ['start', '', 'end'] 256 - _skipped: ['missing <int>'] 257 258 Note that in all the error cases, the '_skipped' results name is 259 present, showing a list of the extra or missing items. 260 261 This form is only valid when used with the '|' operator. 262 263- Improved exception messages to show what was actually found, not 264 just what was expected. 265 266 word = pp.Word(pp.alphas) 267 pp.OneOrMore(word).parseString("aaa bbb 123", parseAll=True) 268 269 Former exception message: 270 271 pyparsing.ParseException: Expected end of text (at char 8), (line:1, col:9) 272 273 New exception message: 274 275 pyparsing.ParseException: Expected end of text, found '1' (at char 8), (line:1, col:9) 276 277- Added diagnostic switches to help detect and warn about common 278 parser construction mistakes, or enable additional parse 279 debugging. Switches are attached to the pyparsing.__diag__ 280 namespace object: 281 - warn_multiple_tokens_in_named_alternation - flag to enable warnings when a results 282 name is defined on a MatchFirst or Or expression with one or more And subexpressions 283 (default=True) 284 - warn_ungrouped_named_tokens_in_collection - flag to enable warnings when a results 285 name is defined on a containing expression with ungrouped subexpressions that also 286 have results names (default=True) 287 - warn_name_set_on_empty_Forward - flag to enable warnings whan a Forward is defined 288 with a results name, but has no contents defined (default=False) 289 - warn_on_multiple_string_args_to_oneof - flag to enable warnings whan oneOf is 290 incorrectly called with multiple str arguments (default=True) 291 - enable_debug_on_named_expressions - flag to auto-enable debug on all subsequent 292 calls to ParserElement.setName() (default=False) 293 294 warn_multiple_tokens_in_named_alternation is intended to help 295 those who currently have set __compat__.collect_all_And_tokens to 296 False as a workaround for using the pre-2.3.1 code with named 297 MatchFirst or Or expressions containing an And expression. 298 299- Added ParseResults.from_dict classmethod, to simplify creation 300 of a ParseResults with results names using a dict, which may be nested. 301 This makes it easy to add a sub-level of named items to the parsed 302 tokens in a parse action. 303 304- Added asKeyword argument (default=False) to oneOf, to force 305 keyword-style matching on the generated expressions. 306 307- ParserElement.runTests now accepts an optional 'file' argument to 308 redirect test output to a file-like object (such as a StringIO, 309 or opened file). Default is to write to sys.stdout. 310 311- conditionAsParseAction is a helper method for constructing a 312 parse action method from a predicate function that simply 313 returns a boolean result. Useful for those places where a 314 predicate cannot be added using addCondition, but must be 315 converted to a parse action (such as in infixNotation). May be 316 used as a decorator if default message and exception types 317 can be used. See ParserElement.addCondition for more details 318 about the expected signature and behavior for predicate condition 319 methods. 320 321- While investigating issue #93, I found that Or and 322 addCondition could interact to select an alternative that 323 is not the longest match. This is because Or first checks 324 all alternatives for matches without running attached 325 parse actions or conditions, orders by longest match, and 326 then rechecks for matches with conditions and parse actions. 327 Some expressions, when checking with conditions, may end 328 up matching on a shorter token list than originally matched, 329 but would be selected because of its original priority. 330 This matching code has been expanded to do more extensive 331 searching for matches when a second-pass check matches a 332 smaller list than in the first pass. 333 334- Fixed issue #87, a regression in indented block. 335 Reported by Renz Bagaporo, who submitted a very nice repro 336 example, which makes the bug-fixing process a lot easier, 337 thanks! 338 339- Fixed MemoryError issue #85 and #91 with str generation for 340 Forwards. Thanks decalage2 and Harmon758 for your patience. 341 342- Modified setParseAction to accept None as an argument, 343 indicating that all previously-defined parse actions for the 344 expression should be cleared. 345 346- Modified pyparsing_common.real and sci_real to parse reals 347 without leading integer digits before the decimal point, 348 consistent with Python real number formats. Original PR #98 349 submitted by ansobolev. 350 351- Modified runTests to call postParse function before dumping out 352 the parsed results - allows for postParse to add further results, 353 such as indications of additional validation success/failure. 354 355- Updated statemachine example: refactored state transitions to use 356 overridden classmethods; added <statename>Mixin class to simplify 357 definition of application classes that "own" the state object and 358 delegate to it to model state-specific properties and behavior. 359 360- Added example nested_markup.py, showing a simple wiki markup with 361 nested markup directives, and illustrating the use of '...' for 362 skipping over input to match the next expression. (This example 363 uses syntax that is not valid under Python 2.) 364 365- Rewrote delta_time.py example (renamed from deltaTime.py) to 366 fix some omitted formats and upgrade to latest pyparsing idioms, 367 beginning with writing an actual BNF. 368 369- With the help and encouragement from several contributors, including 370 Matěj Cepl and Cengiz Kaygusuz, I've started cleaning up the internal 371 coding styles in core pyparsing, bringing it up to modern coding 372 practices from pyparsing's early development days dating back to 373 2003. Whitespace has been largely standardized along PEP8 guidelines, 374 removing extra spaces around parentheses, and adding them around 375 arithmetic operators and after colons and commas. I was going to hold 376 off on doing this work until after 2.4.1, but after cleaning up a 377 few trial classes, the difference was so significant that I continued 378 on to the rest of the core code base. This should facilitate future 379 work and submitted PRs, allowing them to focus on substantive code 380 changes, and not get sidetracked by whitespace issues. 381 382 383Version 2.4.0 - April, 2019 384--------------------------- 385- Well, it looks like the API change that was introduced in 2.3.1 was more 386 drastic than expected, so for a friendlier forward upgrade path, this 387 release: 388 . Bumps the current version number to 2.4.0, to reflect this 389 incompatible change. 390 . Adds a pyparsing.__compat__ object for specifying compatibility with 391 future breaking changes. 392 . Conditionalizes the API-breaking behavior, based on the value 393 pyparsing.__compat__.collect_all_And_tokens. By default, this value 394 will be set to True, reflecting the new bugfixed behavior. To set this 395 value to False, add to your code: 396 397 import pyparsing 398 pyparsing.__compat__.collect_all_And_tokens = False 399 400 . User code that is dependent on the pre-bugfix behavior can restore 401 it by setting this value to False. 402 403 In 2.5 and later versions, the conditional code will be removed and 404 setting the flag to True or False in these later versions will have no 405 effect. 406 407- Updated unitTests.py and simple_unit_tests.py to be compatible with 408 "python setup.py test". To run tests using setup, do: 409 410 python setup.py test 411 python setup.py test -s unitTests.suite 412 python setup.py test -s simple_unit_tests.suite 413 414 Prompted by issue #83 and PR submitted by bdragon28, thanks. 415 416- Fixed bug in runTests handling '\n' literals in quoted strings. 417 418- Added tag_body attribute to the start tag expressions generated by 419 makeHTMLTags, so that you can avoid using SkipTo to roll your own 420 tag body expression: 421 422 a, aEnd = pp.makeHTMLTags('a') 423 link = a + a.tag_body("displayed_text") + aEnd 424 for t in s.searchString(html_page): 425 print(t.displayed_text, '->', t.startA.href) 426 427- indentedBlock failure handling was improved; PR submitted by TMiguelT, 428 thanks! 429 430- Address Py2 incompatibility in simpleUnitTests, plus explain() and 431 Forward str() cleanup; PRs graciously provided by eswald. 432 433- Fixed docstring with embedded '\w', which creates SyntaxWarnings in 434 Py3.8, issue #80. 435 436- Examples: 437 438 - Added example parser for rosettacode.org tutorial compiler. 439 440 - Added example to show how an HTML table can be parsed into a 441 collection of Python lists or dicts, one per row. 442 443 - Updated SimpleSQL.py example to handle nested selects, reworked 444 'where' expression to use infixNotation. 445 446 - Added include_preprocessor.py, similar to macroExpander.py. 447 448 - Examples using makeHTMLTags use new tag_body expression when 449 retrieving a tag's body text. 450 451 - Updated examples that are runnable as unit tests: 452 453 python setup.py test -s examples.antlr_grammar_tests 454 python setup.py test -s examples.test_bibparse 455 456 457Version 2.3.1 - January, 2019 458----------------------------- 459- POSSIBLE API CHANGE: this release fixes a bug when results names were 460 attached to a MatchFirst or Or object containing an And object. 461 Previously, a results name on an And object within an enclosing MatchFirst 462 or Or could return just the first token in the And. Now, all the tokens 463 matched by the And are correctly returned. This may result in subtle 464 changes in the tokens returned if you have this condition in your pyparsing 465 scripts. 466 467- New staticmethod ParseException.explain() to help diagnose parse exceptions 468 by showing the failing input line and the trace of ParserElements in 469 the parser leading up to the exception. explain() returns a multiline 470 string listing each element by name. (This is still an experimental 471 method, and the method signature and format of the returned string may 472 evolve over the next few releases.) 473 474 Example: 475 # define a parser to parse an integer followed by an 476 # alphabetic word 477 expr = pp.Word(pp.nums).setName("int") 478 + pp.Word(pp.alphas).setName("word") 479 try: 480 # parse a string with a numeric second value instead of alpha 481 expr.parseString("123 355") 482 except pp.ParseException as pe: 483 print(pp.ParseException.explain(pe)) 484 485 Prints: 486 123 355 487 ^ 488 ParseException: Expected word (at char 4), (line:1, col:5) 489 __main__.ExplainExceptionTest 490 pyparsing.And - {int word} 491 pyparsing.Word - word 492 493 explain() will accept any exception type and will list the function 494 names and parse expressions in the stack trace. This is especially 495 useful when an exception is raised in a parse action. 496 497 Note: explain() is only supported under Python 3. 498 499- Fix bug in dictOf which could match an empty sequence, making it 500 infinitely loop if wrapped in a OneOrMore. 501 502- Added unicode sets to pyparsing_unicode for Latin-A and Latin-B ranges. 503 504- Added ability to define custom unicode sets as combinations of other sets 505 using multiple inheritance. 506 507 class Turkish_set(pp.pyparsing_unicode.Latin1, pp.pyparsing_unicode.LatinA): 508 pass 509 510 turkish_word = pp.Word(Turkish_set.alphas) 511 512- Updated state machine import examples, with state machine demos for: 513 . traffic light 514 . library book checkin/checkout 515 . document review/approval 516 517 In the traffic light example, you can use the custom 'statemachine' keyword 518 to define the states for a traffic light, and have the state classes 519 auto-generated for you: 520 521 statemachine TrafficLightState: 522 Red -> Green 523 Green -> Yellow 524 Yellow -> Red 525 526 Similar for state machines with named transitions, like the library book 527 state example: 528 529 statemachine LibraryBookState: 530 New -(shelve)-> Available 531 Available -(reserve)-> OnHold 532 OnHold -(release)-> Available 533 Available -(checkout)-> CheckedOut 534 CheckedOut -(checkin)-> Available 535 536 Once the classes are defined, then additional Python code can reference those 537 classes to add class attributes, instance methods, etc. 538 539 See the examples in examples/statemachine 540 541- Added an example parser for the decaf language. This language is used in 542 CS compiler classes in many colleges and universities. 543 544- Fixup of docstrings to Sphinx format, inclusion of test files in the source 545 package, and convert markdown to rst throughout the distribution, great job 546 by Matěj Cepl! 547 548- Expanded the whitespace characters recognized by the White class to include 549 all unicode defined spaces. Suggested in Issue #51 by rtkjbillo. 550 551- Added optional postParse argument to ParserElement.runTests() to add a 552 custom callback to be called for test strings that parse successfully. Useful 553 for running tests that do additional validation or processing on the parsed 554 results. See updated chemicalFormulas.py example. 555 556- Removed distutils fallback in setup.py. If installing the package fails, 557 please update to the latest version of setuptools. Plus overall project code 558 cleanup (CRLFs, whitespace, imports, etc.), thanks Jon Dufresne! 559 560- Fix bug in CaselessKeyword, to make its behavior consistent with 561 Keyword(caseless=True). Fixes Issue #65 reported by telesphore. 562 563 564Version 2.3.0 - October, 2018 565----------------------------- 566- NEW SUPPORT FOR UNICODE CHARACTER RANGES 567 This release introduces the pyparsing_unicode namespace class, defining 568 a series of language character sets to simplify the definition of alphas, 569 nums, alphanums, and printables in the following language sets: 570 . Arabic 571 . Chinese 572 . Cyrillic 573 . Devanagari 574 . Greek 575 . Hebrew 576 . Japanese (including Kanji, Katakana, and Hirigana subsets) 577 . Korean 578 . Latin1 (includes 7 and 8-bit Latin characters) 579 . Thai 580 . CJK (combination of Chinese, Japanese, and Korean sets) 581 582 For example, your code can define words using: 583 584 korean_word = Word(pyparsing_unicode.Korean.alphas) 585 586 See their use in the updated examples greetingInGreek.py and 587 greetingInKorean.py. 588 589 This namespace class also offers access to these sets using their 590 unicode identifiers. 591 592- POSSIBLE API CHANGE: Fixed bug where a parse action that explicitly 593 returned the input ParseResults could add another nesting level in 594 the results if the current expression had a results name. 595 596 vals = pp.OneOrMore(pp.pyparsing_common.integer)("int_values") 597 598 def add_total(tokens): 599 tokens['total'] = sum(tokens) 600 return tokens # this line can be removed 601 602 vals.addParseAction(add_total) 603 print(vals.parseString("244 23 13 2343").dump()) 604 605 Before the fix, this code would print (note the extra nesting level): 606 607 [244, 23, 13, 2343] 608 - int_values: [244, 23, 13, 2343] 609 - int_values: [244, 23, 13, 2343] 610 - total: 2623 611 - total: 2623 612 613 With the fix, this code now prints: 614 615 [244, 23, 13, 2343] 616 - int_values: [244, 23, 13, 2343] 617 - total: 2623 618 619 This fix will change the structure of ParseResults returned if a 620 program defines a parse action that returns the tokens that were 621 sent in. This is not necessary, and statements like "return tokens" 622 in the example above can be safely deleted prior to upgrading to 623 this release, in order to avoid the bug and get the new behavior. 624 625 Reported by seron in Issue #22, nice catch! 626 627- POSSIBLE API CHANGE: Fixed a related bug where a results name 628 erroneously created a second level of hierarchy in the returned 629 ParseResults. The intent for accumulating results names into ParseResults 630 is that, in the absence of Group'ing, all names get merged into a 631 common namespace. This allows us to write: 632 633 key_value_expr = (Word(alphas)("key") + '=' + Word(nums)("value")) 634 result = key_value_expr.parseString("a = 100") 635 636 and have result structured as {"key": "a", "value": "100"} 637 instead of [{"key": "a"}, {"value": "100"}]. 638 639 However, if a named expression is used in a higher-level non-Group 640 expression that *also* has a name, a false sub-level would be created 641 in the namespace: 642 643 num = pp.Word(pp.nums) 644 num_pair = ("[" + (num("A") + num("B"))("values") + "]") 645 U = num_pair.parseString("[ 10 20 ]") 646 print(U.dump()) 647 648 Since there is no grouping, "A", "B", and "values" should all appear 649 at the same level in the results, as: 650 651 ['[', '10', '20', ']'] 652 - A: '10' 653 - B: '20' 654 - values: ['10', '20'] 655 656 Instead, an extra level of "A" and "B" show up under "values": 657 658 ['[', '10', '20', ']'] 659 - A: '10' 660 - B: '20' 661 - values: ['10', '20'] 662 - A: '10' 663 - B: '20' 664 665 This bug has been fixed. Now, if this hierarchy is desired, then a 666 Group should be added: 667 668 num_pair = ("[" + pp.Group(num("A") + num("B"))("values") + "]") 669 670 Giving: 671 672 ['[', ['10', '20'], ']'] 673 - values: ['10', '20'] 674 - A: '10' 675 - B: '20' 676 677 But in no case should "A" and "B" appear in multiple levels. This bug-fix 678 fixes that. 679 680 If you have current code which relies on this behavior, then add or remove 681 Groups as necessary to get your intended results structure. 682 683 Reported by Athanasios Anastasiou. 684 685- IndexError's raised in parse actions will get explicitly reraised 686 as ParseExceptions that wrap the original IndexError. Since 687 IndexError sometimes occurs as part of pyparsing's normal parsing 688 logic, IndexErrors that are raised during a parse action may have 689 gotten silently reinterpreted as parsing errors. To retain the 690 information from the IndexError, these exceptions will now be 691 raised as ParseExceptions that reference the original IndexError. 692 This wrapping will only be visible when run under Python3, since it 693 emulates "raise ... from ..." syntax. 694 695 Addresses Issue #4, reported by guswns0528. 696 697- Added Char class to simplify defining expressions of a single 698 character. (Char("abc") is equivalent to Word("abc", exact=1)) 699 700- Added class PrecededBy to perform lookbehind tests. PrecededBy is 701 used in the same way as FollowedBy, passing in an expression that 702 must occur just prior to the current parse location. 703 704 For fixed-length expressions like a Literal, Keyword, Char, or a 705 Word with an `exact` or `maxLen` length given, `PrecededBy(expr)` 706 is sufficient. For varying length expressions like a Word with no 707 given maximum length, `PrecededBy` must be constructed with an 708 integer `retreat` argument, as in 709 `PrecededBy(Word(alphas, nums), retreat=10)`, to specify the maximum 710 number of characters pyparsing must look backward to make a match. 711 pyparsing will check all the values from 1 up to retreat characters 712 back from the current parse location. 713 714 When stepping backwards through the input string, PrecededBy does 715 *not* skip over whitespace. 716 717 PrecededBy can be created with a results name so that, even though 718 it always returns an empty parse result, the result *can* include 719 named results. 720 721 Idea first suggested in Issue #30 by Freakwill. 722 723- Updated FollowedBy to accept expressions that contain named results, 724 so that results names defined in the lookahead expression will be 725 returned, even though FollowedBy always returns an empty list. 726 Inspired by the same feature implemented in PrecededBy. 727 728 729Version 2.2.2 - September, 2018 730------------------------------- 731- Fixed bug in SkipTo, if a SkipTo expression that was skipping to 732 an expression that returned a list (such as an And), and the 733 SkipTo was saved as a named result, the named result could be 734 saved as a ParseResults - should always be saved as a string. 735 Issue #28, reported by seron. 736 737- Added simple_unit_tests.py, as a collection of easy-to-follow unit 738 tests for various classes and features of the pyparsing library. 739 Primary intent is more to be instructional than actually rigorous 740 testing. Complex tests can still be added in the unitTests.py file. 741 742- New features added to the Regex class: 743 - optional asGroupList parameter, returns all the capture groups as 744 a list 745 - optional asMatch parameter, returns the raw re.match result 746 - new sub(repl) method, which adds a parse action calling 747 re.sub(pattern, repl, parsed_result). Simplifies creating 748 Regex expressions to be used with transformString. Like re.sub, 749 repl may be an ordinary string (similar to using pyparsing's 750 replaceWith), or may contain references to capture groups by group 751 number, or may be a callable that takes an re match group and 752 returns a string. 753 754 For instance: 755 expr = pp.Regex(r"([Hh]\d):\s*(.*)").sub(r"<\1>\2</\1>") 756 expr.transformString("h1: This is the title") 757 758 will return 759 <h1>This is the title</h1> 760 761- Fixed omission of LICENSE file in source tarball, also added 762 CODE_OF_CONDUCT.md per GitHub community standards. 763 764 765Version 2.2.1 - September, 2018 766------------------------------- 767- Applied changes necessary to migrate hosting of pyparsing source 768 over to GitHub. Many thanks for help and contributions from hugovk, 769 jdufresne, and cngkaygusuz among others through this transition, 770 sorry it took me so long! 771 772- Fixed import of collections.abc to address DeprecationWarnings 773 in Python 3.7. 774 775- Updated oc.py example to support function calls in arithmetic 776 expressions; fixed regex for '==' operator; and added packrat 777 parsing. Raised on the pyparsing wiki by Boris Marin, thanks! 778 779- Fixed bug in select_parser.py example, group_by_terms was not 780 reported. Reported on SF bugs by Adam Groszer, thanks Adam! 781 782- Added "Getting Started" section to the module docstring, to 783 guide new users to the most common starting points in pyparsing's 784 API. 785 786- Fixed bug in Literal and Keyword classes, which erroneously 787 raised IndexError instead of ParseException. 788 789 790Version 2.2.0 - March, 2017 791--------------------------- 792- Bumped minor version number to reflect compatibility issues with 793 OneOrMore and ZeroOrMore bugfixes in 2.1.10. (2.1.10 fixed a bug 794 that was introduced in 2.1.4, but the fix could break code 795 written against 2.1.4 - 2.1.9.) 796 797- Updated setup.py to address recursive import problems now 798 that pyparsing is part of 'packaging' (used by setuptools). 799 Patch submitted by Joshua Root, much thanks! 800 801- Fixed KeyError issue reported by Yann Bizeul when using packrat 802 parsing in the Graphite time series database, thanks Yann! 803 804- Fixed incorrect usages of '\' in literals, as described in 805 https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior 806 Patch submitted by Ville Skyttä - thanks! 807 808- Minor internal change when using '-' operator, to be compatible 809 with ParserElement.streamline() method. 810 811- Expanded infixNotation to accept a list or tuple of parse actions 812 to attach to an operation. 813 814- New unit test added for dill support for storing pyparsing parsers. 815 Ordinary Python pickle can be used to pickle pyparsing parsers as 816 long as they do not use any parse actions. The 'dill' module is an 817 extension to pickle which *does* support pickling of attached 818 parse actions. 819 820 821Version 2.1.10 - October, 2016 822------------------------------- 823- Fixed bug in reporting named parse results for ZeroOrMore 824 expressions, thanks Ethan Nash for reporting this! 825 826- Fixed behavior of LineStart to be much more predictable. 827 LineStart can now be used to detect if the next parse position 828 is col 1, factoring in potential leading whitespace (which would 829 cause LineStart to fail). Also fixed a bug in col, which is 830 used in LineStart, where '\n's were erroneously considered to 831 be column 1. 832 833- Added support for multiline test strings in runTests. 834 835- Fixed bug in ParseResults.dump when keys were not strings. 836 Also changed display of string values to show them in quotes, 837 to help distinguish parsed numeric strings from parsed integers 838 that have been converted to Python ints. 839 840 841Version 2.1.9 - September, 2016 842------------------------------- 843- Added class CloseMatch, a variation on Literal which matches 844 "close" matches, that is, strings with at most 'n' mismatching 845 characters. 846 847- Fixed bug in Keyword.setDefaultKeywordChars(), reported by Kobayashi 848 Shinji - nice catch, thanks! 849 850- Minor API change in pyparsing_common. Renamed some of the common 851 expressions to PEP8 format (to be consistent with the other 852 pyparsing_common expressions): 853 . signedInteger -> signed_integer 854 . sciReal -> sci_real 855 856 Also, in trying to stem the API bloat of pyparsing, I've copied 857 some of the global expressions and helper parse actions into 858 pyparsing_common, with the originals to be deprecated and removed 859 in a future release: 860 . commaSeparatedList -> pyparsing_common.comma_separated_list 861 . upcaseTokens -> pyparsing_common.upcaseTokens 862 . downcaseTokens -> pyparsing_common.downcaseTokens 863 864 (I don't expect any other expressions, like the comment expressions, 865 quotedString, or the Word-helping strings like alphas, nums, etc. 866 to migrate to pyparsing_common - they are just too pervasive. As for 867 the PEP8 vs camelCase naming, all the expressions are PEP8, while 868 the parse actions in pyparsing_common are still camelCase. It's a 869 small step - when pyparsing 3.0 comes around, everything will change 870 to PEP8 snake case.) 871 872- Fixed Python3 compatibility bug when using dict keys() and values() 873 in ParseResults.getName(). 874 875- After some prodding, I've reworked the unitTests.py file for 876 pyparsing over the past few releases. It uses some variations on 877 unittest to handle my testing style. The test now: 878 . auto-discovers its test classes (while maintining their order 879 of definition) 880 . suppresses voluminous 'print' output for tests that pass 881 882 883Version 2.1.8 - August, 2016 884---------------------------- 885- Fixed issue in the optimization to _trim_arity, when the full 886 stacktrace is retrieved to determine if a TypeError is raised in 887 pyparsing or in the caller's parse action. Code was traversing 888 the full stacktrace, and potentially encountering UnicodeDecodeError. 889 890- Fixed bug in ParserElement.inlineLiteralsUsing, causing infinite 891 loop with Suppress. 892 893- Fixed bug in Each, when merging named results from multiple 894 expressions in a ZeroOrMore or OneOrMore. Also fixed bug when 895 ZeroOrMore expressions were erroneously treated as required 896 expressions in an Each expression. 897 898- Added a few more inline doc examples. 899 900- Improved use of runTests in several example scripts. 901 902 903Version 2.1.7 - August, 2016 904---------------------------- 905- Fixed regression reported by Andrea Censi (surfaced in PyContracts 906 tests) when using ParseSyntaxExceptions (raised when using operator '-') 907 with packrat parsing. 908 909- Minor fix to oneOf, to accept all iterables, not just space-delimited 910 strings and lists. (If you have a list or set of strings, it is 911 not necessary to concat them using ' '.join to pass them to oneOf, 912 oneOf will accept the list or set or generator directly.) 913 914 915Version 2.1.6 - August, 2016 916---------------------------- 917- *Major packrat upgrade*, inspired by patch provided by Tal Einat - 918 many, many, thanks to Tal for working on this! Tal's tests show 919 faster parsing performance (2X in some tests), *and* memory reduction 920 from 3GB down to ~100MB! Requires no changes to existing code using 921 packratting. (Uses OrderedDict, available in Python 2.7 and later. 922 For Python 2.6 users, will attempt to import from ordereddict 923 backport. If not present, will implement pure-Python Fifo dict.) 924 925- Minor API change - to better distinguish between the flexible 926 numeric types defined in pyparsing_common, I've changed "numeric" 927 (which parsed numbers of different types and returned int for ints, 928 float for floats, etc.) and "number" (which parsed numbers of int 929 or float type, and returned all floats) to "number" and "fnumber" 930 respectively. I hope the "f" prefix of "fnumber" will be a better 931 indicator of its internal conversion of parsed values to floats, 932 while the generic "number" is similar to the flexible number syntax 933 in other languages. Also fixed a bug in pyparsing_common.numeric 934 (now renamed to pyparsing_common.number), integers were parsed and 935 returned as floats instead of being retained as ints. 936 937- Fixed bug in upcaseTokens and downcaseTokens introduced in 2.1.5, 938 when the parse action was used in conjunction with results names. 939 Reported by Steven Arcangeli from the dql project, thanks for your 940 patience, Steven! 941 942- Major change to docs! After seeing some comments on reddit about 943 general issue with docs of Python modules, and thinking that I'm a 944 little overdue in doing some doc tuneup on pyparsing, I decided to 945 following the suggestions of the redditor and add more inline examples 946 to the pyparsing reference documentation. I hope this addition 947 will clarify some of the more common questions people have, especially 948 when first starting with pyparsing/Python. 949 950- Deprecated ParseResults.asXML. I've never been too happy with this 951 method, and it usually forces some unnatural code in the parsers in 952 order to get decent tag names. The amount of guesswork that asXML 953 has to do to try to match names with values should have been a red 954 flag from day one. If you are using asXML, you will need to implement 955 your own ParseResults->XML serialization. Or consider migrating to 956 a more current format such as JSON (which is very easy to do: 957 results_as_json = json.dumps(parse_result.asDict()) Hopefully, when 958 I remove this code in a future version, I'll also be able to simplify 959 some of the craziness in ParseResults, which IIRC was only there to try 960 to make asXML work. 961 962- Updated traceParseAction parse action decorator to show the repr 963 of the input and output tokens, instead of the str format, since 964 str has been simplified to just show the token list content. 965 966 (The change to ParseResults.__str__ occurred in pyparsing 2.0.4, but 967 it seems that didn't make it into the release notes - sorry! Too 968 many users, especially beginners, were confused by the 969 "([token_list], {names_dict})" str format for ParseResults, thinking 970 they were getting a tuple containing a list and a dict. The full form 971 can be seen if using repr().) 972 973 For tracing tokens in and out of parse actions, the more complete 974 repr form provides important information when debugging parse actions. 975 976 977Verison 2.1.5 - June, 2016 978------------------------------ 979- Added ParserElement.split() generator method, similar to re.split(). 980 Includes optional arguments maxsplit (to limit the number of splits), 981 and includeSeparators (to include the separating matched text in the 982 returned output, default=False). 983 984- Added a new parse action construction helper tokenMap, which will 985 apply a function and optional arguments to each element in a 986 ParseResults. So this parse action: 987 988 def lowercase_all(tokens): 989 return [str(t).lower() for t in tokens] 990 OneOrMore(Word(alphas)).setParseAction(lowercase_all) 991 992 can now be written: 993 994 OneOrMore(Word(alphas)).setParseAction(tokenMap(str.lower)) 995 996 Also simplifies writing conversion parse actions like: 997 998 integer = Word(nums).setParseAction(lambda t: int(t[0])) 999 1000 to just: 1001 1002 integer = Word(nums).setParseAction(tokenMap(int)) 1003 1004 If additional arguments are necessary, they can be included in the 1005 call to tokenMap, as in: 1006 1007 hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16)) 1008 1009- Added more expressions to pyparsing_common: 1010 . IPv4 and IPv6 addresses (including long, short, and mixed forms 1011 of IPv6) 1012 . MAC address 1013 . ISO8601 date and date time strings (with named fields for year, month, etc.) 1014 . UUID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) 1015 . hex integer (returned as int) 1016 . fraction (integer '/' integer, returned as float) 1017 . mixed integer (integer '-' fraction, or just fraction, returned as float) 1018 . stripHTMLTags (parse action to remove tags from HTML source) 1019 . parse action helpers convertToDate and convertToDatetime to do custom parse 1020 time conversions of parsed ISO8601 strings 1021 1022- runTests now returns a two-tuple: success if all tests succeed, 1023 and an output list of each test and its output lines. 1024 1025- Added failureTests argument (default=False) to runTests, so that 1026 tests can be run that are expected failures, and runTests' success 1027 value will return True only if all tests *fail* as expected. Also, 1028 parseAll now defaults to True. 1029 1030- New example numerics.py, shows samples of parsing integer and real 1031 numbers using locale-dependent formats: 1032 1033 4.294.967.295,000 1034 4 294 967 295,000 1035 4,294,967,295.000 1036 1037 1038Version 2.1.4 - May, 2016 1039------------------------------ 1040- Split out the '==' behavior in ParserElement, now implemented 1041 as the ParserElement.matches() method. Using '==' for string test 1042 purposes will be removed in a future release. 1043 1044- Expanded capabilities of runTests(). Will now accept embedded 1045 comments (default is Python style, leading '#' character, but 1046 customizable). Comments will be emitted along with the tests and 1047 test output. Useful during test development, to create a test string 1048 consisting only of test case description comments separated by 1049 blank lines, and then fill in the test cases. Will also highlight 1050 ParseFatalExceptions with "(FATAL)". 1051 1052- Added a 'pyparsing_common' class containing common/helpful little 1053 expressions such as integer, float, identifier, etc. I used this 1054 class as a sort of embedded namespace, to contain these helpers 1055 without further adding to pyparsing's namespace bloat. 1056 1057- Minor enhancement to traceParseAction decorator, to retain the 1058 parse action's name for the trace output. 1059 1060- Added optional 'fatal' keyword arg to addCondition, to indicate that 1061 a condition failure should halt parsing immediately. 1062 1063 1064Version 2.1.3 - May, 2016 1065------------------------------ 1066- _trim_arity fix in 2.1.2 was very version-dependent on Py 3.5.0. 1067 Now works for Python 2.x, 3.3, 3.4, 3.5.0, and 3.5.1 (and hopefully 1068 beyond). 1069 1070 1071Version 2.1.2 - May, 2016 1072------------------------------ 1073- Fixed bug in _trim_arity when pyparsing code is included in a 1074 PyInstaller, reported by maluwa. 1075 1076- Fixed catastrophic regex backtracking in implementation of the 1077 quoted string expressions (dblQuotedString, sglQuotedString, and 1078 quotedString). Reported on the pyparsing wiki by webpentest, 1079 good catch! (Also tuned up some other expressions susceptible to the 1080 same backtracking problem, such as cStyleComment, cppStyleComment, 1081 etc.) 1082 1083 1084Version 2.1.1 - March, 2016 1085--------------------------- 1086- Added support for assigning to ParseResults using slices. 1087 1088- Fixed bug in ParseResults.toDict(), in which dict values were always 1089 converted to dicts, even if they were just unkeyed lists of tokens. 1090 Reported on SO by Gerald Thibault, thanks Gerald! 1091 1092- Fixed bug in SkipTo when using failOn, reported by robyschek, thanks! 1093 1094- Fixed bug in Each introduced in 2.1.0, reported by AND patch and 1095 unit test submitted by robyschek, well done! 1096 1097- Removed use of functools.partial in replaceWith, as this creates 1098 an ambiguous signature for the generated parse action, which fails in 1099 PyPy. Reported by Evan Hubinger, thanks Evan! 1100 1101- Added default behavior to QuotedString to convert embedded '\t', '\n', 1102 etc. characters to their whitespace counterparts. Found during Q&A 1103 exchange on SO with Maxim. 1104 1105 1106Version 2.1.0 - February, 2016 1107------------------------------ 1108- Modified the internal _trim_arity method to distinguish between 1109 TypeError's raised while trying to determine parse action arity and 1110 those raised within the parse action itself. This will clear up those 1111 confusing "<lambda>() takes exactly 1 argument (0 given)" error 1112 messages when there is an actual TypeError in the body of the parse 1113 action. Thanks to all who have raised this issue in the past, and 1114 most recently to Michael Cohen, who sent in a proposed patch, and got 1115 me to finally tackle this problem. 1116 1117- Added compatibility for pickle protocols 2-4 when pickling ParseResults. 1118 In Python 2.x, protocol 0 was the default, and protocol 2 did not work. 1119 In Python 3.x, protocol 3 is the default, so explicitly naming 1120 protocol 0 or 1 was required to pickle ParseResults. With this release, 1121 all protocols 0-4 are supported. Thanks for reporting this on StackOverflow, 1122 Arne Wolframm, and for providing a nice simple test case! 1123 1124- Added optional 'stopOn' argument to ZeroOrMore and OneOrMore, to 1125 simplify breaking on stop tokens that would match the repetition 1126 expression. 1127 1128 It is a common problem to fail to look ahead when matching repetitive 1129 tokens if the sentinel at the end also matches the repetition 1130 expression, as when parsing "BEGIN aaa bbb ccc END" with: 1131 1132 "BEGIN" + OneOrMore(Word(alphas)) + "END" 1133 1134 Since "END" matches the repetition expression "Word(alphas)", it will 1135 never get parsed as the terminating sentinel. Up until now, this has 1136 to be resolved by the user inserting their own negative lookahead: 1137 1138 "BEGIN" + OneOrMore(~Literal("END") + Word(alphas)) + "END" 1139 1140 Using stopOn, they can more easily write: 1141 1142 "BEGIN" + OneOrMore(Word(alphas), stopOn="END") + "END" 1143 1144 The stopOn argument can be a literal string or a pyparsing expression. 1145 Inspired by a question by Lamakaha on StackOverflow (and many previous 1146 questions with the same negative-lookahead resolution). 1147 1148- Added expression names for many internal and builtin expressions, to 1149 reduce name and error message overhead during parsing. 1150 1151- Converted helper lambdas to functions to refactor and add docstring 1152 support. 1153 1154- Fixed ParseResults.asDict() to correctly convert nested ParseResults 1155 values to dicts. 1156 1157- Cleaned up some examples, fixed typo in fourFn.py identified by 1158 aristotle2600 on reddit. 1159 1160- Removed keepOriginalText helper method, which was deprecated ages ago. 1161 Superceded by originalTextFor. 1162 1163- Same for the Upcase class, which was long ago deprecated and replaced 1164 with the upcaseTokens method. 1165 1166 1167 1168Version 2.0.7 - December, 2015 1169------------------------------ 1170- Simplified string representation of Forward class, to avoid memory 1171 and performance errors while building ParseException messages. Thanks, 1172 Will McGugan, Andrea Censi, and Martijn Vermaat for the bug reports and 1173 test code. 1174 1175- Cleaned up additional issues from enhancing the error messages for 1176 Or and MatchFirst, handling Unicode values in expressions. Fixes Unicode 1177 encoding issues in Python 2, thanks to Evan Hubinger for the bug report. 1178 1179- Fixed implementation of dir() for ParseResults - was leaving out all the 1180 defined methods and just adding the custom results names. 1181 1182- Fixed bug in ignore() that was introduced in pyparsing 1.5.3, that would 1183 not accept a string literal as the ignore expression. 1184 1185- Added new example parseTabularData.py to illustrate parsing of data 1186 formatted in columns, with detection of empty cells. 1187 1188- Updated a number of examples to more current Python and pyparsing 1189 forms. 1190 1191 1192Version 2.0.6 - November, 2015 1193------------------------------ 1194- Fixed a bug in Each when multiple Optional elements are present. 1195 Thanks for reporting this, whereswalden on SO. 1196 1197- Fixed another bug in Each, when Optional elements have results names 1198 or parse actions, reported by Max Rothman - thank you, Max! 1199 1200- Added optional parseAll argument to runTests, whether tests should 1201 require the entire input string to be parsed or not (similar to 1202 parseAll argument to parseString). Plus a little neaten-up of the 1203 output on Python 2 (no stray ()'s). 1204 1205- Modified exception messages from MatchFirst and Or expressions. These 1206 were formerly misleading as they would only give the first or longest 1207 exception mismatch error message. Now the error message includes all 1208 the alternatives that were possible matches. Originally proposed by 1209 a pyparsing user, but I've lost the email thread - finally figured out 1210 a fairly clean way to do this. 1211 1212- Fixed a bug in Or, when a parse action on an alternative raises an 1213 exception, other potentially matching alternatives were not always tried. 1214 Reported by TheVeryOmni on the pyparsing wiki, thanks! 1215 1216- Fixed a bug to dump() introduced in 2.0.4, where list values were shown 1217 in duplicate. 1218 1219 1220Version 2.0.5 - October, 2015 1221----------------------------- 1222- (&$(@#&$(@!!!! Some "print" statements snuck into pyparsing v2.0.4, 1223 breaking Python 3 compatibility! Fixed. Reported by jenshn, thanks! 1224 1225 1226Version 2.0.4 - October, 2015 1227----------------------------- 1228- Added ParserElement.addCondition, to simplify adding parse actions 1229 that act primarily as filters. If the given condition evaluates False, 1230 pyparsing will raise a ParseException. The condition should be a method 1231 with the same method signature as a parse action, but should return a 1232 boolean. Suggested by Victor Porton, nice idea Victor, thanks! 1233 1234- Slight mod to srange to accept unicode literals for the input string, 1235 such as "[а-яА-Я]" instead of "[\u0430-\u044f\u0410-\u042f]". Thanks 1236 to Alexandr Suchkov for the patch! 1237 1238- Enhanced implementation of replaceWith. 1239 1240- Fixed enhanced ParseResults.dump() method when the results consists 1241 only of an unnamed array of sub-structure results. Reported by Robin 1242 Siebler, thanks for your patience and persistence, Robin! 1243 1244- Fixed bug in fourFn.py example code, where pi and e were defined using 1245 CaselessLiteral instead of CaselessKeyword. This was not a problem until 1246 adding a new function 'exp', and the leading 'e' of 'exp' was accidentally 1247 parsed as the mathematical constant 'e'. Nice catch, Tom Grydeland - thanks! 1248 1249- Adopt new-fangled Python features, like decorators and ternary expressions, 1250 per suggestions from Williamzjc - thanks William! (Oh yeah, I'm not 1251 supporting Python 2.3 with this code any more...) Plus, some additional 1252 code fixes/cleanup - thanks again! 1253 1254- Added ParserElement.runTests, a little test bench for quickly running 1255 an expression against a list of sample input strings. Basically, I got 1256 tired of writing the same test code over and over, and finally added it 1257 as a test point method on ParserElement. 1258 1259- Added withClass helper method, a simplified version of withAttribute for 1260 the common but annoying case when defining a filter on a div's class - 1261 made difficult because 'class' is a Python reserved word. 1262 1263 1264Version 2.0.3 - October, 2014 1265----------------------------- 1266- Fixed escaping behavior in QuotedString. Formerly, only quotation 1267 marks (or characters designated as quotation marks in the QuotedString 1268 constructor) would be escaped. Now all escaped characters will be 1269 escaped, and the escaping backslashes will be removed. 1270 1271- Fixed regression in ParseResults.pop() - pop() was pretty much 1272 broken after I added *improvements* in 2.0.2. Reported by Iain 1273 Shelvington, thanks Iain! 1274 1275- Fixed bug in And class when initializing using a generator. 1276 1277- Enhanced ParseResults.dump() method to list out nested ParseResults that 1278 are unnamed arrays of sub-structures. 1279 1280- Fixed UnboundLocalError under Python 3.4 in oneOf method, reported 1281 on Sourceforge by aldanor, thanks! 1282 1283- Fixed bug in ParseResults __init__ method, when returning non-ParseResults 1284 types from parse actions that implement __eq__. Raised during discussion 1285 on the pyparsing wiki with cyrfer. 1286 1287 1288Version 2.0.2 - April, 2014 1289--------------------------- 1290- Extended "expr(name)" shortcut (same as "expr.setResultsName(name)") 1291 to accept "expr()" as a shortcut for "expr.copy()". 1292 1293- Added "locatedExpr(expr)" helper, to decorate any returned tokens 1294 with their location within the input string. Adds the results names 1295 locn_start and locn_end to the output parse results. 1296 1297- Added "pprint()" method to ParseResults, to simplify troubleshooting 1298 and prettified output. Now instead of importing the pprint module 1299 and then writing "pprint.pprint(result)", you can just write 1300 "result.pprint()". This method also accepts addtional positional and 1301 keyword arguments (such as indent, width, etc.), which get passed 1302 through directly to the pprint method 1303 (see https://docs.python.org/2/library/pprint.html#pprint.pprint). 1304 1305- Removed deprecation warnings when using '<<' for Forward expression 1306 assignment. '<<=' is still preferred, but '<<' will be retained 1307 for cases where '<<=' operator is not suitable (such as in defining 1308 lambda expressions). 1309 1310- Expanded argument compatibility for classes and functions that 1311 take list arguments, to now accept generators as well. 1312 1313- Extended list-like behavior of ParseResults, adding support for 1314 append and extend. NOTE: if you have existing applications using 1315 these names as results names, you will have to access them using 1316 dict-style syntax: res["append"] and res["extend"] 1317 1318- ParseResults emulates the change in list vs. iterator semantics for 1319 methods like keys(), values(), and items(). Under Python 2.x, these 1320 methods will return lists, under Python 3.x, these methods will 1321 return iterators. 1322 1323- ParseResults now has a method haskeys() which returns True or False 1324 depending on whether any results names have been defined. This simplifies 1325 testing for the existence of results names under Python 3.x, which 1326 returns keys() as an iterator, not a list. 1327 1328- ParseResults now supports both list and dict semantics for pop(). 1329 If passed no argument or an integer argument, it will use list semantics 1330 and pop tokens from the list of parsed tokens. If passed a non-integer 1331 argument (most likely a string), it will use dict semantics and 1332 pop the corresponding value from any defined results names. A 1333 second default return value argument is supported, just as in 1334 dict.pop(). 1335 1336- Fixed bug in markInputline, thanks for reporting this, Matt Grant! 1337 1338- Cleaned up my unit test environment, now runs with Python 2.6 and 1339 3.3. 1340 1341 1342Version 2.0.1 - July, 2013 1343-------------------------- 1344- Removed use of "nonlocal" that prevented using this version of 1345 pyparsing with Python 2.6 and 2.7. This will make it easier to 1346 install for packages that depend on pyparsing, under Python 1347 versions 2.6 and later. Those using older versions of Python 1348 will have to manually install pyparsing 1.5.7. 1349 1350- Fixed implementation of <<= operator to return self; reported by 1351 Luc J. Bourhis, with patch fix by Mathias Mamsch - thanks, Luc 1352 and Mathias! 1353 1354 1355Version 2.0.0 - November, 2012 1356------------------------------ 1357- Rather than release another combined Python 2.x/3.x release 1358 I've decided to start a new major version that is only 1359 compatible with Python 3.x (and consequently Python 2.7 as 1360 well due to backporting of key features). This version will 1361 be the main development path from now on, with little follow-on 1362 development on the 1.5.x path. 1363 1364- Operator '<<' is now deprecated, in favor of operator '<<=' for 1365 attaching parsing expressions to Forward() expressions. This is 1366 being done to address precedence of operations problems with '<<'. 1367 Operator '<<' will be removed in a future version of pyparsing. 1368 1369 1370Version 1.5.7 - November, 2012 1371----------------------------- 1372- NOTE: This is the last release of pyparsing that will try to 1373 maintain compatibility with Python versions < 2.6. The next 1374 release of pyparsing will be version 2.0.0, using new Python 1375 syntax that will not be compatible for Python version 2.5 or 1376 older. 1377 1378- An awesome new example is included in this release, submitted 1379 by Luca DellOlio, for parsing ANTLR grammar definitions, nice 1380 work Luca! 1381 1382- Fixed implementation of ParseResults.__str__ to use Pythonic 1383 ''.join() instead of repeated string concatenation. This 1384 purportedly has been a performance issue under PyPy. 1385 1386- Fixed bug in ParseResults.__dir__ under Python 3, reported by 1387 Thomas Kluyver, thank you Thomas! 1388 1389- Added ParserElement.inlineLiteralsUsing static method, to 1390 override pyparsing's default behavior of converting string 1391 literals to Literal instances, to use other classes (such 1392 as Suppress or CaselessLiteral). 1393 1394- Added new operator '<<=', which will eventually replace '<<' for 1395 storing the contents of a Forward(). '<<=' does not have the same 1396 operator precedence problems that '<<' does. 1397 1398- 'operatorPrecedence' is being renamed 'infixNotation' as a better 1399 description of what this helper function creates. 'operatorPrecedence' 1400 is deprecated, and will be dropped entirely in a future release. 1401 1402- Added optional arguments lpar and rpar to operatorPrecedence, so that 1403 expressions that use it can override the default suppression of the 1404 grouping characters. 1405 1406- Added support for using single argument builtin functions as parse 1407 actions. Now you can write 'expr.setParseAction(len)' and get back 1408 the length of the list of matched tokens. Supported builtins are: 1409 sum, len, sorted, reversed, list, tuple, set, any, all, min, and max. 1410 A script demonstrating this feature is included in the examples 1411 directory. 1412 1413- Improved linking in generated docs, proposed on the pyparsing wiki 1414 by techtonik, thanks! 1415 1416- Fixed a bug in the definition of 'alphas', which was based on the 1417 string.uppercase and string.lowercase "constants", which in fact 1418 *aren't* constant, but vary with locale settings. This could make 1419 parsers locale-sensitive in a subtle way. Thanks to Kef Schecter for 1420 his diligence in following through on reporting and monitoring 1421 this bugfix! 1422 1423- Fixed a bug in the Py3 version of pyparsing, during exception 1424 handling with packrat parsing enabled, reported by Catherine 1425 Devlin - thanks Catherine! 1426 1427- Fixed typo in ParseBaseException.__dir__, reported anonymously on 1428 the SourceForge bug tracker, thank you Pyparsing User With No Name. 1429 1430- Fixed bug in srange when using '\x###' hex character codes. 1431 1432- Addeed optional 'intExpr' argument to countedArray, so that you 1433 can define your own expression that will evaluate to an integer, 1434 to be used as the count for the following elements. Allows you 1435 to define a countedArray with the count given in hex, for example, 1436 by defining intExpr as "Word(hexnums).setParseAction(int(t[0],16))". 1437 1438 1439Version 1.5.6 - June, 2011 1440---------------------------- 1441- Cleanup of parse action normalizing code, to be more version-tolerant, 1442 and robust in the face of future Python versions - much thanks to 1443 Raymond Hettinger for this rewrite! 1444 1445- Removal of exception cacheing, addressing a memory leak condition 1446 in Python 3. Thanks to Michael Droettboom and the Cape Town PUG for 1447 their analysis and work on this problem! 1448 1449- Fixed bug when using packrat parsing, where a previously parsed 1450 expression would duplicate subsequent tokens - reported by Frankie 1451 Ribery on stackoverflow, thanks! 1452 1453- Added 'ungroup' helper method, to address token grouping done 1454 implicitly by And expressions, even if only one expression in the 1455 And actually returns any text - also inspired by stackoverflow 1456 discussion with Frankie Ribery! 1457 1458- Fixed bug in srange, which accepted escaped hex characters of the 1459 form '\0x##', but should be '\x##'. Both forms will be supported 1460 for backwards compatibility. 1461 1462- Enhancement to countedArray, accepting an optional expression to be 1463 used for matching the leading integer count - proposed by Mathias on 1464 the pyparsing mailing list, good idea! 1465 1466- Added the Verilog parser to the provided set of examples, under the 1467 MIT license. While this frees up this parser for any use, if you find 1468 yourself using it in a commercial purpose, please consider making a 1469 charitable donation as described in the parser's header. 1470 1471- Added the excludeChars argument to the Word class, to simplify defining 1472 a word composed of all characters in a large range except for one or 1473 two. Suggested by JesterEE on the pyparsing wiki. 1474 1475- Added optional overlap parameter to scanString, to return overlapping 1476 matches found in the source text. 1477 1478- Updated oneOf internal regular expression generation, with improved 1479 parse time performance. 1480 1481- Slight performance improvement in transformString, removing empty 1482 strings from the list of string fragments built while scanning the 1483 source text, before calling ''.join. Especially useful when using 1484 transformString to strip out selected text. 1485 1486- Enhanced form of using the "expr('name')" style of results naming, 1487 in lieu of calling setResultsName. If name ends with an '*', then 1488 this is equivalent to expr.setResultsName('name',listAllMatches=True). 1489 1490- Fixed up internal list flattener to use iteration instead of recursion, 1491 to avoid stack overflow when transforming large files. 1492 1493- Added other new examples: 1494 . protobuf parser - parses Google's protobuf language 1495 . btpyparse - a BibTex parser contributed by Matthew Brett, 1496 with test suite test_bibparse.py (thanks, Matthew!) 1497 . groupUsingListAllMatches.py - demo using trailing '*' for results 1498 names 1499 1500 1501Version 1.5.5 - August, 2010 1502---------------------------- 1503 1504- Typo in Python3 version of pyparsing, "builtin" should be "builtins". 1505 (sigh) 1506 1507 1508Version 1.5.4 - August, 2010 1509---------------------------- 1510 1511- Fixed __builtins__ and file references in Python 3 code, thanks to 1512 Greg Watson, saulspatz, sminos, and Mark Summerfield for reporting 1513 their Python 3 experiences. 1514 1515- Added new example, apicheck.py, as a sample of scanning a Tcl-like 1516 language for functions with incorrect number of arguments (difficult 1517 to track down in Tcl languages). This example uses some interesting 1518 methods for capturing exceptions while scanning through source 1519 code. 1520 1521- Added new example deltaTime.py, that takes everyday time references 1522 like "an hour from now", "2 days ago", "next Sunday at 2pm". 1523 1524 1525Version 1.5.3 - June, 2010 1526-------------------------- 1527 1528- ======= NOTE: API CHANGE!!!!!!! =============== 1529 With this release, and henceforward, the pyparsing module is 1530 imported as "pyparsing" on both Python 2.x and Python 3.x versions. 1531 1532- Fixed up setup.py to auto-detect Python version and install the 1533 correct version of pyparsing - suggested by Alex Martelli, 1534 thanks, Alex! (and my apologies to all those who struggled with 1535 those spurious installation errors caused by my earlier 1536 fumblings!) 1537 1538- Fixed bug on Python3 when using parseFile, getting bytes instead of 1539 a str from the input file. 1540 1541- Fixed subtle bug in originalTextFor, if followed by 1542 significant whitespace (like a newline) - discovered by 1543 Francis Vidal, thanks! 1544 1545- Fixed very sneaky bug in Each, in which Optional elements were 1546 not completely recognized as optional - found by Tal Weiss, thanks 1547 for your patience. 1548 1549- Fixed off-by-1 bug in line() method when the first line of the 1550 input text was an empty line. Thanks to John Krukoff for submitting 1551 a patch! 1552 1553- Fixed bug in transformString if grammar contains Group expressions, 1554 thanks to patch submitted by barnabas79, nice work! 1555 1556- Fixed bug in originalTextFor in which trailing comments or otherwised 1557 ignored text got slurped in with the matched expression. Thanks to 1558 michael_ramirez44 on the pyparsing wiki for reporting this just in 1559 time to get into this release! 1560 1561- Added better support for summing ParseResults, see the new example, 1562 parseResultsSumExample.py. 1563 1564- Added support for composing a Regex using a compiled RE object; 1565 thanks to my new colleague, Mike Thornton! 1566 1567- In version 1.5.2, I changed the way exceptions are raised in order 1568 to simplify the stacktraces reported during parsing. An anonymous 1569 user posted a bug report on SF that this behavior makes it difficult 1570 to debug some complex parsers, or parsers nested within parsers. In 1571 this release I've added a class attribute ParserElement.verbose_stacktrace, 1572 with a default value of False. If you set this to True, pyparsing will 1573 report stacktraces using the pre-1.5.2 behavior. 1574 1575- New examples: 1576 1577 . pymicko.py, a MicroC compiler submitted by Zarko Zivanov. 1578 (Note: this example is separately licensed under the GPLv3, 1579 and requires Python 2.6 or higher.) Thank you, Zarko! 1580 1581 . oc.py, a subset C parser, using the BNF from the 1996 Obfuscated C 1582 Contest. 1583 1584 . stateMachine2.py, a modified version of stateMachine.py submitted 1585 by Matt Anderson, that is compatible with Python versions 2.7 and 1586 above - thanks so much, Matt! 1587 1588 . select_parser.py, a parser for reading SQLite SELECT statements, 1589 as specified at https://www.sqlite.org/lang_select.html this goes 1590 into much more detail than the simple SQL parser included in pyparsing's 1591 source code 1592 1593 . excelExpr.py, a *simplistic* first-cut at a parser for Excel 1594 expressions, which I originally posted on comp.lang.python in January, 1595 2010; beware, this parser omits many common Excel cases (addition of 1596 numbers represented as strings, references to named ranges) 1597 1598 . cpp_enum_parser.py, a nice little parser posted my Mark Tolonen on 1599 comp.lang.python in August, 2009 (redistributed here with Mark's 1600 permission). Thanks a bunch, Mark! 1601 1602 . partial_gene_match.py, a sample I posted to Stackoverflow.com, 1603 implementing a special variation on Literal that does "close" matching, 1604 up to a given number of allowed mismatches. The application was to 1605 find matching gene sequences, with allowance for one or two mismatches. 1606 1607 . tagCapture.py, a sample showing how to use a Forward placeholder to 1608 enforce matching of text parsed in a previous expression. 1609 1610 . matchPreviousDemo.py, simple demo showing how the matchPreviousLiteral 1611 helper method is used to match a previously parsed token. 1612 1613 1614Version 1.5.2 - April, 2009 1615------------------------------ 1616- Added pyparsing_py3.py module, so that Python 3 users can use 1617 pyparsing by changing their pyparsing import statement to: 1618 1619 import pyparsing_py3 1620 1621 Thanks for help from Patrick Laban and his friend Geremy 1622 Condra on the pyparsing wiki. 1623 1624- Removed __slots__ declaration on ParseBaseException, for 1625 compatibility with IronPython 2.0.1. Raised by David 1626 Lawler on the pyparsing wiki, thanks David! 1627 1628- Fixed bug in SkipTo/failOn handling - caught by eagle eye 1629 cpennington on the pyparsing wiki! 1630 1631- Fixed second bug in SkipTo when using the ignore constructor 1632 argument, reported by Catherine Devlin, thanks! 1633 1634- Fixed obscure bug reported by Eike Welk when using a class 1635 as a ParseAction with an errant __getitem__ method. 1636 1637- Simplified exception stack traces when reporting parse 1638 exceptions back to caller of parseString or parseFile - thanks 1639 to a tip from Peter Otten on comp.lang.python. 1640 1641- Changed behavior of scanString to avoid infinitely looping on 1642 expressions that match zero-length strings. Prompted by a 1643 question posted by ellisonbg on the wiki. 1644 1645- Enhanced classes that take a list of expressions (And, Or, 1646 MatchFirst, and Each) to accept generator expressions also. 1647 This can be useful when generating lists of alternative 1648 expressions, as in this case, where the user wanted to match 1649 any repetitions of '+', '*', '#', or '.', but not mixtures 1650 of them (that is, match '+++', but not '+-+'): 1651 1652 codes = "+*#." 1653 format = MatchFirst(Word(c) for c in codes) 1654 1655 Based on a problem posed by Denis Spir on the Python tutor 1656 list. 1657 1658- Added new example eval_arith.py, which extends the example 1659 simpleArith.py to actually evaluate the parsed expressions. 1660 1661 1662Version 1.5.1 - October, 2008 1663------------------------------- 1664- Added new helper method originalTextFor, to replace the use of 1665 the current keepOriginalText parse action. Now instead of 1666 using the parse action, as in: 1667 1668 fullName = Word(alphas) + Word(alphas) 1669 fullName.setParseAction(keepOriginalText) 1670 1671 (in this example, we used keepOriginalText to restore any white 1672 space that may have been skipped between the first and last 1673 names) 1674 You can now write: 1675 1676 fullName = originalTextFor(Word(alphas) + Word(alphas)) 1677 1678 The implementation of originalTextFor is simpler and faster than 1679 keepOriginalText, and does not depend on using the inspect or 1680 imp modules. 1681 1682- Added optional parseAll argument to parseFile, to be consistent 1683 with parseAll argument to parseString. Posted by pboucher on the 1684 pyparsing wiki, thanks! 1685 1686- Added failOn argument to SkipTo, so that grammars can define 1687 literal strings or pyparsing expressions which, if found in the 1688 skipped text, will cause SkipTo to fail. Useful to prevent 1689 SkipTo from reading past terminating expression. Instigated by 1690 question posed by Aki Niimura on the pyparsing wiki. 1691 1692- Fixed bug in nestedExpr if multi-character expressions are given 1693 for nesting delimiters. Patch provided by new pyparsing user, 1694 Hans-Martin Gaudecker - thanks, H-M! 1695 1696- Removed dependency on xml.sax.saxutils.escape, and included 1697 internal implementation instead - proposed by Mike Droettboom on 1698 the pyparsing mailing list, thanks Mike! Also fixed erroneous 1699 mapping in replaceHTMLEntity of " to ', now correctly maps 1700 to ". (Also added support for mapping ' to '.) 1701 1702- Fixed typo in ParseResults.insert, found by Alejandro Dubrovsky, 1703 good catch! 1704 1705- Added __dir__() methods to ParseBaseException and ParseResults, 1706 to support new dir() behavior in Py2.6 and Py3.0. If dir() is 1707 called on a ParseResults object, the returned list will include 1708 the base set of attribute names, plus any results names that are 1709 defined. 1710 1711- Fixed bug in ParseResults.asXML(), in which the first named 1712 item within a ParseResults gets reported with an <ITEM> tag 1713 instead of with the correct results name. 1714 1715- Fixed bug in '-' error stop, when '-' operator is used inside a 1716 Combine expression. 1717 1718- Reverted generator expression to use list comprehension, for 1719 better compatibility with old versions of Python. Reported by 1720 jester/artixdesign on the SourceForge pyparsing discussion list. 1721 1722- Fixed bug in parseString(parseAll=True), when the input string 1723 ends with a comment or whitespace. 1724 1725- Fixed bug in LineStart and LineEnd that did not recognize any 1726 special whitespace chars defined using ParserElement.setDefault- 1727 WhitespaceChars, found while debugging an issue for Marek Kubica, 1728 thanks for the new test case, Marek! 1729 1730- Made Forward class more tolerant of subclassing. 1731 1732 1733Version 1.5.0 - June, 2008 1734-------------------------- 1735This version of pyparsing includes work on two long-standing 1736FAQ's: support for forcing parsing of the complete input string 1737(without having to explicitly append StringEnd() to the grammar), 1738and a method to improve the mechanism of detecting where syntax 1739errors occur in an input string with various optional and 1740alternative paths. This release also includes a helper method 1741to simplify definition of indentation-based grammars. With 1742these changes (and the past few minor updates), I thought it was 1743finally time to bump the minor rev number on pyparsing - so 17441.5.0 is now available! Read on... 1745 1746- AT LAST!!! You can now call parseString and have it raise 1747 an exception if the expression does not parse the entire 1748 input string. This has been an FAQ for a LONG time. 1749 1750 The parseString method now includes an optional parseAll 1751 argument (default=False). If parseAll is set to True, then 1752 the given parse expression must parse the entire input 1753 string. (This is equivalent to adding StringEnd() to the 1754 end of the expression.) The default value is False to 1755 retain backward compatibility. 1756 1757 Inspired by MANY requests over the years, most recently by 1758 ecir-hana on the pyparsing wiki! 1759 1760- Added new operator '-' for composing grammar sequences. '-' 1761 behaves just like '+' in creating And expressions, but '-' 1762 is used to mark grammar structures that should stop parsing 1763 immediately and report a syntax error, rather than just 1764 backtracking to the last successful parse and trying another 1765 alternative. For instance, running the following code: 1766 1767 port_definition = Keyword("port") + '=' + Word(nums) 1768 entity_definition = Keyword("entity") + "{" + 1769 Optional(port_definition) + "}" 1770 1771 entity_definition.parseString("entity { port 100 }") 1772 1773 pyparsing fails to detect the missing '=' in the port definition. 1774 But, since this expression is optional, pyparsing then proceeds 1775 to try to match the closing '}' of the entity_definition. Not 1776 finding it, pyparsing reports that there was no '}' after the '{' 1777 character. Instead, we would like pyparsing to parse the 'port' 1778 keyword, and if not followed by an equals sign and an integer, 1779 to signal this as a syntax error. 1780 1781 This can now be done simply by changing the port_definition to: 1782 1783 port_definition = Keyword("port") - '=' + Word(nums) 1784 1785 Now after successfully parsing 'port', pyparsing must also find 1786 an equals sign and an integer, or it will raise a fatal syntax 1787 exception. 1788 1789 By judicious insertion of '-' operators, a pyparsing developer 1790 can have their grammar report much more informative syntax error 1791 messages. 1792 1793 Patches and suggestions proposed by several contributors on 1794 the pyparsing mailing list and wiki - special thanks to 1795 Eike Welk and Thomas/Poldy on the pyparsing wiki! 1796 1797- Added indentedBlock helper method, to encapsulate the parse 1798 actions and indentation stack management needed to keep track of 1799 indentation levels. Use indentedBlock to define grammars for 1800 indentation-based grouping grammars, like Python's. 1801 1802 indentedBlock takes up to 3 parameters: 1803 - blockStatementExpr - expression defining syntax of statement 1804 that is repeated within the indented block 1805 - indentStack - list created by caller to manage indentation 1806 stack (multiple indentedBlock expressions 1807 within a single grammar should share a common indentStack) 1808 - indent - boolean indicating whether block must be indented 1809 beyond the current level; set to False for block of 1810 left-most statements (default=True) 1811 1812 A valid block must contain at least one indented statement. 1813 1814- Fixed bug in nestedExpr in which ignored expressions needed 1815 to be set off with whitespace. Reported by Stefaan Himpe, 1816 nice catch! 1817 1818- Expanded multiplication of an expression by a tuple, to 1819 accept tuple values of None: 1820 . expr*(n,None) or expr*(n,) is equivalent 1821 to expr*n + ZeroOrMore(expr) 1822 (read as "at least n instances of expr") 1823 . expr*(None,n) is equivalent to expr*(0,n) 1824 (read as "0 to n instances of expr") 1825 . expr*(None,None) is equivalent to ZeroOrMore(expr) 1826 . expr*(1,None) is equivalent to OneOrMore(expr) 1827 1828 Note that expr*(None,n) does not raise an exception if 1829 more than n exprs exist in the input stream; that is, 1830 expr*(None,n) does not enforce a maximum number of expr 1831 occurrences. If this behavior is desired, then write 1832 expr*(None,n) + ~expr 1833 1834- Added None as a possible operator for operatorPrecedence. 1835 None signifies "no operator", as in multiplying m times x 1836 in "y=mx+b". 1837 1838- Fixed bug in Each, reported by Michael Ramirez, in which the 1839 order of terms in the Each affected the parsing of the results. 1840 Problem was due to premature grouping of the expressions in 1841 the overall Each during grammar construction, before the 1842 complete Each was defined. Thanks, Michael! 1843 1844- Also fixed bug in Each in which Optional's with default values 1845 were not getting the defaults added to the results of the 1846 overall Each expression. 1847 1848- Fixed a bug in Optional in which results names were not 1849 assigned if a default value was supplied. 1850 1851- Cleaned up Py3K compatibility statements, including exception 1852 construction statements, and better equivalence between _ustr 1853 and basestring, and __nonzero__ and __bool__. 1854 1855 1856Version 1.4.11 - February, 2008 1857------------------------------- 1858- With help from Robert A. Clark, this version of pyparsing 1859 is compatible with Python 3.0a3. Thanks for the help, 1860 Robert! 1861 1862- Added WordStart and WordEnd positional classes, to support 1863 expressions that must occur at the start or end of a word. 1864 Proposed by piranha on the pyparsing wiki, good idea! 1865 1866- Added matchOnlyAtCol helper parser action, to simplify 1867 parsing log or data files that have optional fields that are 1868 column dependent. Inspired by a discussion thread with 1869 hubritic on comp.lang.python. 1870 1871- Added withAttribute.ANY_VALUE as a match-all value when using 1872 withAttribute. Used to ensure that an attribute is present, 1873 without having to match on the actual attribute value. 1874 1875- Added get() method to ParseResults, similar to dict.get(). 1876 Suggested by new pyparsing user, Alejandro Dubrovksy, thanks! 1877 1878- Added '==' short-cut to see if a given string matches a 1879 pyparsing expression. For instance, you can now write: 1880 1881 integer = Word(nums) 1882 if "123" == integer: 1883 # do something 1884 1885 print [ x for x in "123 234 asld".split() if x==integer ] 1886 # prints ['123', '234'] 1887 1888- Simplified the use of nestedExpr when using an expression for 1889 the opening or closing delimiters. Now the content expression 1890 will not have to explicitly negate closing delimiters. Found 1891 while working with dfinnie on GHOP Task #277, thanks! 1892 1893- Fixed bug when defining ignorable expressions that are 1894 later enclosed in a wrapper expression (such as ZeroOrMore, 1895 OneOrMore, etc.) - found while working with Prabhu 1896 Gurumurthy, thanks Prahbu! 1897 1898- Fixed bug in withAttribute in which keys were automatically 1899 converted to lowercase, making it impossible to match XML 1900 attributes with uppercase characters in them. Using with- 1901 Attribute requires that you reference attributes in all 1902 lowercase if parsing HTML, and in correct case when parsing 1903 XML. 1904 1905- Changed '<<' operator on Forward to return None, since this 1906 is really used as a pseudo-assignment operator, not as a 1907 left-shift operator. By returning None, it is easier to 1908 catch faulty statements such as a << b | c, where precedence 1909 of operations causes the '|' operation to be performed 1910 *after* inserting b into a, so no alternation is actually 1911 implemented. The correct form is a << (b | c). With this 1912 change, an error will be reported instead of silently 1913 clipping the alternative term. (Note: this may break some 1914 existing code, but if it does, the code had a silent bug in 1915 it anyway.) Proposed by wcbarksdale on the pyparsing wiki, 1916 thanks! 1917 1918- Several unit tests were added to pyparsing's regression 1919 suite, courtesy of the Google Highly-Open Participation 1920 Contest. Thanks to all who administered and took part in 1921 this event! 1922 1923 1924Version 1.4.10 - December 9, 2007 1925--------------------------------- 1926- Fixed bug introduced in v1.4.8, parse actions were called for 1927 intermediate operator levels, not just the deepest matching 1928 operation level. Again, big thanks to Torsten Marek for 1929 helping isolate this problem! 1930 1931 1932Version 1.4.9 - December 8, 2007 1933-------------------------------- 1934- Added '*' multiplication operator support when creating 1935 grammars, accepting either an integer, or a two-integer 1936 tuple multiplier, as in: 1937 ipAddress = Word(nums) + ('.'+Word(nums))*3 1938 usPhoneNumber = Word(nums) + ('-'+Word(nums))*(1,2) 1939 If multiplying by a tuple, the two integer values represent 1940 min and max multiples. Suggested by Vincent of eToy.com, 1941 great idea, Vincent! 1942 1943- Fixed bug in nestedExpr, original version was overly greedy! 1944 Thanks to Michael Ramirez for raising this issue. 1945 1946- Fixed internal bug in ParseResults - when an item was deleted, 1947 the key indices were not updated. Thanks to Tim Mitchell for 1948 posting a bugfix patch to the SF bug tracking system! 1949 1950- Fixed internal bug in operatorPrecedence - when the results of 1951 a right-associative term were sent to a parse action, the wrong 1952 tokens were sent. Reported by Torsten Marek, nice job! 1953 1954- Added pop() method to ParseResults. If pop is called with an 1955 integer or with no arguments, it will use list semantics and 1956 update the ParseResults' list of tokens. If pop is called with 1957 a non-integer (a string, for instance), then it will use dict 1958 semantics and update the ParseResults' internal dict. 1959 Suggested by Donn Ingle, thanks Donn! 1960 1961- Fixed quoted string built-ins to accept '\xHH' hex characters 1962 within the string. 1963 1964 1965Version 1.4.8 - October, 2007 1966----------------------------- 1967- Added new helper method nestedExpr to easily create expressions 1968 that parse lists of data in nested parentheses, braces, brackets, 1969 etc. 1970 1971- Added withAttribute parse action helper, to simplify creating 1972 filtering parse actions to attach to expressions returned by 1973 makeHTMLTags and makeXMLTags. Use withAttribute to qualify a 1974 starting tag with one or more required attribute values, to avoid 1975 false matches on common tags such as <TD> or <DIV>. 1976 1977- Added new examples nested.py and withAttribute.py to demonstrate 1978 the new features. 1979 1980- Added performance speedup to grammars using operatorPrecedence, 1981 instigated by Stefan Reichör - thanks for the feedback, Stefan! 1982 1983- Fixed bug/typo when deleting an element from a ParseResults by 1984 using the element's results name. 1985 1986- Fixed whitespace-skipping bug in wrapper classes (such as Group, 1987 Suppress, Combine, etc.) and when using setDebug(), reported by 1988 new pyparsing user dazzawazza on SourceForge, nice job! 1989 1990- Added restriction to prevent defining Word or CharsNotIn expressions 1991 with minimum length of 0 (should use Optional if this is desired), 1992 and enhanced docstrings to reflect this limitation. Issue was 1993 raised by Joey Tallieu, who submitted a patch with a slightly 1994 different solution. Thanks for taking the initiative, Joey, and 1995 please keep submitting your ideas! 1996 1997- Fixed bug in makeHTMLTags that did not detect HTML tag attributes 1998 with no '= value' portion (such as "<td nowrap>"), reported by 1999 hamidh on the pyparsing wiki - thanks! 2000 2001- Fixed minor bug in makeHTMLTags and makeXMLTags, which did not 2002 accept whitespace in closing tags. 2003 2004 2005Version 1.4.7 - July, 2007 2006-------------------------- 2007- NEW NOTATION SHORTCUT: ParserElement now accepts results names using 2008 a notational shortcut, following the expression with the results name 2009 in parentheses. So this: 2010 2011 stats = "AVE:" + realNum.setResultsName("average") + \ 2012 "MIN:" + realNum.setResultsName("min") + \ 2013 "MAX:" + realNum.setResultsName("max") 2014 2015 can now be written as this: 2016 2017 stats = "AVE:" + realNum("average") + \ 2018 "MIN:" + realNum("min") + \ 2019 "MAX:" + realNum("max") 2020 2021 The intent behind this change is to make it simpler to define results 2022 names for significant fields within the expression, while keeping 2023 the grammar syntax clean and uncluttered. 2024 2025- Fixed bug when packrat parsing is enabled, with cached ParseResults 2026 being updated by subsequent parsing. Reported on the pyparsing 2027 wiki by Kambiz, thanks! 2028 2029- Fixed bug in operatorPrecedence for unary operators with left 2030 associativity, if multiple operators were given for the same term. 2031 2032- Fixed bug in example simpleBool.py, corrected precedence of "and" vs. 2033 "or" operations. 2034 2035- Fixed bug in Dict class, in which keys were converted to strings 2036 whether they needed to be or not. Have narrowed this logic to 2037 convert keys to strings only if the keys are ints (which would 2038 confuse __getitem__ behavior for list indexing vs. key lookup). 2039 2040- Added ParserElement method setBreak(), which will invoke the pdb 2041 module's set_trace() function when this expression is about to be 2042 parsed. 2043 2044- Fixed bug in StringEnd in which reading off the end of the input 2045 string raises an exception - should match. Resolved while 2046 answering a question for Shawn on the pyparsing wiki. 2047 2048 2049Version 1.4.6 - April, 2007 2050--------------------------- 2051- Simplified constructor for ParseFatalException, to support common 2052 exception construction idiom: 2053 raise ParseFatalException, "unexpected text: 'Spanish Inquisition'" 2054 2055- Added method getTokensEndLoc(), to be called from within a parse action, 2056 for those parse actions that need both the starting *and* ending 2057 location of the parsed tokens within the input text. 2058 2059- Enhanced behavior of keepOriginalText so that named parse fields are 2060 preserved, even though tokens are replaced with the original input 2061 text matched by the current expression. Also, cleaned up the stack 2062 traversal to be more robust. Suggested by Tim Arnold - thanks, Tim! 2063 2064- Fixed subtle bug in which countedArray (and similar dynamic 2065 expressions configured in parse actions) failed to match within Or, 2066 Each, FollowedBy, or NotAny. Reported by Ralf Vosseler, thanks for 2067 your patience, Ralf! 2068 2069- Fixed Unicode bug in upcaseTokens and downcaseTokens parse actions, 2070 scanString, and default debugging actions; reported (and patch submitted) 2071 by Nikolai Zamkovoi, spasibo! 2072 2073- Fixed bug when saving a tuple as a named result. The returned 2074 token list gave the proper tuple value, but accessing the result by 2075 name only gave the first element of the tuple. Reported by 2076 Poromenos, nice catch! 2077 2078- Fixed bug in makeHTMLTags/makeXMLTags, which failed to match tag 2079 attributes with namespaces. 2080 2081- Fixed bug in SkipTo when setting include=True, to have the skipped-to 2082 tokens correctly included in the returned data. Reported by gunars on 2083 the pyparsing wiki, thanks! 2084 2085- Fixed typobug in OnceOnly.reset method, omitted self argument. 2086 Submitted by eike welk, thanks for the lint-picking! 2087 2088- Added performance enhancement to Forward class, suggested by 2089 akkartik on the pyparsing Wiki discussion, nice work! 2090 2091- Added optional asKeyword to Word constructor, to indicate that the 2092 given word pattern should be matched only as a keyword, that is, it 2093 should only match if it is within word boundaries. 2094 2095- Added S-expression parser to examples directory. 2096 2097- Added macro substitution example to examples directory. 2098 2099- Added holaMundo.py example, excerpted from Marco Alfonso's blog - 2100 muchas gracias, Marco! 2101 2102- Modified internal cyclic references in ParseResults to use weakrefs; 2103 this should help reduce the memory footprint of large parsing 2104 programs, at some cost to performance (3-5%). Suggested by bca48150 on 2105 the pyparsing wiki, thanks! 2106 2107- Enhanced the documentation describing the vagaries and idiosyncracies 2108 of parsing strings with embedded tabs, and the impact on: 2109 . parse actions 2110 . scanString 2111 . col and line helper functions 2112 (Suggested by eike welk in response to some unexplained inconsistencies 2113 between parsed location and offsets in the input string.) 2114 2115- Cleaned up internal decorators to preserve function names, 2116 docstrings, etc. 2117 2118 2119Version 1.4.5 - December, 2006 2120------------------------------ 2121- Removed debugging print statement from QuotedString class. Sorry 2122 for not stripping this out before the 1.4.4 release! 2123 2124- A significant performance improvement, the first one in a while! 2125 For my Verilog parser, this version of pyparsing is about double the 2126 speed - YMMV. 2127 2128- Added support for pickling of ParseResults objects. (Reported by 2129 Jeff Poole, thanks Jeff!) 2130 2131- Fixed minor bug in makeHTMLTags that did not recognize tag attributes 2132 with embedded '-' or '_' characters. Also, added support for 2133 passing expressions to makeHTMLTags and makeXMLTags, and used this 2134 feature to define the globals anyOpenTag and anyCloseTag. 2135 2136- Fixed error in alphas8bit, I had omitted the y-with-umlaut character. 2137 2138- Added punc8bit string to complement alphas8bit - it contains all the 2139 non-alphabetic, non-blank 8-bit characters. 2140 2141- Added commonHTMLEntity expression, to match common HTML "ampersand" 2142 codes, such as "<", ">", "&", " ", and """. This 2143 expression also defines a results name 'entity', which can be used 2144 to extract the entity field (that is, "lt", "gt", etc.). Also added 2145 built-in parse action replaceHTMLEntity, which can be attached to 2146 commonHTMLEntity to translate "<", ">", "&", " ", and 2147 """ to "<", ">", "&", " ", and "'". 2148 2149- Added example, htmlStripper.py, that strips HTML tags and scripts 2150 from HTML pages. It also translates common HTML entities to their 2151 respective characters. 2152 2153 2154Version 1.4.4 - October, 2006 2155------------------------------- 2156- Fixed traceParseAction decorator to also trap and record exception 2157 returns from parse actions, and to handle parse actions with 0, 2158 1, 2, or 3 arguments. 2159 2160- Enhanced parse action normalization to support using classes as 2161 parse actions; that is, the class constructor is called at parse 2162 time and the __init__ function is called with 0, 1, 2, or 3 2163 arguments. If passing a class as a parse action, the __init__ 2164 method must use one of the valid parse action parameter list 2165 formats. (This technique is useful when using pyparsing to compile 2166 parsed text into a series of application objects - see the new 2167 example simpleBool.py.) 2168 2169- Fixed bug in ParseResults when setting an item using an integer 2170 index. (Reported by Christopher Lambacher, thanks!) 2171 2172- Fixed whitespace-skipping bug, patch submitted by Paolo Losi - 2173 grazie, Paolo! 2174 2175- Fixed bug when a Combine contained an embedded Forward expression, 2176 reported by cie on the pyparsing wiki - good catch! 2177 2178- Fixed listAllMatches bug, when a listAllMatches result was 2179 nested within another result. (Reported by don pasquale on 2180 comp.lang.python, well done!) 2181 2182- Fixed bug in ParseResults items() method, when returning an item 2183 marked as listAllMatches=True 2184 2185- Fixed bug in definition of cppStyleComment (and javaStyleComment) 2186 in which '//' line comments were not continued to the next line 2187 if the line ends with a '\'. (Reported by eagle-eyed Ralph 2188 Corderoy!) 2189 2190- Optimized re's for cppStyleComment and quotedString for better 2191 re performance - also provided by Ralph Corderoy, thanks! 2192 2193- Added new example, indentedGrammarExample.py, showing how to 2194 define a grammar using indentation to show grouping (as Python 2195 does for defining statement nesting). Instigated by an e-mail 2196 discussion with Andrew Dalke, thanks Andrew! 2197 2198- Added new helper operatorPrecedence (based on e-mail list discussion 2199 with Ralph Corderoy and Paolo Losi), to facilitate definition of 2200 grammars for expressions with unary and binary operators. For 2201 instance, this grammar defines a 6-function arithmetic expression 2202 grammar, with unary plus and minus, proper operator precedence,and 2203 right- and left-associativity: 2204 2205 expr = operatorPrecedence( operand, 2206 [("!", 1, opAssoc.LEFT), 2207 ("^", 2, opAssoc.RIGHT), 2208 (oneOf("+ -"), 1, opAssoc.RIGHT), 2209 (oneOf("* /"), 2, opAssoc.LEFT), 2210 (oneOf("+ -"), 2, opAssoc.LEFT),] 2211 ) 2212 2213 Also added example simpleArith.py and simpleBool.py to provide 2214 more detailed code samples using this new helper method. 2215 2216- Added new helpers matchPreviousLiteral and matchPreviousExpr, for 2217 creating adaptive parsing expressions that match the same content 2218 as was parsed in a previous parse expression. For instance: 2219 2220 first = Word(nums) 2221 matchExpr = first + ":" + matchPreviousLiteral(first) 2222 2223 will match "1:1", but not "1:2". Since this matches at the literal 2224 level, this will also match the leading "1:1" in "1:10". 2225 2226 In contrast: 2227 2228 first = Word(nums) 2229 matchExpr = first + ":" + matchPreviousExpr(first) 2230 2231 will *not* match the leading "1:1" in "1:10"; the expressions are 2232 evaluated first, and then compared, so "1" is compared with "10". 2233 2234- Added keepOriginalText parse action. Sometimes pyparsing's 2235 whitespace-skipping leaves out too much whitespace. Adding this 2236 parse action will restore any internal whitespace for a parse 2237 expression. This is especially useful when defining expressions 2238 for scanString or transformString applications. 2239 2240- Added __add__ method for ParseResults class, to better support 2241 using Python sum built-in for summing ParseResults objects returned 2242 from scanString. 2243 2244- Added reset method for the new OnlyOnce class wrapper for parse 2245 actions (to allow a grammar to be used multiple times). 2246 2247- Added optional maxMatches argument to scanString and searchString, 2248 to short-circuit scanning after 'n' expression matches are found. 2249 2250 2251Version 1.4.3 - July, 2006 2252------------------------------ 2253- Fixed implementation of multiple parse actions for an expression 2254 (added in 1.4.2). 2255 . setParseAction() reverts to its previous behavior, setting 2256 one (or more) actions for an expression, overwriting any 2257 action or actions previously defined 2258 . new method addParseAction() appends one or more parse actions 2259 to the list of parse actions attached to an expression 2260 Now it is harder to accidentally append parse actions to an 2261 expression, when what you wanted to do was overwrite whatever had 2262 been defined before. (Thanks, Jean-Paul Calderone!) 2263 2264- Simplified interface to parse actions that do not require all 3 2265 parse action arguments. Very rarely do parse actions require more 2266 than just the parsed tokens, yet parse actions still require all 2267 3 arguments including the string being parsed and the location 2268 within the string where the parse expression was matched. With this 2269 release, parse actions may now be defined to be called as: 2270 . fn(string,locn,tokens) (the current form) 2271 . fn(locn,tokens) 2272 . fn(tokens) 2273 . fn() 2274 The setParseAction and addParseAction methods will internally decorate 2275 the provided parse actions with compatible wrappers to conform to 2276 the full (string,locn,tokens) argument sequence. 2277 2278- REMOVED SUPPORT FOR RETURNING PARSE LOCATION FROM A PARSE ACTION. 2279 I announced this in March, 2004, and gave a final warning in the last 2280 release. Now you can return a tuple from a parse action, and it will 2281 be treated like any other return value (i.e., the tuple will be 2282 substituted for the incoming tokens passed to the parse action, 2283 which is useful when trying to parse strings into tuples). 2284 2285- Added setFailAction method, taking a callable function fn that 2286 takes the arguments fn(s,loc,expr,err) where: 2287 . s - string being parsed 2288 . loc - location where expression match was attempted and failed 2289 . expr - the parse expression that failed 2290 . err - the exception thrown 2291 The function returns no values. It may throw ParseFatalException 2292 if it is desired to stop parsing immediately. 2293 (Suggested by peter21081944 on wikispaces.com) 2294 2295- Added class OnlyOnce as helper wrapper for parse actions. OnlyOnce 2296 only permits a parse action to be called one time, after which 2297 all subsequent calls throw a ParseException. 2298 2299- Added traceParseAction decorator to help debug parse actions. 2300 Simply insert "@traceParseAction" ahead of the definition of your 2301 parse action, and each invocation will be displayed, along with 2302 incoming arguments, and returned value. 2303 2304- Fixed bug when copying ParserElements using copy() or 2305 setResultsName(). (Reported by Dan Thill, great catch!) 2306 2307- Fixed bug in asXML() where token text contains <, >, and & 2308 characters - generated XML now escapes these as <, > and 2309 &. (Reported by Jacek Sieka, thanks!) 2310 2311- Fixed bug in SkipTo() when searching for a StringEnd(). (Reported 2312 by Pete McEvoy, thanks Pete!) 2313 2314- Fixed "except Exception" statements, the most critical added as part 2315 of the packrat parsing enhancement. (Thanks, Erick Tryzelaar!) 2316 2317- Fixed end-of-string infinite looping on LineEnd and StringEnd 2318 expressions. (Thanks again to Erick Tryzelaar.) 2319 2320- Modified setWhitespaceChars to return self, to be consistent with 2321 other ParserElement modifiers. (Suggested by Erick Tryzelaar.) 2322 2323- Fixed bug/typo in new ParseResults.dump() method. 2324 2325- Fixed bug in searchString() method, in which only the first token of 2326 an expression was returned. searchString() now returns a 2327 ParseResults collection of all search matches. 2328 2329- Added example program removeLineBreaks.py, a string transformer that 2330 converts text files with hard line-breaks into one with line breaks 2331 only between paragraphs. 2332 2333- Added example program listAllMatches.py, to illustrate using the 2334 listAllMatches option when specifying results names (also shows new 2335 support for passing lists to oneOf). 2336 2337- Added example program linenoExample.py, to illustrate using the 2338 helper methods lineno, line, and col, and returning objects from a 2339 parse action. 2340 2341- Added example program parseListString.py, to which can parse the 2342 string representation of a Python list back into a true list. Taken 2343 mostly from my PyCon presentation examples, but now with support 2344 for tuple elements, too! 2345 2346 2347 2348Version 1.4.2 - April 1, 2006 (No foolin'!) 2349------------------------------------------- 2350- Significant speedup from memoizing nested expressions (a technique 2351 known as "packrat parsing"), thanks to Chris Lesniewski-Laas! Your 2352 mileage may vary, but my Verilog parser almost doubled in speed to 2353 over 600 lines/sec! 2354 2355 This speedup may break existing programs that use parse actions that 2356 have side-effects. For this reason, packrat parsing is disabled when 2357 you first import pyparsing. To activate the packrat feature, your 2358 program must call the class method ParserElement.enablePackrat(). If 2359 your program uses psyco to "compile as you go", you must call 2360 enablePackrat before calling psyco.full(). If you do not do this, 2361 Python will crash. For best results, call enablePackrat() immediately 2362 after importing pyparsing. 2363 2364- Added new helper method countedArray(expr), for defining patterns that 2365 start with a leading integer to indicate the number of array elements, 2366 followed by that many elements, matching the given expr parse 2367 expression. For instance, this two-liner: 2368 wordArray = countedArray(Word(alphas)) 2369 print wordArray.parseString("3 Practicality beats purity")[0] 2370 returns the parsed array of words: 2371 ['Practicality', 'beats', 'purity'] 2372 The leading token '3' is suppressed, although it is easily obtained 2373 from the length of the returned array. 2374 (Inspired by e-mail discussion with Ralf Vosseler.) 2375 2376- Added support for attaching multiple parse actions to a single 2377 ParserElement. (Suggested by Dan "Dang" Griffith - nice idea, Dan!) 2378 2379- Added support for asymmetric quoting characters in the recently-added 2380 QuotedString class. Now you can define your own quoted string syntax 2381 like "<<This is a string in double angle brackets.>>". To define 2382 this custom form of QuotedString, your code would define: 2383 dblAngleQuotedString = QuotedString('<<',endQuoteChar='>>') 2384 QuotedString also supports escaped quotes, escape character other 2385 than '\', and multiline. 2386 2387- Changed the default value returned internally by Optional, so that 2388 None can be used as a default value. (Suggested by Steven Bethard - 2389 I finally saw the light!) 2390 2391- Added dump() method to ParseResults, to make it easier to list out 2392 and diagnose values returned from calling parseString. 2393 2394- A new example, a search query string parser, submitted by Steven 2395 Mooij and Rudolph Froger - a very interesting application, thanks! 2396 2397- Added an example that parses the BNF in Python's Grammar file, in 2398 support of generating Python grammar documentation. (Suggested by 2399 J H Stovall.) 2400 2401- A new example, submitted by Tim Cera, of a flexible parser module, 2402 using a simple config variable to adjust parsing for input formats 2403 that have slight variations - thanks, Tim! 2404 2405- Added an example for parsing Roman numerals, showing the capability 2406 of parse actions to "compile" Roman numerals into their integer 2407 values during parsing. 2408 2409- Added a new docs directory, for additional documentation or help. 2410 Currently, this includes the text and examples from my recent 2411 presentation at PyCon. 2412 2413- Fixed another typo in CaselessKeyword, thanks Stefan Behnel. 2414 2415- Expanded oneOf to also accept tuples, not just lists. This really 2416 should be sufficient... 2417 2418- Added deprecation warnings when tuple is returned from a parse action. 2419 Looking back, I see that I originally deprecated this feature in March, 2420 2004, so I'm guessing people really shouldn't have been using this 2421 feature - I'll drop it altogether in the next release, which will 2422 allow users to return a tuple from a parse action (which is really 2423 handy when trying to reconstuct tuples from a tuple string 2424 representation!). 2425 2426 2427Version 1.4.1 - February, 2006 2428------------------------------ 2429- Converted generator expression in QuotedString class to list 2430 comprehension, to retain compatibility with Python 2.3. (Thanks, Titus 2431 Brown for the heads-up!) 2432 2433- Added searchString() method to ParserElement, as an alternative to 2434 using "scanString(instring).next()[0][0]" to search through a string 2435 looking for a substring matching a given parse expression. (Inspired by 2436 e-mail conversation with Dave Feustel.) 2437 2438- Modified oneOf to accept lists of strings as well as a single string 2439 of space-delimited literals. (Suggested by Jacek Sieka - thanks!) 2440 2441- Removed deprecated use of Upcase in pyparsing test code. (Also caught by 2442 Titus Brown.) 2443 2444- Removed lstrip() call from Literal - too aggressive in stripping 2445 whitespace which may be valid for some grammars. (Point raised by Jacek 2446 Sieka). Also, made Literal more robust in the event of passing an empty 2447 string. 2448 2449- Fixed bug in replaceWith when returning None. 2450 2451- Added cautionary documentation for Forward class when assigning a 2452 MatchFirst expression, as in: 2453 fwdExpr << a | b | c 2454 Precedence of operators causes this to be evaluated as: 2455 (fwdExpr << a) | b | c 2456 thereby leaving b and c out as parseable alternatives. Users must 2457 explicitly group the values inserted into the Forward: 2458 fwdExpr << (a | b | c) 2459 (Suggested by Scot Wilcoxon - thanks, Scot!) 2460 2461 2462Version 1.4 - January 18, 2006 2463------------------------------ 2464- Added Regex class, to permit definition of complex embedded expressions 2465 using regular expressions. (Enhancement provided by John Beisley, great 2466 job!) 2467 2468- Converted implementations of Word, oneOf, quoted string, and comment 2469 helpers to utilize regular expression matching. Performance improvements 2470 in the 20-40% range. 2471 2472- Added QuotedString class, to support definition of non-standard quoted 2473 strings (Suggested by Guillaume Proulx, thanks!) 2474 2475- Added CaselessKeyword class, to streamline grammars with, well, caseless 2476 keywords (Proposed by Stefan Behnel, thanks!) 2477 2478- Fixed bug in SkipTo, when using an ignoreable expression. (Patch provided 2479 by Anonymous, thanks, whoever-you-are!) 2480 2481- Fixed typo in NoMatch class. (Good catch, Stefan Behnel!) 2482 2483- Fixed minor bug in _makeTags(), using string.printables instead of 2484 pyparsing.printables. 2485 2486- Cleaned up some of the expressions created by makeXXXTags helpers, to 2487 suppress extraneous <> characters. 2488 2489- Added some grammar definition-time checking to verify that a grammar is 2490 being built using proper ParserElements. 2491 2492- Added examples: 2493 . LAparser.py - linear algebra C preprocessor (submitted by Mike Ellis, 2494 thanks Mike!) 2495 . wordsToNum.py - converts word description of a number back to 2496 the original number (such as 'one hundred and twenty three' -> 123) 2497 . updated fourFn.py to support unary minus, added BNF comments 2498 2499 2500Version 1.3.3 - September 12, 2005 2501---------------------------------- 2502- Improved support for Unicode strings that would be returned using 2503 srange. Added greetingInKorean.py example, for a Korean version of 2504 "Hello, World!" using Unicode. (Thanks, June Kim!) 2505 2506- Added 'hexnums' string constant (nums+"ABCDEFabcdef") for defining 2507 hexadecimal value expressions. 2508 2509- NOTE: ===THIS CHANGE MAY BREAK EXISTING CODE=== 2510 Modified tag and results definitions returned by makeHTMLTags(), 2511 to better support the looseness of HTML parsing. Tags to be 2512 parsed are now caseless, and keys generated for tag attributes are 2513 now converted to lower case. 2514 2515 Formerly, makeXMLTags("XYZ") would return a tag with results 2516 name of "startXYZ", this has been changed to "startXyz". If this 2517 tag is matched against '<XYZ Abc="1" DEF="2" ghi="3">', the 2518 matched keys formerly would be "Abc", "DEF", and "ghi"; keys are 2519 now converted to lower case, giving keys of "abc", "def", and 2520 "ghi". These changes were made to try to address the lax 2521 case sensitivity agreement between start and end tags in many 2522 HTML pages. 2523 2524 No changes were made to makeXMLTags(), which assumes more rigorous 2525 parsing rules. 2526 2527 Also, cleaned up case-sensitivity bugs in closing tags, and 2528 switched to using Keyword instead of Literal class for tags. 2529 (Thanks, Steve Young, for getting me to look at these in more 2530 detail!) 2531 2532- Added two helper parse actions, upcaseTokens and downcaseTokens, 2533 which will convert matched text to all uppercase or lowercase, 2534 respectively. 2535 2536- Deprecated Upcase class, to be replaced by upcaseTokens parse 2537 action. 2538 2539- Converted messages sent to stderr to use warnings module, such as 2540 when constructing a Literal with an empty string, one should use 2541 the Empty() class or the empty helper instead. 2542 2543- Added ' ' (space) as an escapable character within a quoted 2544 string. 2545 2546- Added helper expressions for common comment types, in addition 2547 to the existing cStyleComment (/*...*/) and htmlStyleComment 2548 (<!-- ... -->) 2549 . dblSlashComment = // ... (to end of line) 2550 . cppStyleComment = cStyleComment or dblSlashComment 2551 . javaStyleComment = cppStyleComment 2552 . pythonStyleComment = # ... (to end of line) 2553 2554 2555 2556Version 1.3.2 - July 24, 2005 2557----------------------------- 2558- Added Each class as an enhanced version of And. 'Each' requires 2559 that all given expressions be present, but may occur in any order. 2560 Special handling is provided to group ZeroOrMore and OneOrMore 2561 elements that occur out-of-order in the input string. You can also 2562 construct 'Each' objects by joining expressions with the '&' 2563 operator. When using the Each class, results names are strongly 2564 recommended for accessing the matched tokens. (Suggested by Pradam 2565 Amini - thanks, Pradam!) 2566 2567- Stricter interpretation of 'max' qualifier on Word elements. If the 2568 'max' attribute is specified, matching will fail if an input field 2569 contains more than 'max' consecutive body characters. For example, 2570 previously, Word(nums,max=3) would match the first three characters 2571 of '0123456', returning '012' and continuing parsing at '3'. Now, 2572 when constructed using the max attribute, Word will raise an 2573 exception with this string. 2574 2575- Cleaner handling of nested dictionaries returned by Dict. No 2576 longer necessary to dereference sub-dictionaries as element [0] of 2577 their parents. 2578 === NOTE: THIS CHANGE MAY BREAK SOME EXISTING CODE, BUT ONLY IF 2579 PARSING NESTED DICTIONARIES USING THE LITTLE-USED DICT CLASS === 2580 (Prompted by discussion thread on the Python Tutor list, with 2581 contributions from Danny Yoo, Kent Johnson, and original post by 2582 Liam Clarke - thanks all!) 2583 2584 2585 2586Version 1.3.1 - June, 2005 2587---------------------------------- 2588- Added markInputline() method to ParseException, to display the input 2589 text line location of the parsing exception. (Thanks, Stefan Behnel!) 2590 2591- Added setDefaultKeywordChars(), so that Keyword definitions using a 2592 custom keyword character set do not all need to add the keywordChars 2593 constructor argument (similar to setDefaultWhitespaceChars()). 2594 (suggested by rzhanka on the SourceForge pyparsing forum.) 2595 2596- Simplified passing debug actions to setDebugAction(). You can now 2597 pass 'None' for a debug action if you want to take the default 2598 debug behavior. To suppress a particular debug action, you can pass 2599 the pyparsing method nullDebugAction. 2600 2601- Refactored parse exception classes, moved all behavior to 2602 ParseBaseException, and the former ParseException is now a subclass of 2603 ParseBaseException. Added a second subclass, ParseFatalException, as 2604 a subclass of ParseBaseException. User-defined parse actions can raise 2605 ParseFatalException if a data inconsistency is detected (such as a 2606 begin-tag/end-tag mismatch), and this will stop all parsing immediately. 2607 (Inspired by e-mail thread with Michele Petrazzo - thanks, Michelle!) 2608 2609- Added helper methods makeXMLTags and makeHTMLTags, that simplify the 2610 definition of XML or HTML tag parse expressions for a given tagname. 2611 Both functions return a pair of parse expressions, one for the opening 2612 tag (that is, '<tagname>') and one for the closing tag ('</tagname>'). 2613 The opening tagame also recognizes any attribute definitions that have 2614 been included in the opening tag, as well as an empty tag (one with a 2615 trailing '/', as in '<BODY/>' which is equivalent to '<BODY></BODY>'). 2616 makeXMLTags uses stricter XML syntax for attributes, requiring that they 2617 be enclosed in double quote characters - makeHTMLTags is more lenient, 2618 and accepts single-quoted strings or any contiguous string of characters 2619 up to the next whitespace character or '>' character. Attributes can 2620 be retrieved as dictionary or attribute values of the returned results 2621 from the opening tag. 2622 2623- Added example minimath2.py, a refinement on fourFn.py that adds 2624 an interactive session and support for variables. (Thanks, Steven Siew!) 2625 2626- Added performance improvement, up to 20% reduction! (Found while working 2627 with Wolfgang Borgert on performance tuning of his TTCN3 parser.) 2628 2629- And another performance improvement, up to 25%, when using scanString! 2630 (Found while working with Henrik Westlund on his C header file scanner.) 2631 2632- Updated UML diagrams to reflect latest class/method changes. 2633 2634 2635Version 1.3 - March, 2005 2636---------------------------------- 2637- Added new Keyword class, as a special form of Literal. Keywords 2638 must be followed by whitespace or other non-keyword characters, to 2639 distinguish them from variables or other identifiers that just 2640 happen to start with the same characters as a keyword. For instance, 2641 the input string containing "ifOnlyIfOnly" will match a Literal("if") 2642 at the beginning and in the middle, but will fail to match a 2643 Keyword("if"). Keyword("if") will match only strings such as "if only" 2644 or "if(only)". (Proposed by Wolfgang Borgert, and Berteun Damman 2645 separately requested this on comp.lang.python - great idea!) 2646 2647- Added setWhitespaceChars() method to override the characters to be 2648 skipped as whitespace before matching a particular ParseElement. Also 2649 added the class-level method setDefaultWhitespaceChars(), to allow 2650 users to override the default set of whitespace characters (space, 2651 tab, newline, and return) for all subsequently defined ParseElements. 2652 (Inspired by Klaas Hofstra's inquiry on the Sourceforge pyparsing 2653 forum.) 2654 2655- Added helper parse actions to support some very common parse 2656 action use cases: 2657 . replaceWith(replStr) - replaces the matching tokens with the 2658 provided replStr replacement string; especially useful with 2659 transformString() 2660 . removeQuotes - removes first and last character from string enclosed 2661 in quotes (note - NOT the same as the string strip() method, as only 2662 a single character is removed at each end) 2663 2664- Added copy() method to ParseElement, to make it easier to define 2665 different parse actions for the same basic parse expression. (Note, copy 2666 is implicitly called when using setResultsName().) 2667 2668 2669 (The following changes were posted to CVS as Version 1.2.3 - 2670 October-December, 2004) 2671 2672- Added support for Unicode strings in creating grammar definitions. 2673 (Big thanks to Gavin Panella!) 2674 2675- Added constant alphas8bit to include the following 8-bit characters: 2676 ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ 2677 2678- Added srange() function to simplify definition of Word elements, using 2679 regexp-like '[A-Za-z0-9]' syntax. This also simplifies referencing 2680 common 8-bit characters. 2681 2682- Fixed bug in Dict when a single element Dict was embedded within another 2683 Dict. (Thanks Andy Yates for catching this one!) 2684 2685- Added 'formatted' argument to ParseResults.asXML(). If set to False, 2686 suppresses insertion of whitespace for pretty-print formatting. Default 2687 equals True for backward compatibility. 2688 2689- Added setDebugActions() function to ParserElement, to allow user-defined 2690 debugging actions. 2691 2692- Added support for escaped quotes (either in \', \", or doubled quote 2693 form) to the predefined expressions for quoted strings. (Thanks, Ero 2694 Carrera!) 2695 2696- Minor performance improvement (~5%) converting "char in string" tests 2697 to "char in dict". (Suggested by Gavin Panella, cool idea!) 2698 2699 2700Version 1.2.2 - September 27, 2004 2701---------------------------------- 2702- Modified delimitedList to accept an expression as the delimiter, instead 2703 of only accepting strings. 2704 2705- Modified ParseResults, to convert integer field keys to strings (to 2706 avoid confusion with list access). 2707 2708- Modified Combine, to convert all embedded tokens to strings before 2709 combining. 2710 2711- Fixed bug in MatchFirst in which parse actions would be called for 2712 expressions that only partially match. (Thanks, John Hunter!) 2713 2714- Fixed bug in fourFn.py example that fixes right-associativity of ^ 2715 operator. (Thanks, Andrea Griffini!) 2716 2717- Added class FollowedBy(expression), to look ahead in the input string 2718 without consuming tokens. 2719 2720- Added class NoMatch that never matches any input. Can be useful in 2721 debugging, and in very specialized grammars. 2722 2723- Added example pgn.py, for parsing chess game files stored in Portable 2724 Game Notation. (Thanks, Alberto Santini!) 2725 2726 2727Version 1.2.1 - August 19, 2004 2728------------------------------- 2729- Added SkipTo(expression) token type, simplifying grammars that only 2730 want to specify delimiting expressions, and want to match any characters 2731 between them. 2732 2733- Added helper method dictOf(key,value), making it easier to work with 2734 the Dict class. (Inspired by Pavel Volkovitskiy, thanks!). 2735 2736- Added optional argument listAllMatches (default=False) to 2737 setResultsName(). Setting listAllMatches to True overrides the default 2738 modal setting of tokens to results names; instead, the results name 2739 acts as an accumulator for all matching tokens within the local 2740 repetition group. (Suggested by Amaury Le Leyzour - thanks!) 2741 2742- Fixed bug in ParseResults, throwing exception when trying to extract 2743 slice, or make a copy using [:]. (Thanks, Wilson Fowlie!) 2744 2745- Fixed bug in transformString() when the input string contains <TAB>'s 2746 (Thanks, Rick Walia!). 2747 2748- Fixed bug in returning tokens from un-Grouped And's, Or's and 2749 MatchFirst's, where too many tokens would be included in the results, 2750 confounding parse actions and returned results. 2751 2752- Fixed bug in naming ParseResults returned by And's, Or's, and Match 2753 First's. 2754 2755- Fixed bug in LineEnd() - matching this token now correctly consumes 2756 and returns the end of line "\n". 2757 2758- Added a beautiful example for parsing Mozilla calendar files (Thanks, 2759 Petri Savolainen!). 2760 2761- Added support for dynamically modifying Forward expressions during 2762 parsing. 2763 2764 2765Version 1.2 - 20 June 2004 2766-------------------------- 2767- Added definition for htmlComment to help support HTML scanning and 2768 parsing. 2769 2770- Fixed bug in generating XML for Dict classes, in which trailing item was 2771 duplicated in the output XML. 2772 2773- Fixed release bug in which scanExamples.py was omitted from release 2774 files. 2775 2776- Fixed bug in transformString() when parse actions are not defined on the 2777 outermost parser element. 2778 2779- Added example urlExtractor.py, as another example of using scanString 2780 and parse actions. 2781 2782 2783Version 1.2beta3 - 4 June 2004 2784------------------------------ 2785- Added White() token type, analogous to Word, to match on whitespace 2786 characters. Use White in parsers with significant whitespace (such as 2787 configuration file parsers that use indentation to indicate grouping). 2788 Construct White with a string containing the whitespace characters to be 2789 matched. Similar to Word, White also takes optional min, max, and exact 2790 parameters. 2791 2792- As part of supporting whitespace-signficant parsing, added parseWithTabs() 2793 method to ParserElement, to override the default behavior in parseString 2794 of automatically expanding tabs to spaces. To retain tabs during 2795 parsing, call parseWithTabs() before calling parseString(), parseFile() or 2796 scanString(). (Thanks, Jean-Guillaume Paradis for catching this, and for 2797 your suggestions on whitespace-significant parsing.) 2798 2799- Added transformString() method to ParseElement, as a complement to 2800 scanString(). To use transformString, define a grammar and attach a parse 2801 action to the overall grammar that modifies the returned token list. 2802 Invoking transformString() on a target string will then scan for matches, 2803 and replace the matched text patterns according to the logic in the parse 2804 action. transformString() returns the resulting transformed string. 2805 (Note: transformString() does *not* automatically expand tabs to spaces.) 2806 Also added scanExamples.py to the examples directory to show sample uses of 2807 scanString() and transformString(). 2808 2809- Removed group() method that was introduced in beta2. This turns out NOT to 2810 be equivalent to nesting within a Group() object, and I'd prefer not to sow 2811 more seeds of confusion. 2812 2813- Fixed behavior of asXML() where tags for groups were incorrectly duplicated. 2814 (Thanks, Brad Clements!) 2815 2816- Changed beta version message to display to stderr instead of stdout, to 2817 make asXML() easier to use. (Thanks again, Brad.) 2818 2819 2820Version 1.2beta2 - 19 May 2004 2821------------------------------ 2822- *** SIMPLIFIED API *** - Parse actions that do not modify the list of tokens 2823 no longer need to return a value. This simplifies those parse actions that 2824 use the list of tokens to update a counter or record or display some of the 2825 token content; these parse actions can simply end without having to specify 2826 'return toks'. 2827 2828- *** POSSIBLE API INCOMPATIBILITY *** - Fixed CaselessLiteral bug, where the 2829 returned token text was not the original string (as stated in the docs), 2830 but the original string converted to upper case. (Thanks, Dang Griffith!) 2831 **NOTE: this may break some code that relied on this erroneous behavior. 2832 Users should scan their code for uses of CaselessLiteral.** 2833 2834- *** POSSIBLE CODE INCOMPATIBILITY *** - I have renamed the internal 2835 attributes on ParseResults from 'dict' and 'list' to '__tokdict' and 2836 '__toklist', to avoid collisions with user-defined data fields named 'dict' 2837 and 'list'. Any client code that accesses these attributes directly will 2838 need to be modified. Hopefully the implementation of methods such as keys(), 2839 items(), len(), etc. on ParseResults will make such direct attribute 2840 accessess unnecessary. 2841 2842- Added asXML() method to ParseResults. This greatly simplifies the process 2843 of parsing an input data file and generating XML-structured data. 2844 2845- Added getName() method to ParseResults. This method is helpful when 2846 a grammar specifies ZeroOrMore or OneOrMore of a MatchFirst or Or 2847 expression, and the parsing code needs to know which expression matched. 2848 (Thanks, Eric van der Vlist, for this idea!) 2849 2850- Added items() and values() methods to ParseResults, to better support using 2851 ParseResults as a Dictionary. 2852 2853- Added parseFile() as a convenience function to parse the contents of an 2854 entire text file. Accepts either a file name or a file object. (Thanks 2855 again, Dang!) 2856 2857- Added group() method to And, Or, and MatchFirst, as a short-cut alternative 2858 to enclosing a construct inside a Group object. 2859 2860- Extended fourFn.py to support exponentiation, and simple built-in functions. 2861 2862- Added EBNF parser to examples, including a demo where it parses its own 2863 EBNF! (Thanks to Seo Sanghyeon!) 2864 2865- Added Delphi Form parser to examples, dfmparse.py, plus a couple of 2866 sample Delphi forms as tests. (Well done, Dang!) 2867 2868- Another performance speedup, 5-10%, inspired by Dang! Plus about a 20% 2869 speedup, by pre-constructing and cacheing exception objects instead of 2870 constructing them on the fly. 2871 2872- Fixed minor bug when specifying oneOf() with 'caseless=True'. 2873 2874- Cleaned up and added a few more docstrings, to improve the generated docs. 2875 2876 2877Version 1.1.2 - 21 Mar 2004 2878--------------------------- 2879- Fixed minor bug in scanString(), so that start location is at the start of 2880 the matched tokens, not at the start of the whitespace before the matched 2881 tokens. 2882 2883- Inclusion of HTML documentation, generated using Epydoc. Reformatted some 2884 doc strings to better generate readable docs. (Beautiful work, Ed Loper, 2885 thanks for Epydoc!) 2886 2887- Minor performance speedup, 5-15% 2888 2889- And on a process note, I've used the unittest module to define a series of 2890 unit tests, to help avoid the embarrassment of the version 1.1 snafu. 2891 2892 2893Version 1.1.1 - 6 Mar 2004 2894-------------------------- 2895- Fixed critical bug introduced in 1.1, which broke MatchFirst(!) token 2896 matching. 2897 **THANK YOU, SEO SANGHYEON!!!** 2898 2899- Added "from future import __generators__" to permit running under 2900 pre-Python 2.3. 2901 2902- Added example getNTPservers.py, showing how to use pyparsing to extract 2903 a text pattern from the HTML of a web page. 2904 2905 2906Version 1.1 - 3 Mar 2004 2907------------------------- 2908- ***Changed API*** - While testing out parse actions, I found that the value 2909 of loc passed in was not the starting location of the matched tokens, but 2910 the location of the next token in the list. With this version, the location 2911 passed to the parse action is now the starting location of the tokens that 2912 matched. 2913 2914 A second part of this change is that the return value of parse actions no 2915 longer needs to return a tuple containing both the location and the parsed 2916 tokens (which may optionally be modified); parse actions only need to return 2917 the list of tokens. Parse actions that return a tuple are deprecated; they 2918 will still work properly for conversion/compatibility, but this behavior will 2919 be removed in a future version. 2920 2921- Added validate() method, to help diagnose infinite recursion in a grammar tree. 2922 validate() is not 100% fool-proof, but it can help track down nasty infinite 2923 looping due to recursively referencing the same grammar construct without some 2924 intervening characters. 2925 2926- Cleaned up default listing of some parse element types, to more closely match 2927 ordinary BNF. Instead of the form <classname>:[contents-list], some changes 2928 are: 2929 . And(token1,token2,token3) is "{ token1 token2 token3 }" 2930 . Or(token1,token2,token3) is "{ token1 ^ token2 ^ token3 }" 2931 . MatchFirst(token1,token2,token3) is "{ token1 | token2 | token3 }" 2932 . Optional(token) is "[ token ]" 2933 . OneOrMore(token) is "{ token }..." 2934 . ZeroOrMore(token) is "[ token ]..." 2935 2936- Fixed an infinite loop in oneOf if the input string contains a duplicated 2937 option. (Thanks Brad Clements) 2938 2939- Fixed a bug when specifying a results name on an Optional token. (Thanks 2940 again, Brad Clements) 2941 2942- Fixed a bug introduced in 1.0.6 when I converted quotedString to use 2943 CharsNotIn; I accidentally permitted quoted strings to span newlines. I have 2944 fixed this in this version to go back to the original behavior, in which 2945 quoted strings do *not* span newlines. 2946 2947- Fixed minor bug in HTTP server log parser. (Thanks Jim Richardson) 2948 2949 2950Version 1.0.6 - 13 Feb 2004 2951---------------------------- 2952- Added CharsNotIn class (Thanks, Lee SangYeong). This is the opposite of 2953 Word, in that it is constructed with a set of characters *not* to be matched. 2954 (This enhancement also allowed me to clean up and simplify some of the 2955 definitions for quoted strings, cStyleComment, and restOfLine.) 2956 2957- **MINOR API CHANGE** - Added joinString argument to the __init__ method of 2958 Combine (Thanks, Thomas Kalka). joinString defaults to "", but some 2959 applications might choose some other string to use instead, such as a blank 2960 or newline. joinString was inserted as the second argument to __init__, 2961 so if you have code that specifies an adjacent value, without using 2962 'adjacent=', this code will break. 2963 2964- Modified LineStart to recognize the start of an empty line. 2965 2966- Added optional caseless flag to oneOf(), to create a list of CaselessLiteral 2967 tokens instead of Literal tokens. 2968 2969- Added some enhancements to the SQL example: 2970 . Oracle-style comments (Thanks to Harald Armin Massa) 2971 . simple WHERE clause 2972 2973- Minor performance speedup - 5-15% 2974 2975 2976Version 1.0.5 - 19 Jan 2004 2977---------------------------- 2978- Added scanString() generator method to ParseElement, to support regex-like 2979 pattern-searching 2980 2981- Added items() list to ParseResults, to return named results as a 2982 list of (key,value) pairs 2983 2984- Fixed memory overflow in asList() for deeply nested ParseResults (Thanks, 2985 Sverrir Valgeirsson) 2986 2987- Minor performance speedup - 10-15% 2988 2989 2990Version 1.0.4 - 8 Jan 2004 2991--------------------------- 2992- Added positional tokens StringStart, StringEnd, LineStart, and LineEnd 2993 2994- Added commaSeparatedList to pre-defined global token definitions; also added 2995 commasep.py to the examples directory, to demonstrate the differences between 2996 parsing comma-separated data and simple line-splitting at commas 2997 2998- Minor API change: delimitedList does not automatically enclose the 2999 list elements in a Group, but makes this the responsibility of the caller; 3000 also, if invoked using 'combine=True', the list delimiters are also included 3001 in the returned text (good for scoped variables, such as a.b.c or a::b::c, or 3002 for directory paths such as a/b/c) 3003 3004- Performance speed-up again, 30-40% 3005 3006- Added httpServerLogParser.py to examples directory, as this is 3007 a common parsing task 3008 3009 3010Version 1.0.3 - 23 Dec 2003 3011--------------------------- 3012- Performance speed-up again, 20-40% 3013 3014- Added Python distutils installation setup.py, etc. (thanks, Dave Kuhlman) 3015 3016 3017Version 1.0.2 - 18 Dec 2003 3018--------------------------- 3019- **NOTE: Changed API again!!!** (for the last time, I hope) 3020 3021 + Renamed module from parsing to pyparsing, to better reflect Python 3022 linkage. 3023 3024- Also added dictExample.py to examples directory, to illustrate 3025 usage of the Dict class. 3026 3027 3028Version 1.0.1 - 17 Dec 2003 3029--------------------------- 3030- **NOTE: Changed API!** 3031 3032 + Renamed 'len' argument on Word.__init__() to 'exact' 3033 3034- Performance speed-up, 10-30% 3035 3036 3037Version 1.0.0 - 15 Dec 2003 3038--------------------------- 3039- Initial public release 3040 3041Version 0.1.1 thru 0.1.17 - October-November, 2003 3042-------------------------------------------------- 3043- initial development iterations: 3044 - added Dict, Group 3045 - added helper methods oneOf, delimitedList 3046 - added helpers quotedString (and double and single), restOfLine, cStyleComment 3047 - added MatchFirst as an alternative to the slower Or 3048 - added UML class diagram 3049 - fixed various logic bugs 3050