A new version of grappa is out and it brings with it a feature which I have wanted for as long as I have known parboiled...
You don't need the stack, Vars or Actions anymore to pull out your parser's productions! Thanks to Guava once again and its EventBus.
You can now do things like these with Grappa:
public final class StringListener<V>
private final StringBuilder sb = new StringBuilder();
public void capture(@Untainted @Nonnull final BasicMatchEvent<V> event)
public String getContent()
final MyParser parser = Parboiled.createParser(MyParser.class);
final StringListener<Object> listener = new StringListener<Object>();
And your `StringListener` instance will contain the match!
More uses of EventBus are envisioned in the future; in particular, producing debugging output, whether that be rule tracing, parse tree building etc... Possibilities are vast. And for the latter, there is also TreeTraverser (from Guava, again!) which will be an immense help.
At this stage, I am going to take full advantage of this API to write example parsers to show what you can do ;)