From c91f003551542c2aab62dd8ef89a7894c7e50689 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 15 Jun 2009 22:42:48 +0000 Subject: Copied JOGL_2_SANDBOX r145 on to trunk; JOGL_2_SANDBOX branch is now closed git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@147 a78bb65f-1512-4460-ba86-f6dc96a7bf27 --- src/java/com/sun/gluegen/cgram/TNodeFactory.java | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/java/com/sun/gluegen/cgram/TNodeFactory.java (limited to 'src/java/com/sun/gluegen/cgram/TNodeFactory.java') diff --git a/src/java/com/sun/gluegen/cgram/TNodeFactory.java b/src/java/com/sun/gluegen/cgram/TNodeFactory.java new file mode 100644 index 0000000..4523632 --- /dev/null +++ b/src/java/com/sun/gluegen/cgram/TNodeFactory.java @@ -0,0 +1,33 @@ +package com.sun.gluegen.cgram; + +import antlr.Token; +import antlr.ASTFactory; +import antlr.collections.AST; + +/** This class extends ASTFactory to build instances + of class TNode */ +public class TNodeFactory extends ASTFactory { + + /** Create a new ampty AST node */ + public AST create() { + return new TNode(); + } + + /** Create a new AST node from type and text */ + public AST create(int ttype, String text) { + AST ast = new TNode(); + ast.setType(ttype); + ast.setText(text); + return ast; + } + + /** Create a new AST node from an existing AST node */ + public AST create(AST ast) { + AST newast = new TNode(); + newast.setType(ast.getType()); + newast.setText(ast.getText()); + return newast; + } + + +} -- cgit v1.2.3