Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Update #86

Merged
merged 24 commits into from
Nov 20, 2018
Merged

Initial Update #86

merged 24 commits into from
Nov 20, 2018

Conversation

pyup-bot
Copy link
Collaborator

This PR sets up pyup.io on this repo and updates all dependencies at once, in a single branch.

Subsequent pull requests will update one dependency at a time, each in their own branch. If you want to start with that right away, simply close this PR.

Update six from 1.11.0 to 1.11.0.

Changelog

1.11.0

------

- Pull request 178: `with_metaclass` now properly proxies `__prepare__` to the
underlying metaclass.

- Pull request 191: Allow `with_metaclass` to work with metaclasses implemented
in C.

- Pull request 203: Add parse_http_list and parse_keqv_list to moved
urllib.request.

- Pull request 172 and issue 171: Add unquote_to_bytes to moved urllib.parse.

- Pull request 167: Add `six.moves.getoutput`.

- Pull request 80: Add `six.moves.urllib_parse.splitvalue`.

- Pull request 75: Add `six.moves.email_mime_image`.

- Pull request 72: Avoid creating reference cycles through tracebacks in
`reraise`.

1.10.0

------

- Issue 122: Improve the performance of `six.int2byte` on Python 3.

- Pull request 55 and issue 99: Don't add the `winreg` module to `six.moves`
on non-Windows platforms.

- Pull request 60 and issue 108: Add `six.moves.getcwd` and
`six.moves.getcwdu`.

- Pull request 64: Add `create_unbound_method` to create unbound methods.

1.9.0

-----

- Issue 106: Support the `flush` parameter to `six.print_`.

- Pull request 48 and issue 15: Add the `python_2_unicode_compatible`
decorator.

- Pull request 57 and issue 50: Add several compatibility methods for unittest
assertions that were renamed between Python 2 and 3.

- Issue 105 and pull request 58: Ensure `six.wraps` respects the *updated* and
*assigned* arguments.

- Issue 102: Add `raise_from` to abstract out Python 3's raise from syntax.

- Issue 97: Optimize `six.iterbytes` on Python 2.

- Issue 98: Fix `six.moves` race condition in multi-threaded code.

- Pull request 51: Add `six.view(keys|values|itmes)`, which provide dictionary
views on Python 2.7+.

- Issue 112: `six.moves.reload_module` now uses the importlib module on
Python 3.4+.

1.8.0

-----

- Issue 90: Add `six.moves.shlex_quote`.

- Issue 59: Add `six.moves.intern`.

- Add `six.urllib.parse.uses_(fragment|netloc|params|query|relative)`.

- Issue 88: Fix add_metaclass when the class has `__slots__` containing
`__weakref__` or `__dict__`.

- Issue 89: Make six use absolute imports.

- Issue 85: Always accept *updated* and *assigned* arguments for `wraps()`.

- Issue 86: In `reraise()`, instantiate the exception if the second argument is
`None`.

- Pull request 45: Add `six.moves.email_mime_nonmultipart`.

- Issue 81: Add `six.urllib.request.splittag` mapping.

- Issue 80: Add `six.urllib.request.splituser` mapping.

1.7.3

-----

- Issue 77: Fix import six on Python 3.4 with a custom loader.

- Issue 74: `six.moves.xmlrpc_server` should map to `SimpleXMLRPCServer` on Python
2 as documented not `xmlrpclib`.

1.7.2

-----

- Issue 72: Fix installing on Python 2.

1.7.1

-----

- Issue 71: Make the six.moves meta path importer handle reloading of the six
module gracefully.

1.7.0

-----

- Pull request 30: Implement six.moves with a PEP 302 meta path hook.

- Pull request 32: Add six.wraps, which is like functools.wraps but always sets
the __wrapped__ attribute.

- Pull request 35: Improve add_metaclass, so that it doesn't end up inserting
another class into the hierarchy.

- Pull request 34: Add import mappings for dummy_thread.

- Pull request 33: Add import mappings for UserDict and UserList.

- Pull request 31: Select the implementations of dictionary iterator routines
at import time for a 20% speed boost.

1.6.1

-----

- Raise an AttributeError for six.moves.X when X is a module not available in
the current interpreter.

1.6.0

-----

- Raise an AttributeError for every attribute of unimportable modules.

- Issue 56: Make the fake modules six.moves puts into sys.modules appear not to
have a __path__ unless they are loaded.

- Pull request 28: Add support for SplitResult.

- Issue 55: Add move mapping for xmlrpc.server.

- Pull request 29: Add move for urllib.parse.splitquery.

1.5.2

-----

- Issue 53: Make the fake modules six.moves puts into sys.modules appear not to
have a __name__ unless they are loaded.

1.5.1

-----

- Issue 51: Hack around the Django autoreloader after recent six.moves changes.

1.5.0

-----

- Removed support for Python 2.4. This is because py.test no longer supports
2.4.

- Fix various import problems including issues 19 and 41. six.moves modules
are now lazy wrappers over the underlying modules instead of the actual
modules themselves.

- Issue 49: Add six.moves mapping for tkinter.ttk.

- Pull request 24: Add __dir__ special method to six.moves modules.

- Issue 47: Fix add_metaclass on classes with a string for the __slots__
variable.

- Issue 44: Fix interpretation of backslashes on Python 2 in the u() function.

- Pull request 21: Add import mapping for urllib's proxy_bypass function.

- Issue 43: Add import mapping for the Python 2 xmlrpclib module.

- Issue 39: Add import mapping for the Python 2 thread module.

- Issue 40: Add import mapping for the Python 2 gdbm module.

- Issue 35: On Python versions less than 2.7, print_ now encodes unicode
strings when outputing to standard streams. (Python 2.7 handles this
automatically.)

1.4.1

-----

- Issue 32: urllib module wrappings don't work when six is not a toplevel file.

1.4.0

-----

- Issue 31: Add six.moves mapping for UserString.

- Pull request 12: Add six.add_metaclass, a decorator for adding a metaclass to
a class.

- Add six.moves.zip_longest and six.moves.filterfalse, which correspond
respectively to itertools.izip_longest and itertools.ifilterfalse on Python 2
and itertools.zip_longest and itertools.filterfalse on Python 3.

- Issue 25: Add the unichr function, which returns a string for a Unicode
codepoint.

- Issue 26: Add byte2int function, which complements int2byte.

- Add a PY2 constant with obvious semantics.

- Add helpers for indexing and iterating over bytes: iterbytes and indexbytes.

- Add create_bound_method() wrapper.

- Issue 23: Allow multiple base classes to be passed to with_metaclass.

- Issue 24: Add six.moves.range alias. This exactly the same as the current
xrange alias.

- Pull request 5: Create six.moves.urllib, which contains abstractions for a
bunch of things which are in urllib in Python 3 and spread out across urllib,
urllib2, and urlparse in Python 2.

1.3.0

-----

- Issue 21: Add methods to access the closure and globals of a function.

