… for the other fixes.
This will enable me to work on improving error trapping without risking making performance crappy. (And really, I *avoided* coming up with a benchmarking framework--yay!)
* Now, rather than returning None, parse() and match() raise ParseError if they don't succeed. ParseError gives you a nice, human-readable unicode representation as well as some attributes that let you construct your own presentation. * Grammar construction now raises ParseError rather than BadGrammar if it can't parse your rules. * Make UndefinedLabel subclass StrAndRepr so __str__ returns the right type. * Remove some things from the future-directions sections of the readme that are done or just stupid. * Add Grammar to top-level package namespace. I'm tired of typing ".grammar" at the REPL.
…her sorts of horrific behavior. Fix #19. Surprisingly, it cleans up the RuleVisitor quite a bit. * Had to add a couple more rules, like negative lookahead, to the bootstrapping grammar. * Separated the notions of labels and references, which solves the problem of figuring out where a new rule starts and, as a bonus, saves some backtracking in the visitor.
This fixes the last of the tests failing in Python 3. Tox is happy now.
2to3 doesn't parse strings.
This fixes another failing test.
This fixes several failing tests.
This reveals that Python 3 support is broken. Whee.
…lved rule. Fix #22. Also, I apparently forgot to push the tests in the previous commit. Still not terrifically confident in this, but I think it's demonstrably than the original. However, it's one of those things that's so complicated that it has no obvious bugs, not so simple that it obviously has no bugs. Simplify.
You couldn't import * from it before, because not all the mentioned symbols were defined.
The `except Exception as e` form is preferred over the older `except Exception, e` form, as it works in both Python 2 and 3.
Rename "rhs" to "expression", since we now use it within the definition of parentheticals, which don't necessarily contain a whole right-hand side.
This helps when writing tests. Also, since Node no longer uses half of it, divorce Node from StrAndRepr, which I'm starting to hate. Really, I just hate Python 2's half-baked unicode integration.