@ParametersAreNonnullByDefault
public final class GrappaSslrFactory
extends java.lang.Object
Grammar and
a Grappa parser
The syntax to create a factory is:
final GrappaSslrFactory factory = GrappaSslrFactory
.withParserClass(MyParser.class)
.withInjector(MyGrammar::myMethod)
.withEntryPoint(someGrammarRuleKey)
.build();
You then use the getParser() method to build a parser, which you
will then use in an AstScanner.
Unless otherwise noted, all methods of this class do not accept null
arguments; if a null argument is passed, a NullPointerException will
be thrown.
| Modifier and Type | Class and Description |
|---|---|
static class |
GrappaSslrFactory.Builder<P extends SonarParserBase>
A builder for a
GrappaSslrFactory
This class is not directly instantiable; use withParserClass(Class) to create a new instance. |
| Modifier and Type | Method and Description |
|---|---|
com.sonar.sslr.impl.Parser<com.sonar.sslr.api.Grammar> |
getParser()
Get a Sonar
Parser from this factory |
static <P extends SonarParserBase> |
withParserClass(java.lang.Class<P> parserClass)
Initialize a builder for a new factory
|
public static <P extends SonarParserBase> GrappaSslrFactory.Builder<P> withParserClass(java.lang.Class<P> parserClass)
P - type of the parserparserClass - the parser classpublic com.sonar.sslr.impl.Parser<com.sonar.sslr.api.Grammar> getParser()
Parser from this factory