org.teatrove.tea.compiler
Class Parser
java.lang.Object
org.teatrove.tea.compiler.Parser
public class Parser
- extends Object
A Parser creates the parse tree for a template by reading tokens emitted by
a Scanner. The parse tree represents the entire template as a
data structure composed of specialized nodes. Add an ErrorListener
to capture any syntax errors detected by the Parser.
- Author:
- Brian S O'Neill
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Parser
public Parser(Scanner scanner)
Parser
public Parser(Scanner scanner,
CompilationUnit unit)
addErrorListener
public void addErrorListener(ErrorListener listener)
removeErrorListener
public void removeErrorListener(ErrorListener listener)
parse
public Template parse()
throws IOException
- Returns a parse tree by its root node. The parse tree is generated
from tokens read from the scanner. Any errors encountered while
parsing are delivered by dispatching an event. Add an error listener
in order to capture parse errors.
- Returns:
- Non-null template node, even if there were errors during
parsing.
- Throws:
IOException- See Also:
addErrorListener(org.teatrove.tea.compiler.ErrorListener)
getErrorCount
public int getErrorCount()
main
public static void main(String[] arg)
throws Exception
- Test program
- Throws:
Exception
Copyright © 1997-2012 TeaTrove.org. All Rights Reserved.