ANN: pyparsing 1.5.2 released!


Paul McGuire

Well, it has been about 6 months since the release of pyparsing 1.5.1,
and there have been no new functional enhancements to pyparsing. I
this as a further sign that pyparsing is reaching a development/

With the help of the pyparsing community, there are some
upgrades, and few bug fixes. The major news is compatibility with
Python 3 and IronPython 2.0.1. Here is the high-level summary of
new in pyparsing 1.5.2:

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

- Added 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.

- 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

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

Download pyparsing 1.5.2 at
The pyparsing Wiki is at

-- Paul

Pyparsing is a pure-Python class library for quickly developing
recursive-descent parsers. Parser grammars are assembled directly in
the calling Python code, using classes such as Literal, Word,
OneOrMore, Optional, etc., combined with operators '+', '|', and '^'
for And, MatchFirst, and Or. No separate code-generation or external
files are required. Pyparsing can be used in many cases in place of
regular expressions, with shorter learning curve and greater
readability and maintainability. Pyparsing comes with a number of
parsing examples, including:
- "Hello, World!" (English, Korean, Greek, and Spanish(new))
- chemical formulas
- configuration file parser
- web page URL extractor
- 5-function arithmetic expression parser
- subset of CORBA IDL
- chess portable game notation
- simple SQL parser
- Mozilla calendar file parser
- EBNF parser/compiler
- Python value string parser (lists, dicts, tuples, with nesting)
(safe alternative to eval)
- HTML tag stripper
- S-expression parser
- macro substitution preprocessor

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Latest member

Latest Threads