From 63a10f4775d1f231f160c65779b442c9835c34e9 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Thu, 7 Aug 2014 14:26:02 +0200 Subject: [PATCH] Fehler behoben --- src/mycompiler/myclass/FieldDeclaration.java | 1 + src/mycompiler/myparser/JavaParser.java | 298 +++++++++--------- src/mycompiler/mystatement/IfStmt.java | 2 +- src/mycompiler/mystatement/WhileStmt.java | 2 +- .../TypeInsertTests/LambdaTest19.jav | 14 + .../TypeInsertTests/LambdaTest19.java | 16 + .../TypeInsertTests/LambdaTest20.jav | 11 + .../TypeInsertTests/LambdaTest20.java | 16 + .../TypeInsertTests/LambdaTest21.jav | 9 + .../MultipleTypesInsertTester.java | 2 +- 10 files changed, 219 insertions(+), 152 deletions(-) create mode 100644 test/plugindevelopment/TypeInsertTests/LambdaTest19.jav create mode 100644 test/plugindevelopment/TypeInsertTests/LambdaTest19.java create mode 100644 test/plugindevelopment/TypeInsertTests/LambdaTest20.jav create mode 100644 test/plugindevelopment/TypeInsertTests/LambdaTest20.java create mode 100644 test/plugindevelopment/TypeInsertTests/LambdaTest21.jav diff --git a/src/mycompiler/myclass/FieldDeclaration.java b/src/mycompiler/myclass/FieldDeclaration.java index 39393a04..694c9e35 100644 --- a/src/mycompiler/myclass/FieldDeclaration.java +++ b/src/mycompiler/myclass/FieldDeclaration.java @@ -128,6 +128,7 @@ public class FieldDeclaration extends Field{ } @Override public ConstraintsSet TYPE(TypeAssumptions publicAssumptions) { + if(this.wert == null)throw new TypeinferenceException("Typlose Felder müssen mit Wert initialisiert werden", this); ConstraintsSet ret = new ConstraintsSet(); TypeAssumptions localAssumptions = publicAssumptions.clone(); diff --git a/src/mycompiler/myparser/JavaParser.java b/src/mycompiler/myparser/JavaParser.java index 970b48cd..4a72fd29 100644 --- a/src/mycompiler/myparser/JavaParser.java +++ b/src/mycompiler/myparser/JavaParser.java @@ -1855,13 +1855,13 @@ case 136: } break; case 137: - // line 1252 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1246 "./../src/mycompiler/myparser/JavaParser.jay" { ((RefType)yyVals[-2+yyTop]).setArray(true); } break; case 138: - // line 1256 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1250 "./../src/mycompiler/myparser/JavaParser.jay" { FieldDeclaration IVD = new FieldDeclaration(((DeclId)yyVals[0+yyTop]).getOffset()); IVD.getDeclIdVector().addElement( ((DeclId)yyVals[0+yyTop]) ); @@ -1870,20 +1870,20 @@ case 138: } break; case 139: - // line 1263 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1257 "./../src/mycompiler/myparser/JavaParser.jay" { ((FieldDeclaration)yyVals[-2+yyTop]).getDeclIdVector().addElement(((DeclId)yyVals[0+yyTop])); yyVal=((FieldDeclaration)yyVals[-2+yyTop]); } break; case 140: - // line 1269 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1263 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Block)yyVals[0+yyTop]); } break; case 141: - // line 1274 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1268 "./../src/mycompiler/myparser/JavaParser.jay" { Block Blstat = new Block(); Blstat.set_Statement(((Statement)yyVals[0+yyTop])); @@ -1891,14 +1891,14 @@ case 141: } break; case 142: - // line 1281 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1275 "./../src/mycompiler/myparser/JavaParser.jay" { ((Block)yyVals[-1+yyTop]).set_Statement(((Statement)yyVals[0+yyTop])); yyVal=((Block)yyVals[-1+yyTop]); } break; case 143: - // line 1287 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1281 "./../src/mycompiler/myparser/JavaParser.jay" { ParameterList PL = new ParameterList(); PL.set_AddParameter(((FormalParameter)yyVals[0+yyTop])); @@ -1906,21 +1906,21 @@ case 143: } break; case 144: - // line 1293 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1287 "./../src/mycompiler/myparser/JavaParser.jay" { ((ParameterList)yyVals[-2+yyTop]).set_AddParameter(((FormalParameter)yyVals[0+yyTop])); yyVal = ((ParameterList)yyVals[-2+yyTop]); } break; case 145: - // line 1299 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1293 "./../src/mycompiler/myparser/JavaParser.jay" { This THCON = new This(((Token)yyVals[-3+yyTop]).getOffset(),((Token)yyVals[-3+yyTop]).getLexem().length()); yyVal=THCON; } break; case 146: - // line 1304 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1298 "./../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])); @@ -1928,7 +1928,7 @@ case 146: } break; case 147: - // line 1313 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1307 "./../src/mycompiler/myparser/JavaParser.jay" { RefType RT = new RefType(-1); RT.set_UsedId(((UsedId)yyVals[0+yyTop])); @@ -1937,7 +1937,7 @@ case 147: } break; case 148: - // line 1320 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1314 "./../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()); @@ -1945,7 +1945,7 @@ case 148: } break; case 149: - // line 1327 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1321 "./../src/mycompiler/myparser/JavaParser.jay" { Method met = new Method(((Token)yyVals[-2+yyTop]).getOffset()); /* #JB# 10.04.2005 */ @@ -1960,7 +1960,7 @@ case 149: } break; case 150: - // line 1340 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1334 "./../src/mycompiler/myparser/JavaParser.jay" { Method met_para = new Method(((Token)yyVals[-3+yyTop]).getOffset()); /* #JB# 10.04.2005 */ @@ -1976,7 +1976,7 @@ case 150: } break; case 151: - // line 1355 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1349 "./../src/mycompiler/myparser/JavaParser.jay" { BooleanType BT = new BooleanType(); /* #JB# 05.04.2005 */ @@ -1987,13 +1987,13 @@ case 151: } break; case 152: - // line 1364 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1358 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((BaseType)yyVals[0+yyTop]); } break; case 153: - // line 1369 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1363 "./../src/mycompiler/myparser/JavaParser.jay" { if (((Vector)yyVals[0+yyTop]) != null) { /*$1.set_ParaList($2.get_ParaList());*/ @@ -2016,7 +2016,7 @@ case 153: } break; case 154: - // line 1391 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1385 "./../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()); @@ -2036,25 +2036,25 @@ case 154: } break; case 155: - // line 1413 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1407 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((DeclId)yyVals[0+yyTop]); } break; case 156: - // line 1434 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1428 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((LocalVarDecl)yyVals[0+yyTop]); } break; case 157: - // line 1438 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1432 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Statement)yyVals[0+yyTop]); } break; case 158: - // line 1443 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1437 "./../src/mycompiler/myparser/JavaParser.jay" { FormalParameter FP = new FormalParameter(((DeclId)yyVals[0+yyTop])); FP.setType(((Type)yyVals[-1+yyTop])); @@ -2063,7 +2063,7 @@ case 158: } break; case 159: - // line 1468 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1462 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("\nFunktionsdeklaration mit typlosen Parametern: " + ((DeclId)yyVals[0+yyTop]).name); @@ -2083,7 +2083,7 @@ case 159: } break; case 160: - // line 1487 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1481 "./../src/mycompiler/myparser/JavaParser.jay" { ArgumentList AL = new ArgumentList(); AL.expr.addElement(((Expr)yyVals[0+yyTop])); @@ -2091,20 +2091,20 @@ case 160: } break; case 161: - // line 1493 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1487 "./../src/mycompiler/myparser/JavaParser.jay" { ((ArgumentList)yyVals[-2+yyTop]).expr.addElement(((Expr)yyVals[0+yyTop])); yyVal=((ArgumentList)yyVals[-2+yyTop]); } break; case 162: - // line 1499 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1493 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((BaseType)yyVals[0+yyTop]); } break; case 163: - // line 1504 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1498 "./../src/mycompiler/myparser/JavaParser.jay" { DeclId DI = new DeclId(); /* #JB# 10.04.2005 */ @@ -2117,61 +2117,61 @@ case 163: } break; case 164: - // line 1516 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1510 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 165: - // line 1521 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1515 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((LocalVarDecl)yyVals[-1+yyTop]); } break; case 166: - // line 1526 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1520 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Statement)yyVals[0+yyTop]); } break; case 167: - // line 1530 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1524 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((IfStmt)yyVals[0+yyTop]); } break; case 168: - // line 1534 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1528 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((IfStmt)yyVals[0+yyTop]); } break; case 169: - // line 1538 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1532 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((WhileStmt)yyVals[0+yyTop]); } break; case 170: - // line 1542 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1536 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((ForStmt)yyVals[0+yyTop]); } break; case 171: - // line 1547 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1541 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 172: - // line 1551 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1545 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((NewClass)yyVals[0+yyTop]); } break; case 173: - // line 1556 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1550 "./../src/mycompiler/myparser/JavaParser.jay" { IntegerType IT = new IntegerType(); /* #JB# 05.04.2005 */ @@ -2182,7 +2182,7 @@ case 173: } break; case 174: - // line 1565 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1559 "./../src/mycompiler/myparser/JavaParser.jay" { CharacterType CT = new CharacterType(); /* #JB# 05.04.2005 */ @@ -2193,7 +2193,7 @@ case 174: } break; case 175: - // line 1575 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1569 "./../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()); @@ -2203,7 +2203,7 @@ case 175: } break; case 176: - // line 1586 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1580 "./../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()); @@ -2213,31 +2213,31 @@ case 176: } break; case 177: - // line 1596 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1590 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Block)yyVals[0+yyTop]); } break; case 178: - // line 1600 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1594 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((EmptyStmt)yyVals[0+yyTop]); } break; case 179: - // line 1604 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1598 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((ExprStmt)yyVals[0+yyTop]); } break; case 180: - // line 1608 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1602 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Return)yyVals[0+yyTop]); } break; case 181: - // line 1613 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1607 "./../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])); @@ -2246,7 +2246,7 @@ case 181: } break; case 182: - // line 1621 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1615 "./../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])); @@ -2256,7 +2256,7 @@ case 182: } break; case 183: - // line 1630 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1624 "./../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])); @@ -2265,7 +2265,7 @@ case 183: } break; case 184: - // line 1641 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1635 "./../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])); @@ -2278,7 +2278,7 @@ case 184: } break; case 185: - // line 1653 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1647 "./../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])); @@ -2290,7 +2290,7 @@ case 185: } break; case 186: - // line 1664 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1658 "./../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])); @@ -2302,7 +2302,7 @@ case 186: } break; case 187: - // line 1675 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1669 "./../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])); @@ -2314,7 +2314,7 @@ case 187: } break; case 188: - // line 1686 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1680 "./../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])); @@ -2325,7 +2325,7 @@ case 188: } break; case 189: - // line 1696 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1690 "./../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])); @@ -2336,7 +2336,7 @@ case 189: } break; case 190: - // line 1706 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1700 "./../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])); @@ -2347,7 +2347,7 @@ case 190: } break; case 191: - // line 1716 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1710 "./../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])); @@ -2357,40 +2357,40 @@ case 191: } break; case 192: - // line 1725 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1719 "./../src/mycompiler/myparser/JavaParser.jay" { org.apache.log4j.Logger.getLogger("parser").debug("conditionalexpression"); yyVal=((Expr)yyVals[0+yyTop]); } break; case 193: - // line 1730 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1724 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Assign)yyVals[0+yyTop]); } break; case 194: - // line 1736 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1730 "./../src/mycompiler/myparser/JavaParser.jay" { EmptyStmt Empst = new EmptyStmt(); yyVal=Empst; } break; case 195: - // line 1742 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1736 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[-1+yyTop]); } break; case 196: - // line 1747 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1741 "./../src/mycompiler/myparser/JavaParser.jay" { Return ret = new Return(-1,-1); yyVal= ret; } break; case 197: - // line 1752 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1746 "./../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])); @@ -2398,31 +2398,31 @@ case 197: } break; case 198: - // line 1759 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1753 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Statement)yyVals[0+yyTop]); } break; case 199: - // line 1763 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1757 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((IfStmt)yyVals[0+yyTop]); } break; case 200: - // line 1767 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1761 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((WhileStmt)yyVals[0+yyTop]); } break; case 201: - // line 1772 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1766 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 202: - // line 1778 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1772 "./../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()); @@ -2449,7 +2449,7 @@ case 202: } break; case 203: - // line 1803 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1797 "./../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()); @@ -2473,43 +2473,43 @@ case 203: } break; case 204: - // line 1826 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1820 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Assign)yyVals[0+yyTop]); } break; case 205: - // line 1830 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1824 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 206: - // line 1834 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1828 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 207: - // line 1838 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1832 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 208: - // line 1842 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1836 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 209: - // line 1846 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1840 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((MethodCall)yyVals[0+yyTop]); } break; case 210: - // line 1857 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1851 "./../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])); @@ -2519,7 +2519,7 @@ case 210: } break; case 211: - // line 1866 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1860 "./../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])); @@ -2528,13 +2528,13 @@ case 211: } break; case 212: - // line 1874 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1868 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 213: - // line 1878 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1872 "./../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()); @@ -2546,19 +2546,19 @@ case 213: } break; case 214: - // line 1891 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1885 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=null; } break; case 215: - // line 1896 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1890 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Block)yyVals[0+yyTop]); } break; case 216: - // line 1900 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1894 "./../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";}|*/ @@ -2569,19 +2569,19 @@ case 216: } break; case 217: - // line 1910 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1904 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=null; } break; case 218: - // line 1914 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1908 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((ParameterList)yyVals[-1+yyTop]); } break; case 219: - // line 1919 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1913 "./../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])); @@ -2590,54 +2590,54 @@ case 219: } break; case 220: - // line 1938 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1932 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((UsedId)yyVals[0+yyTop]); } break; case 221: - // line 1943 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1937 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=null; } break; case 222: - // line 1947 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1941 "./../src/mycompiler/myparser/JavaParser.jay" { TimesOp TEO = new TimesOp(-1,-1); yyVal=TEO; } break; case 223: - // line 1952 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1946 "./../src/mycompiler/myparser/JavaParser.jay" { DivideOp DEO = new DivideOp(-1,-1); yyVal=DEO; } break; case 224: - // line 1957 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1951 "./../src/mycompiler/myparser/JavaParser.jay" { ModuloOp MEO = new ModuloOp(-1,-1); yyVal=MEO; } break; case 225: - // line 1962 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1956 "./../src/mycompiler/myparser/JavaParser.jay" { PlusOp PEO = new PlusOp(-1,-1); yyVal=PEO; } break; case 226: - // line 1967 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1961 "./../src/mycompiler/myparser/JavaParser.jay" { MinusOp MEO = new MinusOp(-1,-1); yyVal=MEO; } break; case 227: - // line 1979 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1973 "./../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])); @@ -2645,7 +2645,7 @@ case 227: } break; case 228: - // line 1986 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1980 "./../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])); @@ -2653,7 +2653,7 @@ case 228: } break; case 229: - // line 1993 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1987 "./../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])); @@ -2661,7 +2661,7 @@ case 229: } break; case 230: - // line 2000 "./../src/mycompiler/myparser/JavaParser.jay" + // line 1994 "./../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])); @@ -2669,7 +2669,7 @@ case 230: } break; case 231: - // line 2008 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2002 "./../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()); @@ -2701,7 +2701,7 @@ case 231: } break; case 232: - // line 2038 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2032 "./../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()); @@ -2734,7 +2734,7 @@ case 232: } break; case 233: - // line 2069 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2063 "./../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()); @@ -2755,7 +2755,7 @@ case 233: } break; case 234: - // line 2088 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2082 "./../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()); @@ -2777,7 +2777,7 @@ case 234: } break; case 235: - // line 2111 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2105 "./../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])); @@ -2787,7 +2787,7 @@ case 235: } break; case 236: - // line 2119 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2113 "./../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])); @@ -2798,13 +2798,13 @@ case 236: } break; case 237: - // line 2129 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2123 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 238: - // line 2133 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2127 "./../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()); @@ -2816,19 +2816,19 @@ case 238: } break; case 239: - // line 2149 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2143 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 240: - // line 2153 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2147 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 241: - // line 2157 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2151 "./../src/mycompiler/myparser/JavaParser.jay" { PositivExpr POSEX=new PositivExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength()); UnaryPlus UP= new UnaryPlus(); @@ -2838,7 +2838,7 @@ case 241: } break; case 242: - // line 2165 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2159 "./../src/mycompiler/myparser/JavaParser.jay" { NegativeExpr NEGEX=new NegativeExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength()); UnaryMinus UM=new UnaryMinus(); @@ -2848,19 +2848,19 @@ case 242: } break; case 243: - // line 2173 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2167 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 244: - // line 2178 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2172 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 245: - // line 2182 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2176 "./../src/mycompiler/myparser/JavaParser.jay" { if (((UsedId)yyVals[0+yyTop]).get_Name().size() > 1) { @@ -2880,37 +2880,37 @@ case 245: } break; case 246: - // line 2200 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2194 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 247: - // line 2204 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2198 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 248: - // line 2209 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2203 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 249: - // line 2214 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2208 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 251: - // line 2220 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2214 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Literal)yyVals[0+yyTop]); } break; case 252: - // line 2224 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2218 "./../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()); @@ -2920,23 +2920,23 @@ case 252: } break; case 253: - // line 2245 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2239 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((MethodCall)yyVals[0+yyTop]); } break; case 254: - // line 2249 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2243 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 255: - // line 2254 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2248 "./../src/mycompiler/myparser/JavaParser.jay" {yyVal=((Expr)yyVals[0+yyTop]);} break; case 256: - // line 2256 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2250 "./../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); @@ -2945,36 +2945,36 @@ case 256: } break; case 257: - // line 2262 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2256 "./../src/mycompiler/myparser/JavaParser.jay" {yyVal=((CastExpr)yyVals[0+yyTop]);} break; case 258: - // line 2264 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2258 "./../src/mycompiler/myparser/JavaParser.jay" {yyVal=((Expr)yyVals[0+yyTop]);} break; case 260: - // line 2269 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2263 "./../src/mycompiler/myparser/JavaParser.jay" {IntLiteral IL = new IntLiteral(); IL.set_Int(((Token)yyVals[0+yyTop]).String2Int()); yyVal = IL; } break; case 261: - // line 2274 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2268 "./../src/mycompiler/myparser/JavaParser.jay" {BoolLiteral BL = new BoolLiteral(); BL.set_Bool(((Token)yyVals[0+yyTop]).String2Bool()); yyVal = BL; } break; case 262: - // line 2278 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2272 "./../src/mycompiler/myparser/JavaParser.jay" {CharLiteral CL = new CharLiteral(); CL.set_Char(((Token)yyVals[0+yyTop]).CharInString()); yyVal=CL; } break; case 263: - // line 2283 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2277 "./../src/mycompiler/myparser/JavaParser.jay" { StringLiteral ST = new StringLiteral(); ST.set_String(((Token)yyVals[0+yyTop]).get_String()); @@ -2982,14 +2982,14 @@ case 263: } break; case 264: - // line 2288 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2282 "./../src/mycompiler/myparser/JavaParser.jay" { LongLiteral LL = new LongLiteral(); LL.set_Long(((Token)yyVals[0+yyTop]).String2Long()); yyVal = LL; } break; case 265: - // line 2292 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2286 "./../src/mycompiler/myparser/JavaParser.jay" { FloatLiteral FL = new FloatLiteral(); FL.set_Float(((Token)yyVals[0+yyTop]).String2Float()); @@ -2997,7 +2997,7 @@ case 265: } break; case 266: - // line 2297 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2291 "./../src/mycompiler/myparser/JavaParser.jay" { DoubleLiteral DL = new DoubleLiteral(); DL.set_Double(((Token)yyVals[0+yyTop]).String2Double()); @@ -3005,14 +3005,14 @@ case 266: } break; case 267: - // line 2303 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2297 "./../src/mycompiler/myparser/JavaParser.jay" { Null NN = new Null(); yyVal=NN; } break; case 268: - // line 2309 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2303 "./../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])); @@ -3021,24 +3021,24 @@ case 268: } break; case 269: - // line 2318 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2312 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 270: - // line 2322 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2316 "./../src/mycompiler/myparser/JavaParser.jay" { } break; case 271: - // line 2326 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2320 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 272: - // line 2330 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2324 "./../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()); @@ -3050,7 +3050,7 @@ case 272: } break; case 273: - // line 2340 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2334 "./../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()); @@ -3062,13 +3062,13 @@ case 273: } break; case 274: - // line 2351 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2345 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 275: - // line 2355 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2349 "./../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()); @@ -3080,7 +3080,7 @@ case 275: } break; case 276: - // line 2365 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2359 "./../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()); @@ -3092,7 +3092,7 @@ case 276: } break; case 277: - // line 2375 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2369 "./../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()); @@ -3104,7 +3104,7 @@ case 277: } break; case 278: - // line 2385 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2379 "./../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()); @@ -3116,7 +3116,7 @@ case 278: } break; case 279: - // line 2395 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2389 "./../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])); @@ -3125,19 +3125,19 @@ case 279: } break; case 280: - // line 2403 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2397 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 281: - // line 2408 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2402 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 282: - // line 2412 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2406 "./../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()); @@ -3149,7 +3149,7 @@ case 282: } break; case 283: - // line 2422 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2416 "./../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()); @@ -3161,13 +3161,13 @@ case 283: } break; case 284: - // line 2433 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2427 "./../src/mycompiler/myparser/JavaParser.jay" { yyVal=((Expr)yyVals[0+yyTop]); } break; case 285: - // line 2437 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2431 "./../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()); @@ -3179,7 +3179,7 @@ case 285: } break; case 286: - // line 2447 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2441 "./../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()); @@ -3191,7 +3191,7 @@ case 286: } break; case 287: - // line 2457 "./../src/mycompiler/myparser/JavaParser.jay" + // line 2451 "./../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()); diff --git a/src/mycompiler/mystatement/IfStmt.java b/src/mycompiler/mystatement/IfStmt.java index c79d1529..202cb6d1 100755 --- a/src/mycompiler/mystatement/IfStmt.java +++ b/src/mycompiler/mystatement/IfStmt.java @@ -389,7 +389,7 @@ public class IfStmt extends Statement ret.add(this.else_block.TYPEStmt(assumptions)); if(!(else_block.getType() instanceof Void))ret.add(new SingleConstraint(else_block.getType(),this.getType())); } - ret.add(new SingleConstraint(expr.getType(),new RefType("boolean",0))); //(expressionDesIfStmt)<.boolean + ret.add(new SingleConstraint(expr.getType(),assumptions.getTypeFor(new RefType("Boolean",0)))); //(expressionDesIfStmt)<.boolean if(!(then_block.getType() instanceof Void))ret.add(new SingleConstraint(then_block.getType(),this.getType())); if(then_block.getType() instanceof Void && (else_block == null || else_block.getType() instanceof Void))this.setType(new Void(this.getOffset())); diff --git a/src/mycompiler/mystatement/WhileStmt.java b/src/mycompiler/mystatement/WhileStmt.java index ff9989ee..aa382447 100755 --- a/src/mycompiler/mystatement/WhileStmt.java +++ b/src/mycompiler/mystatement/WhileStmt.java @@ -182,7 +182,7 @@ public class WhileStmt extends Statement public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) { ConstraintsSet ret = new ConstraintsSet(); ret.add(expr.TYPEExpr(assumptions)); - SingleConstraint exprMustBeBool = new SingleConstraint(expr.getType(), new RefType("boolean", 0)); // while(expr){}; expr <. boolean + SingleConstraint exprMustBeBool = new SingleConstraint(expr.getType(), assumptions.getTypeFor(new RefType("Boolean", 0))); // while(expr){}; expr <. boolean ret.add(exprMustBeBool); ret.add(this.loop_block.TYPEStmt(assumptions)); this.setType(loop_block.getType()); diff --git a/test/plugindevelopment/TypeInsertTests/LambdaTest19.jav b/test/plugindevelopment/TypeInsertTests/LambdaTest19.jav new file mode 100644 index 00000000..32bf4fce --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/LambdaTest19.jav @@ -0,0 +1,14 @@ + +class TestIfStmt { + +methode(){ + var; + if(true){ + var=this; + }else{ + var=this; + } + return 1; +} + +} \ No newline at end of file diff --git a/test/plugindevelopment/TypeInsertTests/LambdaTest19.java b/test/plugindevelopment/TypeInsertTests/LambdaTest19.java new file mode 100644 index 00000000..f6c4a5e8 --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/LambdaTest19.java @@ -0,0 +1,16 @@ +package plugindevelopment.TypeInsertTests; + +import java.util.Vector; + +import org.junit.Test; + +public class LambdaTest19 { + private static final String TEST_FILE = "LambdaTest19.jav"; + + @Test + public void run(){ + Vector mustContain = new Vector(); + mustContain.add("TestIfStmt var"); + MultipleTypesInsertTester.testSingleInsert(this.TEST_FILE, mustContain); + } +} diff --git a/test/plugindevelopment/TypeInsertTests/LambdaTest20.jav b/test/plugindevelopment/TypeInsertTests/LambdaTest20.jav new file mode 100644 index 00000000..79053b87 --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/LambdaTest20.jav @@ -0,0 +1,11 @@ + +class WhileTest{ + + var; + public method(){ + while(true){ + var = "String"; + } + } + +} diff --git a/test/plugindevelopment/TypeInsertTests/LambdaTest20.java b/test/plugindevelopment/TypeInsertTests/LambdaTest20.java new file mode 100644 index 00000000..1cae420a --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/LambdaTest20.java @@ -0,0 +1,16 @@ +package plugindevelopment.TypeInsertTests; + +import java.util.Vector; + +import org.junit.Test; + +public class LambdaTest20 { + private static final String TEST_FILE = "LambdaTest21.jav"; + + @Test + public void run(){ + Vector mustContain = new Vector(); + //mustContain.add("TestIfStmt var"); + MultipleTypesInsertTester.testSingleInsert(this.TEST_FILE, mustContain); + } +} diff --git a/test/plugindevelopment/TypeInsertTests/LambdaTest21.jav b/test/plugindevelopment/TypeInsertTests/LambdaTest21.jav new file mode 100644 index 00000000..f510f0be --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/LambdaTest21.jav @@ -0,0 +1,9 @@ + +class Test{ + +void methode(){ + var; + var.toString(); +} + +} diff --git a/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java b/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java index 2c897b04..ca337c4b 100644 --- a/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java +++ b/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java @@ -65,8 +65,8 @@ public class MultipleTypesInsertTester extends TypeInsertTester{ System.out.println("Setze " + tip + " ein:"); inferedSource = point.insertType(tip, TypeInsertTester.getFileContent(rootDirectory + sourceFileToInfere)); System.out.println(inferedSource); + gesamterSrc += inferedSource; } - gesamterSrc += inferedSource; } } } catch (IOException | yyException e) {