Modgrammar 0.10 released!

53 views
Skip to first unread message

Alex Stewart

unread,
Feb 15, 2013, 5:28:13 PM2/15/13
to modgr...@googlegroups.com
Hear Ye, Hear Ye!

Modgrammar 0.10 has now been released!

New in this release:
  • Added matchtype='complete' option to the parser (this is mainly to support the new parse_string behavior, but may be useful separately as well)
  • Added "encoding" parameter for parse_file()
  • Added grammar_noteworthy attribute (which allows you to tell the parser that certain grammars aren't useful to include in error messages)
  • A few misc doc cleanups/format changes
Issues fixed in this release:
  • Issue 11: Change parse_string to assume self-contained input
  • Issue 15: Change grammar_whitespace_mode to be 'explicit' by default
  • Issue 16: Change SPACE to not match newlines
  • Issue 19: Makesure all whitespace/EOL handling is unicode-aware
  • Issue 21: Add the ability to produce debug output
  • Issue 26: Add the ability to use regexp character class escapes in WORDs
  • Issue 31: repr() breaks for abstract classes
ATTENTION: API CHANGES AND WARNINGS

As mentioned previously, there were a number of things deprecated in 0.9 which were going to be changed or removed in 0.10, and these changes have now occurred.  What this means is that if you are upgrading from an earlier version, beware of API changes!

If your code is currently working with 0.9 (or 0.9.1), it is strongly recommended that before you upgrade to 0.10, you should run all your code on 0.9.x using the "-Wd" Python command-line switch and look for DeprecationWarning messages.  This will tell you if you are using features which will be changing out from under you with 0.10.  If your code runs without any complaints under 0.9 with -Wd, then it should continue to run just fine under 0.10.

If you are currently using a version prior to 0.9, it is strongly recommended that you should first upgrade to 0.9.1, and then test your code with "-Wd" (as above).  Only after you have fixed all the DeprecationWarnings (there will be some!) should you attempt to upgrade to 0.10 or beyond.  Due to the nature of some of the changes, code written for 0.8 or earlier is pretty much guaranteed not to work under 0.10 without changes.

The following ways of doing things have changed with the 0.10 release (all of these were deprecated as of 0.9):
  • The old parse_string has been renamed to parse_text instead.  With 0.10, the behavior of parse_string does something significantly different (it will assume the provided text is self-contained (i.e. "reset=True, eof=True"), and will raise an error if the text is not matched completely (i.e. has a remainder).
  • Using "grammar_whitespace = True" or "grammar_whitespace = False" is no longer supported.  grammar_whitespace should always be a regular expression.  To change whether whitespace is handled specially or not, you should use "grammar_whitespace_mode" instead.  (Basically, if you currently set "grammar_whitespace = True", you should change that to read "grammar_whitespace_mode = 'optional'".  If you currently set "grammar_whitespace = False", you should change it to "grammar_whitespace_mode = 'explicit'")
  • The default whitespace mode is now "explicit" instead of "optional".  If you do not currently set grammar_whitespace (now grammar_whitespace_mode) explicitly in your modules, your grammars may suddenly handle whitespace differently with 0.10.  It is strongly recommended you set "grammar_whitespace_mode" explicitly at the module level in any case.
  • In 0.10, the meaning of the SPACE builtin grammar has changed to mean all non-newline space characters (instead of all whitespace characters including newlines).  If you currently use SPACE and want to retain the same behavior, you should change all occurrences of "SPACE" to "WHITESPACE" instead.
  • find_tag and find_tag_all have been removed in 0.10.  This functionality is now available through the find and find_all methods instead.  You should replace all references to find_tag[_all] with find[_all] instead.
Additionally, the following behavior has been deprecated in 0.10 and will be changing with the next release (which will be either 1.0 or 0.11, depending on how things work out):
  • The "longest" argument to WORD() will be changing to "fullmatch" instead.  Using WORD(longest=True) is now deprecated in favor of using WORD(fullmatch=True) instead.
  • The elem_init method has been renamed to grammar_elem_init to be more consistent with other grammar class functions.  As of 0.10, using elem_init still works but is deprecated.  It will be going away in a future release.
With luck, I'm aiming for the next significant release of Modgrammar to be an official 1.0 (production-stable) release!  If there's any issues or requests anybody wants to get in before that, please let me know.

--Alex
Reply all
Reply to author
Forward
0 new messages