Modgrammar 0.9 released!

10 views
Skip to first unread message

Alex Stewart

unread,
Jan 3, 2013, 9:32:22 PM1/3/13
to modgr...@googlegroups.com
Hear Ye, Hear Ye!

Modgrammar 0.9 has now been released!

New in this release:
  • Changed get/get_all/find/find_all to work with tags in addition to class names
  • Changed array-index notation on result objects to support tag/class lookup in addition to index numbers.
  • Added a "longest=True" option for WORD
  • Added grammar_whitespace_mode setting which can be set to "explicit", "optional", or "required"
  • Added infix_precedence example to the documentation
  • Added WS_DEFAULT and WS_NOEOL standard regexps (for use with grammar_whitespace)
  • Made ParseError "found text" chooser a bit smarter
Issues fixed in this release:
  • Fixed Issue 8: Grammars with NOT_FOLLOWED_BY don't correctly return a parse error before terminating the generator
  • Fixed Issue 10: EXCEPT incorrectly matches on prefixes of the result
ATTENTION: API CHANGES AND WARNINGS

Release 0.9 does not introduce any backwards-incompatible changes, but there are a number of impending changes which will be happening with 0.10.  To prepare for this, a number of things are now deprecated in 0.9.  It is strongly recommended that everyone upgrade to 0.9 and test their grammars using the "-Wd" Python interpreter option to display deprecation warnings.  This will tell you about changes you will need to make in order to be compatible with 0.10 when it's released.

The following ways of doing things will be changing and you will likely need to make changes to your code prior to the 0.10 release:
  • parse_string has been renamed to parse_text instead.  With 0.10, the behavior of parse_string will be changing in incompatible ways, so it is strongly recommended that you change your code to use parse_text instead (in most cases this should just be a quick search-and-replace sort of thing)
  • Using "grammar_whitespace = True" or "grammar_whitespace = False" is now deprecated.  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 will be changing to "explicit" instead of "optional" in 0.10.  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 0.10, the meaning of the SPACE builtin grammar will change 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 will be going away 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.
Sorry about the large number of tweaks required, but I really do think a lot of these changes will make modgrammar more consistent and easier to use in the long run.  The upcoming 0.10 release should be pretty much the last set of major API changes which will be happening prior to 1.0, I think, which means we're also closing in on a full 1.0 (non beta) release of Modgrammar in the forseeable future!

Anyway, have fun and please let me know if anybody runs into any problems with the new release..

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