- In six.iter(items/keys/values/lists), passed keyword arguments through to the
underlying method.

- Add six.iterlists().

- Issue 20: Fix tests if tkinter is not available.

- Issue 17: Define callable to be builtin callable when it is available again
in Python 3.2+.

- Issue 16: Rename Python 2 exec_'s arguments, so casually calling exec_ with
keyword arguments will raise.

- Issue 14: Put the six.moves package in sys.modules based on the name six is
imported under.

- Fix Jython detection.

- Pull request 4: Add email_mime_multipart, email_mime_text, and
email_mime_base to six.moves.

1.2.0

-----

- Issue 13: Make iterkeys/itervalues/iteritems return iterators on Python 3
instead of iterables.

- Issue 11: Fix maxsize support on Jython.

- Add six.next() as an alias for six.advance_iterator().

- Use the builtin next() function for advance_iterator() where is available
(2.6+), not just Python 3.

- Add the Iterator class for writing portable iterators.

1.1.0

-----

- Add the int2byte function.

- Add compatibility mappings for iterators over the keys, values, and items of a
dictionary.

- Fix six.MAXSIZE on platforms where sizeof(long) != sizeof(Py_ssize_t).

- Issue 3: Add six.moves mappings for filter, map, and zip.

1.0

----------

- Reworked six into one .py file.  This breaks imports.  Please tell me if you
are interested in an import compatibility layer.

1.0.0

-----

- Issue 2: u() on Python 2.x now resolves unicode escapes.

- Expose an API for adding mappings to six.moves.
Links

Update pyparsing from 2.3.0 to 2.3.0.

Changelog

2.3.0

-----------------------------
- NEW SUPPORT FOR UNICODE CHARACTER RANGES
This release introduces the pyparsing_unicode namespace class, defining
a series of language character sets to simplify the definition of alphas,
nums, alphanums, and printables in the following language sets:
. Arabic
. Chinese
. Cyrillic
. Devanagari
. Greek
. Hebrew
. Japanese (including Kanji, Katakana, and Hirigana subsets)
. Korean
. Latin1 (includes 7 and 8-bit Latin characters)
. Thai
. CJK (combination of Chinese, Japanese, and Korean sets)

For example, your code can define words using:

 korean_word = Word(pyparsing_unicode.Korean.alphas)

See their use in the updated examples greetingInGreek.py and
greetingInKorean.py.

This namespace class also offers access to these sets using their
unicode identifiers.

- POSSIBLE API CHANGE: Fixed bug where a parse action that explicitly 
returned the input ParseResults could add another nesting level in
the results if the current expression had a results name.

     vals = pp.OneOrMore(pp.pyparsing_common.integer)("int_values")
     
     def add_total(tokens):
         tokens['total'] = sum(tokens)
         return tokens   this line can be removed

     vals.addParseAction(add_total)
     print(vals.parseString("244 23 13 2343").dump())

Before the fix, this code would print (note the extra nesting level):

 [244, 23, 13, 2343]
 - int_values: [244, 23, 13, 2343]
   - int_values: [244, 23, 13, 2343]
   - total: 2623
 - total: 2623

With the fix, this code now prints:

 [244, 23, 13, 2343]
 - int_values: [244, 23, 13, 2343]
 - total: 2623

This fix will change the structure of ParseResults returned if a 
program defines a parse action that returns the tokens that were 
sent in. This is not necessary, and statements like "return tokens" 
in the example above can be safely deleted prior to upgrading to 
this release, in order to avoid the bug and get the new behavior.

Reported by seron in Issue 22, nice catch!

- POSSIBLE API CHANGE: Fixed a related bug where a results name 
erroneously created a second level of hierarchy in the returned 
ParseResults. The intent for accumulating results names into ParseResults
is that, in the absence of Group'ing, all names get merged into a
common namespace. This allows us to write:

    key_value_expr = (Word(alphas)("key") + '=' + Word(nums)("value"))
    result = key_value_expr.parseString("a = 100") 
 
and have result structured as {"key": "a", "value": "100"} 
instead of [{"key": "a"}, {"value": "100"}].

However, if a named expression is used in a higher-level non-Group 
expression that *also* has a name, a false sub-level would be created 
in the namespace:

     num = pp.Word(pp.nums)
     num_pair = ("[" + (num("A") + num("B"))("values") + "]")
     U = num_pair.parseString("[ 10 20 ]")
     print(U.dump())

Since there is no grouping, "A", "B", and "values" should all appear
at the same level in the results, as:

     ['[', '10', '20', ']']
     - A: '10'
     - B: '20'
     - values: ['10', '20']

Instead, an extra level of "A" and "B" show up under "values":

     ['[', '10', '20', ']']
     - A: '10'
     - B: '20'
     - values: ['10', '20']
       - A: '10'
       - B: '20'

This bug has been fixed. Now, if this hierarchy is desired, then a
Group should be added:

     num_pair = ("[" + pp.Group(num("A") + num("B"))("values") + "]")

Giving:

     ['[', ['10', '20'], ']']
     - values: ['10', '20']
       - A: '10'
       - B: '20'

But in no case should "A" and "B" appear in multiple levels. This bug-fix
fixes that.

If you have current code which relies on this behavior, then add or remove
Groups as necessary to get your intended results structure.

Reported by Athanasios Anastasiou.

- IndexError's raised in parse actions will get explicitly reraised 
as ParseExceptions that wrap the original IndexError. Since 
IndexError sometimes occurs as part of pyparsing's normal parsing 
logic, IndexErrors that are raised during a parse action may have
gotten silently reinterpreted as parsing errors. To retain the 
information from the IndexError, these exceptions will now be 
raised as ParseExceptions that reference the original IndexError. 
This wrapping will only be visible when run under Python3, since it
emulates "raise ... from ..." syntax. 

Addresses Issue 4, reported by guswns0528.

- Added Char class to simplify defining expressions of a single
character. (Char("abc") is equivalent to Word("abc", exact=1))

- Added class PrecededBy to perform lookbehind tests. PrecededBy is 
used in the same way as FollowedBy, passing in an expression that
must occur just prior to the current parse location.

For fixed-length expressions like a Literal, Keyword, Char, or a 
Word with an `exact` or `maxLen` length given, `PrecededBy(expr)` 
is sufficient. For varying length expressions like a Word with no 
given maximum length, `PrecededBy` must be constructed with an 
integer `retreat` argument, as in 
`PrecededBy(Word(alphas, nums), retreat=10)`, to specify the maximum 
number of characters pyparsing must look backward to make a match. 
pyparsing will check all the values from 1 up to retreat characters 
back from the current parse location.

When stepping backwards through the input string, PrecededBy does 
*not* skip over whitespace.

PrecededBy can be created with a results name so that, even though
it always returns an empty parse result, the result *can* include
named results.

Idea first suggested in Issue 30 by Freakwill.

- Updated FollowedBy to accept expressions that contain named results,
so that results names defined in the lookahead expression will be 
returned, even though FollowedBy always returns an empty list.
Inspired by the same feature implemented in PrecededBy.

