Class VerbatimTokenParser

  • All Implemented Interfaces:
    TokenParser

    public class VerbatimTokenParser
    extends java.lang.Object
    implements TokenParser
    This is just a dummy class to point developers into the right direction; the verbatim tag had to be implemented directly into the lexer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getTag()
      The "tag" is used to determine when to use a particular instance of a TokenParser.
      RenderableNode parse​(Token token, Parser parser)
      The TokenParser is responsible to convert all the necessary tokens into appropriate Nodes.
      • Methods inherited from class java.lang.Object

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

      • VerbatimTokenParser

        public VerbatimTokenParser()
    • Method Detail

      • parse

        public RenderableNode parse​(Token token,
                                    Parser parser)
        Description copied from interface: TokenParser
        The TokenParser is responsible to convert all the necessary tokens into appropriate Nodes. It can access tokens using parser.getTokenStream(). The tag may be self contained like the "extends" tag or it may have a start and end point with content in the middle like the "block" tag. If it contains content in the middle, it can use parser.subparse(stopCondition) to parse the middle content at which point responsibility comes back to the TokenParser to parse the end point. It is the responsibility of the TokenParser to ensure that when it is complete, the "current" token of the primary Parser's TokenStream is pointing to the NEXT token. USUALLY this means the last statement in this parse method, immediately prior to the return statement, is the following which will consume one token: stream.expect(Token.Type.EXECUTE_END); Here are two relatively simple examples of how TokenParsers are implemented: - self contained: io.pebbletemplates.tokenParser.pebble.SetTokenParser - middle content: io.pebbletemplates.tokenParser.pebble.BlockTokenParser
        Specified by:
        parse in interface TokenParser
        Parameters:
        token - The token to parse
        parser - the parser which should be used to parse the token
        Returns:
        A node representation of the token
      • getTag

        public java.lang.String getTag()
        Description copied from interface: TokenParser
        The "tag" is used to determine when to use a particular instance of a TokenParser. For example, the TokenParser that handles the "block" tag would return "block" with this method.
        Specified by:
        getTag in interface TokenParser
        Returns:
        The tag used to define this TokenParser.