You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error messages are generated by the parse runners themselves; the rules, by themselves, have no way of emitting error messages of their own (problem highlighted in issue Allow custom parse error messages #7).
Nulls! Unless you call the appropriate ParseRunner, a ParsingResult will have most of its fields set to null.
Parsing trees; there is no reason for @BuildParseTree to exist at all; you should be able to generate a parse tree for any parser without having to annotate it.
There are other problems as well.
Proposed new API
The new API would look like this:
// default factoryfinalParseRunnerFactoryfactory = ParseRunnerFactory.defaultFactory();
// customizedfinalParseRunnerFactoryfactory = ParseRunnerFactory.newBuilder()
.noValueStack() // don't create a value stack
.createParseTree() // create a parse tree
.build(); // create the factory// "parser" is a generated parser instance// unlike the current API, parse runners created would be reusablefinalParseRunner<X> runner = factory.create(parser.rule());
The text was updated successfully, but these errors were encountered:
Such an API is needed. We will start by highlighting the problems with the current API (and there are many!) and then propose a new one.
Problems with the current API
ParsingResult
has fields which are allpublic
, with no accessors! This will change starting with 1.0.0-beta.10;ParseRunner
, aParsingResult
will have most of its fields set tonull
.@BuildParseTree
to exist at all; you should be able to generate a parse tree for any parser without having to annotate it.There are other problems as well.
Proposed new API
The new API would look like this:
The text was updated successfully, but these errors were encountered: