dk.brics.grammar.ast
Class Node

java.lang.Object
  extended by dk.brics.grammar.ast.Node
Direct Known Subclasses:
BranchNode, LeafNode

public abstract class Node
extends Object

Superclass of AST nodes.


Constructor Summary
protected Node(int i, int j)
          Constructs a new node.
 
Method Summary
 int getFromIndex()
          Returns index in original string corresponding to the start of this node.
 String getString(String x)
          Returns the substring represented by this node.
 int getToIndex()
          Returns index in original string corresponding to the end (exclusive) of this node.
abstract  void print(String x, StringBuilder b)
          Prints this node.
abstract  void visitBy(NodeVisitor v)
          Visits this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

protected Node(int i,
               int j)
Constructs a new node.

Parameters:
i - from index
j - to index
Method Detail

getFromIndex

public int getFromIndex()
Returns index in original string corresponding to the start of this node.

Returns:
index

getString

public String getString(String x)
Returns the substring represented by this node.

Parameters:
x - original string
Returns:
substring

getToIndex

public int getToIndex()
Returns index in original string corresponding to the end (exclusive) of this node.

Returns:
index

print

public abstract void print(String x,
                           StringBuilder b)
Prints this node.

Parameters:
x - original string
b - string buffer for output

visitBy

public abstract void visitBy(NodeVisitor v)
Visits this node.

Parameters:
v - visitor


Copyright © 2005-2008 Anders Møller.