public final class TokensOutput extends Object
The generated Java class is the base class for all
token instances. It contains a static inner enum
class Kind
listing all the various token
kinds (the enum constants follow the token names).
Each token without value is represented by
a singleton member of the abstract type,
whereas each valued token is represented by a
specific subclass, with a value
field
and a static factory to be used in the lexer's
semantic actions.
output(Writer, String, Config, int, List)
Modifier | Constructor and Description |
---|---|
protected |
TokensOutput(String className,
Config config,
List<TokenDecl> tokenDecls,
CodeBuilder buf) |
Modifier and Type | Method and Description |
---|---|
protected void |
genTokens() |
static void |
output(Writer writer,
String className,
Config config,
int level,
List<TokenDecl> tokenDecls)
Outputs to
writer the definition of a token class
for the tokens described in tokenDecls . |
protected TokensOutput(String className, Config config, List<TokenDecl> tokenDecls, CodeBuilder buf)
protected void genTokens()
public static void output(Writer writer, String className, Config config, int level, List<TokenDecl> tokenDecls) throws IOException
writer
the definition of a token class
for the tokens described in tokenDecls
. The token
class name is given by className
and code is emitted
starting at the given indentation level
.writer
- className
- config
- level
- tokenDecls
- IOException