Package openbook.tools.converter
Class PlainTokenRenderer
- java.lang.Object
-
- openbook.tools.converter.PlainTokenRenderer
-
- All Implemented Interfaces:
TokenRenderer
public class PlainTokenRenderer extends java.lang.Object implements TokenRenderer
A default implementation of TokenRenderer that simply prints the token.- Author:
- Pinaki Poddar
-
-
Constructor Summary
Constructors Constructor Description PlainTokenRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
endLine(int line)
Produce a string to signal end of a line.java.lang.String
getEpilogue()
Gets a string to be added after token processing ends.java.lang.String
getLineNumberFormat()
java.lang.String
getPrologue()
Gets a string to be added before token processing begins.boolean
getShowLineNumber()
java.lang.String
newLine(int line)
Produce a string to signal beginning of a line.java.lang.String
render(int decision, org.antlr.runtime.Token token)
Produce a string representation of the given token.void
setLineNumberFormat(java.lang.String lineNumberFormat)
void
setShowLineNumber(boolean showLineNumber)
-
-
-
Method Detail
-
endLine
public java.lang.String endLine(int line)
Description copied from interface:TokenRenderer
Produce a string to signal end of a line.
For example, a renderer can produce a newline.- Specified by:
endLine
in interfaceTokenRenderer
- Parameters:
line
- the line being ended- Returns:
- a String can be a blank
-
newLine
public java.lang.String newLine(int line)
Description copied from interface:TokenRenderer
Produce a string to signal beginning of a line.
For example, a renderer printing line numbers can produce a String with the given line number.- Specified by:
newLine
in interfaceTokenRenderer
- Parameters:
line
- the current line number- Returns:
- a String can be a blank
-
render
public java.lang.String render(int decision, org.antlr.runtime.Token token)
Description copied from interface:TokenRenderer
Produce a string representation of the given token.- Specified by:
render
in interfaceTokenRenderer
- Parameters:
decision
- the index of the decision (or the context) in which the current token is being processed. The index refers to ANTLRDebugEventListener.enterDecision(int)
.token
- the token to be rendered. Can be a hidden token as well.- Returns:
- a string representation of the given token.
-
getEpilogue
public java.lang.String getEpilogue()
Description copied from interface:TokenRenderer
Gets a string to be added after token processing ends. For example, a HTML renderer may return the closing HTML and BODY tags.- Specified by:
getEpilogue
in interfaceTokenRenderer
-
getPrologue
public java.lang.String getPrologue()
Description copied from interface:TokenRenderer
Gets a string to be added before token processing begins.
For example, a HTML renderer may return the opening HTML and BODY tags. A HTML render using a Cascaded Style Sheet may additionally specify the tag to include the style sheet.- Specified by:
getPrologue
in interfaceTokenRenderer
-
getShowLineNumber
public boolean getShowLineNumber()
-
setShowLineNumber
public void setShowLineNumber(boolean showLineNumber)
-
getLineNumberFormat
public java.lang.String getLineNumberFormat()
- Returns:
- the lineNumberFormat
-
setLineNumberFormat
public void setLineNumberFormat(java.lang.String lineNumberFormat)
- Parameters:
lineNumberFormat
- the lineNumberFormat to set
-
-