2.2.2

-------------------------------
- Fixed bug in SkipTo, if a SkipTo expression that was skipping to
an expression that returned a list (such as an And), and the 
SkipTo was saved as a named result, the named result could be 
saved as a ParseResults - should always be saved as a string.
Issue 28, reported by seron.

- Added simple_unit_tests.py, as a collection of easy-to-follow unit 
tests for various classes and features of the pyparsing library. 
Primary intent is more to be instructional than actually rigorous 
testing. Complex tests can still be added in the unitTests.py file.

- New features added to the Regex class:
- optional asGroupList parameter, returns all the capture groups as
 a list
- optional asMatch parameter, returns the raw re.match result
- new sub(repl) method, which adds a parse action calling
 re.sub(pattern, repl, parsed_result). Simplifies creating 
 Regex expressions to be used with transformString. Like re.sub,
 repl may be an ordinary string (similar to using pyparsing's 
 replaceWith), or may contain references to capture groups by group 
 number, or may be a callable that takes an re match group and 
 returns a string.
 
 For instance:
     expr = pp.Regex(r"([Hh]\d):\s*(.*)").sub(r"<\1>\2</\1>")
     expr.transformString("h1: This is the title")

 will return
     <h1>This is the title</h1>

- Fixed omission of LICENSE file in source tarball, also added 
CODE_OF_CONDUCT.md per GitHub community standards.

2.2.1

-------------------------------
- Applied changes necessary to migrate hosting of pyparsing source
over to GitHub. Many thanks for help and contributions from hugovk,
jdufresne, and cngkaygusuz among others through this transition,
sorry it took me so long!

- Fixed import of collections.abc to address DeprecationWarnings
in Python 3.7.

- Updated oc.py example to support function calls in arithmetic
expressions; fixed regex for '==' operator; and added packrat
parsing. Raised on the pyparsing wiki by Boris Marin, thanks!

- Fixed bug in select_parser.py example, group_by_terms was not
reported. Reported on SF bugs by Adam Groszer, thanks Adam!

- Added "Getting Started" section to the module docstring, to 
guide new users to the most common starting points in pyparsing's
API.

- Fixed bug in Literal and Keyword classes, which erroneously
raised IndexError instead of ParseException.

2.2.0

---------------------------
- Bumped minor version number to reflect compatibility issues with
OneOrMore and ZeroOrMore bugfixes in 2.1.10. (2.1.10 fixed a bug
that was introduced in 2.1.4, but the fix could break code
written against 2.1.4 - 2.1.9.)

- Updated setup.py to address recursive import problems now
that pyparsing is part of 'packaging' (used by setuptools).
Patch submitted by Joshua Root, much thanks!

- Fixed KeyError issue reported by Yann Bizeul when using packrat
parsing in the Graphite time series database, thanks Yann!

- Fixed incorrect usages of '\' in literals, as described in
https://docs.python.org/3/whatsnew/3.6.htmldeprecated-python-behavior
Patch submitted by Ville Skyttä - thanks!

- Minor internal change when using '-' operator, to be compatible
with ParserElement.streamline() method.

- Expanded infixNotation to accept a list or tuple of parse actions
to attach to an operation.

- New unit test added for dill support for storing pyparsing parsers.
Ordinary Python pickle can be used to pickle pyparsing parsers as
long as they do not use any parse actions. The 'dill' module is an
extension to pickle which *does* support pickling of attached
parse actions.

2.1.10

-------------------------------
- Fixed bug in reporting named parse results for ZeroOrMore
expressions, thanks Ethan Nash for reporting this!

- Fixed behavior of LineStart to be much more predictable.
LineStart can now be used to detect if the next parse position
is col 1, factoring in potential leading whitespace (which would
cause LineStart to fail). Also fixed a bug in col, which is
used in LineStart, where '\n's were erroneously considered to
be column 1.

- Added support for multiline test strings in runTests.

- Fixed bug in ParseResults.dump when keys were not strings.
Also changed display of string values to show them in quotes,
to help distinguish parsed numeric strings from parsed integers
that have been converted to Python ints.

2.1.9

-------------------------------
- Added class CloseMatch, a variation on Literal which matches 
"close" matches, that is, strings with at most 'n' mismatching
characters.

- Fixed bug in Keyword.setDefaultKeywordChars(), reported by Kobayashi
Shinji - nice catch, thanks!

- Minor API change in pyparsing_common. Renamed some of the common
expressions to PEP8 format (to be consistent with the other 
pyparsing_common expressions):
. signedInteger -> signed_integer
. sciReal -> sci_real

Also, in trying to stem the API bloat of pyparsing, I've copied
some of the global expressions and helper parse actions into 
pyparsing_common, with the originals to be deprecated and removed
in a future release:
. commaSeparatedList -> pyparsing_common.comma_separated_list
. upcaseTokens -> pyparsing_common.upcaseTokens
. downcaseTokens -> pyparsing_common.downcaseTokens

(I don't expect any other expressions, like the comment expressions,
quotedString, or the Word-helping strings like alphas, nums, etc.
to migrate to pyparsing_common - they are just too pervasive. As for
the PEP8 vs camelCase naming, all the expressions are PEP8, while
the parse actions in pyparsing_common are still camelCase. It's a 
small step - when pyparsing 3.0 comes around, everything will change
to PEP8 snake case.)

- Fixed Python3 compatibility bug when using dict keys() and values()
in ParseResults.getName().

- After some prodding, I've reworked the unitTests.py file for 
pyparsing over the past few releases. It uses some variations on 
unittest to handle my testing style. The test now:
. auto-discovers its test classes (while maintining their order
 of definition)
. suppresses voluminous 'print' output for tests that pass

2.1.8

----------------------------
- Fixed issue in the optimization to _trim_arity, when the full 
stacktrace is retrieved to determine if a TypeError is raised in
pyparsing or in the caller's parse action. Code was traversing
the full stacktrace, and potentially encountering UnicodeDecodeError.

- Fixed bug in ParserElement.inlineLiteralsUsing, causing infinite 
loop with Suppress.

- Fixed bug in Each, when merging named results from multiple
expressions in a ZeroOrMore or OneOrMore. Also fixed bug when
ZeroOrMore expressions were erroneously treated as required 
expressions in an Each expression.

- Added a few more inline doc examples.

- Improved use of runTests in several example scripts.

2.1.7

----------------------------
- Fixed regression reported by Andrea Censi (surfaced in PyContracts 
tests) when using ParseSyntaxExceptions (raised when using operator '-')
with packrat parsing.

- Minor fix to oneOf, to accept all iterables, not just space-delimited
strings and lists. (If you have a list or set of strings, it is 
not necessary to concat them using ' '.join to pass them to oneOf,
oneOf will accept the list or set or generator directly.)

2.1.6

