153154155156157158159160161162163
public AST create(int type) { Class c = getASTNodeType(type); AST t = create(c); if ( t!=null ) { t.initialize(type, ""); } return t; } public AST create(int type, String txt) {
161162163164165166167168169170171
} public AST create(int type, String txt) { AST t = create(type); if ( t!=null ) { t.initialize(type, txt); } return t; } /** Create an AST node with the token type and text passed in, but
174175176177178179180181182183184
* @since 2.7.2 */ public AST create(int type, String txt, String className) { AST t = create(className); if ( t!=null ) { t.initialize(type, txt); } return t; } /** Create a new empty AST node; if the user did not specify
186187188189190191192193194195196
*/ public AST create(AST tr) { if (tr == null) return null; // create(null) == null AST t = create(tr.getType()); if ( t!=null ) { t.initialize(tr); } return t; } public AST create(Token tok) {
194195196197198199200201202203204
} public AST create(Token tok) { AST t = create(tok.getType()); if ( t!=null ) { t.initialize(tok); } return t; } /** ANTLR generates reference to this when you reference a token
250251252253254255256257258259260
// just do the regular thing if you can't find the ctor // Your AST must have default ctor to use this. t = create(c); if ( t!=null ) { t.initialize(token); } } } catch (Exception e) { // for c# conversion
294295296297298299300301302303304
public AST dup(AST t) { if ( t==null ) { return null; } AST dup_t = create(t.getClass()); dup_t.initialize(t); return dup_t; } /** Duplicate tree including siblings of root. */ public AST dupList(AST t) {