From 4786345f7b729169ec3be2676577662c6d06e005 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Sun, 9 Mar 2014 12:10:03 +0100 Subject: [PATCH] =?UTF-8?q?Felder=20(Field)=20m=C3=BCssen=20nun=20immer=20?= =?UTF-8?q?mit=20einem=20Offset=20initialisiert=20werden.=20Fehler=20behob?= =?UTF-8?q?en.=20Parser=20modifiziert.=20VariableTypeInsertTest=20l=C3=A4u?= =?UTF-8?q?ft=20erfolgreich?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/mycompiler/myparser/JavaParser.jay | 11 +- src/mycompiler/myclass/Constant.java | 2 + src/mycompiler/myclass/Constructor.java | 2 + src/mycompiler/myclass/Field.java | 4 + src/mycompiler/myclass/FieldDeclaration.java | 4 + src/mycompiler/myclass/Method.java | 6 +- src/mycompiler/myparser/JavaParser.java | 305 ++++++++++--------- src/mycompiler/myparser/JavaParser.jay | 11 +- src/typinferenz/FunNMethod.java | 1 + 9 files changed, 183 insertions(+), 163 deletions(-) diff --git a/bin/mycompiler/myparser/JavaParser.jay b/bin/mycompiler/myparser/JavaParser.jay index 793ea163..8b53e82f 100755 --- a/bin/mycompiler/myparser/JavaParser.jay +++ b/bin/mycompiler/myparser/JavaParser.jay @@ -821,7 +821,7 @@ classmemberdeclaration : fielddeclaration staticinitializer : STATIC block { - Method STAT = new Method(); + Method STAT = new Method($1.getOffset()); DeclId DST = new DeclId(); DST.set_Name($1.getLexem()); STAT.set_DeclId(DST); @@ -869,7 +869,7 @@ Dieses Problem ist bei Feldern nicht der Fall. */ fielddeclarator : variabledeclarator '=' expression { - FieldDeclaration ret = new FieldDeclaration(); + FieldDeclaration ret = new FieldDeclaration($1.getOffset()); ret.set_DeclId($1); ret.setWert($3); $$=ret; @@ -1197,8 +1197,9 @@ type : primitivetype } variabledeclarators : variabledeclarator { - FieldDeclaration IVD = new FieldDeclaration(); + FieldDeclaration IVD = new FieldDeclaration($1.getOffset()); IVD.getDeclIdVector().addElement( $1 ); + IVD.setOffset($1.getOffset()); $$ = IVD; } | variabledeclarators ',' variabledeclarator @@ -1267,7 +1268,7 @@ classtypelist : classtype methoddeclarator :IDENTIFIER '(' ')' { - Method met = new Method(); + Method met = new Method($1.getOffset()); /* #JB# 10.04.2005 */ /* ########################################################### */ met.setLineNumber($1.getLineNumber()); @@ -1280,7 +1281,7 @@ methoddeclarator :IDENTIFIER '(' ')' } |IDENTIFIER '(' formalparameterlist ')' { - Method met_para = new Method(); + Method met_para = new Method($1.getOffset()); /* #JB# 10.04.2005 */ /* ########################################################### */ met_para.setLineNumber($1.getLineNumber()); diff --git a/src/mycompiler/myclass/Constant.java b/src/mycompiler/myclass/Constant.java index 86a347bb..f4936a3e 100755 --- a/src/mycompiler/myclass/Constant.java +++ b/src/mycompiler/myclass/Constant.java @@ -50,10 +50,12 @@ public class Constant extends Method // ino.end // ino.method.Constant.23228.definition + @Deprecated public Constant(String name, Modifiers mod) // ino.end // ino.method.Constant.23228.body { + super(0); //Nur ein Workaraound. Da Constant = Deprecated this.name = name; this.mod = mod; } diff --git a/src/mycompiler/myclass/Constructor.java b/src/mycompiler/myclass/Constructor.java index 5a611fc9..2eb1259e 100644 --- a/src/mycompiler/myclass/Constructor.java +++ b/src/mycompiler/myclass/Constructor.java @@ -26,11 +26,13 @@ public class Constructor extends Method { * Diese Klasse beherbegt den als Methode geparsten Konstruktor und wandelt sein verhalten zu dem eines Konstruktors ab. */ public Constructor(Method methode){ + super(methode.getOffset()); this.methode = methode; this.setDeclIdVector(methode.getDeclIdVector()); this.methode.setType(new RefType(this.methode.getParentClass().getName(),0)); } + @Override public void setGenericMethodParameters( Vector genericMethodParameters) { diff --git a/src/mycompiler/myclass/Field.java b/src/mycompiler/myclass/Field.java index 552b4f84..e3885aa4 100644 --- a/src/mycompiler/myclass/Field.java +++ b/src/mycompiler/myclass/Field.java @@ -22,6 +22,10 @@ public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Ty private int offset; + public Field(int offset){ + this.offset = offset; + } + @Override public void setOffset(int offset){ this.offset = offset; diff --git a/src/mycompiler/myclass/FieldDeclaration.java b/src/mycompiler/myclass/FieldDeclaration.java index d04969b5..dc0b1efc 100644 --- a/src/mycompiler/myclass/FieldDeclaration.java +++ b/src/mycompiler/myclass/FieldDeclaration.java @@ -29,6 +29,10 @@ public class FieldDeclaration extends Field{ private Expr wert; //private Type type; + public FieldDeclaration(int offset){ + super(offset); + } + public void setWert(Expr initialExpression){ this.wert = initialExpression; } diff --git a/src/mycompiler/myclass/Method.java b/src/mycompiler/myclass/Method.java index b645a312..fece74d8 100755 --- a/src/mycompiler/myclass/Method.java +++ b/src/mycompiler/myclass/Method.java @@ -100,6 +100,10 @@ public class Method extends Field implements ITypeReplacementListener, IItemWith protected static Logger parserlog = Logger.getLogger("parser"); // ino.end + public Method(int offset){ + super(offset); + } + // ino.method.setGenericMethodParameters.23521.definition public void setGenericMethodParameters(Vector genericMethodParameters) // ino.end @@ -684,7 +688,7 @@ public class Method extends Field implements ITypeReplacementListener, IItemWith } public static Method createEmptyMethod(String withSignature, Class parent){ - Method ret = new Method(); + Method ret = new Method(0); DeclId DImethod = new DeclId(); DImethod.set_Name(withSignature); ret.set_DeclId(DImethod); diff --git a/src/mycompiler/myparser/JavaParser.java b/src/mycompiler/myparser/JavaParser.java index 1f5ddd2d..a0406caf 100644 --- a/src/mycompiler/myparser/JavaParser.java +++ b/src/mycompiler/myparser/JavaParser.java @@ -1320,7 +1320,7 @@ case 72: case 73: // line 823 "./../src/mycompiler/myparser/JavaParser.jay" { - Method STAT = new Method(); + Method STAT = new Method(((Token)yyVals[-1+yyTop]).getOffset()); DeclId DST = new DeclId(); DST.set_Name(((Token)yyVals[-1+yyTop]).getLexem()); STAT.set_DeclId(DST); @@ -1367,7 +1367,7 @@ case 77: case 78: // line 871 "./../src/mycompiler/myparser/JavaParser.jay" { - FieldDeclaration ret = new FieldDeclaration(); + FieldDeclaration ret = new FieldDeclaration(((DeclId)yyVals[-2+yyTop]).getOffset()); ret.set_DeclId(((DeclId)yyVals[-2+yyTop])); ret.setWert(((Expr)yyVals[0+yyTop])); yyVal=ret; @@ -1771,26 +1771,27 @@ case 127: case 128: // line 1199 "./../src/mycompiler/myparser/JavaParser.jay" { - FieldDeclaration IVD = new FieldDeclaration(); + FieldDeclaration IVD = new FieldDeclaration(((DeclId)yyVals[0+yyTop]).getOffset()); IVD.getDeclIdVector().addElement( ((DeclId)yyVals[0+yyTop]) ); + IVD.setOffset(((DeclId)yyVals[0+yyTop]).getOffset()); yyVal = IVD; } break; case 129: - // line 1205 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1206 "./../src/mycompiler/myparser/JavaParser.jay" { ((FieldDeclaration)yyVals[-2+yyTop]).getDeclIdVector().addElement(((DeclId)yyVals[0+yyTop])); yyVal=((FieldDeclaration)yyVals[-2+yyTop]); } break; case 130: - // line 1211 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1212 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Block)yyVals[0+yyTop]); } break; case 131: - // line 1216 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1217 "./../src/mycompiler/myparser/JavaParser.jay" { Block Blstat = new Block(); Blstat.set_Statement(((Statement)yyVals[0+yyTop])); @@ -1798,14 +1799,14 @@ case 131: } break; case 132: - // line 1223 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1224 "./../src/mycompiler/myparser/JavaParser.jay" { ((Block)yyVals[-1+yyTop]).set_Statement(((Statement)yyVals[0+yyTop])); yyVal=((Block)yyVals[-1+yyTop]); } break; case 133: - // line 1229 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1230 "./../src/mycompiler/myparser/JavaParser.jay" { ParameterList PL = new ParameterList(); PL.set_AddParameter(((FormalParameter)yyVals[0+yyTop])); @@ -1813,21 +1814,21 @@ case 133: } break; case 134: - // line 1235 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1236 "./../src/mycompiler/myparser/JavaParser.jay" { ((ParameterList)yyVals[-2+yyTop]).set_AddParameter(((FormalParameter)yyVals[0+yyTop])); yyVal = ((ParameterList)yyVals[-2+yyTop]); } break; case 135: - // line 1241 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1242 "./../src/mycompiler/myparser/JavaParser.jay" { This THCON = new This(((Token)yyVals[-3+yyTop]).getOffset(),((Token)yyVals[-3+yyTop]).getLexem().length()); yyVal=THCON; } break; case 136: - // line 1246 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1247 "./../src/mycompiler/myparser/JavaParser.jay" { This THCONargl = new This(((Token)yyVals[-4+yyTop]).getOffset(),((Token)yyVals[-4+yyTop]).getLexem().length()); THCONargl.set_ArgumentList(((ArgumentList)yyVals[-2+yyTop])); @@ -1835,7 +1836,7 @@ case 136: } break; case 137: - // line 1255 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1256 "./../src/mycompiler/myparser/JavaParser.jay" { RefType RT = new RefType(-1); RT.set_UsedId(((UsedId)yyVals[0+yyTop])); @@ -1844,7 +1845,7 @@ case 137: } break; case 138: - // line 1262 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1263 "./../src/mycompiler/myparser/JavaParser.jay" { ((RefType)yyVals[-2+yyTop]).set_UsedId(((UsedId)yyVals[0+yyTop])); ((RefType)yyVals[-2+yyTop]).setName(((RefType)yyVals[-2+yyTop]).get_UsedId().get_Name_1Element()); @@ -1852,9 +1853,9 @@ case 138: } break; case 139: - // line 1269 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1270 "./../src/mycompiler/myparser/JavaParser.jay" { - Method met = new Method(); + Method met = new Method(((Token)yyVals[-2+yyTop]).getOffset()); /* #JB# 10.04.2005 */ /* ########################################################### */ met.setLineNumber(((Token)yyVals[-2+yyTop]).getLineNumber()); @@ -1867,9 +1868,9 @@ case 139: } break; case 140: - // line 1282 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1283 "./../src/mycompiler/myparser/JavaParser.jay" { - Method met_para = new Method(); + Method met_para = new Method(((Token)yyVals[-3+yyTop]).getOffset()); /* #JB# 10.04.2005 */ /* ########################################################### */ met_para.setLineNumber(((Token)yyVals[-3+yyTop]).getLineNumber()); @@ -1883,7 +1884,7 @@ case 140: } break; case 141: - // line 1297 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1298 "./../src/mycompiler/myparser/JavaParser.jay" { BooleanType BT = new BooleanType(); /* #JB# 05.04.2005 */ @@ -1894,13 +1895,13 @@ case 141: } break; case 142: - // line 1306 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1307 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((BaseType)yyVals[0+yyTop]); } break; case 143: - // line 1312 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1313 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("T->Parser->referenctype: " + ((UsedId)yyVals[0+yyTop])); RefType RT = new RefType(((UsedId)yyVals[0+yyTop]).getOffset()); @@ -1920,25 +1921,25 @@ case 143: } break; case 144: - // line 1332 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1333 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((DeclId)yyVals[0+yyTop]); } break; case 145: - // line 1353 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1354 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((LocalVarDecl)yyVals[0+yyTop]); } break; case 146: - // line 1357 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1358 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Statement)yyVals[0+yyTop]); } break; case 147: - // line 1362 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1363 "./../src/mycompiler/myparser/JavaParser.jay" { FormalParameter FP = new FormalParameter(); FP.setType(((Type)yyVals[-1+yyTop])); @@ -1947,7 +1948,7 @@ case 147: } break; case 148: - // line 1387 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1388 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("\nFunktionsdeklaration mit typlosen Parametern: " + ((DeclId)yyVals[0+yyTop]).name); @@ -1967,7 +1968,7 @@ case 148: } break; case 149: - // line 1406 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1407 "./../src/mycompiler/myparser/JavaParser.jay" { ArgumentList AL = new ArgumentList(); AL.expr.addElement(((Expr)yyVals[0+yyTop])); @@ -1975,20 +1976,20 @@ case 149: } break; case 150: - // line 1412 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1413 "./../src/mycompiler/myparser/JavaParser.jay" { ((ArgumentList)yyVals[-2+yyTop]).expr.addElement(((Expr)yyVals[0+yyTop])); yyVal=((ArgumentList)yyVals[-2+yyTop]); } break; case 151: - // line 1418 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1419 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((BaseType)yyVals[0+yyTop]); } break; case 152: - // line 1423 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1424 "./../src/mycompiler/myparser/JavaParser.jay" { DeclId DI = new DeclId(); /* #JB# 10.04.2005 */ @@ -2001,61 +2002,61 @@ case 152: } break; case 153: - // line 1435 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1436 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 154: - // line 1440 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1441 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((LocalVarDecl)yyVals[-1+yyTop]); } break; case 155: - // line 1445 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1446 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Statement)yyVals[0+yyTop]); } break; case 156: - // line 1449 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1450 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((IfStmt)yyVals[0+yyTop]); } break; case 157: - // line 1453 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1454 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((IfStmt)yyVals[0+yyTop]); } break; case 158: - // line 1457 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1458 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((WhileStmt)yyVals[0+yyTop]); } break; case 159: - // line 1461 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1462 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((ForStmt)yyVals[0+yyTop]); } break; case 160: - // line 1466 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1467 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 161: - // line 1470 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1471 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((NewClass)yyVals[0+yyTop]); } break; case 162: - // line 1475 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1476 "./../src/mycompiler/myparser/JavaParser.jay" { IntegerType IT = new IntegerType(); /* #JB# 05.04.2005 */ @@ -2066,7 +2067,7 @@ case 162: } break; case 163: - // line 1484 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1485 "./../src/mycompiler/myparser/JavaParser.jay" { CharacterType CT = new CharacterType(); /* #JB# 05.04.2005 */ @@ -2077,7 +2078,7 @@ case 163: } break; case 164: - // line 1494 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1495 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!"); LocalVarDecl LVD = new LocalVarDecl(((Type)yyVals[-1+yyTop]).getOffset(),((Type)yyVals[-1+yyTop]).getVariableLength()); @@ -2087,7 +2088,7 @@ case 164: } break; case 165: - // line 1505 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1506 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!"); LocalVarDecl LVD = new LocalVarDecl(((FieldDeclaration)yyVals[0+yyTop]).getOffset(),((FieldDeclaration)yyVals[0+yyTop]).getVariableLength()); @@ -2097,31 +2098,31 @@ case 165: } break; case 166: - // line 1515 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1516 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Block)yyVals[0+yyTop]); } break; case 167: - // line 1519 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1520 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((EmptyStmt)yyVals[0+yyTop]); } break; case 168: - // line 1523 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1524 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((ExprStmt)yyVals[0+yyTop]); } break; case 169: - // line 1527 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1528 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Return)yyVals[0+yyTop]); } break; case 170: - // line 1532 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1533 "./../src/mycompiler/myparser/JavaParser.jay" { IfStmt Ifst = new IfStmt(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); Ifst.set_Expr(((Expr)yyVals[-2+yyTop])); @@ -2130,7 +2131,7 @@ case 170: } break; case 171: - // line 1540 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1541 "./../src/mycompiler/myparser/JavaParser.jay" { IfStmt IfstElst = new IfStmt(((Expr)yyVals[-4+yyTop]).getOffset(),((Expr)yyVals[-4+yyTop]).getVariableLength()); IfstElst.set_Expr(((Expr)yyVals[-4+yyTop])); @@ -2140,7 +2141,7 @@ case 171: } break; case 172: - // line 1549 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1550 "./../src/mycompiler/myparser/JavaParser.jay" { WhileStmt Whlst = new WhileStmt(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); Whlst.set_Expr(((Expr)yyVals[-2+yyTop])); @@ -2149,7 +2150,7 @@ case 172: } break; case 173: - // line 1560 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1561 "./../src/mycompiler/myparser/JavaParser.jay" { ForStmt Fst = new ForStmt(((Expr)yyVals[-6+yyTop]).getOffset(),((Expr)yyVals[-6+yyTop]).getVariableLength()); Fst.set_head_Initializer(((Expr)yyVals[-6+yyTop])); @@ -2162,7 +2163,7 @@ case 173: } break; case 174: - // line 1572 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1573 "./../src/mycompiler/myparser/JavaParser.jay" { ForStmt Fst = new ForStmt(((Expr)yyVals[-5+yyTop]).getOffset(),((Expr)yyVals[-5+yyTop]).getVariableLength()); Fst.set_head_Initializer(((Expr)yyVals[-5+yyTop])); @@ -2174,7 +2175,7 @@ case 174: } break; case 175: - // line 1583 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1584 "./../src/mycompiler/myparser/JavaParser.jay" { ForStmt Fst = new ForStmt(((Expr)yyVals[-5+yyTop]).getOffset(),((Expr)yyVals[-5+yyTop]).getVariableLength()); Fst.set_head_Initializer(((Expr)yyVals[-5+yyTop])); @@ -2186,7 +2187,7 @@ case 175: } break; case 176: - // line 1594 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1595 "./../src/mycompiler/myparser/JavaParser.jay" { ForStmt Fst = new ForStmt(((Expr)yyVals[-4+yyTop]).getOffset(),((Expr)yyVals[-4+yyTop]).getVariableLength()); Fst.set_head_Condition(((Expr)yyVals[-4+yyTop])); @@ -2198,7 +2199,7 @@ case 176: } break; case 177: - // line 1605 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1606 "./../src/mycompiler/myparser/JavaParser.jay" { ForStmt Fst = new ForStmt(((Expr)yyVals[-4+yyTop]).getOffset(),((Expr)yyVals[-4+yyTop]).getVariableLength()); Fst.set_head_Initializer(((Expr)yyVals[-4+yyTop])); @@ -2209,7 +2210,7 @@ case 177: } break; case 178: - // line 1615 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1616 "./../src/mycompiler/myparser/JavaParser.jay" { ForStmt Fst = new ForStmt(((Expr)yyVals[-3+yyTop]).getOffset(),((Expr)yyVals[-3+yyTop]).getVariableLength()); Fst.set_head_Condition(((Expr)yyVals[-3+yyTop])); @@ -2220,7 +2221,7 @@ case 178: } break; case 179: - // line 1625 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1626 "./../src/mycompiler/myparser/JavaParser.jay" { ForStmt Fst = new ForStmt(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); Fst.set_head_Loop_expr(((Expr)yyVals[-2+yyTop])); @@ -2231,7 +2232,7 @@ case 179: } break; case 180: - // line 1635 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1636 "./../src/mycompiler/myparser/JavaParser.jay" { ForStmt Fst = new ForStmt(((Statement)yyVals[0+yyTop]).getOffset(),((Statement)yyVals[0+yyTop]).getVariableLength()); Fst.set_body_Loop_block(((Statement)yyVals[0+yyTop])); @@ -2241,40 +2242,40 @@ case 180: } break; case 181: - // line 1644 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1645 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("conditionalexpression"); yyVal=((Expr)yyVals[0+yyTop]); } break; case 182: - // line 1649 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1650 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Assign)yyVals[0+yyTop]); } break; case 183: - // line 1655 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1656 "./../src/mycompiler/myparser/JavaParser.jay" { EmptyStmt Empst = new EmptyStmt(); yyVal=Empst; } break; case 184: - // line 1661 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1662 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[-1+yyTop]); } break; case 185: - // line 1666 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1667 "./../src/mycompiler/myparser/JavaParser.jay" { Return ret = new Return(-1,-1); yyVal= ret; } break; case 186: - // line 1671 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1672 "./../src/mycompiler/myparser/JavaParser.jay" { Return retexp = new Return(((Expr)yyVals[-1+yyTop]).getOffset(),((Expr)yyVals[-1+yyTop]).getVariableLength()); retexp.set_ReturnExpr(((Expr)yyVals[-1+yyTop])); @@ -2282,31 +2283,31 @@ case 186: } break; case 187: - // line 1678 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1679 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Statement)yyVals[0+yyTop]); } break; case 188: - // line 1682 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1683 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((IfStmt)yyVals[0+yyTop]); } break; case 189: - // line 1686 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1687 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((WhileStmt)yyVals[0+yyTop]); } break; case 190: - // line 1691 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1692 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 191: - // line 1697 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1698 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("\nParser --> Zuweisung1!\n"); Assign Ass = new Assign(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength()); @@ -2333,7 +2334,7 @@ case 191: } break; case 192: - // line 1722 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1723 "./../src/mycompiler/myparser/JavaParser.jay" { Assign Ass =new Assign(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength()); LocalOrFieldVar LOFV = new LocalOrFieldVar(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength()); @@ -2357,43 +2358,43 @@ case 192: } break; case 193: - // line 1745 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1746 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Assign)yyVals[0+yyTop]); } break; case 194: - // line 1749 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1750 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 195: - // line 1753 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1754 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 196: - // line 1757 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1758 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 197: - // line 1761 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1762 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 198: - // line 1765 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1766 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((MethodCall)yyVals[0+yyTop]); } break; case 199: - // line 1776 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1777 "./../src/mycompiler/myparser/JavaParser.jay" { IfStmt IfElno = new IfStmt(((Expr)yyVals[-4+yyTop]).getOffset(),((Expr)yyVals[-4+yyTop]).getVariableLength()); IfElno.set_Expr(((Expr)yyVals[-4+yyTop])); @@ -2403,7 +2404,7 @@ case 199: } break; case 200: - // line 1785 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1786 "./../src/mycompiler/myparser/JavaParser.jay" { WhileStmt Whstno = new WhileStmt(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); Whstno.set_Expr(((Expr)yyVals[-2+yyTop])); @@ -2412,13 +2413,13 @@ case 200: } break; case 201: - // line 1793 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1794 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 202: - // line 1797 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1798 "./../src/mycompiler/myparser/JavaParser.jay" { Binary LogOr = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); OrOp OrO = new OrOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -2430,19 +2431,19 @@ case 202: } break; case 203: - // line 1810 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1811 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=null; } break; case 204: - // line 1815 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1816 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Block)yyVals[0+yyTop]); } break; case 205: - // line 1819 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1820 "./../src/mycompiler/myparser/JavaParser.jay" { /*Lambdabody kann auch nur aus einer Expression bestehen. In diesem Fall wird ein Block erstellt, welcher als einziges Statement ein return statment mit der expression hat.*/ /*Bsp.: Aus der Expression |var=="hallo"| wird: |{return var=="hallo";}|*/ @@ -2453,19 +2454,19 @@ case 205: } break; case 206: - // line 1829 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1830 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=null; } break; case 207: - // line 1833 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1834 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((ParameterList)yyVals[-1+yyTop]); } break; case 208: - // line 1838 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1839 "./../src/mycompiler/myparser/JavaParser.jay" { LambdaExpression lambda = new LambdaExpression(/*((ParameSterList)$2).getOffset(),((ParameterList)$2).getVariableLength()*/0,0); if(((ParameterList)yyVals[-2+yyTop])!=null)lambda.setParameterList(((ParameterList)yyVals[-2+yyTop])); @@ -2474,54 +2475,54 @@ case 208: } break; case 209: - // line 1857 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1858 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((UsedId)yyVals[0+yyTop]); } break; case 210: - // line 1862 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1863 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=null; } break; case 211: - // line 1866 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1867 "./../src/mycompiler/myparser/JavaParser.jay" { TimesOp TEO = new TimesOp(-1,-1); yyVal=TEO; } break; case 212: - // line 1871 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1872 "./../src/mycompiler/myparser/JavaParser.jay" { DivideOp DEO = new DivideOp(-1,-1); yyVal=DEO; } break; case 213: - // line 1876 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1877 "./../src/mycompiler/myparser/JavaParser.jay" { ModuloOp MEO = new ModuloOp(-1,-1); yyVal=MEO; } break; case 214: - // line 1881 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1882 "./../src/mycompiler/myparser/JavaParser.jay" { PlusOp PEO = new PlusOp(-1,-1); yyVal=PEO; } break; case 215: - // line 1886 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1887 "./../src/mycompiler/myparser/JavaParser.jay" { MinusOp MEO = new MinusOp(-1,-1); yyVal=MEO; } break; case 216: - // line 1898 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1899 "./../src/mycompiler/myparser/JavaParser.jay" { PreIncExpr PRINC = new PreIncExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength()); PRINC.set_Expr(((Expr)yyVals[0+yyTop])); @@ -2529,7 +2530,7 @@ case 216: } break; case 217: - // line 1905 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1906 "./../src/mycompiler/myparser/JavaParser.jay" { PreDecExpr PRDEC = new PreDecExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength()); PRDEC.set_Expr(((Expr)yyVals[0+yyTop])); @@ -2537,7 +2538,7 @@ case 217: } break; case 218: - // line 1912 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1913 "./../src/mycompiler/myparser/JavaParser.jay" { PostIncExpr PIE = new PostIncExpr(((Expr)yyVals[-1+yyTop]).getOffset(),((Expr)yyVals[-1+yyTop]).getVariableLength()); PIE.set_Expr(((Expr)yyVals[-1+yyTop])); @@ -2545,7 +2546,7 @@ case 218: } break; case 219: - // line 1919 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1920 "./../src/mycompiler/myparser/JavaParser.jay" { PostDecExpr PDE = new PostDecExpr(((Expr)yyVals[-1+yyTop]).getOffset(),((Expr)yyVals[-1+yyTop]).getVariableLength()); PDE.set_Expr(((Expr)yyVals[-1+yyTop])); @@ -2553,7 +2554,7 @@ case 219: } break; case 220: - // line 1927 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1928 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("M1"); MethodCall MC = new MethodCall(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength()); @@ -2585,7 +2586,7 @@ case 220: } break; case 221: - // line 1957 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1958 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("M2"); MethodCall MCarg = new MethodCall(((UsedId)yyVals[-3+yyTop]).getOffset(),((UsedId)yyVals[-3+yyTop]).getVariableLength()); @@ -2618,7 +2619,7 @@ case 221: } break; case 222: - // line 1988 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1989 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("M3"); MethodCall MCpr = new MethodCall(((Expr)yyVals[-4+yyTop]).getOffset(),((Expr)yyVals[-4+yyTop]).getVariableLength()); @@ -2639,7 +2640,7 @@ case 222: } break; case 223: - // line 2007 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2008 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("M4"); MethodCall MCPA = new MethodCall(((Expr)yyVals[-5+yyTop]).getOffset(),((Expr)yyVals[-5+yyTop]).getVariableLength()); @@ -2661,7 +2662,7 @@ case 223: } break; case 224: - // line 2030 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2031 "./../src/mycompiler/myparser/JavaParser.jay" { NewClass NC = new NewClass(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength()); NC.set_UsedId(((UsedId)yyVals[-2+yyTop])); @@ -2671,7 +2672,7 @@ case 224: } break; case 225: - // line 2038 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2039 "./../src/mycompiler/myparser/JavaParser.jay" { NewClass NCarg = new NewClass(((UsedId)yyVals[-3+yyTop]).getOffset(),((UsedId)yyVals[-3+yyTop]).getVariableLength()); NCarg.set_UsedId(((UsedId)yyVals[-3+yyTop])); @@ -2682,13 +2683,13 @@ case 225: } break; case 226: - // line 2048 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2049 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 227: - // line 2052 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2053 "./../src/mycompiler/myparser/JavaParser.jay" { Binary And = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); AndOp AndO = new AndOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -2700,19 +2701,19 @@ case 227: } break; case 228: - // line 2068 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2069 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 229: - // line 2072 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2073 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 230: - // line 2076 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2077 "./../src/mycompiler/myparser/JavaParser.jay" { PositivExpr POSEX=new PositivExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength()); UnaryPlus UP= new UnaryPlus(); @@ -2722,7 +2723,7 @@ case 230: } break; case 231: - // line 2084 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2085 "./../src/mycompiler/myparser/JavaParser.jay" { NegativeExpr NEGEX=new NegativeExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength()); UnaryMinus UM=new UnaryMinus(); @@ -2732,19 +2733,19 @@ case 231: } break; case 232: - // line 2092 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2093 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 233: - // line 2097 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2098 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 234: - // line 2101 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2102 "./../src/mycompiler/myparser/JavaParser.jay" { if (((UsedId)yyVals[0+yyTop]).get_Name().size() > 1) { @@ -2764,37 +2765,37 @@ case 234: } break; case 235: - // line 2119 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2120 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 236: - // line 2123 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2124 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 237: - // line 2128 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2129 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 238: - // line 2133 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2134 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 240: - // line 2139 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2140 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Literal)yyVals[0+yyTop]); } break; case 241: - // line 2143 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2144 "./../src/mycompiler/myparser/JavaParser.jay" { This T = new This(((Token)yyVals[0+yyTop]).getOffset(),((Token)yyVals[0+yyTop]).getLexem().length()); UsedId UT = new UsedId(((Token)yyVals[0+yyTop]).getOffset()); @@ -2804,23 +2805,23 @@ case 241: } break; case 242: - // line 2164 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2165 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((MethodCall)yyVals[0+yyTop]); } break; case 243: - // line 2168 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2169 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 244: - // line 2173 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2174 "./../src/mycompiler/myparser/JavaParser.jay" {yyVal=((Expr)yyVals[0+yyTop]);} break; case 245: - // line 2175 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2176 "./../src/mycompiler/myparser/JavaParser.jay" {NotExpr NE=new NotExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength()); UnaryNot UN=new UnaryNot(); NE.set_UnaryNot(UN); @@ -2829,36 +2830,36 @@ case 245: } break; case 246: - // line 2181 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2182 "./../src/mycompiler/myparser/JavaParser.jay" {yyVal=((CastExpr)yyVals[0+yyTop]);} break; case 247: - // line 2183 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2184 "./../src/mycompiler/myparser/JavaParser.jay" {yyVal=((Expr)yyVals[0+yyTop]);} break; case 249: - // line 2188 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2189 "./../src/mycompiler/myparser/JavaParser.jay" {IntLiteral IL = new IntLiteral(); IL.set_Int(((Token)yyVals[0+yyTop]).String2Int()); yyVal = IL; } break; case 250: - // line 2193 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2194 "./../src/mycompiler/myparser/JavaParser.jay" {BoolLiteral BL = new BoolLiteral(); BL.set_Bool(((Token)yyVals[0+yyTop]).String2Bool()); yyVal = BL; } break; case 251: - // line 2197 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2198 "./../src/mycompiler/myparser/JavaParser.jay" {CharLiteral CL = new CharLiteral(); CL.set_Char(((Token)yyVals[0+yyTop]).CharInString()); yyVal=CL; } break; case 252: - // line 2202 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2203 "./../src/mycompiler/myparser/JavaParser.jay" { StringLiteral ST = new StringLiteral(); ST.set_String(((Token)yyVals[0+yyTop]).get_String()); @@ -2866,14 +2867,14 @@ case 252: } break; case 253: - // line 2207 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2208 "./../src/mycompiler/myparser/JavaParser.jay" { LongLiteral LL = new LongLiteral(); LL.set_Long(((Token)yyVals[0+yyTop]).String2Long()); yyVal = LL; } break; case 254: - // line 2211 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2212 "./../src/mycompiler/myparser/JavaParser.jay" { FloatLiteral FL = new FloatLiteral(); FL.set_Float(((Token)yyVals[0+yyTop]).String2Float()); @@ -2881,7 +2882,7 @@ case 254: } break; case 255: - // line 2216 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2217 "./../src/mycompiler/myparser/JavaParser.jay" { DoubleLiteral DL = new DoubleLiteral(); DL.set_Double(((Token)yyVals[0+yyTop]).String2Double()); @@ -2889,14 +2890,14 @@ case 255: } break; case 256: - // line 2222 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2223 "./../src/mycompiler/myparser/JavaParser.jay" { Null NN = new Null(); yyVal=NN; } break; case 257: - // line 2228 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2229 "./../src/mycompiler/myparser/JavaParser.jay" { CastExpr CaEx=new CastExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength()); CaEx.set_Type(((BaseType)yyVals[-2+yyTop])); @@ -2905,24 +2906,24 @@ case 257: } break; case 258: - // line 2237 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2238 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 259: - // line 2241 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2242 "./../src/mycompiler/myparser/JavaParser.jay" { } break; case 260: - // line 2245 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2246 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 261: - // line 2249 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2250 "./../src/mycompiler/myparser/JavaParser.jay" { Binary EQ = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); EqualOp EO = new EqualOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -2934,7 +2935,7 @@ case 261: } break; case 262: - // line 2259 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2260 "./../src/mycompiler/myparser/JavaParser.jay" { Binary NEQ = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); NotEqualOp NEO = new NotEqualOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -2946,13 +2947,13 @@ case 262: } break; case 263: - // line 2270 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2271 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 264: - // line 2274 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2275 "./../src/mycompiler/myparser/JavaParser.jay" { Binary LO = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); LessOp LOO = new LessOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -2964,7 +2965,7 @@ case 264: } break; case 265: - // line 2284 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2285 "./../src/mycompiler/myparser/JavaParser.jay" { Binary GO = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); GreaterOp GOO = new GreaterOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -2976,7 +2977,7 @@ case 265: } break; case 266: - // line 2294 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2295 "./../src/mycompiler/myparser/JavaParser.jay" { Binary LE = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); LessEquOp LEO = new LessEquOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -2988,7 +2989,7 @@ case 266: } break; case 267: - // line 2304 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2305 "./../src/mycompiler/myparser/JavaParser.jay" { Binary GE = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); GreaterEquOp GEO = new GreaterEquOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -3000,7 +3001,7 @@ case 267: } break; case 268: - // line 2314 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2315 "./../src/mycompiler/myparser/JavaParser.jay" { InstanceOf ISO=new InstanceOf(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); ISO.set_Expr(((Expr)yyVals[-2+yyTop])); @@ -3009,19 +3010,19 @@ case 268: } break; case 269: - // line 2322 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2323 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 270: - // line 2327 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2328 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 271: - // line 2331 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2332 "./../src/mycompiler/myparser/JavaParser.jay" { Binary AD = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); PlusOp PO = new PlusOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -3033,7 +3034,7 @@ case 271: } break; case 272: - // line 2341 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2342 "./../src/mycompiler/myparser/JavaParser.jay" { Binary MI = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); MinusOp MO = new MinusOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -3045,13 +3046,13 @@ case 272: } break; case 273: - // line 2352 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2353 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 274: - // line 2356 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2357 "./../src/mycompiler/myparser/JavaParser.jay" { Binary ML = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); TimesOp TO = new TimesOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -3063,7 +3064,7 @@ case 274: } break; case 275: - // line 2366 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2367 "./../src/mycompiler/myparser/JavaParser.jay" { Binary DV = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); DivideOp DO = new DivideOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -3075,7 +3076,7 @@ case 275: } break; case 276: - // line 2376 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2377 "./../src/mycompiler/myparser/JavaParser.jay" { Binary MD = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); ModuloOp MO = new ModuloOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength()); @@ -3086,7 +3087,7 @@ case 276: yyVal =MD; } break; - // line 3090 "-" + // line 3091 "-" } yyTop -= yyLen[yyN]; yyState = yyStates[yyTop]; diff --git a/src/mycompiler/myparser/JavaParser.jay b/src/mycompiler/myparser/JavaParser.jay index 793ea163..8b53e82f 100755 --- a/src/mycompiler/myparser/JavaParser.jay +++ b/src/mycompiler/myparser/JavaParser.jay @@ -821,7 +821,7 @@ classmemberdeclaration : fielddeclaration staticinitializer : STATIC block { - Method STAT = new Method(); + Method STAT = new Method($1.getOffset()); DeclId DST = new DeclId(); DST.set_Name($1.getLexem()); STAT.set_DeclId(DST); @@ -869,7 +869,7 @@ Dieses Problem ist bei Feldern nicht der Fall. */ fielddeclarator : variabledeclarator '=' expression { - FieldDeclaration ret = new FieldDeclaration(); + FieldDeclaration ret = new FieldDeclaration($1.getOffset()); ret.set_DeclId($1); ret.setWert($3); $$=ret; @@ -1197,8 +1197,9 @@ type : primitivetype } variabledeclarators : variabledeclarator { - FieldDeclaration IVD = new FieldDeclaration(); + FieldDeclaration IVD = new FieldDeclaration($1.getOffset()); IVD.getDeclIdVector().addElement( $1 ); + IVD.setOffset($1.getOffset()); $$ = IVD; } | variabledeclarators ',' variabledeclarator @@ -1267,7 +1268,7 @@ classtypelist : classtype methoddeclarator :IDENTIFIER '(' ')' { - Method met = new Method(); + Method met = new Method($1.getOffset()); /* #JB# 10.04.2005 */ /* ########################################################### */ met.setLineNumber($1.getLineNumber()); @@ -1280,7 +1281,7 @@ methoddeclarator :IDENTIFIER '(' ')' } |IDENTIFIER '(' formalparameterlist ')' { - Method met_para = new Method(); + Method met_para = new Method($1.getOffset()); /* #JB# 10.04.2005 */ /* ########################################################### */ met_para.setLineNumber($1.getLineNumber()); diff --git a/src/typinferenz/FunNMethod.java b/src/typinferenz/FunNMethod.java index 7581f9b8..7d14317e 100644 --- a/src/typinferenz/FunNMethod.java +++ b/src/typinferenz/FunNMethod.java @@ -12,6 +12,7 @@ public class FunNMethod extends Method{ * @param N - Anzahl der Parameter (Beispiel: Fun2) */ public FunNMethod(int N){ + super(0); //Hat keinen Offset, da nur theoretisch gedachte Methode this.setType(TypePlaceholder.fresh(this)); ParameterList pl = new ParameterList(); Vector fpList = new Vector();