----------------------------
- *Major packrat upgrade*, inspired by patch provided by Tal Einat - 
many, many, thanks to Tal for working on this! Tal's tests show 
faster parsing performance (2X in some tests), *and* memory reduction 
from 3GB down to ~100MB! Requires no changes to existing code using 
packratting. (Uses OrderedDict, available in Python 2.7 and later.
For Python 2.6 users, will attempt to import from ordereddict
backport. If not present, will implement pure-Python Fifo dict.)

- Minor API change - to better distinguish between the flexible
numeric types defined in pyparsing_common, I've changed "numeric" 
(which parsed numbers of different types and returned int for ints, 
float for floats, etc.) and "number" (which parsed numbers of int
or float type, and returned all floats) to "number" and "fnumber"
respectively. I hope the "f" prefix of "fnumber" will be a better
indicator of its internal conversion of parsed values to floats, 
while the generic "number" is similar to the flexible number syntax
in other languages. Also fixed a bug in pyparsing_common.numeric
(now renamed to pyparsing_common.number), integers were parsed and 
returned as floats instead of being retained as ints.

- Fixed bug in upcaseTokens and downcaseTokens introduced in 2.1.5,
when the parse action was used in conjunction with results names.
Reported by Steven Arcangeli from the dql project, thanks for your
patience, Steven!

- Major change to docs! After seeing some comments on reddit about 
general issue with docs of Python modules, and thinking that I'm a 
little overdue in doing some doc tuneup on pyparsing, I decided to
following the suggestions of the redditor and add more inline examples
to the pyparsing reference documentation. I hope this addition 
will clarify some of the more common questions people have, especially
when first starting with pyparsing/Python.

- Deprecated ParseResults.asXML. I've never been too happy with this
method, and it usually forces some unnatural code in the parsers in
order to get decent tag names. The amount of guesswork that asXML 
has to do to try to match names with values should have been a red
flag from day one. If you are using asXML, you will need to implement 
your own ParseResults->XML serialization. Or consider migrating to
a more current format such as JSON (which is very easy to do: 
results_as_json = json.dumps(parse_result.asDict()) Hopefully, when
I remove this code in a future version, I'll also be able to simplify 
some of the craziness in ParseResults, which IIRC was only there to try 
to make asXML work.

- Updated traceParseAction parse action decorator to show the repr
of the input and output tokens, instead of the str format, since 
str has been simplified to just show the token list content.  

(The change to ParseResults.__str__ occurred in pyparsing 2.0.4, but
it seems that didn't make it into the release notes - sorry! Too
many users, especially beginners, were confused by the 
"([token_list], {names_dict})" str format for ParseResults, thinking 
they were getting a tuple containing a list and a dict. The full form 
can be seen if using repr().)

For tracing tokens in and out of parse actions, the more complete 
repr form provides important information when debugging parse actions.


Verison 2.1.5 - June, 2016
------------------------------
- Added ParserElement.split() generator method, similar to re.split(). 
Includes optional arguments maxsplit (to limit the number of splits),
and includeSeparators (to include the separating matched text in the 
returned output, default=False).

- Added a new parse action construction helper tokenMap, which will
apply a function and optional arguments to each element in a 
ParseResults. So this parse action:

   def lowercase_all(tokens):
       return [str(t).lower() for t in tokens]
   OneOrMore(Word(alphas)).setParseAction(lowercase_all)

can now be written:

   OneOrMore(Word(alphas)).setParseAction(tokenMap(str.lower))

Also simplifies writing conversion parse actions like:

   integer = Word(nums).setParseAction(lambda t: int(t[0]))

to just:

   integer = Word(nums).setParseAction(tokenMap(int))

If additional arguments are necessary, they can be included in the
call to tokenMap, as in:

   hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))

- Added more expressions to pyparsing_common:
. IPv4 and IPv6 addresses (including long, short, and mixed forms
 of IPv6)
. MAC address
. ISO8601 date and date time strings (with named fields for year, month, etc.)
. UUID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
. hex integer (returned as int)
. fraction (integer '/' integer, returned as float)
. mixed integer (integer '-' fraction, or just fraction, returned as float)
. stripHTMLTags (parse action to remove tags from HTML source)
. parse action helpers convertToDate and convertToDatetime to do custom parse
 time conversions of parsed ISO8601 strings

- runTests now returns a two-tuple: success if all tests succeed,
and an output list of each test and its output lines.

- Added failureTests argument (default=False) to runTests, so that
tests can be run that are expected failures, and runTests' success 
value will return True only if all tests *fail* as expected. Also,
parseAll now defaults to True.

- New example numerics.py, shows samples of parsing integer and real
numbers using locale-dependent formats:

 4.294.967.295,000 
 4 294 967 295,000  
 4,294,967,295.000

2.1.4

------------------------------
- Split out the '==' behavior in ParserElement, now implemented
as the ParserElement.matches() method. Using '==' for string test 
purposes will be removed in a future release.

- Expanded capabilities of runTests(). Will now accept embedded
comments (default is Python style, leading '' character, but 
customizable). Comments will be emitted along with the tests and
test output. Useful during test development, to create a test string
consisting only of test case description comments separated by 
blank lines, and then fill in the test cases. Will also highlight
ParseFatalExceptions with "(FATAL)".

- Added a 'pyparsing_common' class containing common/helpful little 
expressions such as integer, float, identifier, etc. I used this 
class as a sort of embedded namespace, to contain these helpers 
without further adding to pyparsing's namespace bloat.

- Minor enhancement to traceParseAction decorator, to retain the 
parse action's name for the trace output.

- Added optional 'fatal' keyword arg to addCondition, to indicate that
a condition failure should halt parsing immediately.

2.1.3

------------------------------
- _trim_arity fix in 2.1.2 was very version-dependent on Py 3.5.0.
Now works for Python 2.x, 3.3, 3.4, 3.5.0, and 3.5.1 (and hopefully
beyond).

2.1.2

------------------------------
- Fixed bug in _trim_arity when pyparsing code is included in a
PyInstaller, reported by maluwa.

- Fixed catastrophic regex backtracking in implementation of the
quoted string expressions (dblQuotedString, sglQuotedString, and
quotedString). Reported on the pyparsing wiki by webpentest,
good catch! (Also tuned up some other expressions susceptible to the 
same backtracking problem, such as cStyleComment, cppStyleComment, 
etc.)

2.1.1

---------------------------
- Added support for assigning to ParseResults using slices.

- Fixed bug in ParseResults.toDict(), in which dict values were always
converted to dicts, even if they were just unkeyed lists of tokens.
Reported on SO by Gerald Thibault, thanks Gerald!

- Fixed bug in SkipTo when using failOn, reported by robyschek, thanks!

- Fixed bug in Each introduced in 2.1.0, reported by AND patch and
unit test submitted by robyschek, well done!

- Removed use of functools.partial in replaceWith, as this creates
an ambiguous signature for the generated parse action, which fails in 
PyPy. Reported by Evan Hubinger, thanks Evan!

- Added default behavior to QuotedString to convert embedded '\t', '\n',
etc. characters to their whitespace counterparts. Found during Q&A
exchange on SO with Maxim.

