Package org.javacc.jjdoc
Class TextGenerator
- java.lang.Object
-
- org.javacc.jjdoc.TextGenerator
-
- All Implemented Interfaces:
Generator
- Direct Known Subclasses:
HTMLGenerator,XTextGenerator
public class TextGenerator extends java.lang.Object implements Generator
Output BNF in text format.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.PrintWriterostr
-
Constructor Summary
Constructors Constructor Description TextGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcppcode(CppCodeProduction cp)Output comment from a production.protected java.io.PrintWritercreate_output_stream()Create an output stream for the generated Jack code.voiddebug(java.lang.String message)Log debug messages.voiddocumentEnd()Output document footer.voiddocumentStart()Output document header.voiderror(java.lang.String message)Log error messages.voidexpansionEnd(Expansion e, boolean first)Output end of Expansion.voidexpansionStart(Expansion e, boolean first)Output start of an Expansion.voidhandleTokenProduction(TokenProduction tp)voidinfo(java.lang.String message)Log informational messages.voidjavacode(JavaCodeProduction jp)Output comment from a production.voidnonTerminalEnd(NonTerminal nt)Output end of non-terminal.voidnonterminalsEnd()Output end of non-terminal.voidnonterminalsStart()Output start of non-terminal.voidnonTerminalStart(NonTerminal nt)Output start of non-terminal.voidprint(java.lang.String s)Output String.voidproductionEnd(NormalProduction np)Output end of a normal production.voidproductionStart(NormalProduction np)Output start of a normal production.voidreEnd(RegularExpression r)Output end of regular expression.voidreStart(RegularExpression r)Output start of regular expression.voidspecialTokens(java.lang.String s)Output Special Tokens.voidtext(java.lang.String s)Output string with entity substitution for brackets and ampersands.voidtokensEnd()Output end of tokens.voidtokensStart()Output start of tokens.voidwarn(java.lang.String message)Log warning messages.
-
-
-
Method Detail
-
text
public void text(java.lang.String s)
Output string with entity substitution for brackets and ampersands.- Specified by:
textin interfaceGenerator- Parameters:
s- the String to output- See Also:
Generator.text(java.lang.String)
-
print
public void print(java.lang.String s)
Output String.- Specified by:
printin interfaceGenerator- Parameters:
s- String to output- See Also:
Generator.print(java.lang.String)
-
documentStart
public void documentStart()
Output document header.- Specified by:
documentStartin interfaceGenerator- See Also:
Generator.documentStart()
-
documentEnd
public void documentEnd()
Output document footer.- Specified by:
documentEndin interfaceGenerator- See Also:
Generator.documentEnd()
-
specialTokens
public void specialTokens(java.lang.String s)
Output Special Tokens.- Specified by:
specialTokensin interfaceGenerator- Parameters:
s- tokens to output- See Also:
Generator.specialTokens(java.lang.String)
-
nonterminalsStart
public void nonterminalsStart()
Output start of non-terminal.- Specified by:
nonterminalsStartin interfaceGenerator- See Also:
Generator.nonterminalsStart()
-
nonterminalsEnd
public void nonterminalsEnd()
Output end of non-terminal.- Specified by:
nonterminalsEndin interfaceGenerator- See Also:
Generator.nonterminalsEnd()
-
tokensStart
public void tokensStart()
Output start of tokens.- Specified by:
tokensStartin interfaceGenerator- See Also:
Generator.tokensStart()
-
handleTokenProduction
public void handleTokenProduction(TokenProduction tp)
- Specified by:
handleTokenProductionin interfaceGenerator
-
tokensEnd
public void tokensEnd()
Output end of tokens.- Specified by:
tokensEndin interfaceGenerator- See Also:
Generator.tokensEnd()
-
javacode
public void javacode(JavaCodeProduction jp)
Output comment from a production.- Specified by:
javacodein interfaceGenerator- Parameters:
jp- the JavaCodeProduction to output- See Also:
Generator.javacode(org.javacc.parser.JavaCodeProduction)
-
cppcode
public void cppcode(CppCodeProduction cp)
Output comment from a production.- Specified by:
cppcodein interfaceGenerator- Parameters:
cp- the CppCodeProduction to output- See Also:
Generator.cppcode(org.javacc.parser.CppCodeProduction)
-
productionStart
public void productionStart(NormalProduction np)
Output start of a normal production.- Specified by:
productionStartin interfaceGenerator- Parameters:
np- the NormalProduction being output- See Also:
Generator.productionStart(org.javacc.parser.NormalProduction)
-
productionEnd
public void productionEnd(NormalProduction np)
Output end of a normal production.- Specified by:
productionEndin interfaceGenerator- Parameters:
np- the NormalProduction being output- See Also:
Generator.productionEnd(org.javacc.parser.NormalProduction)
-
expansionStart
public void expansionStart(Expansion e, boolean first)
Output start of an Expansion.- Specified by:
expansionStartin interfaceGenerator- Parameters:
e- Expansion being outputfirst- whether this is the first expansion- See Also:
Generator.expansionStart(org.javacc.parser.Expansion, boolean)
-
expansionEnd
public void expansionEnd(Expansion e, boolean first)
Output end of Expansion.- Specified by:
expansionEndin interfaceGenerator- Parameters:
e- Expansion being outputfirst- whether this is the first expansion- See Also:
Generator.expansionEnd(org.javacc.parser.Expansion, boolean)
-
nonTerminalStart
public void nonTerminalStart(NonTerminal nt)
Output start of non-terminal.- Specified by:
nonTerminalStartin interfaceGenerator- Parameters:
nt- the NonTerminal being output- See Also:
Generator.nonTerminalStart(org.javacc.parser.NonTerminal)
-
nonTerminalEnd
public void nonTerminalEnd(NonTerminal nt)
Output end of non-terminal.- Specified by:
nonTerminalEndin interfaceGenerator- Parameters:
nt- the NonTerminal being output- See Also:
Generator.nonTerminalEnd(org.javacc.parser.NonTerminal)
-
reStart
public void reStart(RegularExpression r)
Output start of regular expression.- Specified by:
reStartin interfaceGenerator- Parameters:
r- the RegularExpression being output- See Also:
Generator.reStart(org.javacc.parser.RegularExpression)
-
reEnd
public void reEnd(RegularExpression r)
Output end of regular expression.- Specified by:
reEndin interfaceGenerator- Parameters:
r- the RegularExpression being output- See Also:
Generator.reEnd(org.javacc.parser.RegularExpression)
-
create_output_stream
protected java.io.PrintWriter create_output_stream()
Create an output stream for the generated Jack code. Try to open a file based on the name of the parser, but if that fails use the standard output stream.
-
debug
public void debug(java.lang.String message)
Log debug messages.- Specified by:
debugin interfaceGenerator- Parameters:
message- the string to log- See Also:
Generator.debug(java.lang.String)
-
info
public void info(java.lang.String message)
Log informational messages.- Specified by:
infoin interfaceGenerator- Parameters:
message- the string to log- See Also:
Generator.info(java.lang.String)
-
warn
public void warn(java.lang.String message)
Log warning messages.- Specified by:
warnin interfaceGenerator- Parameters:
message- the string to log- See Also:
Generator.warn(java.lang.String)
-
error
public void error(java.lang.String message)
Log error messages.- Specified by:
errorin interfaceGenerator- Parameters:
message- the string to log- See Also:
Generator.error(java.lang.String)
-
-