freemarker.template.compiler
Interface TemplateParser

All Known Implementing Classes:
StandardTemplateParser

public interface TemplateParser

An interface for classes that parse templates. This defines the minimum contract that LinkedListTemplateBuilder expects.

The typical scenario is text blocks with one or more instructions between each one. Text blocks are simply Instructions of type TextBlockInstruction.

Version:
$Id: TemplateParser.java 1101 2013-04-01 04:17:32Z run2000 $
Author:
Nicholas Cull

Method Summary
 java.lang.String atChar()
          Adds text to an error message indicating the line number where the error was found.
 Instruction getNextInstruction()
          Searches the text for an instruction, starting at the current parse position.
 boolean isMoreInstructions()
          Are there any more instructions left to be parsed?
 java.lang.String skipToEndInstruction(ContainerInstruction beginInstruction)
          Searches the text for a matching end instruction, starting at the current parse position.
 

Method Detail

getNextInstruction

Instruction getNextInstruction()
                               throws ParseException
Searches the text for an instruction, starting at the current parse position. If one is found, parses it into an Instruction.

Returns:
an Instruction, or null if no more instructions exist in the template representing the next instruction following the current parse position.
Throws:
ParseException

isMoreInstructions

boolean isMoreInstructions()
Are there any more instructions left to be parsed?

Returns:
true if there is more text to parse, otherwise false

skipToEndInstruction

java.lang.String skipToEndInstruction(ContainerInstruction beginInstruction)
Searches the text for a matching end instruction, starting at the current parse position. If we find it, parse it and return.

Returns:
a String of the intermediate text if we find the end instruction we're after, otherwise null.

atChar

java.lang.String atChar()
Adds text to an error message indicating the line number where the error was found.

Returns:
a String containing the message.