2.1.0

------------------------------
- Modified the internal _trim_arity method to distinguish between 
TypeError's raised while trying to determine parse action arity and
those raised within the parse action itself. This will clear up those
confusing "<lambda>() takes exactly 1 argument (0 given)" error 
messages when there is an actual TypeError in the body of the parse
action. Thanks to all who have raised this issue in the past, and
most recently to Michael Cohen, who sent in a proposed patch, and got
me to finally tackle this problem.

- Added compatibility for pickle protocols 2-4 when pickling ParseResults. 
In Python 2.x, protocol 0 was the default, and protocol 2 did not work.
In Python 3.x, protocol 3 is the default, so explicitly naming 
protocol 0 or 1 was required to pickle ParseResults. With this release,
all protocols 0-4 are supported. Thanks for reporting this on StackOverflow,
Arne Wolframm, and for providing a nice simple test case!

- Added optional 'stopOn' argument to ZeroOrMore and OneOrMore, to
simplify breaking on stop tokens that would match the repetition 
expression. 

It is a common problem to fail to look ahead when matching repetitive 
tokens if the sentinel at the end also matches the repetition
expression, as when parsing "BEGIN aaa bbb ccc END" with:

 "BEGIN" + OneOrMore(Word(alphas)) + "END"

Since "END" matches the repetition expression "Word(alphas)", it will
never get parsed as the terminating sentinel. Up until now, this has 
to be resolved by the user inserting their own negative lookahead:

 "BEGIN" + OneOrMore(~Literal("END") + Word(alphas)) + "END"

Using stopOn, they can more easily write:

 "BEGIN" + OneOrMore(Word(alphas), stopOn="END") + "END"

The stopOn argument can be a literal string or a pyparsing expression.
Inspired by a question by Lamakaha on StackOverflow (and many previous
questions with the same negative-lookahead resolution).

- Added expression names for many internal and builtin expressions, to 
reduce name and error message overhead during parsing.

- Converted helper lambdas to functions to refactor and add docstring
support.

- Fixed ParseResults.asDict() to correctly convert nested ParseResults
values to dicts.

- Cleaned up some examples, fixed typo in fourFn.py identified by
aristotle2600 on reddit.

- Removed keepOriginalText helper method, which was deprecated ages ago.
Superceded by originalTextFor.

- Same for the Upcase class, which was long ago deprecated and replaced
with the upcaseTokens method.

2.0.7

------------------------------
- Simplified string representation of Forward class, to avoid memory
and performance errors while building ParseException messages. Thanks,
Will McGugan, Andrea Censi, and Martijn Vermaat for the bug reports and
test code.

- Cleaned up additional issues from enhancing the error messages for
Or and MatchFirst, handling Unicode values in expressions. Fixes Unicode
encoding issues in Python 2, thanks to Evan Hubinger for the bug report.

- Fixed implementation of dir() for ParseResults - was leaving out all the
defined methods and just adding the custom results names.

- Fixed bug in ignore() that was introduced in pyparsing 1.5.3, that would
not accept a string literal as the ignore expression.

- Added new example parseTabularData.py to illustrate parsing of data 
formatted in columns, with detection of empty cells.

- Updated a number of examples to more current Python and pyparsing 
forms.

2.0.6

------------------------------
- Fixed a bug in Each when multiple Optional elements are present.
Thanks for reporting this, whereswalden on SO.

- Fixed another bug in Each, when Optional elements have results names
or parse actions, reported by Max Rothman - thank you, Max!

