com.go.tea.compiler
Class Parser

java.lang.Object
  |
  +--com.go.tea.compiler.Parser

public class Parser
extends java.lang.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.

Version:
64 , 5/31/01
Author:
Brian S O'Neill

Constructor Summary
Parser(Scanner scanner)
           
Parser(Scanner scanner, CompilationUnit unit)
           
 
Method Summary
 void addErrorListener(ErrorListener listener)
           
 int getErrorCount()
           
static void main(java.lang.String[] arg)
          Test program
 Template parse()
          Returns a parse tree by its root node.
 void removeErrorListener(ErrorListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser(Scanner scanner)

Parser

public Parser(Scanner scanner,
              CompilationUnit unit)
Method Detail

addErrorListener

public void addErrorListener(ErrorListener listener)

removeErrorListener

public void removeErrorListener(ErrorListener listener)

parse

public Template parse()
               throws java.io.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.
See Also:
addErrorListener(com.go.tea.compiler.ErrorListener)

getErrorCount

public int getErrorCount()

main

public static void main(java.lang.String[] arg)
                 throws java.lang.Exception
Test program