ANN: pyparsing-1.3.1 released

Paul McGuire ptmcg at
Mon Jun 13 05:55:30 CEST 2005

Pyparsing is a pure-Python class library for quickly and easily
constructing recursive-descent parsers.  Pyparsing takes a
"building-block" approach to parser construction, as opposed to code
generation methods (such as lex/yacc) or pattern definition strings
(such as regular expressions).

Version 1.3.1 includes some minor enhancements, plus some performance
improvements that can really improve performance for grammars that use
the Combine class (often used in specifying floating point numbers).

The 1.3.1 change notes are listed below.  Download pyparsing at

-- Paul McGuire

Version 1.3.1 - June 12, 2005
- Added markInputline() method to ParseException, to display the input
  text line location of the parsing exception. (Thanks, Stefan Behnel!)

- Added setDefaultKeywordChars(), so that Keyword definitions using a
  custom keyword character set do not all need to add the keywordChars
  constructor argument (similar to setDefaultWhitespaceChars()).
  by rzhanka on the SourceForge pyparsing forum.)

- Simplified passing debug actions to setDebugAction().  You can now
  pass 'None' for a debug action if you want to take the default
  debug behavior.  To suppress a particular debug action, you can pass
  the pyparsing method nullDebugAction.

- Refactored parse exception classes, moved all behavior to
  ParseBaseException, and the former ParseException is now a subclass
  ParseBaseException.  Added a second subclass, ParseFatalException, as
  a subclass of ParseBaseException.  User-defined parse actions can
  ParseFatalException if a data inconsistency is detected (such as a
  begin-tag/end-tag mismatch), and this will stop all parsing
  (Inspired by e-mail thread with Michele Petrazzo - thanks, Michelle!)

- Added helper methods makeXMLTags and makeHTMLTags, that simplify the
  definition of XML or HTML tag parse expressions for a given tagname.

  Both functions return a pair of parse expressions, one for the
  tag (that is, '<tagname>') and one for the closing tag
  The opening tagame also recognizes any attribute definitions that
  been included in the opening tag, as well as an empty tag (one with a
  trailing '/', as in '<BODY/>' which is equivalent to
  makeXMLTags uses stricter XML syntax for attributes, requiring that
  be enclosed in double quote characters - makeHTMLTags is more
  and accepts single-quoted strings or any contiguous string of
  up to the next whitespace character or '>' character.  Attributes can
  be retrieved as dictionary or attribute values of the returned
  from the opening tag.

- Added example, a refinement on that adds
  an interactive session and support for variables.  (Thanks, Steven

- Added performance improvement, up to 20% reduction!  (Found while
  with Wolfgang Borgert on performance tuning of his TTCN3 parser.)

- And another performance improvement, up to 25%, when using
  (Found while working with Henrik Westlund on his C header file
- Updated UML diagrams to reflect latest class/method changes.

More information about the Python-announce-list mailing list