CodeReaderListener, since it is necessary to add the generated tokens
to the lexer.ListenerSupplier to the factory
Since a ListeningParseRunner is used, it means you can add
further parsing listeners when the file is parsed; for instance, you
may want to add a TracingListener to debug the parsing
process.InputBuffer over a CodeReader
Unfortunately, this is required.CodeReader and Lexer
This listener will handle both the consumption of characters from the code
reader, and adding tokens to the lexer.Parser from this factoryLexerfulGrammarBuilder
This interface is used by GrappaSslrFactory to prepare a grammar
for a Sonar Parser.LexerGrammar 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 GrappaSslrFactory.getParser() method to build a parser, which you
will then use in an AstScanner.GrappaSslrFactory
This class is not directly instantiable; use GrappaSslrFactory.withParserClass(Class) to create a new instance.injectInto
exists in the class you pass as an argument to the constructor, and this
method must takes LexerfulGrammarBuilder as an argument.ParseRunnerListener given a CodeReader and a Lexer as arguments
This allows you to register listeners to a GrappaChannel.TokenType and always returns true.GrammarInjector is a
functional interface, you can use method references here.Function
Typically, if your parser class is MyParser and the rule
you want as a main rule is called myRule, the argument to
this method will be MyParser::myRule.