I'm happy to announce that 1) pyparsing has been pretty stable for the past 6 months (the last formal release 1.2.2 was last September), and 2) I finally found the time to put together a new release, version 1.3. This release also includes all of the enhancements I posted to CVS last fall as version 1.2.3, but never formally released.
Here are some of the major new features and bug-fixes:
Version 1.3 - March, 2005 ---------------------------------- - Added new Keyword class, as a special form of Literal. Keywords must be followed by whitespace or other non-keyword characters, to distinguish them from variables or other identifiers that just happen to start with the same characters as a keyword. For instance, the input string containing "ifOnlyIfOnly" will match a Literal("if") at the beginning and in the middle, but will fail to match a Keyword("if"). Keyword("if") will match only strings such as "if only" or "if(only)". (Berteun Damman requested this on comp.lang.python - great idea!)
- Added setWhitespaceChars() method to override the characters to be skipped as whitespace before matching a particular ParseElement. Also added the class-level method setDefaultWhitespaceChars(), to allow users to override the default set of whitespace characters (space, tab, newline, and return) for all subsequently defined ParseElements. (Inspired by Klaas Hofstra's inquiry on the Sourceforge pyparsing forum.)
- Added helper parse actions to support some very common parse action use cases: .. replaceWith(replStr) - replaces the matching tokens with the provided replStr replacement string; especially useful with transformString() .. removeQuotes - removes first and last character from string enclosed in quotes (note - NOT the same as the string strip() method, as only a single quote character is removed at each end)
- Added copy() method to ParseElement, to make it easier to define different parse actions for the same basic parse expression. (Note, copy is implicitly called when using setResultsName().)
(The following changes were posted to CVS as Version 1.2.3 - October-December, 2004)
- Added support for Unicode strings in creating grammar definitions. (Big thanks to Gavin Panella!)
- Added constant alphas8bit to include the following 8-bit characters: ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ
- Added srange() function to simplify definition of Word elements, using regexp-like '[A-Za-z0-9]' syntax. This also simplifies referencing common 8-bit characters.
- Fixed bug in Dict when a single element Dict was embedded within another Dict. (Thanks Andy Yates for catching this one!)
- Added 'formatted' argument to ParseResults.asXML(). If set to False, suppresses insertion of whitespace for pretty-print formatting. Default equals True for backward compatibility.
- Added setDebugActions() function to ParserElement, to allow user-defined debugging actions.
- Added support for escaped quotes (either in ', ", or doubled quote form) to the predefined expressions for quoted strings. (Thanks, Ero Carrera!)
- Minor performance improvement (~5%) converting "char in string" tests to "char in dict". (Suggested by Gavin Panella, cool idea!)
You can download pyparsing at http://pyparsing.sourceforge.net.
Enjoy! -- Paul McGuire