de.hunsicker.jalopy.language.antlr
Class JavaNodeFactory

java.lang.Object
  |
  +--antlr.ASTFactory
        |
        +--de.hunsicker.jalopy.language.antlr.JavaNodeFactory

public class JavaNodeFactory
extends antlr.ASTFactory

Central facility to create the nodes for Java parse trees.

Version:
$Revision: 1.1.2.1 $
Author:
Marco Hunsicker

Field Summary
 
Fields inherited from class antlr.ASTFactory
theASTNodeType, theASTNodeTypeClass, tokenTypeToASTClassMap
 
Constructor Summary
JavaNodeFactory(CompositeFactory compositeFactory)
          Creates a new JavaNodeFactory object.
 
Method Summary
 void addASTChild(antlr.ASTPair currentAST, antlr.collections.AST child)
          Add the given node as a child to the given root.
 antlr.collections.AST create(antlr.collections.AST node)
          Creates a new JavaNode node.
 antlr.collections.AST create(int type)
          Creates a new JavaNode node.
 JavaNode create(int startLine, int startColumn, int endLine, int endColumn)
           
 antlr.collections.AST create(int type, java.lang.String text)
          Creates a new JavaNode node.
 antlr.collections.AST create(antlr.Token token)
          Creates a new JavaNode node.
 antlr.collections.AST dup(antlr.collections.AST t)
          Copy a single node with same Java AST objec type.
 antlr.collections.AST dupList(antlr.collections.AST t)
          Duplicate the given tree (including all siblings of root).
 antlr.collections.AST dupTree(antlr.collections.AST t)
          Duplicate a tree, assuming this is a root node of a tree -- duplicates that node and what's below; ignore siblings of root node.
 void error(java.lang.String message)
          Logs the given error message.
 antlr.collections.AST make(antlr.collections.AST[] nodes)
          Makes a tree from a list of nodes.
 void makeASTRoot(antlr.ASTPair currentAST, antlr.collections.AST root)
          DOCUMENT ME!
 
Methods inherited from class antlr.ASTFactory
create, create, create, create, create, createUsingCtor, getASTNodeType, getTokenTypeToASTClassMap, make, setASTNodeClass, setASTNodeClass, setASTNodeType, setTokenTypeASTNodeType, setTokenTypeToASTClassMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaNodeFactory

public JavaNodeFactory(CompositeFactory compositeFactory)
Creates a new JavaNodeFactory object.

Method Detail

addASTChild

public void addASTChild(antlr.ASTPair currentAST,
                        antlr.collections.AST child)
Add the given node as a child to the given root.

Overrides:
addASTChild in class antlr.ASTFactory
Parameters:
currentAST - root pair.
child - new child to add. TODO Examine what this does ?

create

public antlr.collections.AST create(int type)
Creates a new JavaNode node.

Overrides:
create in class antlr.ASTFactory
Parameters:
type - information to setup the node with.
Returns:
newly created Node.

create

public antlr.collections.AST create(antlr.collections.AST node)
Creates a new JavaNode node.

Overrides:
create in class antlr.ASTFactory
Parameters:
node - node to setup the new node with.
Returns:
newly created Node.

create

public antlr.collections.AST create(antlr.Token token)
Creates a new JavaNode node.

Overrides:
create in class antlr.ASTFactory
Parameters:
token - token to setup the new node with.
Returns:
newly created Node.

create

public antlr.collections.AST create(int type,
                                    java.lang.String text)
Creates a new JavaNode node.

Overrides:
create in class antlr.ASTFactory
Parameters:
type - type information to setup the node with.
text - text to setup the node with.
Returns:
newly created Node.

dupList

public antlr.collections.AST dupList(antlr.collections.AST t)
Duplicate the given tree (including all siblings of root).

Overrides:
dupList in class antlr.ASTFactory
Parameters:
t - the root node of the tree (or tree portion)
Returns:
the copy of the tree.

dup

public antlr.collections.AST dup(antlr.collections.AST t)
Copy a single node with same Java AST objec type. Ignore the tokenType->Class mapping since you know the type of the node, t.getClass(), and doing a dup. clone() is not used because we want all AST creation to go thru the factory so creation can be tracked. Returns null if t is null.

Overrides:
dup in class antlr.ASTFactory

dupTree

public antlr.collections.AST dupTree(antlr.collections.AST t)
Duplicate a tree, assuming this is a root node of a tree -- duplicates that node and what's below; ignore siblings of root node.

Overrides:
dupTree in class antlr.ASTFactory
Parameters:
t - the root node of the tree (or tree portion)
Returns:
the copy of the tree.

error

public void error(java.lang.String message)
Logs the given error message.

Overrides:
error in class antlr.ASTFactory
Parameters:
message - an error message.

make

public antlr.collections.AST make(antlr.collections.AST[] nodes)
Makes a tree from a list of nodes. The first element in the array is the root. If the root is null, then the tree is actually a simple list not a tree. Handles null children nodes correctly. For example, build(a, b, null, c) yields tree (a b c). build(null,a,b) yields tree (nil a b).

Sets also the line/column info of the root node.

Overrides:
make in class antlr.ASTFactory
Parameters:
nodes - the nodes to create the tree with. TODO Examine what this does
Returns:
the generated tree.

makeASTRoot

public void makeASTRoot(antlr.ASTPair currentAST,
                        antlr.collections.AST root)
DOCUMENT ME!

Overrides:
makeASTRoot in class antlr.ASTFactory
Parameters:
currentAST - DOCUMENT ME!
root - DOCUMENT ME!

create

public JavaNode create(int startLine,
                       int startColumn,
                       int endLine,
                       int endColumn)


Copyright © 1997-2005 Jalopy. All Rights Reserved.