Building Parsers with Java

sjm.parse.tokens
Class SymbolRootNode

java.lang.Object
  |
  +--sjm.parse.tokens.SymbolNode
        |
        +--sjm.parse.tokens.SymbolRootNode

public class SymbolRootNode
extends SymbolNode

This class is a special case of a SymbolNode. A SymbolRootNode object has no symbol of its own, but has children that represent all possible symbols.


Field Summary
protected  SymbolNode[] children
           
 
Fields inherited from class sjm.parse.tokens.SymbolNode
children, myChar, parent, valid
 
Constructor Summary
SymbolRootNode()
          Create and initialize a root node.
 
Method Summary
 void add(java.lang.String s)
          Add the given string as a symbol.
 java.lang.String ancestry()
          A root node has no parent and no character of its own, so its ancestry is "".
protected  SymbolNode findChildWithChar(char c)
           
protected  void init()
           
 java.lang.String nextSymbol(java.io.PushbackReader r, int first)
          Return a symbol string from a reader.
 
Methods inherited from class sjm.parse.tokens.SymbolNode
addDescendantLine, deepestRead, ensureChildWithChar, findDescendant, setValid, toString, unreadToValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

children

protected SymbolNode[] children
Constructor Detail

SymbolRootNode

public SymbolRootNode()
Create and initialize a root node.
Method Detail

add

public void add(java.lang.String s)
Add the given string as a symbol.
Parameters:
String - the character sequence to add

ancestry

public java.lang.String ancestry()
A root node has no parent and no character of its own, so its ancestry is "".
Overrides:
ancestry in class SymbolNode
Returns:
an empty string

findChildWithChar

protected SymbolNode findChildWithChar(char c)
Overrides:
findChildWithChar in class SymbolNode

init

protected void init()

nextSymbol

public java.lang.String nextSymbol(java.io.PushbackReader r,
                                   int first)
                            throws java.io.IOException
Return a symbol string from a reader.
Parameters:
PushbackReader - a reader to read from
int - the first character of this symbol, already read from the reader
Returns:
a symbol string from a reader

by Steve Metsker