public final class GrammarOutput extends Object
Each public non-terminal in the grammar description leads to a public entry point in the generated grammar.
The generated Java class also contains classes to represent the various tokens declared in the grammar.
TokensOutput
,
output(Writer, String, Config, Grammar, Grammars.PredictionTable)
Modifier and Type | Method and Description |
---|---|
protected void |
genParser(String name) |
static SourceMapping |
output(Writer writer,
String className,
Config config,
Grammar grammar,
Grammars.PredictionTable predict)
Outputs to
writer the definition of a top-down
parser for the given grammar , provided the prediction table
predict has no conflicts. |
static SourceMapping |
outputDefault(Writer writer,
String className,
Grammar grammar,
Grammars.PredictionTable predict)
Same as
output(Writer, String, Config, Grammar, Grammars.PredictionTable)
with the default configuration Config.DEFAULT . |
protected void genParser(String name)
public static SourceMapping output(Writer writer, String className, Config config, Grammar grammar, Grammars.PredictionTable predict) throws IOException
writer
the definition of a top-down
parser for the given grammar
, provided the prediction table
predict
has no conflicts. The name of the
generated Java class is className
and specific
configuration for the code generation is passed via config
.
Returns the source mappings computed when emitting
the code. Positions in generated code are computed
assuming that writer
is fresh, unless a
CountingWriter
is passed in which case its
current character count is taken into account.
writer
- className
- config
- grammar
- predict
- IOException
public static SourceMapping outputDefault(Writer writer, String className, Grammar grammar, Grammars.PredictionTable predict) throws IOException
output(Writer, String, Config, Grammar, Grammars.PredictionTable)
with the default configuration Config.DEFAULT
.writer
- className
- grammar
- predict
- IOException