From: <fwi...@us...> - 2008-11-24 19:41:56
|
Revision: 5633 http://jython.svn.sourceforge.net/jython/?rev=5633&view=rev Author: fwierzbicki Date: 2008-11-24 19:41:50 +0000 (Mon, 24 Nov 2008) Log Message: ----------- internal compiler operates on the internal lists now ListWrappers. Modified Paths: -------------- branches/astwrite/ast/asdl_antlr.py branches/astwrite/src/org/python/antlr/AstAdapter.java branches/astwrite/src/org/python/antlr/ast/Assert.java branches/astwrite/src/org/python/antlr/ast/Assign.java branches/astwrite/src/org/python/antlr/ast/Attribute.java branches/astwrite/src/org/python/antlr/ast/AugAssign.java branches/astwrite/src/org/python/antlr/ast/BinOp.java branches/astwrite/src/org/python/antlr/ast/BoolOp.java branches/astwrite/src/org/python/antlr/ast/Break.java branches/astwrite/src/org/python/antlr/ast/Call.java branches/astwrite/src/org/python/antlr/ast/ClassDef.java branches/astwrite/src/org/python/antlr/ast/Compare.java branches/astwrite/src/org/python/antlr/ast/Continue.java branches/astwrite/src/org/python/antlr/ast/Delete.java branches/astwrite/src/org/python/antlr/ast/Dict.java branches/astwrite/src/org/python/antlr/ast/Ellipsis.java branches/astwrite/src/org/python/antlr/ast/Exec.java branches/astwrite/src/org/python/antlr/ast/Expr.java branches/astwrite/src/org/python/antlr/ast/Expression.java branches/astwrite/src/org/python/antlr/ast/ExtSlice.java branches/astwrite/src/org/python/antlr/ast/For.java branches/astwrite/src/org/python/antlr/ast/FunctionDef.java branches/astwrite/src/org/python/antlr/ast/GeneratorExp.java branches/astwrite/src/org/python/antlr/ast/Global.java branches/astwrite/src/org/python/antlr/ast/If.java branches/astwrite/src/org/python/antlr/ast/IfExp.java branches/astwrite/src/org/python/antlr/ast/Import.java branches/astwrite/src/org/python/antlr/ast/ImportFrom.java branches/astwrite/src/org/python/antlr/ast/Index.java branches/astwrite/src/org/python/antlr/ast/Interactive.java branches/astwrite/src/org/python/antlr/ast/Lambda.java branches/astwrite/src/org/python/antlr/ast/List.java branches/astwrite/src/org/python/antlr/ast/ListComp.java branches/astwrite/src/org/python/antlr/ast/Module.java branches/astwrite/src/org/python/antlr/ast/Name.java branches/astwrite/src/org/python/antlr/ast/Num.java branches/astwrite/src/org/python/antlr/ast/Pass.java branches/astwrite/src/org/python/antlr/ast/Print.java branches/astwrite/src/org/python/antlr/ast/Raise.java branches/astwrite/src/org/python/antlr/ast/Repr.java branches/astwrite/src/org/python/antlr/ast/Return.java branches/astwrite/src/org/python/antlr/ast/Slice.java branches/astwrite/src/org/python/antlr/ast/Str.java branches/astwrite/src/org/python/antlr/ast/Subscript.java branches/astwrite/src/org/python/antlr/ast/Suite.java branches/astwrite/src/org/python/antlr/ast/TryExcept.java branches/astwrite/src/org/python/antlr/ast/TryFinally.java branches/astwrite/src/org/python/antlr/ast/Tuple.java branches/astwrite/src/org/python/antlr/ast/UnaryOp.java branches/astwrite/src/org/python/antlr/ast/VisitorBase.java branches/astwrite/src/org/python/antlr/ast/While.java branches/astwrite/src/org/python/antlr/ast/With.java branches/astwrite/src/org/python/antlr/ast/Yield.java branches/astwrite/src/org/python/antlr/ast/aliasType.java branches/astwrite/src/org/python/antlr/ast/argumentsType.java branches/astwrite/src/org/python/antlr/ast/comprehensionType.java branches/astwrite/src/org/python/antlr/ast/excepthandlerType.java branches/astwrite/src/org/python/antlr/ast/exprType.java branches/astwrite/src/org/python/antlr/ast/keywordType.java branches/astwrite/src/org/python/antlr/ast/modType.java branches/astwrite/src/org/python/antlr/ast/sliceType.java branches/astwrite/src/org/python/antlr/ast/stmtType.java branches/astwrite/src/org/python/compiler/ArgListCompiler.java Modified: branches/astwrite/ast/asdl_antlr.py =================================================================== --- branches/astwrite/ast/asdl_antlr.py 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/ast/asdl_antlr.py 2008-11-24 19:41:50 UTC (rev 5633) @@ -56,6 +56,7 @@ print >> self.file, "// Autogenerated AST node" print >> self.file, 'package org.python.antlr.ast;' if refersToPythonTree: + print >> self.file, 'import java.util.ArrayList;' print >> self.file, 'import org.python.antlr.AstAdapter;' print >> self.file, 'import org.python.antlr.PythonTree;' print >> self.file, 'import org.python.antlr.ListWrapper;' @@ -294,11 +295,11 @@ def javaConstructorHelper(self, fields, depth): for f in fields: - if f.seq: - self.emit("this.%s = new %s(%s);" % (f.name, - self.javaType(f, True), f.name), depth+1) - else: - self.emit("this.%s = %s;" % (f.name, f.name), depth+1) + #if f.seq: + # self.emit("this.%s = new %s(%s);" % (f.name, + # self.javaType(f), f.name), depth+1) + #else: + self.emit("this.%s = %s;" % (f.name, f.name), depth+1) fparg = self.fieldDef(f) @@ -308,11 +309,12 @@ #For now ignoring String -- will want to revisit if not_simple and fparg.find("String") == -1: if f.seq: - self.emit("if (%s != null) {" % f.name, depth+1); - self.emit("for(PythonTree t : %(name)s) {" % {"name":f.name}, depth+2) - self.emit("addChild(t);", depth+3) - self.emit("}", depth+2) + self.emit("if (%s == null) {" % f.name, depth+1); + self.emit("this.%s = new ArrayList<%s>();" % (f.name, self.javaType(f, False)), depth+2) self.emit("}", depth+1) + self.emit("for(PythonTree t : this.%(name)s) {" % {"name":f.name}, depth+1) + self.emit("addChild(t);", depth+2) + self.emit("}", depth+1) elif str(f.type) == "expr": self.emit("addChild(%s);" % (f.name), depth+1) @@ -413,19 +415,22 @@ def visitField(self, field, depth): - self.emit("private %s;" % self.fieldDef(field, True), depth) - self.emit("public %s getInternal%s() {" % (self.javaType(field, True), + self.emit("private %s;" % self.fieldDef(field), depth) + self.emit("public %s getInternal%s() {" % (self.javaType(field), str(field.name).capitalize()), depth) self.emit("return %s;" % field.name, depth+1) self.emit("}", depth) self.emit("public Object get%s() {" % (str(field.name).capitalize()), depth) - self.emit("return %s;" % field.name, depth+1) + if field.seq: + self.emit("return new ListWrapper(%s);" % field.name, depth+1) + else: + self.emit("return %s;" % field.name, depth+1) self.emit("}", depth) self.emit("public void set%s(Object %s) {" % (str(field.name).capitalize(), field.name), depth) if field.seq: - self.emit("this.%s = new %s(" % (field.name, self.javaType(field, True)), depth+1) - self.emit("(%s)%s);" % (self.javaType(field), field.name), depth+2) + #self.emit("this.%s = new %s(" % (field.name, self.javaType(field)), depth+1) + self.emit("this.%s = AstAdapter.to_%sList(%s);" % (field.name, str(field.type), field.name), depth+1) else: self.emit("this.%s = AstAdapter.to_%s(%s);" % (field.name, str(field.type), field.name), depth+1) self.emit("}", depth) @@ -441,20 +446,16 @@ 'PythonTree' : 'PythonTree', # also for antlr type } - def fieldDef(self, field, wrapper=False): - jtype = self.javaType(field, wrapper) + def fieldDef(self, field): + jtype = self.javaType(field) name = field.name return "%s %s" % (jtype, name) - def javaType(self, field, wrapper=False): + def javaType(self, field, check_seq=True): jtype = str(field.type) jtype = self.bltinnames.get(jtype, jtype + 'Type') - if field.seq: - if wrapper: - return "ListWrapper<%s>" % jtype - else: - return "java.util.List<%s>" % jtype - + if check_seq and field.seq: + return "java.util.List<%s>" % jtype return jtype class VisitorVisitor(EmitVisitor): Modified: branches/astwrite/src/org/python/antlr/AstAdapter.java =================================================================== --- branches/astwrite/src/org/python/antlr/AstAdapter.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/AstAdapter.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -8,6 +8,42 @@ */ public class AstAdapter { + public static java.util.List<aliasType> to_aliasList(Object o) { + return null; + } + + public static java.util.List<cmpopType> to_cmpopList(Object o) { + return null; + } + + public static java.util.List<comprehensionType> to_comprehensionList(Object o) { + return null; + } + + public static java.util.List<excepthandlerType> to_excepthandlerList(Object o) { + return null; + } + + public static java.util.List<exprType> to_exprList(Object o) { + return null; + } + + public static java.util.List<String> to_identifierList(Object o) { + return null; + } + + public static java.util.List<keywordType> to_keywordList(Object o) { + return null; + } + + public static java.util.List<sliceType> to_sliceList(Object o) { + return null; + } + + public static java.util.List<stmtType> to_stmtList(Object o) { + return null; + } + public static exprType to_expr(Object o) { if (o == null || o instanceof exprType) { return (exprType)o; Modified: branches/astwrite/src/org/python/antlr/ast/Assert.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Assert.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Assert.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; Modified: branches/astwrite/src/org/python/antlr/ast/Assign.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Assign.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Assign.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -9,16 +10,15 @@ import java.io.IOException; public class Assign extends stmtType { - private ListWrapper<exprType> targets; - public ListWrapper<exprType> getInternalTargets() { + private java.util.List<exprType> targets; + public java.util.List<exprType> getInternalTargets() { return targets; } public Object getTargets() { - return targets; + return new ListWrapper(targets); } public void setTargets(Object targets) { - this.targets = new ListWrapper<exprType>( - (java.util.List<exprType>)targets); + this.targets = AstAdapter.to_exprList(targets); } private exprType value; @@ -45,12 +45,13 @@ public Assign(Token token, java.util.List<exprType> targets, exprType value) { super(token); - this.targets = new ListWrapper<exprType>(targets); - if (targets != null) { - for(PythonTree t : targets) { - addChild(t); - } + this.targets = targets; + if (targets == null) { + this.targets = new ArrayList<exprType>(); } + for(PythonTree t : this.targets) { + addChild(t); + } this.value = value; addChild(value); } @@ -58,12 +59,13 @@ public Assign(Integer ttype, Token token, java.util.List<exprType> targets, exprType value) { super(ttype, token); - this.targets = new ListWrapper<exprType>(targets); - if (targets != null) { - for(PythonTree t : targets) { - addChild(t); - } + this.targets = targets; + if (targets == null) { + this.targets = new ArrayList<exprType>(); } + for(PythonTree t : this.targets) { + addChild(t); + } this.value = value; addChild(value); } @@ -71,12 +73,13 @@ public Assign(PythonTree tree, java.util.List<exprType> targets, exprType value) { super(tree); - this.targets = new ListWrapper<exprType>(targets); - if (targets != null) { - for(PythonTree t : targets) { - addChild(t); - } + this.targets = targets; + if (targets == null) { + this.targets = new ArrayList<exprType>(); } + for(PythonTree t : this.targets) { + addChild(t); + } this.value = value; addChild(value); } Modified: branches/astwrite/src/org/python/antlr/ast/Attribute.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Attribute.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Attribute.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; Modified: branches/astwrite/src/org/python/antlr/ast/AugAssign.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/AugAssign.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/AugAssign.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; Modified: branches/astwrite/src/org/python/antlr/ast/BinOp.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/BinOp.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/BinOp.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; Modified: branches/astwrite/src/org/python/antlr/ast/BoolOp.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/BoolOp.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/BoolOp.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -20,16 +21,15 @@ this.op = AstAdapter.to_boolop(op); } - private ListWrapper<exprType> values; - public ListWrapper<exprType> getInternalValues() { + private java.util.List<exprType> values; + public java.util.List<exprType> getInternalValues() { return values; } public Object getValues() { - return values; + return new ListWrapper(values); } public void setValues(Object values) { - this.values = new ListWrapper<exprType>( - (java.util.List<exprType>)values); + this.values = AstAdapter.to_exprList(values); } @@ -45,36 +45,39 @@ public BoolOp(Token token, boolopType op, java.util.List<exprType> values) { super(token); this.op = op; - this.values = new ListWrapper<exprType>(values); - if (values != null) { - for(PythonTree t : values) { - addChild(t); - } + this.values = values; + if (values == null) { + this.values = new ArrayList<exprType>(); } + for(PythonTree t : this.values) { + addChild(t); + } } public BoolOp(Integer ttype, Token token, boolopType op, java.util.List<exprType> values) { super(ttype, token); this.op = op; - this.values = new ListWrapper<exprType>(values); - if (values != null) { - for(PythonTree t : values) { - addChild(t); - } + this.values = values; + if (values == null) { + this.values = new ArrayList<exprType>(); } + for(PythonTree t : this.values) { + addChild(t); + } } public BoolOp(PythonTree tree, boolopType op, java.util.List<exprType> values) { super(tree); this.op = op; - this.values = new ListWrapper<exprType>(values); - if (values != null) { - for(PythonTree t : values) { - addChild(t); - } + this.values = values; + if (values == null) { + this.values = new ArrayList<exprType>(); } + for(PythonTree t : this.values) { + addChild(t); + } } public String toString() { Modified: branches/astwrite/src/org/python/antlr/ast/Break.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Break.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Break.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; Modified: branches/astwrite/src/org/python/antlr/ast/Call.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Call.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Call.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -20,28 +21,26 @@ this.func = AstAdapter.to_expr(func); } - private ListWrapper<exprType> args; - public ListWrapper<exprType> getInternalArgs() { + private java.util.List<exprType> args; + public java.util.List<exprType> getInternalArgs() { return args; } public Object getArgs() { - return args; + return new ListWrapper(args); } public void setArgs(Object args) { - this.args = new ListWrapper<exprType>( - (java.util.List<exprType>)args); + this.args = AstAdapter.to_exprList(args); } - private ListWrapper<keywordType> keywords; - public ListWrapper<keywordType> getInternalKeywords() { + private java.util.List<keywordType> keywords; + public java.util.List<keywordType> getInternalKeywords() { return keywords; } public Object getKeywords() { - return keywords; + return new ListWrapper(keywords); } public void setKeywords(Object keywords) { - this.keywords = new ListWrapper<keywordType>( - (java.util.List<keywordType>)keywords); + this.keywords = AstAdapter.to_keywordList(keywords); } private exprType starargs; @@ -87,18 +86,20 @@ super(token); this.func = func; addChild(func); - this.args = new ListWrapper<exprType>(args); - if (args != null) { - for(PythonTree t : args) { - addChild(t); - } + this.args = args; + if (args == null) { + this.args = new ArrayList<exprType>(); } - this.keywords = new ListWrapper<keywordType>(keywords); - if (keywords != null) { - for(PythonTree t : keywords) { - addChild(t); - } + for(PythonTree t : this.args) { + addChild(t); } + this.keywords = keywords; + if (keywords == null) { + this.keywords = new ArrayList<keywordType>(); + } + for(PythonTree t : this.keywords) { + addChild(t); + } this.starargs = starargs; addChild(starargs); this.kwargs = kwargs; @@ -111,18 +112,20 @@ super(ttype, token); this.func = func; addChild(func); - this.args = new ListWrapper<exprType>(args); - if (args != null) { - for(PythonTree t : args) { - addChild(t); - } + this.args = args; + if (args == null) { + this.args = new ArrayList<exprType>(); } - this.keywords = new ListWrapper<keywordType>(keywords); - if (keywords != null) { - for(PythonTree t : keywords) { - addChild(t); - } + for(PythonTree t : this.args) { + addChild(t); } + this.keywords = keywords; + if (keywords == null) { + this.keywords = new ArrayList<keywordType>(); + } + for(PythonTree t : this.keywords) { + addChild(t); + } this.starargs = starargs; addChild(starargs); this.kwargs = kwargs; @@ -134,18 +137,20 @@ super(tree); this.func = func; addChild(func); - this.args = new ListWrapper<exprType>(args); - if (args != null) { - for(PythonTree t : args) { - addChild(t); - } + this.args = args; + if (args == null) { + this.args = new ArrayList<exprType>(); } - this.keywords = new ListWrapper<keywordType>(keywords); - if (keywords != null) { - for(PythonTree t : keywords) { - addChild(t); - } + for(PythonTree t : this.args) { + addChild(t); } + this.keywords = keywords; + if (keywords == null) { + this.keywords = new ArrayList<keywordType>(); + } + for(PythonTree t : this.keywords) { + addChild(t); + } this.starargs = starargs; addChild(starargs); this.kwargs = kwargs; Modified: branches/astwrite/src/org/python/antlr/ast/ClassDef.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/ClassDef.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/ClassDef.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -20,40 +21,37 @@ this.name = AstAdapter.to_identifier(name); } - private ListWrapper<exprType> bases; - public ListWrapper<exprType> getInternalBases() { + private java.util.List<exprType> bases; + public java.util.List<exprType> getInternalBases() { return bases; } public Object getBases() { - return bases; + return new ListWrapper(bases); } public void setBases(Object bases) { - this.bases = new ListWrapper<exprType>( - (java.util.List<exprType>)bases); + this.bases = AstAdapter.to_exprList(bases); } - private ListWrapper<stmtType> body; - public ListWrapper<stmtType> getInternalBody() { + private java.util.List<stmtType> body; + public java.util.List<stmtType> getInternalBody() { return body; } public Object getBody() { - return body; + return new ListWrapper(body); } public void setBody(Object body) { - this.body = new ListWrapper<stmtType>( - (java.util.List<stmtType>)body); + this.body = AstAdapter.to_stmtList(body); } - private ListWrapper<exprType> decorators; - public ListWrapper<exprType> getInternalDecorators() { + private java.util.List<exprType> decorators; + public java.util.List<exprType> getInternalDecorators() { return decorators; } public Object getDecorators() { - return decorators; + return new ListWrapper(decorators); } public void setDecorators(Object decorators) { - this.decorators = new ListWrapper<exprType>( - (java.util.List<exprType>)decorators); + this.decorators = AstAdapter.to_exprList(decorators); } @@ -73,24 +71,27 @@ java.util.List<stmtType> body, java.util.List<exprType> decorators) { super(token); this.name = name; - this.bases = new ListWrapper<exprType>(bases); - if (bases != null) { - for(PythonTree t : bases) { - addChild(t); - } + this.bases = bases; + if (bases == null) { + this.bases = new ArrayList<exprType>(); } - this.body = new ListWrapper<stmtType>(body); - if (body != null) { - for(PythonTree t : body) { - addChild(t); - } + for(PythonTree t : this.bases) { + addChild(t); } - this.decorators = new ListWrapper<exprType>(decorators); - if (decorators != null) { - for(PythonTree t : decorators) { - addChild(t); - } + this.body = body; + if (body == null) { + this.body = new ArrayList<stmtType>(); } + for(PythonTree t : this.body) { + addChild(t); + } + this.decorators = decorators; + if (decorators == null) { + this.decorators = new ArrayList<exprType>(); + } + for(PythonTree t : this.decorators) { + addChild(t); + } } public ClassDef(Integer ttype, Token token, String name, @@ -98,48 +99,54 @@ java.util.List<exprType> decorators) { super(ttype, token); this.name = name; - this.bases = new ListWrapper<exprType>(bases); - if (bases != null) { - for(PythonTree t : bases) { - addChild(t); - } + this.bases = bases; + if (bases == null) { + this.bases = new ArrayList<exprType>(); } - this.body = new ListWrapper<stmtType>(body); - if (body != null) { - for(PythonTree t : body) { - addChild(t); - } + for(PythonTree t : this.bases) { + addChild(t); } - this.decorators = new ListWrapper<exprType>(decorators); - if (decorators != null) { - for(PythonTree t : decorators) { - addChild(t); - } + this.body = body; + if (body == null) { + this.body = new ArrayList<stmtType>(); } + for(PythonTree t : this.body) { + addChild(t); + } + this.decorators = decorators; + if (decorators == null) { + this.decorators = new ArrayList<exprType>(); + } + for(PythonTree t : this.decorators) { + addChild(t); + } } public ClassDef(PythonTree tree, String name, java.util.List<exprType> bases, java.util.List<stmtType> body, java.util.List<exprType> decorators) { super(tree); this.name = name; - this.bases = new ListWrapper<exprType>(bases); - if (bases != null) { - for(PythonTree t : bases) { - addChild(t); - } + this.bases = bases; + if (bases == null) { + this.bases = new ArrayList<exprType>(); } - this.body = new ListWrapper<stmtType>(body); - if (body != null) { - for(PythonTree t : body) { - addChild(t); - } + for(PythonTree t : this.bases) { + addChild(t); } - this.decorators = new ListWrapper<exprType>(decorators); - if (decorators != null) { - for(PythonTree t : decorators) { - addChild(t); - } + this.body = body; + if (body == null) { + this.body = new ArrayList<stmtType>(); } + for(PythonTree t : this.body) { + addChild(t); + } + this.decorators = decorators; + if (decorators == null) { + this.decorators = new ArrayList<exprType>(); + } + for(PythonTree t : this.decorators) { + addChild(t); + } } public String toString() { Modified: branches/astwrite/src/org/python/antlr/ast/Compare.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Compare.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Compare.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -20,28 +21,26 @@ this.left = AstAdapter.to_expr(left); } - private ListWrapper<cmpopType> ops; - public ListWrapper<cmpopType> getInternalOps() { + private java.util.List<cmpopType> ops; + public java.util.List<cmpopType> getInternalOps() { return ops; } public Object getOps() { - return ops; + return new ListWrapper(ops); } public void setOps(Object ops) { - this.ops = new ListWrapper<cmpopType>( - (java.util.List<cmpopType>)ops); + this.ops = AstAdapter.to_cmpopList(ops); } - private ListWrapper<exprType> comparators; - public ListWrapper<exprType> getInternalComparators() { + private java.util.List<exprType> comparators; + public java.util.List<exprType> getInternalComparators() { return comparators; } public Object getComparators() { - return comparators; + return new ListWrapper(comparators); } public void setComparators(Object comparators) { - this.comparators = new ListWrapper<exprType>( - (java.util.List<exprType>)comparators); + this.comparators = AstAdapter.to_exprList(comparators); } @@ -61,13 +60,14 @@ super(token); this.left = left; addChild(left); - this.ops = new ListWrapper<cmpopType>(ops); - this.comparators = new ListWrapper<exprType>(comparators); - if (comparators != null) { - for(PythonTree t : comparators) { - addChild(t); - } + this.ops = ops; + this.comparators = comparators; + if (comparators == null) { + this.comparators = new ArrayList<exprType>(); } + for(PythonTree t : this.comparators) { + addChild(t); + } } public Compare(Integer ttype, Token token, exprType left, @@ -75,13 +75,14 @@ super(ttype, token); this.left = left; addChild(left); - this.ops = new ListWrapper<cmpopType>(ops); - this.comparators = new ListWrapper<exprType>(comparators); - if (comparators != null) { - for(PythonTree t : comparators) { - addChild(t); - } + this.ops = ops; + this.comparators = comparators; + if (comparators == null) { + this.comparators = new ArrayList<exprType>(); } + for(PythonTree t : this.comparators) { + addChild(t); + } } public Compare(PythonTree tree, exprType left, java.util.List<cmpopType> @@ -89,13 +90,14 @@ super(tree); this.left = left; addChild(left); - this.ops = new ListWrapper<cmpopType>(ops); - this.comparators = new ListWrapper<exprType>(comparators); - if (comparators != null) { - for(PythonTree t : comparators) { - addChild(t); - } + this.ops = ops; + this.comparators = comparators; + if (comparators == null) { + this.comparators = new ArrayList<exprType>(); } + for(PythonTree t : this.comparators) { + addChild(t); + } } public String toString() { Modified: branches/astwrite/src/org/python/antlr/ast/Continue.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Continue.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Continue.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; Modified: branches/astwrite/src/org/python/antlr/ast/Delete.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Delete.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Delete.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -9,16 +10,15 @@ import java.io.IOException; public class Delete extends stmtType { - private ListWrapper<exprType> targets; - public ListWrapper<exprType> getInternalTargets() { + private java.util.List<exprType> targets; + public java.util.List<exprType> getInternalTargets() { return targets; } public Object getTargets() { - return targets; + return new ListWrapper(targets); } public void setTargets(Object targets) { - this.targets = new ListWrapper<exprType>( - (java.util.List<exprType>)targets); + this.targets = AstAdapter.to_exprList(targets); } @@ -32,33 +32,36 @@ public Delete(Token token, java.util.List<exprType> targets) { super(token); - this.targets = new ListWrapper<exprType>(targets); - if (targets != null) { - for(PythonTree t : targets) { - addChild(t); - } + this.targets = targets; + if (targets == null) { + this.targets = new ArrayList<exprType>(); } + for(PythonTree t : this.targets) { + addChild(t); + } } public Delete(Integer ttype, Token token, java.util.List<exprType> targets) { super(ttype, token); - this.targets = new ListWrapper<exprType>(targets); - if (targets != null) { - for(PythonTree t : targets) { - addChild(t); - } + this.targets = targets; + if (targets == null) { + this.targets = new ArrayList<exprType>(); } + for(PythonTree t : this.targets) { + addChild(t); + } } public Delete(PythonTree tree, java.util.List<exprType> targets) { super(tree); - this.targets = new ListWrapper<exprType>(targets); - if (targets != null) { - for(PythonTree t : targets) { - addChild(t); - } + this.targets = targets; + if (targets == null) { + this.targets = new ArrayList<exprType>(); } + for(PythonTree t : this.targets) { + addChild(t); + } } public String toString() { Modified: branches/astwrite/src/org/python/antlr/ast/Dict.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Dict.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Dict.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -9,28 +10,26 @@ import java.io.IOException; public class Dict extends exprType { - private ListWrapper<exprType> keys; - public ListWrapper<exprType> getInternalKeys() { + private java.util.List<exprType> keys; + public java.util.List<exprType> getInternalKeys() { return keys; } public Object getKeys() { - return keys; + return new ListWrapper(keys); } public void setKeys(Object keys) { - this.keys = new ListWrapper<exprType>( - (java.util.List<exprType>)keys); + this.keys = AstAdapter.to_exprList(keys); } - private ListWrapper<exprType> values; - public ListWrapper<exprType> getInternalValues() { + private java.util.List<exprType> values; + public java.util.List<exprType> getInternalValues() { return values; } public Object getValues() { - return values; + return new ListWrapper(values); } public void setValues(Object values) { - this.values = new ListWrapper<exprType>( - (java.util.List<exprType>)values); + this.values = AstAdapter.to_exprList(values); } @@ -46,52 +45,58 @@ public Dict(Token token, java.util.List<exprType> keys, java.util.List<exprType> values) { super(token); - this.keys = new ListWrapper<exprType>(keys); - if (keys != null) { - for(PythonTree t : keys) { - addChild(t); - } + this.keys = keys; + if (keys == null) { + this.keys = new ArrayList<exprType>(); } - this.values = new ListWrapper<exprType>(values); - if (values != null) { - for(PythonTree t : values) { - addChild(t); - } + for(PythonTree t : this.keys) { + addChild(t); } + this.values = values; + if (values == null) { + this.values = new ArrayList<exprType>(); + } + for(PythonTree t : this.values) { + addChild(t); + } } public Dict(Integer ttype, Token token, java.util.List<exprType> keys, java.util.List<exprType> values) { super(ttype, token); - this.keys = new ListWrapper<exprType>(keys); - if (keys != null) { - for(PythonTree t : keys) { - addChild(t); - } + this.keys = keys; + if (keys == null) { + this.keys = new ArrayList<exprType>(); } - this.values = new ListWrapper<exprType>(values); - if (values != null) { - for(PythonTree t : values) { - addChild(t); - } + for(PythonTree t : this.keys) { + addChild(t); } + this.values = values; + if (values == null) { + this.values = new ArrayList<exprType>(); + } + for(PythonTree t : this.values) { + addChild(t); + } } public Dict(PythonTree tree, java.util.List<exprType> keys, java.util.List<exprType> values) { super(tree); - this.keys = new ListWrapper<exprType>(keys); - if (keys != null) { - for(PythonTree t : keys) { - addChild(t); - } + this.keys = keys; + if (keys == null) { + this.keys = new ArrayList<exprType>(); } - this.values = new ListWrapper<exprType>(values); - if (values != null) { - for(PythonTree t : values) { - addChild(t); - } + for(PythonTree t : this.keys) { + addChild(t); } + this.values = values; + if (values == null) { + this.values = new ArrayList<exprType>(); + } + for(PythonTree t : this.values) { + addChild(t); + } } public String toString() { Modified: branches/astwrite/src/org/python/antlr/ast/Ellipsis.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Ellipsis.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Ellipsis.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; Modified: branches/astwrite/src/org/python/antlr/ast/Exec.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Exec.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Exec.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; Modified: branches/astwrite/src/org/python/antlr/ast/Expr.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Expr.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Expr.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; Modified: branches/astwrite/src/org/python/antlr/ast/Expression.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Expression.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Expression.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; Modified: branches/astwrite/src/org/python/antlr/ast/ExtSlice.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/ExtSlice.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/ExtSlice.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -9,16 +10,15 @@ import java.io.IOException; public class ExtSlice extends sliceType { - private ListWrapper<sliceType> dims; - public ListWrapper<sliceType> getInternalDims() { + private java.util.List<sliceType> dims; + public java.util.List<sliceType> getInternalDims() { return dims; } public Object getDims() { - return dims; + return new ListWrapper(dims); } public void setDims(Object dims) { - this.dims = new ListWrapper<sliceType>( - (java.util.List<sliceType>)dims); + this.dims = AstAdapter.to_sliceList(dims); } @@ -32,33 +32,36 @@ public ExtSlice(Token token, java.util.List<sliceType> dims) { super(token); - this.dims = new ListWrapper<sliceType>(dims); - if (dims != null) { - for(PythonTree t : dims) { - addChild(t); - } + this.dims = dims; + if (dims == null) { + this.dims = new ArrayList<sliceType>(); } + for(PythonTree t : this.dims) { + addChild(t); + } } public ExtSlice(Integer ttype, Token token, java.util.List<sliceType> dims) { super(ttype, token); - this.dims = new ListWrapper<sliceType>(dims); - if (dims != null) { - for(PythonTree t : dims) { - addChild(t); - } + this.dims = dims; + if (dims == null) { + this.dims = new ArrayList<sliceType>(); } + for(PythonTree t : this.dims) { + addChild(t); + } } public ExtSlice(PythonTree tree, java.util.List<sliceType> dims) { super(tree); - this.dims = new ListWrapper<sliceType>(dims); - if (dims != null) { - for(PythonTree t : dims) { - addChild(t); - } + this.dims = dims; + if (dims == null) { + this.dims = new ArrayList<sliceType>(); } + for(PythonTree t : this.dims) { + addChild(t); + } } public String toString() { Modified: branches/astwrite/src/org/python/antlr/ast/For.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/For.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/For.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -31,28 +32,26 @@ this.iter = AstAdapter.to_expr(iter); } - private ListWrapper<stmtType> body; - public ListWrapper<stmtType> getInternalBody() { + private java.util.List<stmtType> body; + public java.util.List<stmtType> getInternalBody() { return body; } public Object getBody() { - return body; + return new ListWrapper(body); } public void setBody(Object body) { - this.body = new ListWrapper<stmtType>( - (java.util.List<stmtType>)body); + this.body = AstAdapter.to_stmtList(body); } - private ListWrapper<stmtType> orelse; - public ListWrapper<stmtType> getInternalOrelse() { + private java.util.List<stmtType> orelse; + public java.util.List<stmtType> getInternalOrelse() { return orelse; } public Object getOrelse() { - return orelse; + return new ListWrapper(orelse); } public void setOrelse(Object orelse) { - this.orelse = new ListWrapper<stmtType>( - (java.util.List<stmtType>)orelse); + this.orelse = AstAdapter.to_stmtList(orelse); } @@ -75,18 +74,20 @@ addChild(target); this.iter = iter; addChild(iter); - this.body = new ListWrapper<stmtType>(body); - if (body != null) { - for(PythonTree t : body) { - addChild(t); - } + this.body = body; + if (body == null) { + this.body = new ArrayList<stmtType>(); } - this.orelse = new ListWrapper<stmtType>(orelse); - if (orelse != null) { - for(PythonTree t : orelse) { - addChild(t); - } + for(PythonTree t : this.body) { + addChild(t); } + this.orelse = orelse; + if (orelse == null) { + this.orelse = new ArrayList<stmtType>(); + } + for(PythonTree t : this.orelse) { + addChild(t); + } } public For(Integer ttype, Token token, exprType target, exprType iter, @@ -96,18 +97,20 @@ addChild(target); this.iter = iter; addChild(iter); - this.body = new ListWrapper<stmtType>(body); - if (body != null) { - for(PythonTree t : body) { - addChild(t); - } + this.body = body; + if (body == null) { + this.body = new ArrayList<stmtType>(); } - this.orelse = new ListWrapper<stmtType>(orelse); - if (orelse != null) { - for(PythonTree t : orelse) { - addChild(t); - } + for(PythonTree t : this.body) { + addChild(t); } + this.orelse = orelse; + if (orelse == null) { + this.orelse = new ArrayList<stmtType>(); + } + for(PythonTree t : this.orelse) { + addChild(t); + } } public For(PythonTree tree, exprType target, exprType iter, @@ -117,18 +120,20 @@ addChild(target); this.iter = iter; addChild(iter); - this.body = new ListWrapper<stmtType>(body); - if (body != null) { - for(PythonTree t : body) { - addChild(t); - } + this.body = body; + if (body == null) { + this.body = new ArrayList<stmtType>(); } - this.orelse = new ListWrapper<stmtType>(orelse); - if (orelse != null) { - for(PythonTree t : orelse) { - addChild(t); - } + for(PythonTree t : this.body) { + addChild(t); } + this.orelse = orelse; + if (orelse == null) { + this.orelse = new ArrayList<stmtType>(); + } + for(PythonTree t : this.orelse) { + addChild(t); + } } public String toString() { Modified: branches/astwrite/src/org/python/antlr/ast/FunctionDef.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/FunctionDef.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/FunctionDef.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -31,28 +32,26 @@ this.args = AstAdapter.to_arguments(args); } - private ListWrapper<stmtType> body; - public ListWrapper<stmtType> getInternalBody() { + private java.util.List<stmtType> body; + public java.util.List<stmtType> getInternalBody() { return body; } public Object getBody() { - return body; + return new ListWrapper(body); } public void setBody(Object body) { - this.body = new ListWrapper<stmtType>( - (java.util.List<stmtType>)body); + this.body = AstAdapter.to_stmtList(body); } - private ListWrapper<exprType> decorators; - public ListWrapper<exprType> getInternalDecorators() { + private java.util.List<exprType> decorators; + public java.util.List<exprType> getInternalDecorators() { return decorators; } public Object getDecorators() { - return decorators; + return new ListWrapper(decorators); } public void setDecorators(Object decorators) { - this.decorators = new ListWrapper<exprType>( - (java.util.List<exprType>)decorators); + this.decorators = AstAdapter.to_exprList(decorators); } @@ -74,18 +73,20 @@ super(token); this.name = name; this.args = args; - this.body = new ListWrapper<stmtType>(body); - if (body != null) { - for(PythonTree t : body) { - addChild(t); - } + this.body = body; + if (body == null) { + this.body = new ArrayList<stmtType>(); } - this.decorators = new ListWrapper<exprType>(decorators); - if (decorators != null) { - for(PythonTree t : decorators) { - addChild(t); - } + for(PythonTree t : this.body) { + addChild(t); } + this.decorators = decorators; + if (decorators == null) { + this.decorators = new ArrayList<exprType>(); + } + for(PythonTree t : this.decorators) { + addChild(t); + } } public FunctionDef(Integer ttype, Token token, String name, argumentsType @@ -93,18 +94,20 @@ super(ttype, token); this.name = name; this.args = args; - this.body = new ListWrapper<stmtType>(body); - if (body != null) { - for(PythonTree t : body) { - addChild(t); - } + this.body = body; + if (body == null) { + this.body = new ArrayList<stmtType>(); } - this.decorators = new ListWrapper<exprType>(decorators); - if (decorators != null) { - for(PythonTree t : decorators) { - addChild(t); - } + for(PythonTree t : this.body) { + addChild(t); } + this.decorators = decorators; + if (decorators == null) { + this.decorators = new ArrayList<exprType>(); + } + for(PythonTree t : this.decorators) { + addChild(t); + } } public FunctionDef(PythonTree tree, String name, argumentsType args, @@ -112,18 +115,20 @@ super(tree); this.name = name; this.args = args; - this.body = new ListWrapper<stmtType>(body); - if (body != null) { - for(PythonTree t : body) { - addChild(t); - } + this.body = body; + if (body == null) { + this.body = new ArrayList<stmtType>(); } - this.decorators = new ListWrapper<exprType>(decorators); - if (decorators != null) { - for(PythonTree t : decorators) { - addChild(t); - } + for(PythonTree t : this.body) { + addChild(t); } + this.decorators = decorators; + if (decorators == null) { + this.decorators = new ArrayList<exprType>(); + } + for(PythonTree t : this.decorators) { + addChild(t); + } } public String toString() { Modified: branches/astwrite/src/org/python/antlr/ast/GeneratorExp.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/GeneratorExp.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/GeneratorExp.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -20,16 +21,15 @@ this.elt = AstAdapter.to_expr(elt); } - private ListWrapper<comprehensionType> generators; - public ListWrapper<comprehensionType> getInternalGenerators() { + private java.util.List<comprehensionType> generators; + public java.util.List<comprehensionType> getInternalGenerators() { return generators; } public Object getGenerators() { - return generators; + return new ListWrapper(generators); } public void setGenerators(Object generators) { - this.generators = new ListWrapper<comprehensionType>( - (java.util.List<comprehensionType>)generators); + this.generators = AstAdapter.to_comprehensionList(generators); } @@ -47,12 +47,13 @@ super(token); this.elt = elt; addChild(elt); - this.generators = new ListWrapper<comprehensionType>(generators); - if (generators != null) { - for(PythonTree t : generators) { - addChild(t); - } + this.generators = generators; + if (generators == null) { + this.generators = new ArrayList<comprehensionType>(); } + for(PythonTree t : this.generators) { + addChild(t); + } } public GeneratorExp(Integer ttype, Token token, exprType elt, @@ -60,12 +61,13 @@ super(ttype, token); this.elt = elt; addChild(elt); - this.generators = new ListWrapper<comprehensionType>(generators); - if (generators != null) { - for(PythonTree t : generators) { - addChild(t); - } + this.generators = generators; + if (generators == null) { + this.generators = new ArrayList<comprehensionType>(); } + for(PythonTree t : this.generators) { + addChild(t); + } } public GeneratorExp(PythonTree tree, exprType elt, @@ -73,12 +75,13 @@ super(tree); this.elt = elt; addChild(elt); - this.generators = new ListWrapper<comprehensionType>(generators); - if (generators != null) { - for(PythonTree t : generators) { - addChild(t); - } + this.generators = generators; + if (generators == null) { + this.generators = new ArrayList<comprehensionType>(); } + for(PythonTree t : this.generators) { + addChild(t); + } } public String toString() { Modified: branches/astwrite/src/org/python/antlr/ast/Global.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/Global.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/Global.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -9,16 +10,15 @@ import java.io.IOException; public class Global extends stmtType { - private ListWrapper<String> names; - public ListWrapper<String> getInternalNames() { + private java.util.List<String> names; + public java.util.List<String> getInternalNames() { return names; } public Object getNames() { - return names; + return new ListWrapper(names); } public void setNames(Object names) { - this.names = new ListWrapper<String>( - (java.util.List<String>)names); + this.names = AstAdapter.to_identifierList(names); } @@ -32,17 +32,17 @@ public Global(Token token, java.util.List<String> names) { super(token); - this.names = new ListWrapper<String>(names); + this.names = names; } public Global(Integer ttype, Token token, java.util.List<String> names) { super(ttype, token); - this.names = new ListWrapper<String>(names); + this.names = names; } public Global(PythonTree tree, java.util.List<String> names) { super(tree); - this.names = new ListWrapper<String>(names); + this.names = names; } public String toString() { Modified: branches/astwrite/src/org/python/antlr/ast/If.java =================================================================== --- branches/astwrite/src/org/python/antlr/ast/If.java 2008-11-24 05:52:36 UTC (rev 5632) +++ branches/astwrite/src/org/python/antlr/ast/If.java 2008-11-24 19:41:50 UTC (rev 5633) @@ -1,5 +1,6 @@ // Autogenerated AST node package org.python.antlr.ast; +import java.util.ArrayList; import org.python.antlr.AstAdapter; import org.python.antlr.PythonTree; import org.python.antlr.ListWrapper; @@ -20,28 +21,26 @@ this.test = AstAdapter.to_expr(test); } - private ListWrapper<stmtType> body; - public ListWrapper<stmtType> getInternalBody() { + private java.util.List<stmtType> body; + public java.util.List<stmtType> getInternalBody() { return body; } public Object getBody() { - return body; + return new ListWrapper(body); } public void setBo... [truncated message content] |