From: <fwi...@us...> - 2008-12-05 16:10:23
|
Revision: 5703 http://jython.svn.sourceforge.net/jython/?rev=5703&view=rev Author: fwierzbicki Date: 2008-12-05 16:10:15 +0000 (Fri, 05 Dec 2008) Log Message: ----------- org/python/antlr/op/* Derived classes, and fixed lineno, col_offset from ast_antlr.py Modified Paths: -------------- trunk/jython/ast/asdl_antlr.py trunk/jython/src/org/python/antlr/ast/Assert.java trunk/jython/src/org/python/antlr/ast/Assign.java trunk/jython/src/org/python/antlr/ast/Attribute.java trunk/jython/src/org/python/antlr/ast/AugAssign.java trunk/jython/src/org/python/antlr/ast/BinOp.java trunk/jython/src/org/python/antlr/ast/BoolOp.java trunk/jython/src/org/python/antlr/ast/Call.java trunk/jython/src/org/python/antlr/ast/ClassDef.java trunk/jython/src/org/python/antlr/ast/Compare.java trunk/jython/src/org/python/antlr/ast/Delete.java trunk/jython/src/org/python/antlr/ast/Dict.java trunk/jython/src/org/python/antlr/ast/ExceptHandler.java trunk/jython/src/org/python/antlr/ast/Exec.java trunk/jython/src/org/python/antlr/ast/Expr.java trunk/jython/src/org/python/antlr/ast/For.java trunk/jython/src/org/python/antlr/ast/FunctionDef.java trunk/jython/src/org/python/antlr/ast/GeneratorExp.java trunk/jython/src/org/python/antlr/ast/Global.java trunk/jython/src/org/python/antlr/ast/If.java trunk/jython/src/org/python/antlr/ast/IfExp.java trunk/jython/src/org/python/antlr/ast/Import.java trunk/jython/src/org/python/antlr/ast/ImportFrom.java trunk/jython/src/org/python/antlr/ast/Lambda.java trunk/jython/src/org/python/antlr/ast/List.java trunk/jython/src/org/python/antlr/ast/ListComp.java trunk/jython/src/org/python/antlr/ast/Name.java trunk/jython/src/org/python/antlr/ast/Num.java trunk/jython/src/org/python/antlr/ast/Print.java trunk/jython/src/org/python/antlr/ast/Raise.java trunk/jython/src/org/python/antlr/ast/Repr.java trunk/jython/src/org/python/antlr/ast/Return.java trunk/jython/src/org/python/antlr/ast/Str.java trunk/jython/src/org/python/antlr/ast/Subscript.java trunk/jython/src/org/python/antlr/ast/TryExcept.java trunk/jython/src/org/python/antlr/ast/TryFinally.java trunk/jython/src/org/python/antlr/ast/Tuple.java trunk/jython/src/org/python/antlr/ast/UnaryOp.java trunk/jython/src/org/python/antlr/ast/While.java trunk/jython/src/org/python/antlr/ast/With.java trunk/jython/src/org/python/antlr/ast/Yield.java trunk/jython/src/templates/mappings Added Paths: ----------- trunk/jython/src/org/python/antlr/op/AddDerived.java trunk/jython/src/org/python/antlr/op/AndDerived.java trunk/jython/src/org/python/antlr/op/AugLoadDerived.java trunk/jython/src/org/python/antlr/op/AugStoreDerived.java trunk/jython/src/org/python/antlr/op/BitAndDerived.java trunk/jython/src/org/python/antlr/op/BitOrDerived.java trunk/jython/src/org/python/antlr/op/BitXorDerived.java trunk/jython/src/org/python/antlr/op/DelDerived.java trunk/jython/src/org/python/antlr/op/DivDerived.java trunk/jython/src/org/python/antlr/op/EqDerived.java trunk/jython/src/org/python/antlr/op/FloorDivDerived.java trunk/jython/src/org/python/antlr/op/GtDerived.java trunk/jython/src/org/python/antlr/op/GtEDerived.java trunk/jython/src/org/python/antlr/op/InDerived.java trunk/jython/src/org/python/antlr/op/InvertDerived.java trunk/jython/src/org/python/antlr/op/IsDerived.java trunk/jython/src/org/python/antlr/op/IsNotDerived.java trunk/jython/src/org/python/antlr/op/LShiftDerived.java trunk/jython/src/org/python/antlr/op/LoadDerived.java trunk/jython/src/org/python/antlr/op/LtDerived.java trunk/jython/src/org/python/antlr/op/LtEDerived.java trunk/jython/src/org/python/antlr/op/ModDerived.java trunk/jython/src/org/python/antlr/op/MultDerived.java trunk/jython/src/org/python/antlr/op/NotDerived.java trunk/jython/src/org/python/antlr/op/NotEqDerived.java trunk/jython/src/org/python/antlr/op/NotInDerived.java trunk/jython/src/org/python/antlr/op/OrDerived.java trunk/jython/src/org/python/antlr/op/ParamDerived.java trunk/jython/src/org/python/antlr/op/PowDerived.java trunk/jython/src/org/python/antlr/op/RShiftDerived.java trunk/jython/src/org/python/antlr/op/StoreDerived.java trunk/jython/src/org/python/antlr/op/SubDerived.java trunk/jython/src/org/python/antlr/op/UAddDerived.java trunk/jython/src/org/python/antlr/op/USubDerived.java trunk/jython/src/templates/op_Add.derived trunk/jython/src/templates/op_And.derived trunk/jython/src/templates/op_AugLoad.derived trunk/jython/src/templates/op_AugStore.derived trunk/jython/src/templates/op_BitAnd.derived trunk/jython/src/templates/op_BitOr.derived trunk/jython/src/templates/op_BitXor.derived trunk/jython/src/templates/op_Del.derived trunk/jython/src/templates/op_Div.derived trunk/jython/src/templates/op_Eq.derived trunk/jython/src/templates/op_FloorDiv.derived trunk/jython/src/templates/op_Gt.derived trunk/jython/src/templates/op_GtE.derived trunk/jython/src/templates/op_In.derived trunk/jython/src/templates/op_Invert.derived trunk/jython/src/templates/op_Is.derived trunk/jython/src/templates/op_IsNot.derived trunk/jython/src/templates/op_LShift.derived trunk/jython/src/templates/op_Load.derived trunk/jython/src/templates/op_Lt.derived trunk/jython/src/templates/op_LtE.derived trunk/jython/src/templates/op_Mod.derived trunk/jython/src/templates/op_Mult.derived trunk/jython/src/templates/op_Not.derived trunk/jython/src/templates/op_NotEq.derived trunk/jython/src/templates/op_NotIn.derived trunk/jython/src/templates/op_Or.derived trunk/jython/src/templates/op_Param.derived trunk/jython/src/templates/op_Pow.derived trunk/jython/src/templates/op_RShift.derived trunk/jython/src/templates/op_Store.derived trunk/jython/src/templates/op_Sub.derived trunk/jython/src/templates/op_UAdd.derived trunk/jython/src/templates/op_USub.derived Modified: trunk/jython/ast/asdl_antlr.py =================================================================== --- trunk/jython/ast/asdl_antlr.py 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/ast/asdl_antlr.py 2008-12-05 16:10:15 UTC (rev 5703) @@ -308,7 +308,7 @@ self.attributes(product, name, depth) - self.javaMethods(product, name, "%s" % name, product.fields, + self.javaMethods(product, name, name, True, product.fields, depth+1) self.emit("}", depth) @@ -334,7 +334,7 @@ self.attributes(cons, name, depth) - self.javaMethods(cons, cons.name, cons.name, cons.fields, depth+1) + self.javaMethods(cons, name, cons.name, False, cons.fields, depth+1) if "Context" in ifaces: self.emit("public void setContext(expr_contextType c) {", depth + 1) @@ -406,9 +406,9 @@ #XXX: this method used to emit a pickle(DataOutputStream ostream) for cPickle support. # If we want to re-add it, see Jython 2.2's pickle method in its ast nodes. - def javaMethods(self, type, clsname, ctorname, fields, depth): + def javaMethods(self, type, name, clsname, is_product, fields, depth): - self.javaConstructors(type, clsname, ctorname, fields, depth) + self.javaConstructors(type, name, clsname, is_product, fields, depth) # The toString() method self.emit('@ExposedGet(name = "repr")', depth) @@ -432,11 +432,11 @@ # The accept() method self.emit("public <R> R accept(VisitorIF<R> visitor) throws Exception {", depth) - if clsname == ctorname: - self.emit('return visitor.visit%s(this);' % clsname, depth+1) - else: + if is_product: self.emit('traverse(visitor);' % clsname, depth+1) self.emit('return null;' % clsname, depth+1) + else: + self.emit('return visitor.visit%s(this);' % clsname, depth+1) self.emit("}", depth) self.emit("", 0) @@ -461,39 +461,39 @@ self.emit('}', depth) self.emit("", 0) - def javaConstructors(self, type, clsname, ctorname, fields, depth): - self.emit("public %s(PyType subType) {" % (ctorname), depth) + def javaConstructors(self, type, name, clsname, is_product, fields, depth): + self.emit("public %s(PyType subType) {" % (clsname), depth) self.emit("super(subType);", depth + 1) self.emit("}", depth) if len(fields) > 0: - self.emit("public %s() {" % (ctorname), depth) + self.emit("public %s() {" % (clsname), depth) self.emit("this(TYPE);", depth + 1) self.emit("}", depth) fnames = ['"%s"' % f.name for f in fields] - if str(clsname) in ('stmt', 'expr', 'excepthandler'): + if str(name) in ('stmt', 'expr', 'excepthandler'): fnames.extend(['"lineno"', '"col_offset"']) fpargs = ", ".join(fnames) self.emit("@ExposedNew", depth) self.emit("@ExposedMethod", depth) - self.emit("public void %s___init__(PyObject[] args, String[] keywords) {" % ctorname, depth) - self.emit('ArgParser ap = new ArgParser("%s", args, keywords, new String[]' % ctorname, depth + 1) + self.emit("public void %s___init__(PyObject[] args, String[] keywords) {" % clsname, depth) + self.emit('ArgParser ap = new ArgParser("%s", args, keywords, new String[]' % clsname, depth + 1) self.emit('{%s}, %s);' % (fpargs, len(fields)), depth + 2) i = 0 for f in fields: self.emit("set%s(ap.getPyObject(%s));" % (str(f.name).capitalize(), str(i)), depth+1) i += 1 - if str(clsname) in ('stmt', 'expr', 'excepthandler'): - self.emit("PyObject lin = ap.getPyObject(%s, null);" % str(i), depth + 1) - self.emit("if (lin != null) {", depth + 1) + if str(name) in ('stmt', 'expr', 'excepthandler'): + self.emit("int lin = ap.getInt(%s, -1);" % str(i), depth + 1) + self.emit("if (lin != -1) {", depth + 1) self.emit("setLineno(lin);", depth + 2) self.emit("}", depth + 1) self.emit("", 0) - self.emit("PyObject col = ap.getPyObject(%s, null);" % str(i+1), depth + 1) - self.emit("if (col != null) {", depth + 1) + self.emit("int col = ap.getInt(%s, -1);" % str(i+1), depth + 1) + self.emit("if (col != -1) {", depth + 1) self.emit("setLineno(col);", depth + 2) self.emit("}", depth + 1) self.emit("", 0) @@ -502,7 +502,7 @@ self.emit("", 0) fpargs = ", ".join(["PyObject %s" % f.name for f in fields]) - self.emit("public %s(%s) {" % (ctorname, fpargs), depth) + self.emit("public %s(%s) {" % (clsname, fpargs), depth) for f in fields: self.emit("set%s(%s);" % (str(f.name).capitalize(), f.name), depth+1) @@ -512,7 +512,7 @@ token = asdl.Field('Token', 'token') token.typedef = False fpargs = ", ".join([self.fieldDef(f) for f in [token] + fields]) - self.emit("public %s(%s) {" % (ctorname, fpargs), depth) + self.emit("public %s(%s) {" % (clsname, fpargs), depth) self.emit("super(token);", depth+1) self.javaConstructorHelper(fields, depth) self.emit("}", depth) @@ -521,7 +521,7 @@ ttype = asdl.Field('int', 'ttype') ttype.typedef = False fpargs = ", ".join([self.fieldDef(f) for f in [ttype, token] + fields]) - self.emit("public %s(%s) {" % (ctorname, fpargs), depth) + self.emit("public %s(%s) {" % (clsname, fpargs), depth) self.emit("super(ttype, token);", depth+1) self.javaConstructorHelper(fields, depth) self.emit("}", depth) @@ -530,7 +530,7 @@ tree = asdl.Field('PythonTree', 'tree') tree.typedef = False fpargs = ", ".join([self.fieldDef(f) for f in [tree] + fields]) - self.emit("public %s(%s) {" % (ctorname, fpargs), depth) + self.emit("public %s(%s) {" % (clsname, fpargs), depth) self.emit("super(tree);", depth+1) self.javaConstructorHelper(fields, depth) self.emit("}", depth) Modified: trunk/jython/src/org/python/antlr/ast/Assert.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Assert.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Assert.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -75,9 +75,19 @@ @ExposedMethod public void Assert___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Assert", args, keywords, new String[] - {"test", "msg"}, 2); + {"test", "msg", "lineno", "col_offset"}, 2); setTest(ap.getPyObject(0)); setMsg(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public Assert(PyObject test, PyObject msg) { Modified: trunk/jython/src/org/python/antlr/ast/Assign.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Assign.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Assign.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -75,9 +75,19 @@ @ExposedMethod public void Assign___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Assign", args, keywords, new String[] - {"targets", "value"}, 2); + {"targets", "value", "lineno", "col_offset"}, 2); setTargets(ap.getPyObject(0)); setValue(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public Assign(PyObject targets, PyObject value) { Modified: trunk/jython/src/org/python/antlr/ast/Attribute.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Attribute.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Attribute.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -89,10 +89,20 @@ @ExposedMethod public void Attribute___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Attribute", args, keywords, new String[] - {"value", "attr", "ctx"}, 3); + {"value", "attr", "ctx", "lineno", "col_offset"}, 3); setValue(ap.getPyObject(0)); setAttr(ap.getPyObject(1)); setCtx(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public Attribute(PyObject value, PyObject attr, PyObject ctx) { Modified: trunk/jython/src/org/python/antlr/ast/AugAssign.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/AugAssign.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/AugAssign.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -88,10 +88,20 @@ @ExposedMethod public void AugAssign___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("AugAssign", args, keywords, new String[] - {"target", "op", "value"}, 3); + {"target", "op", "value", "lineno", "col_offset"}, 3); setTarget(ap.getPyObject(0)); setOp(ap.getPyObject(1)); setValue(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public AugAssign(PyObject target, PyObject op, PyObject value) { Modified: trunk/jython/src/org/python/antlr/ast/BinOp.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/BinOp.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/BinOp.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -88,10 +88,20 @@ @ExposedMethod public void BinOp___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("BinOp", args, keywords, new String[] - {"left", "op", "right"}, 3); + {"left", "op", "right", "lineno", "col_offset"}, 3); setLeft(ap.getPyObject(0)); setOp(ap.getPyObject(1)); setRight(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public BinOp(PyObject left, PyObject op, PyObject right) { Modified: trunk/jython/src/org/python/antlr/ast/BoolOp.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/BoolOp.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/BoolOp.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -75,9 +75,19 @@ @ExposedMethod public void BoolOp___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("BoolOp", args, keywords, new String[] - {"op", "values"}, 2); + {"op", "values", "lineno", "col_offset"}, 2); setOp(ap.getPyObject(0)); setValues(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public BoolOp(PyObject op, PyObject values) { Modified: trunk/jython/src/org/python/antlr/ast/Call.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Call.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Call.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -115,12 +115,22 @@ @ExposedMethod public void Call___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Call", args, keywords, new String[] - {"func", "args", "keywords", "starargs", "kwargs"}, 5); + {"func", "args", "keywords", "starargs", "kwargs", "lineno", "col_offset"}, 5); setFunc(ap.getPyObject(0)); setArgs(ap.getPyObject(1)); setKeywords(ap.getPyObject(2)); setStarargs(ap.getPyObject(3)); setKwargs(ap.getPyObject(4)); + int lin = ap.getInt(5, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(6, -1); + if (col != -1) { + setLineno(col); + } + } public Call(PyObject func, PyObject args, PyObject keywords, PyObject starargs, PyObject Modified: trunk/jython/src/org/python/antlr/ast/ClassDef.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ClassDef.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/ClassDef.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -103,11 +103,21 @@ @ExposedMethod public void ClassDef___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("ClassDef", args, keywords, new String[] - {"name", "bases", "body", "decorator_list"}, 4); + {"name", "bases", "body", "decorator_list", "lineno", "col_offset"}, 4); setName(ap.getPyObject(0)); setBases(ap.getPyObject(1)); setBody(ap.getPyObject(2)); setDecorator_list(ap.getPyObject(3)); + int lin = ap.getInt(4, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(5, -1); + if (col != -1) { + setLineno(col); + } + } public ClassDef(PyObject name, PyObject bases, PyObject body, PyObject decorator_list) { Modified: trunk/jython/src/org/python/antlr/ast/Compare.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Compare.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Compare.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -88,10 +88,20 @@ @ExposedMethod public void Compare___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Compare", args, keywords, new String[] - {"left", "ops", "comparators"}, 3); + {"left", "ops", "comparators", "lineno", "col_offset"}, 3); setLeft(ap.getPyObject(0)); setOps(ap.getPyObject(1)); setComparators(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public Compare(PyObject left, PyObject ops, PyObject comparators) { Modified: trunk/jython/src/org/python/antlr/ast/Delete.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Delete.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Delete.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -62,8 +62,18 @@ @ExposedMethod public void Delete___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Delete", args, keywords, new String[] - {"targets"}, 1); + {"targets", "lineno", "col_offset"}, 1); setTargets(ap.getPyObject(0)); + int lin = ap.getInt(1, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(2, -1); + if (col != -1) { + setLineno(col); + } + } public Delete(PyObject targets) { Modified: trunk/jython/src/org/python/antlr/ast/Dict.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Dict.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Dict.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -75,9 +75,19 @@ @ExposedMethod public void Dict___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Dict", args, keywords, new String[] - {"keys", "values"}, 2); + {"keys", "values", "lineno", "col_offset"}, 2); setKeys(ap.getPyObject(0)); setValues(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public Dict(PyObject keys, PyObject values) { Modified: trunk/jython/src/org/python/antlr/ast/ExceptHandler.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ExceptHandler.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/ExceptHandler.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -88,10 +88,20 @@ @ExposedMethod public void ExceptHandler___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("ExceptHandler", args, keywords, new String[] - {"excepttype", "name", "body"}, 3); + {"excepttype", "name", "body", "lineno", "col_offset"}, 3); setExcepttype(ap.getPyObject(0)); setName(ap.getPyObject(1)); setBody(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public ExceptHandler(PyObject excepttype, PyObject name, PyObject body) { Modified: trunk/jython/src/org/python/antlr/ast/Exec.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Exec.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Exec.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -88,10 +88,20 @@ @ExposedMethod public void Exec___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Exec", args, keywords, new String[] - {"body", "globals", "locals"}, 3); + {"body", "globals", "locals", "lineno", "col_offset"}, 3); setBody(ap.getPyObject(0)); setGlobals(ap.getPyObject(1)); setLocals(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public Exec(PyObject body, PyObject globals, PyObject locals) { Modified: trunk/jython/src/org/python/antlr/ast/Expr.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Expr.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Expr.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -62,8 +62,18 @@ @ExposedMethod public void Expr___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Expr", args, keywords, new String[] - {"value"}, 1); + {"value", "lineno", "col_offset"}, 1); setValue(ap.getPyObject(0)); + int lin = ap.getInt(1, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(2, -1); + if (col != -1) { + setLineno(col); + } + } public Expr(PyObject value) { Modified: trunk/jython/src/org/python/antlr/ast/For.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/For.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/For.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -102,11 +102,21 @@ @ExposedMethod public void For___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("For", args, keywords, new String[] - {"target", "iter", "body", "orelse"}, 4); + {"target", "iter", "body", "orelse", "lineno", "col_offset"}, 4); setTarget(ap.getPyObject(0)); setIter(ap.getPyObject(1)); setBody(ap.getPyObject(2)); setOrelse(ap.getPyObject(3)); + int lin = ap.getInt(4, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(5, -1); + if (col != -1) { + setLineno(col); + } + } public For(PyObject target, PyObject iter, PyObject body, PyObject orelse) { Modified: trunk/jython/src/org/python/antlr/ast/FunctionDef.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/FunctionDef.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/FunctionDef.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -103,11 +103,21 @@ @ExposedMethod public void FunctionDef___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("FunctionDef", args, keywords, new String[] - {"name", "args", "body", "decorator_list"}, 4); + {"name", "args", "body", "decorator_list", "lineno", "col_offset"}, 4); setName(ap.getPyObject(0)); setArgs(ap.getPyObject(1)); setBody(ap.getPyObject(2)); setDecorator_list(ap.getPyObject(3)); + int lin = ap.getInt(4, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(5, -1); + if (col != -1) { + setLineno(col); + } + } public FunctionDef(PyObject name, PyObject args, PyObject body, PyObject decorator_list) { Modified: trunk/jython/src/org/python/antlr/ast/GeneratorExp.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/GeneratorExp.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/GeneratorExp.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -75,9 +75,19 @@ @ExposedMethod public void GeneratorExp___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("GeneratorExp", args, keywords, new String[] - {"elt", "generators"}, 2); + {"elt", "generators", "lineno", "col_offset"}, 2); setElt(ap.getPyObject(0)); setGenerators(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public GeneratorExp(PyObject elt, PyObject generators) { Modified: trunk/jython/src/org/python/antlr/ast/Global.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Global.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Global.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -62,8 +62,18 @@ @ExposedMethod public void Global___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Global", args, keywords, new String[] - {"names"}, 1); + {"names", "lineno", "col_offset"}, 1); setNames(ap.getPyObject(0)); + int lin = ap.getInt(1, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(2, -1); + if (col != -1) { + setLineno(col); + } + } public Global(PyObject names) { Modified: trunk/jython/src/org/python/antlr/ast/If.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/If.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/If.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -88,10 +88,20 @@ @ExposedMethod public void If___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("If", args, keywords, new String[] - {"test", "body", "orelse"}, 3); + {"test", "body", "orelse", "lineno", "col_offset"}, 3); setTest(ap.getPyObject(0)); setBody(ap.getPyObject(1)); setOrelse(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public If(PyObject test, PyObject body, PyObject orelse) { Modified: trunk/jython/src/org/python/antlr/ast/IfExp.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/IfExp.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/IfExp.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -88,10 +88,20 @@ @ExposedMethod public void IfExp___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("IfExp", args, keywords, new String[] - {"test", "body", "orelse"}, 3); + {"test", "body", "orelse", "lineno", "col_offset"}, 3); setTest(ap.getPyObject(0)); setBody(ap.getPyObject(1)); setOrelse(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public IfExp(PyObject test, PyObject body, PyObject orelse) { Modified: trunk/jython/src/org/python/antlr/ast/Import.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Import.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Import.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -62,8 +62,18 @@ @ExposedMethod public void Import___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Import", args, keywords, new String[] - {"names"}, 1); + {"names", "lineno", "col_offset"}, 1); setNames(ap.getPyObject(0)); + int lin = ap.getInt(1, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(2, -1); + if (col != -1) { + setLineno(col); + } + } public Import(PyObject names) { Modified: trunk/jython/src/org/python/antlr/ast/ImportFrom.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ImportFrom.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/ImportFrom.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -89,10 +89,20 @@ @ExposedMethod public void ImportFrom___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("ImportFrom", args, keywords, new String[] - {"module", "names", "level"}, 3); + {"module", "names", "level", "lineno", "col_offset"}, 3); setModule(ap.getPyObject(0)); setNames(ap.getPyObject(1)); setLevel(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public ImportFrom(PyObject module, PyObject names, PyObject level) { Modified: trunk/jython/src/org/python/antlr/ast/Lambda.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Lambda.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Lambda.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -75,9 +75,19 @@ @ExposedMethod public void Lambda___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Lambda", args, keywords, new String[] - {"args", "body"}, 2); + {"args", "body", "lineno", "col_offset"}, 2); setArgs(ap.getPyObject(0)); setBody(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public Lambda(PyObject args, PyObject body) { Modified: trunk/jython/src/org/python/antlr/ast/List.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/List.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/List.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -75,9 +75,19 @@ @ExposedMethod public void List___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("List", args, keywords, new String[] - {"elts", "ctx"}, 2); + {"elts", "ctx", "lineno", "col_offset"}, 2); setElts(ap.getPyObject(0)); setCtx(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public List(PyObject elts, PyObject ctx) { Modified: trunk/jython/src/org/python/antlr/ast/ListComp.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ListComp.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/ListComp.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -75,9 +75,19 @@ @ExposedMethod public void ListComp___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("ListComp", args, keywords, new String[] - {"elt", "generators"}, 2); + {"elt", "generators", "lineno", "col_offset"}, 2); setElt(ap.getPyObject(0)); setGenerators(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public ListComp(PyObject elt, PyObject generators) { Modified: trunk/jython/src/org/python/antlr/ast/Name.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Name.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Name.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -76,9 +76,19 @@ @ExposedMethod public void Name___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Name", args, keywords, new String[] - {"id", "ctx"}, 2); + {"id", "ctx", "lineno", "col_offset"}, 2); setId(ap.getPyObject(0)); setCtx(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public Name(PyObject id, PyObject ctx) { Modified: trunk/jython/src/org/python/antlr/ast/Num.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Num.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Num.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -62,8 +62,18 @@ @ExposedMethod public void Num___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Num", args, keywords, new String[] - {"n"}, 1); + {"n", "lineno", "col_offset"}, 1); setN(ap.getPyObject(0)); + int lin = ap.getInt(1, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(2, -1); + if (col != -1) { + setLineno(col); + } + } public Num(PyObject n) { Modified: trunk/jython/src/org/python/antlr/ast/Print.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Print.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Print.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -89,10 +89,20 @@ @ExposedMethod public void Print___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Print", args, keywords, new String[] - {"dest", "values", "nl"}, 3); + {"dest", "values", "nl", "lineno", "col_offset"}, 3); setDest(ap.getPyObject(0)); setValues(ap.getPyObject(1)); setNl(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public Print(PyObject dest, PyObject values, PyObject nl) { Modified: trunk/jython/src/org/python/antlr/ast/Raise.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Raise.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Raise.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -88,10 +88,20 @@ @ExposedMethod public void Raise___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Raise", args, keywords, new String[] - {"excepttype", "inst", "tback"}, 3); + {"excepttype", "inst", "tback", "lineno", "col_offset"}, 3); setExcepttype(ap.getPyObject(0)); setInst(ap.getPyObject(1)); setTback(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public Raise(PyObject excepttype, PyObject inst, PyObject tback) { Modified: trunk/jython/src/org/python/antlr/ast/Repr.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Repr.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Repr.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -62,8 +62,18 @@ @ExposedMethod public void Repr___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Repr", args, keywords, new String[] - {"value"}, 1); + {"value", "lineno", "col_offset"}, 1); setValue(ap.getPyObject(0)); + int lin = ap.getInt(1, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(2, -1); + if (col != -1) { + setLineno(col); + } + } public Repr(PyObject value) { Modified: trunk/jython/src/org/python/antlr/ast/Return.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Return.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Return.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -62,8 +62,18 @@ @ExposedMethod public void Return___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Return", args, keywords, new String[] - {"value"}, 1); + {"value", "lineno", "col_offset"}, 1); setValue(ap.getPyObject(0)); + int lin = ap.getInt(1, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(2, -1); + if (col != -1) { + setLineno(col); + } + } public Return(PyObject value) { Modified: trunk/jython/src/org/python/antlr/ast/Str.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Str.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Str.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -62,8 +62,18 @@ @ExposedMethod public void Str___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Str", args, keywords, new String[] - {"s"}, 1); + {"s", "lineno", "col_offset"}, 1); setS(ap.getPyObject(0)); + int lin = ap.getInt(1, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(2, -1); + if (col != -1) { + setLineno(col); + } + } public Str(PyObject s) { Modified: trunk/jython/src/org/python/antlr/ast/Subscript.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Subscript.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Subscript.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -88,10 +88,20 @@ @ExposedMethod public void Subscript___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Subscript", args, keywords, new String[] - {"value", "slice", "ctx"}, 3); + {"value", "slice", "ctx", "lineno", "col_offset"}, 3); setValue(ap.getPyObject(0)); setSlice(ap.getPyObject(1)); setCtx(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public Subscript(PyObject value, PyObject slice, PyObject ctx) { Modified: trunk/jython/src/org/python/antlr/ast/TryExcept.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/TryExcept.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/TryExcept.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -88,10 +88,20 @@ @ExposedMethod public void TryExcept___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("TryExcept", args, keywords, new String[] - {"body", "handlers", "orelse"}, 3); + {"body", "handlers", "orelse", "lineno", "col_offset"}, 3); setBody(ap.getPyObject(0)); setHandlers(ap.getPyObject(1)); setOrelse(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public TryExcept(PyObject body, PyObject handlers, PyObject orelse) { Modified: trunk/jython/src/org/python/antlr/ast/TryFinally.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/TryFinally.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/TryFinally.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -75,9 +75,19 @@ @ExposedMethod public void TryFinally___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("TryFinally", args, keywords, new String[] - {"body", "finalbody"}, 2); + {"body", "finalbody", "lineno", "col_offset"}, 2); setBody(ap.getPyObject(0)); setFinalbody(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public TryFinally(PyObject body, PyObject finalbody) { Modified: trunk/jython/src/org/python/antlr/ast/Tuple.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Tuple.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Tuple.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -75,9 +75,19 @@ @ExposedMethod public void Tuple___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Tuple", args, keywords, new String[] - {"elts", "ctx"}, 2); + {"elts", "ctx", "lineno", "col_offset"}, 2); setElts(ap.getPyObject(0)); setCtx(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public Tuple(PyObject elts, PyObject ctx) { Modified: trunk/jython/src/org/python/antlr/ast/UnaryOp.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/UnaryOp.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/UnaryOp.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -75,9 +75,19 @@ @ExposedMethod public void UnaryOp___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("UnaryOp", args, keywords, new String[] - {"op", "operand"}, 2); + {"op", "operand", "lineno", "col_offset"}, 2); setOp(ap.getPyObject(0)); setOperand(ap.getPyObject(1)); + int lin = ap.getInt(2, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(3, -1); + if (col != -1) { + setLineno(col); + } + } public UnaryOp(PyObject op, PyObject operand) { Modified: trunk/jython/src/org/python/antlr/ast/While.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/While.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/While.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -88,10 +88,20 @@ @ExposedMethod public void While___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("While", args, keywords, new String[] - {"test", "body", "orelse"}, 3); + {"test", "body", "orelse", "lineno", "col_offset"}, 3); setTest(ap.getPyObject(0)); setBody(ap.getPyObject(1)); setOrelse(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public While(PyObject test, PyObject body, PyObject orelse) { Modified: trunk/jython/src/org/python/antlr/ast/With.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/With.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/With.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -89,10 +89,20 @@ @ExposedMethod public void With___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("With", args, keywords, new String[] - {"context_expr", "optional_vars", "body"}, 3); + {"context_expr", "optional_vars", "body", "lineno", "col_offset"}, 3); setContext_expr(ap.getPyObject(0)); setOptional_vars(ap.getPyObject(1)); setBody(ap.getPyObject(2)); + int lin = ap.getInt(3, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(4, -1); + if (col != -1) { + setLineno(col); + } + } public With(PyObject context_expr, PyObject optional_vars, PyObject body) { Modified: trunk/jython/src/org/python/antlr/ast/Yield.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Yield.java 2008-12-05 14:26:10 UTC (rev 5702) +++ trunk/jython/src/org/python/antlr/ast/Yield.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -62,8 +62,18 @@ @ExposedMethod public void Yield___init__(PyObject[] args, String[] keywords) { ArgParser ap = new ArgParser("Yield", args, keywords, new String[] - {"value"}, 1); + {"value", "lineno", "col_offset"}, 1); setValue(ap.getPyObject(0)); + int lin = ap.getInt(1, -1); + if (lin != -1) { + setLineno(lin); + } + + int col = ap.getInt(2, -1); + if (col != -1) { + setLineno(col); + } + } public Yield(PyObject value) { Added: trunk/jython/src/org/python/antlr/op/AddDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/op/AddDerived.java (rev 0) +++ trunk/jython/src/org/python/antlr/op/AddDerived.java 2008-12-05 16:10:15 UTC (rev 5703) @@ -0,0 +1,1156 @@ +/* Generated file, do not modify. See jython/src/templates/gderived.py. */ +package org.python.antlr.op; + +import org.python.core.*; + +public class AddDerived extends Add implements Slotted { + + public PyObject getSlot(int index) { + return slots[index]; + } + + public void setSlot(int index,PyObject value) { + slots[index]=value; + } + + private PyObject[]slots; + + private PyObject dict; + + public PyObject fastGetDict() { + return dict; + } + + public PyObject getDict() { + return dict; + } + + public void setDict(PyObject newDict) { + if (newDict instanceof PyStringMap||newDict instanceof PyDictionary) { + dict=newDict; + } else { + throw Py.TypeError("__dict__ must be set to a Dictionary "+newDict.getClass().getName()); + } + } + + public void delDict() { + // deleting an object's instance dict makes it grow a new one + dict=new PyStringMap(); + } + + public AddDerived(PyType subtype) { + super(subtype); + slots=new PyObject[subtype.getNumSlots()]; + dict=subtype.instDict(); + } + + public PyString __str__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__str__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyString) + return(PyString)res; + throw Py.TypeError("__str__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")"); + } + return super.__str__(); + } + + public PyString __repr__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__repr__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyString) + return(PyString)res; + throw Py.TypeError("__repr__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")"); + } + return super.__repr__(); + } + + public PyString __hex__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__hex__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyString) + return(PyString)res; + throw Py.TypeError("__hex__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")"); + } + return super.__hex__(); + } + + public PyString __oct__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__oct__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyString) + return(PyString)res; + throw Py.TypeError("__oct__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")"); + } + return super.__oct__(); + } + + public PyFloat __float__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__float__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyFloat) + return(PyFloat)res; + throw Py.TypeError("__float__"+" returned non-"+"float"+" (type "+res.getType().fastGetName()+")"); + } + return super.__float__(); + } + + public PyComplex __complex__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__complex__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyComplex) + return(PyComplex)res; + throw Py.TypeError("__complex__"+" returned non-"+"complex"+" (type "+res.getType().fastGetName()+")"); + } + return super.__complex__(); + } + + public PyObject __pos__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__pos__"); + if (impl!=null) + return impl.__get__(this,self_type).__call__(); + return super.__pos__(); + } + + public PyObject __neg__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__neg__"); + if (impl!=null) + return impl.__get__(this,self_type).__call__(); + return super.__neg__(); + } + + public PyObject __abs__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__abs__"); + if (impl!=null) + return impl.__get__(this,self_type).__call__(); + return super.__abs__(); + } + + public PyObject __invert__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__invert__"); + if (impl!=null) + return impl.__get__(this,self_type).__call__(); + return super.__invert__(); + } + + public PyObject __reduce__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__reduce__"); + if (impl!=null) + return impl.__get__(this,self_type).__call__(); + return super.__reduce__(); + } + + public PyObject __add__(PyObject other) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__add__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } + return super.__add__(other); + } + + public PyObject __radd__(PyObject other) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__radd__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } + return super.__radd__(other); + } + + public PyObject __sub__(PyObject other) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__sub__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } + return super.__sub__(other); + } + + public PyObject __rsub__(PyObject other) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__rsub__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } + return super.__rsub__(other); + } + + public PyObject __mul__(PyObject other) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__mul__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } + return super.__mul__(other); + } + + public PyObject __rmul__(PyObject other) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__rmul__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } + return super.__rmul__(other); + } + + public PyObject __div__(PyObject other) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__div__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } + return super.__div__(other); + } + + public PyObject __rdiv__(PyObject other) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__rdiv__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } + return super.__rdiv__(other); + } + + public PyObject __floordiv__(PyObject other) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__floordiv__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } + return super.__floordiv__(other); + } + + public PyObject __rfloordiv__(PyObject other) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__rfloordiv__"); + if (impl!=null) { + Py... [truncated message content] |