- Added optional parseAll argument to runTests, whether tests should
require the entire input string to be parsed or not (similar to 
parseAll argument to parseString). Plus a little neaten-up of the
output on Python 2 (no stray ()'s).

- Modified exception messages from MatchFirst and Or expressions. These
were formerly misleading as they would only give the first or longest
exception mismatch error message. Now the error message includes all
the alternatives that were possible matches. Originally proposed by 
a pyparsing user, but I've lost the email thread - finally figured out
a fairly clean way to do this.

- Fixed a bug in Or, when a parse action on an alternative raises an 
exception, other potentially matching alternatives were not always tried.
Reported by TheVeryOmni on the pyparsing wiki, thanks!

- Fixed a bug to dump() introduced in 2.0.4, where list values were shown
in duplicate.

2.0.5

-----------------------------
- (&$(&$(!!!!  Some "print" statements snuck into pyparsing v2.0.4,
breaking Python 3 compatibility! Fixed. Reported by jenshn, thanks!

2.0.4

-----------------------------
- Added ParserElement.addCondition, to simplify adding parse actions 
that act primarily as filters. If the given condition evaluates False,
pyparsing will raise a ParseException. The condition should be a method
with the same method signature as a parse action, but should return a
boolean. Suggested by Victor Porton, nice idea Victor, thanks!

- Slight mod to srange to accept unicode literals for the input string,
such as "[а-яА-Я]" instead of "[\u0430-\u044f\u0410-\u042f]". Thanks 
to Alexandr Suchkov for the patch!

- Enhanced implementation of replaceWith.

- Fixed enhanced ParseResults.dump() method when the results consists
only of an unnamed array of sub-structure results. Reported by Robin
Siebler, thanks for your patience and persistence, Robin!

- Fixed bug in fourFn.py example code, where pi and e were defined using
CaselessLiteral instead of CaselessKeyword. This was not a problem until
adding a new function 'exp', and the leading 'e' of 'exp' was accidentally
parsed as the mathematical constant 'e'. Nice catch, Tom Grydeland - thanks!

- Adopt new-fangled Python features, like decorators and ternary expressions, 
per suggestions from Williamzjc - thanks William! (Oh yeah, I'm not
supporting Python 2.3 with this code any more...) Plus, some additional
code fixes/cleanup - thanks again!

- Added ParserElement.runTests, a little test bench for quickly running
an expression against a list of sample input strings. Basically, I got 
tired of writing the same test code over and over, and finally added it
as a test point method on ParserElement.

- Added withClass helper method, a simplified version of withAttribute for
the common but annoying case when defining a filter on a div's class - 
made difficult because 'class' is a Python reserved word.

2.0.3

-----------------------------
- Fixed escaping behavior in QuotedString. Formerly, only quotation
marks (or characters designated as quotation marks in the QuotedString
constructor) would be escaped. Now all escaped characters will be
escaped, and the escaping backslashes will be removed.

- Fixed regression in ParseResults.pop() - pop() was pretty much
broken after I added *improvements* in 2.0.2. Reported by Iain
Shelvington, thanks Iain!

- Fixed bug in And class when initializing using a generator.

- Enhanced ParseResults.dump() method to list out nested ParseResults that
are unnamed arrays of sub-structures.

- Fixed UnboundLocalError under Python 3.4 in oneOf method, reported
on Sourceforge by aldanor, thanks!

- Fixed bug in ParseResults __init__ method, when returning non-ParseResults
types from parse actions that implement __eq__. Raised during discussion 
on the pyparsing wiki with cyrfer.

2.0.2

---------------------------
- Extended "expr(name)" shortcut (same as "expr.setResultsName(name)")
to accept "expr()" as a shortcut for "expr.copy()".

- Added "locatedExpr(expr)" helper, to decorate any returned tokens
with their location within the input string. Adds the results names
locn_start and locn_end to the output parse results.

- Added "pprint()" method to ParseResults, to simplify troubleshooting
and prettified output. Now instead of importing the pprint module
and then writing "pprint.pprint(result)", you can just write
"result.pprint()".  This method also accepts addtional positional and
keyword arguments (such as indent, width, etc.), which get passed 
through directly to the pprint method 
(see http://docs.python.org/2/library/pprint.htmlpprint.pprint).

- Removed deprecation warnings when using '<<' for Forward expression
assignment. '<<=' is still preferred, but '<<' will be retained
for cases whre '<<=' operator is not suitable (such as in defining
lambda expressions).

- Expanded argument compatibility for classes and functions that
take list arguments, to now accept generators as well.

- Extended list-like behavior of ParseResults, adding support for
append and extend. NOTE: if you have existing applications using
these names as results names, you will have to access them using
dict-style syntax: res["append"] and res["extend"]

- ParseResults emulates the change in list vs. iterator semantics for
methods like keys(), values(), and items(). Under Python 2.x, these
methods will return lists, under Python 3.x, these methods will 
return iterators.

- ParseResults now has a method haskeys() which returns True or False
depending on whether any results names have been defined. This simplifies
testing for the existence of results names under Python 3.x, which 
returns keys() as an iterator, not a list.

- ParseResults now supports both list and dict semantics for pop().
If passed no argument or an integer argument, it will use list semantics
and pop tokens from the list of parsed tokens. If passed a non-integer
argument (most likely a string), it will use dict semantics and 
pop the corresponding value from any defined results names. A
second default return value argument is supported, just as in 
dict.pop().

- Fixed bug in markInputline, thanks for reporting this, Matt Grant!

- Cleaned up my unit test environment, now runs with Python 2.6 and 
3.3.

2.0.1

--------------------------
- Removed use of "nonlocal" that prevented using this version of 
pyparsing with Python 2.6 and 2.7. This will make it easier to 
install for packages that depend on pyparsing, under Python 
versions 2.6 and later. Those using older versions of Python
will have to manually install pyparsing 1.5.7.

- Fixed implementation of <<= operator to return self; reported by
Luc J. Bourhis, with patch fix by Mathias Mamsch - thanks, Luc
and Mathias!

2.0.0

------------------------------
- Rather than release another combined Python 2.x/3.x release
I've decided to start a new major version that is only 
compatible with Python 3.x (and consequently Python 2.7 as
well due to backporting of key features). This version will
be the main development path from now on, with little follow-on
development on the 1.5.x path.

- Operator '<<' is now deprecated, in favor of operator '<<=' for
attaching parsing expressions to Forward() expressions. This is
being done to address precedence of operations problems with '<<'.
Operator '<<' will be removed in a future version of pyparsing.

1.5.7

-----------------------------
- NOTE: This is the last release of pyparsing that will try to 
maintain compatibility with Python versions < 2.6. The next
release of pyparsing will be version 2.0.0, using new Python
syntax that will not be compatible for Python version 2.5 or
older.

- An awesome new example is included in this release, submitted
by Luca DellOlio, for parsing ANTLR grammar definitions, nice
work Luca!

- Fixed implementation of ParseResults.__str__ to use Pythonic
''.join() instead of repeated string concatenation. This
purportedly has been a performance issue under PyPy.

- Fixed bug in ParseResults.__dir__ under Python 3, reported by
Thomas Kluyver, thank you Thomas!

- Added ParserElement.inlineLiteralsUsing static method, to 
override pyparsing's default behavior of converting string
literals to Literal instances, to use other classes (such
as Suppress or CaselessLiteral).

- Added new operator '<<=', which will eventually replace '<<' for 
storing the contents of a Forward(). '<<=' does not have the same
operator precedence problems that '<<' does.

- 'operatorPrecedence' is being renamed 'infixNotation' as a better
description of what this helper function creates. 'operatorPrecedence'
is deprecated, and will be dropped entirely in a future release.

- Added optional arguments lpar and rpar to operatorPrecedence, so that 
expressions that use it can override the default suppression of the
grouping characters.

- Added support for using single argument builtin functions as parse 
actions.  Now you can write 'expr.setParseAction(len)' and get back
the length of the list of matched tokens.  Supported builtins are:
sum, len, sorted, reversed, list, tuple, set, any, all, min, and max.
A script demonstrating this feature is included in the examples
directory.

- Improved linking in generated docs, proposed on the pyparsing wiki
by techtonik, thanks!

- Fixed a bug in the definition of 'alphas', which was based on the 
string.uppercase and string.lowercase "constants", which in fact 
*aren't* constant, but vary with locale settings. This could make 
parsers locale-sensitive in a subtle way. Thanks to Kef Schecter for
his diligence in following through on reporting and monitoring 
this bugfix!

- Fixed a bug in the Py3 version of pyparsing, during exception
handling with packrat parsing enabled, reported by Catherine 
Devlin - thanks Catherine!

- Fixed typo in ParseBaseException.__dir__, reported anonymously on 
the SourceForge bug tracker, thank you Pyparsing User With No Name.

- Fixed bug in srange when using '\x' hex character codes.

- Addeed optional 'intExpr' argument to countedArray, so that you 
can define your own expression that will evaluate to an integer,
to be used as the count for the following elements. Allows you 
to define a countedArray with the count given in hex, for example,
by defining intExpr as "Word(hexnums).setParseAction(int(t[0],16))".

1.5.6

----------------------------
- Cleanup of parse action normalizing code, to be more version-tolerant,
and robust in the face of future Python versions - much thanks to 
Raymond Hettinger for this rewrite!

- Removal of exception cacheing, addressing a memory leak condition
in Python 3. Thanks to Michael Droettboom and the Cape Town PUG for
their analysis and work on this problem!

- Fixed bug when using packrat parsing, where a previously parsed
expression would duplicate subsequent tokens - reported by Frankie 
Ribery on stackoverflow, thanks!

- Added 'ungroup' helper method, to address token grouping done
implicitly by And expressions, even if only one expression in the
And actually returns any text - also inspired by stackoverflow
discussion with Frankie Ribery!

- Fixed bug in srange, which accepted escaped hex characters of the 
form '\0x', but should be '\x'.  Both forms will be supported
for backwards compatibility.

- Enhancement to countedArray, accepting an optional expression to be
used for matching the leading integer count - proposed by Mathias on
the pyparsing mailing list, good idea!

- Added the Verilog parser to the provided set of examples, under the
MIT license.  While this frees up this parser for any use, if you find
yourself using it in a commercial purpose, please consider making a
charitable donation as described in the parser's header.

- Added the excludeChars argument to the Word class, to simplify defining
a word composed of all characters in a large range except for one or
two. Suggested by JesterEE on the pyparsing wiki.

- Added optional overlap parameter to scanString, to return overlapping
matches found in the source text.

- Updated oneOf internal regular expression generation, with improved
parse time performance.

- Slight performance improvement in transformString, removing empty
strings from the list of string fragments built while scanning the
source text, before calling ''.join.  Especially useful when using 
transformString to strip out selected text.

- Enhanced form of using the "expr('name')" style of results naming,
in lieu of calling setResultsName.  If name ends with an '*', then
this is equivalent to expr.setResultsName('name',listAllMatches=True).

- Fixed up internal list flattener to use iteration instead of recursion,
to avoid stack overflow when transforming large files.

- Added other new examples:
. protobuf parser - parses Google's protobuf language
. btpyparse - a BibTex parser contributed by Matthew Brett,
 with test suite test_bibparse.py (thanks, Matthew!)
. groupUsingListAllMatches.py - demo using trailing '*' for results 
 names

1.5.5

----------------------------

- Typo in Python3 version of pyparsing, "builtin" should be "builtins".
(sigh)

1.5.4

----------------------------

- Fixed __builtins__ and file references in Python 3 code, thanks to 
Greg Watson, saulspatz, sminos, and Mark Summerfield for reporting 
their Python 3 experiences.

- Added new example, apicheck.py, as a sample of scanning a Tcl-like
language for functions with incorrect number of arguments (difficult
to track down in Tcl languages).  This example uses some interesting
methods for capturing exceptions while scanning through source
code.

- Added new example deltaTime.py, that takes everyday time references
like "an hour from now", "2 days ago", "next Sunday at 2pm".

1.5.3

--------------------------

- ======= NOTE:  API CHANGE!!!!!!! ===============
With this release, and henceforward, the pyparsing module is 
imported as "pyparsing" on both Python 2.x and Python 3.x versions.

- Fixed up setup.py to auto-detect Python version and install the 
correct version of pyparsing - suggested by Alex Martelli, 
thanks, Alex! (and my apologies to all those who struggled with 
those spurious installation errors caused by my earlier 
fumblings!)

- Fixed bug on Python3 when using parseFile, getting bytes instead of
a str from the input file.

- Fixed subtle bug in originalTextFor, if followed by
significant whitespace (like a newline) - discovered by
Francis Vidal, thanks!

- Fixed very sneaky bug in Each, in which Optional elements were
not completely recognized as optional - found by Tal Weiss, thanks
for your patience.

- Fixed off-by-1 bug in line() method when the first line of the
input text was an empty line. Thanks to John Krukoff for submitting
a patch!

- Fixed bug in transformString if grammar contains Group expressions,
thanks to patch submitted by barnabas79, nice work!

- Fixed bug in originalTextFor in which trailing comments or otherwised
ignored text got slurped in with the matched expression.  Thanks to
michael_ramirez44 on the pyparsing wiki for reporting this just in
time to get into this release!

- Added better support for summing ParseResults, see the new example,
parseResultsSumExample.py.

- Added support for composing a Regex using a compiled RE object; 
thanks to my new colleague, Mike Thornton!

- In version 1.5.2, I changed the way exceptions are raised in order
to simplify the stacktraces reported during parsing.  An anonymous
user posted a bug report on SF that this behavior makes it difficult
to debug some complex parsers, or parsers nested within parsers. In
this release I've added a class attribute ParserElement.verbose_stacktrace,
with a default value of False. If you set this to True, pyparsing will 
report stacktraces using the pre-1.5.2 behavior.

- New examples: 

. pymicko.py, a MicroC compiler submitted by Zarko Zivanov. 
 (Note: this example is separately licensed under the GPLv3, 
 and requires Python 2.6 or higher.)  Thank you, Zarko!

. oc.py, a subset C parser, using the BNF from the 1996 Obfuscated C
 Contest.

. stateMachine2.py, a modified version of stateMachine.py submitted 
 by Matt Anderson, that is compatible with Python versions 2.7 and 
 above - thanks so much, Matt!
 
. select_parser.py, a parser for reading SQLite SELECT statements, 
 as specified at http://www.sqlite.org/lang_select.html; this goes
 into much more detail than the simple SQL parser included in pyparsing's
 source code
 
. excelExpr.py, a *simplistic* first-cut at a parser for Excel 
 expressions, which I originally posted on comp.lang.python in January, 
 2010; beware, this parser omits many common Excel cases (addition of
 numbers represented as strings, references to named ranges)
 
. cpp_enum_parser.py, a nice little parser posted my Mark Tolonen on
 comp.lang.python in August, 2009 (redistributed here with Mark's
 permission).  Thanks a bunch, Mark!
 
. partial_gene_match.py, a sample I posted to Stackoverflow.com,
 implementing a special variation on Literal that does "close" matching,
 up to a given number of allowed mismatches.  The application was to 
 find matching gene sequences, with allowance for one or two mismatches.
 
. tagCapture.py, a sample showing how to use a Forward placeholder to
 enforce matching of text parsed in a previous expression.

. matchPreviousDemo.py, simple demo showing how the matchPreviousLiteral
 helper method is used to match a previously parsed token.

1.5.2

------------------------------
- Added pyparsing_py3.py module, so that Python 3 users can use
pyparsing by changing their pyparsing import statement to:

   import pyparsing_py3

Thanks for help from Patrick Laban and his friend Geremy 
Condra on the pyparsing wiki.

- Removed __slots__ declaration on ParseBaseException, for
compatibility with IronPython 2.0.1.  Raised by David
Lawler on the pyparsing wiki, thanks David!

- Fixed bug in SkipTo/failOn handling - caught by eagle eye 
cpennington on the pyparsing wiki!

- Fixed second bug in SkipTo when using the ignore constructor
argument, reported by Catherine Devlin, thanks!

- Fixed obscure bug reported by Eike Welk when using a class
as a ParseAction with an errant __getitem__ method.

- Simplified exception stack traces when reporting parse 
exceptions back to caller of parseString or parseFile - thanks
to a tip from Peter Otten on comp.lang.python.

- Changed behavior of scanString to avoid infinitely looping on
expressions that match zero-length strings.  Prompted by a
question posted by ellisonbg on the wiki.

- Enhanced classes that take a list of expressions (And, Or, 
MatchFirst, and Each) to accept generator expressions also.
This can be useful when generating lists of alternative
expressions, as in this case, where the user wanted to match
any repetitions of '+', '*', '', or '.', but not mixtures
of them (that is, match '+++', but not '+-+'):

   codes = "+*."
   format = MatchFirst(Word(c) for c in codes)
   
Based on a problem posed by Denis Spir on the Python tutor
list.

- Added new example eval_arith.py, which extends the example
simpleArith.py to actually evaluate the parsed expressions.

1.5.1

-------------------------------
- Added new helper method originalTextFor, to replace the use of
the current keepOriginalText parse action.  Now instead of 
using the parse action, as in:

   fullName = Word(alphas) + Word(alphas)
   fullName.setParseAction(keepOriginalText)
   
(in this example, we used keepOriginalText to restore any white
space that may have been skipped between the first and last
names)
You can now write:

   fullName = originalTextFor(Word(alphas) + Word(alphas))
   
The implementation of originalTextFor is simpler and faster than
keepOriginalText, and does not depend on using the inspect or
imp modules.

- Added optional parseAll argument to parseFile, to be consistent
with parseAll argument to parseString.  Posted by pboucher on the
pyparsing wiki, thanks!

- Added failOn argument to SkipTo, so that grammars can define
literal strings or pyparsing expressions which, if found in the
skipped text, will cause SkipTo to fail.  Useful to prevent 
SkipTo from reading past terminating expression.  Instigated by
question posed by Aki Niimura on the pyparsing wiki.

- Fixed bug in nestedExpr if multi-character expressions are given
for nesting delimiters.  Patch provided by new pyparsing user,
Hans-Martin Gaudecker - thanks, H-M!

- Removed dependency on xml.sax.saxutils.escape, and included
internal implementation instead - proposed by Mike Droettboom on
the pyparsing mailing list, thanks Mike!  Also fixed erroneous
mapping in replaceHTMLEntity of " to ', now correctly maps
to ".  (Also added support for mapping ' to '.)

- Fixed typo in ParseResults.insert, found by Alejandro Dubrovsky,
good catch!

- Added __dir__() methods to ParseBaseException and ParseResults,
to support new dir() behavior in Py2.6 and Py3.0.  If dir() is
called on a ParseResults object, the returned list will include
the base set of attribute names, plus any results names that are
defined.

- Fixed bug in ParseResults.asXML(), in which the first named
item within a ParseResults gets reported with an <ITEM> tag 
instead of with the correct results name.

- Fixed bug in '-' error stop, when '-' operator is used inside a 
Combine expression.

- Reverted generator expression to use list comprehension, for 
better compatibility with old versions of Python.  Reported by
jester/artixdesign on the SourceForge pyparsing discussion list.

- Fixed bug in parseString(parseAll=True), when the input string
ends with a comment or whitespace.

- Fixed bug in LineStart and LineEnd that did not recognize any
special whitespace chars defined using ParserElement.setDefault-
WhitespaceChars, found while debugging an issue for Marek Kubica,
thanks for the new test case, Marek!

- Made Forward class more tolerant of subclassing.

1.5.0

--------------------------
This version of pyparsing includes work on two long-standing
FAQ's: support for forcing parsing of the complete input string
(without having to explicitly append StringEnd() to the grammar),
and a method to improve the mechanism of detecting where syntax
errors occur in an input string with various optional and
alternative paths.  This release also includes a helper method
to simplify definition of indentation-based grammars.  With
these changes (and the past few minor updates), I thought it was
finally time to bump the minor rev number on pyparsing - so
1.5.0 is now available!  Read on...

- AT LAST!!!  You can now call parseString and have it raise
an exception if the expression does not parse the entire
input string.  This has been an FAQ for a LONG time.

The parseString method now includes an optional parseAll
argument (default=False).  If parseAll is set to True, then
the given parse expression must parse the entire input
string.  (This is equivalent to adding StringEnd() to the
end of the expression.)  The default value is False to
retain backward compatibility.

Inspired by MANY requests over the years, most recently by
ecir-hana on the pyparsing wiki!

- Added new operator '-' for composing grammar sequences. '-'
behaves just like '+' in creating And expressions, but '-'
is used to mark grammar structures that should stop parsing
immediately and report a syntax error, rather than just
backtracking to the last successful parse and trying another
alternative.  For instance, running the following code:

 port_definition = Keyword("port") + '=' + Word(nums)
 entity_definition = Keyword("entity") + "{" +
     Optional(port_definition) + "}"

 entity_definition.parseString("entity { port 100 }")

pyparsing fails to detect the missing '=' in the port definition.
But, since this expression is optional, pyparsing then proceeds
to try to match the closing '}' of the entity_definition.  Not
finding it, pyparsing reports that there was no '}' after the '{'
character.  Instead, we would like pyparsing to parse the 'port'
keyword, and if not followed by an equals sign and an integer,
to signal this as a syntax error.

This can now be done simply by changing the port_definition to:

 port_definition = Keyword("port") - '=' + Word(nums)

Now after successfully parsing 'port', pyparsing must also find
an equals sign and an integer, or it will raise a fatal syntax
exception.

By judicious insertion of '-' operators, a pyparsing developer
can have their grammar report much more informative syntax error
messages.

Patches and suggestions proposed by several contributors on
the pyparsing mailing list and wiki - special thanks to
Eike Welk and Thomas/Poldy on the pyparsing wiki!

- Added indentedBlock helper method, to encapsulate the parse
actions and indentation stack management needed to keep track of
indentation levels.  Use indentedBlock to define grammars for
indentation-based grouping grammars, like Python's.

indentedBlock takes up to 3 parameters:
 - blockStatementExpr - expression defining syntax of statement
     that is repeated within the indented block
 - indentStack - list created by caller to manage indentation
     stack (multiple indentedBlock expressions
     within a single grammar should share a common indentStack)
 - indent - boolean indicating whether block must be indented
     beyond the the current level; set to False for block of
     left-most statements (default=True)

A valid block must contain at least one indented statement.

- Fixed bug in nestedExpr in which ignored expressions needed
to be set off with whitespace.  Reported by Stefaan Himpe,
nice catch!

- Expanded multiplication of an expression by a tuple, to
accept tuple values of None:
. expr*(n,None) or expr*(n,) is equivalent
 to expr*n + ZeroOrMore(expr)
 (read as "at least n instances of expr")
. expr*(None,n) is equivalent to expr*(0,n)
 (read as "0 to n instances of expr")
. expr*(None,None) is equivalent to ZeroOrMore(expr)
. expr*(1,None) is equivalent to OneOrMore(expr)

Note that expr*(None,n) does not raise an exception if
more than n exprs exist in the input stream; that is,
expr*(None,n) does not enforce a maximum number of expr
occurrences.  If this behavior is desired, then write
expr*(None,n) + ~expr

- Added None as a possible operator for operatorPrecedence.
None signifies "no operator", as in multiplying m times x
in "y=mx+b".

- Fixed bug in Each, reported by Michael Ramirez, in which the
order of terms in the Each affected the parsing of the results.
Problem was due to premature grouping of the expressions in
the overall Each during grammar construction, before the
complete Each was defined.  Thanks, Michael!

- Also fixed bug in Each in which Optional's with default values
were not getting the defaults added to the results of the
overall Each expression.

- Fixed a bug in Optional in which results names were not
assigned if a def

Copy link
Contributor

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me Mr Bot Man!

@cooperlees cooperlees merged commit 37451e9 into master Nov 20, 2018
@cooperlees cooperlees deleted the pyup-initial-update branch November 20, 2018 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants