aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java
blob: ff2f1b059badd22c3d099c1fe21eafb070b5aa2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.jogamp.gluegen.cgram;

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 */
  @Override
  public AST create() {
    return new TNode();
  }

        /** Create a new AST node from type and text */
        @Override
        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 */
        @Override
        public AST create(AST ast) {
                AST newast = new TNode();
                newast.setType(ast.getType());
                newast.setText(ast.getText());
                return newast;
        }


}