Class 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
    • 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PlainTokenRenderer

        public PlainTokenRenderer()
    • 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 interface TokenRenderer
        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 interface TokenRenderer
        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 interface TokenRenderer
        Parameters:
        decision - the index of the decision (or the context) in which the current token is being processed. The index refers to ANTLR DebugEventListener.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 interface TokenRenderer
      • 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 interface TokenRenderer
      • 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