+
Methods inherited from class de.dhbwstuttgart.syntaxtree.statement.Literal
diff --git a/doc/LambdaJavadoc/de/dhbwstuttgart/syntaxtree/statement/class-use/BoolLiteral.html b/doc/LambdaJavadoc/de/dhbwstuttgart/syntaxtree/statement/class-use/BoolLiteral.html
index 9ee5b804..4af21b8e 100644
--- a/doc/LambdaJavadoc/de/dhbwstuttgart/syntaxtree/statement/class-use/BoolLiteral.html
+++ b/doc/LambdaJavadoc/de/dhbwstuttgart/syntaxtree/statement/class-use/BoolLiteral.html
@@ -3,7 +3,7 @@
-Uses of Class de.dhbwstuttgart.syntaxtree.statement.BoolLiteral
+Uses of Class de.dhbwstuttgart.syntaxtree.statement.literal.BoolLiteral
@@ -70,9 +70,9 @@
-No usage of de.dhbwstuttgart.syntaxtree.statement.BoolLiteral
+No usage of de.dhbwstuttgart.syntaxtree.statement.literal.BoolLiteral
-No usage of de.dhbwstuttgart.syntaxtree.statement.CharLiteral
+No usage of de.dhbwstuttgart.syntaxtree.statement.literal.CharLiteral
-No usage of de.dhbwstuttgart.syntaxtree.statement.DoubleLiteral
+No usage of de.dhbwstuttgart.syntaxtree.statement.literal.DoubleLiteral
-No usage of de.dhbwstuttgart.syntaxtree.statement.FloatLiteral
+No usage of de.dhbwstuttgart.syntaxtree.statement.literal.FloatLiteral
-No usage of de.dhbwstuttgart.syntaxtree.statement.IntLiteral
+No usage of de.dhbwstuttgart.syntaxtree.statement.literal.NumberLiteral
diff --git a/doc/LambdaJavadoc/de/dhbwstuttgart/syntaxtree/statement/class-use/Null.html b/doc/LambdaJavadoc/de/dhbwstuttgart/syntaxtree/statement/class-use/Null.html
index 58ad9e25..03a3db97 100644
--- a/doc/LambdaJavadoc/de/dhbwstuttgart/syntaxtree/statement/class-use/Null.html
+++ b/doc/LambdaJavadoc/de/dhbwstuttgart/syntaxtree/statement/class-use/Null.html
@@ -3,7 +3,7 @@
-Uses of Class de.dhbwstuttgart.syntaxtree.statement.Null
+Uses of Class de.dhbwstuttgart.syntaxtree.statement.literal.Null
@@ -70,9 +70,9 @@
-No usage of de.dhbwstuttgart.syntaxtree.statement.Null
+No usage of de.dhbwstuttgart.syntaxtree.statement.literal.Null
-No usage of de.dhbwstuttgart.syntaxtree.statement.StringLiteral
+No usage of de.dhbwstuttgart.syntaxtree.statement.literal.StringLiteral
diff --git a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator.java b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator.java
index 381368d3..b1287693 100644
--- a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator.java
+++ b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator.java
@@ -6,19 +6,18 @@ import de.dhbwstuttgart.syntaxtree.modifier.*;
import de.dhbwstuttgart.syntaxtree.modifier.fieldModifier.*;
import de.dhbwstuttgart.syntaxtree.modifier.methodModifier.MethodModifier;
import de.dhbwstuttgart.syntaxtree.operator.AndOp;
-import de.dhbwstuttgart.syntaxtree.operator.Operator;
import de.dhbwstuttgart.syntaxtree.operator.OrOp;
import de.dhbwstuttgart.syntaxtree.statement.*;
+import de.dhbwstuttgart.syntaxtree.statement.Super;
+import de.dhbwstuttgart.syntaxtree.statement.literal.*;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typecheck.*;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.antlr.v4.runtime.Token;
-import org.antlr.v4.runtime.atn.SemanticContext;
import org.antlr.v4.runtime.tree.TerminalNode;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
@@ -512,21 +511,21 @@ public class SyntaxTreeGenerator{
return convert(declaration);
}
- private static Statement convert(Java8Parser.LabeledStatementContext labeledStatementContext) {
+ private Statement convert(Java8Parser.LabeledStatementContext labeledStatementContext) {
throw new NotImplementedException();
//return convert(labeledStatementContext.statement());
}
- private static Statement convert(Java8Parser.LabeledStatementNoShortIfContext stmt){
+ private Statement convert(Java8Parser.LabeledStatementNoShortIfContext stmt){
throw new NotImplementedException();
//return convert(stmt.statementNoShortIf());
}
- private static Statement convert(Java8Parser.ExpressionStatementContext stmt){
+ private Statement convert(Java8Parser.ExpressionStatementContext stmt){
return convert(stmt.statementExpression());
}
- private static Statement convert(Java8Parser.StatementExpressionContext stmt) {
+ private Statement convert(Java8Parser.StatementExpressionContext stmt) {
if(stmt.assignment() != null){
return convert(stmt.assignment());
}else if(stmt.preIncrementExpression() != null){
@@ -544,23 +543,30 @@ public class SyntaxTreeGenerator{
}else throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.MethodInvocationContext methodInvocationContext) {
- String name = methodInvocationContext.methodName().Identifier().getText();
+ private Statement convert(Java8Parser.MethodInvocationContext methodInvocationContext) {
+ String name;
+ if(methodInvocationContext.methodName()!=null){
+ name = methodInvocationContext.methodName().Identifier().getText();
+ }else{// if(methodInvocationContext.Identifier() != null){
+ name = methodInvocationContext.Identifier().getText();
+ }
Expr receiver;
if(methodInvocationContext.typeName() != null){
- receiver = new LocalOrFieldVarOrClassname(methodInvocationContext.typeName().getText(), methodInvocationContext.typeArguments().getStart());
+ receiver = new LocalOrFieldVarOrClassname(methodInvocationContext.typeName().getText(), methodInvocationContext.typeName().getStart());
}else if(methodInvocationContext.expressionName()!=null){
receiver = convert(methodInvocationContext.expressionName());
- }else{
- receiver = new This(methodInvocationContext.getStart());
- }
+ }else if(methodInvocationContext.primary() != null){
+ receiver = convert(methodInvocationContext.primary());
+ }else if(methodInvocationContext.toString().startsWith("super")){
+ receiver = new Super(methodInvocationContext.getStart());
+ }else throw new NotImplementedException();
ArgumentList argumentList = null;
MethodCall ret = new MethodCall(new Receiver(receiver), name, argumentList, methodInvocationContext.getStart());
return ret;
}
- private static Expr convert(Java8Parser.ExpressionNameContext expressionNameContext) {
+ private Expr convert(Java8Parser.ExpressionNameContext expressionNameContext) {
/*
Der Parser könnte feststellen, ob es sich um einen Klassennamen,
eine lokale Variable oder einen Feldzugriff handelt.
@@ -572,88 +578,88 @@ public class SyntaxTreeGenerator{
}
- private static Statement convert(Java8Parser.ClassInstanceCreationExpressionContext stmt) {
+ private Statement convert(Java8Parser.ClassInstanceCreationExpressionContext stmt) {
//TODO
throw new NotImplementedException();
}
- private static ExprStmt convert(Java8Parser.PreIncrementExpressionContext stmt) {
+ private ExprStmt convert(Java8Parser.PreIncrementExpressionContext stmt) {
//TODO
throw new NotImplementedException();
}
- private static ExprStmt convert(Java8Parser.PreDecrementExpressionContext stmt) {
+ private ExprStmt convert(Java8Parser.PreDecrementExpressionContext stmt) {
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.PostIncrementExpressionContext stmt) {
+ private Statement convert(Java8Parser.PostIncrementExpressionContext stmt) {
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.PostDecrementExpressionContext stmt) {
+ private Statement convert(Java8Parser.PostDecrementExpressionContext stmt) {
//TODO
throw new NotImplementedException();
}
- private static ExprStmt convert(Java8Parser.AssignmentContext stmt) {
+ private ExprStmt convert(Java8Parser.AssignmentContext stmt) {
//TODO
//return new StatementReturn(new Assign())
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.IfThenStatementContext stmt){
+ private Statement convert(Java8Parser.IfThenStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.IfThenElseStatementContext stmt){
+ private Statement convert(Java8Parser.IfThenElseStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.IfThenElseStatementNoShortIfContext stmt){
+ private Statement convert(Java8Parser.IfThenElseStatementNoShortIfContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.AssertStatementContext stmt){
+ private Statement convert(Java8Parser.AssertStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.SwitchStatementContext stmt){
+ private Statement convert(Java8Parser.SwitchStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.SwitchBlockContext stmt){
+ private Statement convert(Java8Parser.SwitchBlockContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.SwitchBlockStatementGroupContext stmt){
+ private Statement convert(Java8Parser.SwitchBlockStatementGroupContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.WhileStatementContext stmt){
+ private Statement convert(Java8Parser.WhileStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.WhileStatementNoShortIfContext stmt){
+ private Statement convert(Java8Parser.WhileStatementNoShortIfContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.DoStatementContext stmt){
+ private Statement convert(Java8Parser.DoStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.ForStatementContext stmt){
+ private Statement convert(Java8Parser.ForStatementContext stmt){
if(stmt.basicForStatement() != null){
return convert(stmt.basicForStatement());
}else if(stmt.enhancedForStatement() != null){
@@ -661,7 +667,7 @@ public class SyntaxTreeGenerator{
}else throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.ForStatementNoShortIfContext stmt){
+ private Statement convert(Java8Parser.ForStatementNoShortIfContext stmt){
if(stmt.basicForStatementNoShortIf() != null){
return convert(stmt.basicForStatementNoShortIf());
}else if(stmt.enhancedForStatementNoShortIf() != null){
@@ -669,12 +675,12 @@ public class SyntaxTreeGenerator{
}else throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.BasicForStatementContext stmt){
+ private Statement convert(Java8Parser.BasicForStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.BasicForStatementNoShortIfContext stmt){
+ private Statement convert(Java8Parser.BasicForStatementNoShortIfContext stmt){
//TODO
throw new NotImplementedException();
}
@@ -706,61 +712,61 @@ public class SyntaxTreeGenerator{
return new LocalVarBunchDeclaration(declarations, declaration.getStart());
}
- private static Statement convert(Java8Parser.ForUpdateContext stmt){
+ private Statement convert(Java8Parser.ForUpdateContext stmt){
return convert(stmt.statementExpressionList());
}
- private static Statement convert(Java8Parser.StatementExpressionListContext stmt){
+ private Statement convert(Java8Parser.StatementExpressionListContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.EnhancedForStatementContext stmt){
+ private Statement convert(Java8Parser.EnhancedForStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.EnhancedForStatementNoShortIfContext stmt){
+ private Statement convert(Java8Parser.EnhancedForStatementNoShortIfContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.BreakStatementContext stmt){
+ private Statement convert(Java8Parser.BreakStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.ContinueStatementContext stmt){
+ private Statement convert(Java8Parser.ContinueStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.ReturnStatementContext stmt){
+ private Statement convert(Java8Parser.ReturnStatementContext stmt){
return new Return(convert(stmt.expression()),stmt.getStart());
//throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.ThrowStatementContext stmt){
+ private Statement convert(Java8Parser.ThrowStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.SynchronizedStatementContext stmt){
+ private Statement convert(Java8Parser.SynchronizedStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.TryStatementContext stmt){
+ private Statement convert(Java8Parser.TryStatementContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.CatchesContext stmt){
+ private Statement convert(Java8Parser.CatchesContext stmt){
//TODO
throw new NotImplementedException();
}
- private static Statement convert(Java8Parser.CatchClauseContext stmt){
+ private Statement convert(Java8Parser.CatchClauseContext stmt){
//TODO
throw new NotImplementedException();
}
@@ -769,7 +775,7 @@ public class SyntaxTreeGenerator{
***************+ Expression Conversions:
*/
- private static Expr convert(Java8Parser.ExpressionContext expression) {
+ private Expr convert(Java8Parser.ExpressionContext expression) {
if(expression.lambdaExpression()!=null){
return convert(expression.lambdaExpression());
}else{
@@ -777,7 +783,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.AssignmentExpressionContext expression) {
+ private Expr convert(Java8Parser.AssignmentExpressionContext expression) {
if(expression.conditionalExpression() != null){
return convert(expression.conditionalExpression());
}else{
@@ -785,7 +791,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.ConditionalExpressionContext expression) {
+ private Expr convert(Java8Parser.ConditionalExpressionContext expression) {
if(expression.conditionalOrExpression() != null){
return convert(expression.conditionalOrExpression());
}else{
@@ -793,7 +799,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.ConditionalOrExpressionContext expression) {
+ private Expr convert(Java8Parser.ConditionalOrExpressionContext expression) {
if(expression.conditionalOrExpression() == null){
return convert(expression.conditionalAndExpression());
}else{
@@ -802,7 +808,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.ConditionalAndExpressionContext expression) {
+ private Expr convert(Java8Parser.ConditionalAndExpressionContext expression) {
if(expression.conditionalAndExpression() == null){
return convert(expression.inclusiveOrExpression());
}else{
@@ -811,7 +817,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.InclusiveOrExpressionContext expression) {
+ private Expr convert(Java8Parser.InclusiveOrExpressionContext expression) {
if(expression.inclusiveOrExpression() == null){
return convert(expression.exclusiveOrExpression());
}else{
@@ -819,7 +825,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.ExclusiveOrExpressionContext expression) {
+ private Expr convert(Java8Parser.ExclusiveOrExpressionContext expression) {
if(expression.exclusiveOrExpression() == null){
return convert(expression.andExpression());
}else{
@@ -827,7 +833,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.AndExpressionContext expression) {
+ private Expr convert(Java8Parser.AndExpressionContext expression) {
if(expression.andExpression() == null){
return convert(expression.equalityExpression());
}else{
@@ -835,7 +841,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.EqualityExpressionContext expression) {
+ private Expr convert(Java8Parser.EqualityExpressionContext expression) {
if(expression.equalityExpression() == null){
return convert(expression.relationalExpression());
}else{
@@ -843,7 +849,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.RelationalExpressionContext expression) {
+ private Expr convert(Java8Parser.RelationalExpressionContext expression) {
if(expression.relationalExpression() == null){
return convert(expression.shiftExpression());
}else{
@@ -851,7 +857,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.ShiftExpressionContext expression) {
+ private Expr convert(Java8Parser.ShiftExpressionContext expression) {
if(expression.shiftExpression() == null){
return convert(expression.additiveExpression());
}else{
@@ -859,7 +865,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.AdditiveExpressionContext expression) {
+ private Expr convert(Java8Parser.AdditiveExpressionContext expression) {
if(expression.additiveExpression() == null){
return convert(expression.multiplicativeExpression());
}else{
@@ -867,7 +873,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.MultiplicativeExpressionContext expression) {
+ private Expr convert(Java8Parser.MultiplicativeExpressionContext expression) {
if(expression.multiplicativeExpression() == null){
return convert(expression.unaryExpression());
}else{
@@ -875,7 +881,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.UnaryExpressionContext expression) {
+ private Expr convert(Java8Parser.UnaryExpressionContext expression) {
if(expression.preIncrementExpression() != null){
return convert(expression.preIncrementExpression());
}else if(expression.preDecrementExpression() != null){
@@ -893,7 +899,7 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.UnaryExpressionNotPlusMinusContext expression) {
+ private Expr convert(Java8Parser.UnaryExpressionNotPlusMinusContext expression) {
if(expression.postfixExpression() != null){
return convert(expression.postfixExpression());
}else if(expression.castExpression() != null){
@@ -903,7 +909,11 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.PostfixExpressionContext expression) {
+ private Expr convert(Java8Parser.CastExpressionContext expressionContext) {
+ throw new NotImplementedException();
+ }
+
+ private Expr convert(Java8Parser.PostfixExpressionContext expression) {
Expr expr;
if(expression.primary() != null){
expr = convert(expression.primary());
@@ -925,7 +935,7 @@ public class SyntaxTreeGenerator{
return expr;
}
- private static Expr convert(Java8Parser.PrimaryContext primary) {
+ private Expr convert(Java8Parser.PrimaryContext primary) {
Expr expr;
if(primary.primaryNoNewArray_lfno_primary()!=null){
expr = convert(primary.primaryNoNewArray_lfno_primary());
@@ -941,7 +951,11 @@ public class SyntaxTreeGenerator{
return expr;
}
- private static Expr convert(Java8Parser.PrimaryNoNewArray_lfno_primaryContext expression) {
+ private Expr convert(Java8Parser.ArrayCreationExpressionContext expression) {
+ throw new NotImplementedException();
+ }
+
+ private Expr convert(Java8Parser.PrimaryNoNewArray_lfno_primaryContext expression) {
if(expression.literal() != null){
return convert(expression.literal());
}else if(expression.expression()!=null){
@@ -953,8 +967,63 @@ public class SyntaxTreeGenerator{
}
}
- private static Expr convert(Java8Parser.MethodInvocation_lfno_primaryContext expression) {
- throw new NotImplementedException();
+ private Expr convert(Java8Parser.LiteralContext literal) {
+ /*if(literal.IntegerLiteral() != null){
+
+ RefType type = new RefType(reg.getName("java.lang.Integer"),literal.getStart());
+ return new IntLiteral(type,
+ Integer.parseInt(literal.toString()),
+ literal.getStart());
+ }else if(literal.FloatingPointLiteral() != null){
+ RefType type = new RefType(reg.getName("java.lang.Float"),literal.getStart());
+ return new FloatLiteral(type,
+ Float.parseFloat(literal.toString()),
+ literal.getStart());
+ */
+ if(literal.IntegerLiteral() != null){
+ Number value = Double.parseDouble(literal.toString());
+ return new NumberLiteral(TypePlaceholder.fresh(literal.getStart()),
+ value, literal.getStart());
+ }else if(literal.BooleanLiteral() != null){
+ RefType type = new RefType(reg.getName("java.lang.Boolean"),literal.getStart());
+ return new BoolLiteral(type,
+ Boolean.parseBoolean(literal.toString()),
+ literal.getStart());
+ }else if(literal.CharacterLiteral() != null){
+ RefType type = new RefType(reg.getName("java.lang.Character"),literal.getStart());
+ return new CharLiteral(type,
+ literal.toString().charAt(0),
+ literal.getStart());
+ }else if(literal.StringLiteral()!=null){
+ RefType type = new RefType(reg.getName("java.lang.String"),literal.getStart());
+ return new StringLiteral(type,
+ literal.toString(),
+ literal.getStart());
+ }else {// if(literal.NullLiteral() != null){
+ return new Null(TypePlaceholder.fresh(literal.getStart()),
+ literal.getStart());
+ }
+ }
+
+ private Expr convert(Java8Parser.MethodInvocation_lfno_primaryContext methodInvocationContext) {
+ String name;
+ if(methodInvocationContext.methodName()!=null){
+ name = methodInvocationContext.methodName().Identifier().getText();
+ }else{// if(methodInvocationContext.Identifier() != null){
+ name = methodInvocationContext.Identifier().getText();
+ }
+ Expr receiver;
+ if(methodInvocationContext.typeName() != null){
+ receiver = new LocalOrFieldVarOrClassname(methodInvocationContext.typeName().getText(), methodInvocationContext.typeName().getStart());
+ }else if(methodInvocationContext.expressionName()!=null){
+ receiver = convert(methodInvocationContext.expressionName());
+ }else if(methodInvocationContext.toString().startsWith("super")){
+ receiver = new Super(methodInvocationContext.getStart());
+ }else throw new NotImplementedException();
+
+ ArgumentList argumentList = null;
+ MethodCall ret = new MethodCall(new Receiver(receiver), name, argumentList, methodInvocationContext.getStart());
+ return ret;
}
private static Expr convert(Java8Parser.LambdaExpressionContext expression) {
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/BoolLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/BoolLiteral.java
deleted file mode 100755
index ff03d1c1..00000000
--- a/src/de/dhbwstuttgart/syntaxtree/statement/BoolLiteral.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package de.dhbwstuttgart.syntaxtree.statement;
-import java.util.Hashtable;
-
-import org.apache.bcel.generic.ClassGen;
-import org.apache.bcel.generic.InstructionConstants;
-import org.apache.bcel.generic.InstructionFactory;
-import org.apache.bcel.generic.InstructionList;
-
-
-
-
-public class BoolLiteral extends Literal
-{
-
-
- private boolean Bool;
-
- public BoolLiteral()
- {
- super(null,-1);
- }
-
-
- /*
- public void sc_check(Menge classname, Hashtable ch, Hashtable bh, boolean ext, Hashtable parach,Hashtable parabh)
- {
- if(ext)
- {
- parserlog.debug(" ---BoolLiteral---");
- }
- }
- */
-
-
- public void set_Bool(boolean b)
- {
- this.Bool = b;
- }
-
-
-
- public String get_Name()
- {
- return null;
- }
-
-
-
-
-
-}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/CharLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/CharLiteral.java
deleted file mode 100755
index 1324c1a1..00000000
--- a/src/de/dhbwstuttgart/syntaxtree/statement/CharLiteral.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package de.dhbwstuttgart.syntaxtree.statement;
-import java.util.Hashtable;
-
-
-
-
-
-public class CharLiteral extends Literal
-{
- private char Char;
-
-
- public CharLiteral()
- {
- super(null,-1);
- // ###########################################################
- }
-
-
- /*
- public void sc_check(Menge classname, Hashtable ch, Hashtable bh, boolean ext, Hashtable parach, Hashtable parabh)
- {
- if(ext)
- parserlog.debug(" ---CharLiteral---");
- }
- */
- public void set_Char( char c)
- {
- this.Char = c ;
- }
-
-
-
- public String get_Name()
- {
- return null;
- }
-
-}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/DoubleLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/DoubleLiteral.java
deleted file mode 100755
index bfb183b6..00000000
--- a/src/de/dhbwstuttgart/syntaxtree/statement/DoubleLiteral.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package de.dhbwstuttgart.syntaxtree.statement;
-
-
-public class DoubleLiteral extends Literal
-{
- private double Double;
-
- public DoubleLiteral()
- {
- super(null,-1);
-
-
- }
-
- public void set_Double(double i)
- {
- this.Double = i;
- }
-
- public double get_Double()
- {
- return Double;
- }
-
- /*
- public void sc_check(Menge classname, Hashtable ch, Hashtable bh, boolean ext, Hashtable parach, Hashtable parabh)
- {
- parserlog.debug("SC -> Semantik-Check f�r DoubleLiteral wurde aufgerufen --> nichts zu tun!");
- }
- */
-
- public String get_Name()
- {
- return null;
- }
-
-
-
-}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/FloatLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/FloatLiteral.java
deleted file mode 100755
index 66133a24..00000000
--- a/src/de/dhbwstuttgart/syntaxtree/statement/FloatLiteral.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package de.dhbwstuttgart.syntaxtree.statement;
-import java.util.Hashtable;
-
-import org.apache.bcel.generic.ClassGen;
-import org.apache.bcel.generic.ConstantPoolGen;
-import org.apache.bcel.generic.InstructionList;
-import org.apache.bcel.generic.LDC;
-import org.apache.bcel.generic.LDC2_W;
-
-
-
-
-public class FloatLiteral extends Literal
-{
- private float Float;
-
- public FloatLiteral()
- {
- super(null,-1);
-
-
- }
-
- public void set_Float(float i)
- {
- this.Float = i;
- }
-
- public float get_Float()
- {
- return Float;
- }
-
- /*
- public void sc_check(Menge classname, Hashtable ch, Hashtable bh, boolean ext, Hashtable parach, Hashtable parabh)
- {
- parserlog.debug("SC -> Semantik-Check f�r FloatLiteral wurde aufgerufen --> nichts zu tun!");
- }
- */
-
- public String get_Name()
- {
- return null;
- }
-
-
-}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/IntLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/IntLiteral.java
deleted file mode 100755
index e53defa2..00000000
--- a/src/de/dhbwstuttgart/syntaxtree/statement/IntLiteral.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package de.dhbwstuttgart.syntaxtree.statement;
-import java.util.Hashtable;
-
-import org.apache.bcel.Constants;
-import org.apache.bcel.generic.BIPUSH;
-import org.apache.bcel.generic.ClassGen;
-import org.apache.bcel.generic.InstructionFactory;
-import org.apache.bcel.generic.InstructionHandle;
-import org.apache.bcel.generic.InstructionList;
-import org.apache.bcel.generic.ObjectType;
-
-
-
-
-public class IntLiteral extends Literal
-{
- private int Int;
-
- public IntLiteral()
- {
- super(null,-1);
- // #JB# 20.04.2005
- }
-
- public void set_Int(int i)
- {
- this.Int = i;
- }
-
- public int get_Int()
- {
- return Int;
- }
-
- /*
- public void sc_check(Menge classname, Hashtable ch, Hashtable bh, boolean ext, Hashtable parach, Hashtable parabh)
- {
- parserlog.debug("SC -> Semantik-Check f�r IntLiteral wurde aufgerufen --> nichts zu tun!");
- }
- */
-
- public String get_Name()
- {
- return null;
- }
-
-
-}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Literal.java b/src/de/dhbwstuttgart/syntaxtree/statement/Literal.java
deleted file mode 100755
index 2136e303..00000000
--- a/src/de/dhbwstuttgart/syntaxtree/statement/Literal.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package de.dhbwstuttgart.syntaxtree.statement;
-
-
-import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
-
-public abstract class Literal extends Expression
-{
- // Gibt an, ob das Literal fuer einen Objekttyp oder
- // als primitive Konstante generiert werden soll.
- // Default: Konstanten werden als primitiver Typ generiert.
-
- private boolean primitiveFlag=true;
-
- public Literal(RefTypeOrTPH o, int i) {
- super(null, null);
- }
-
- public void setPrimitiveFlag(boolean b)
- {
- this.primitiveFlag=b;
- }
- public boolean getPrimitiveFlag()
- {
- return(this.primitiveFlag);
- }
-}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/LocalOrFieldVarOrClassname.java b/src/de/dhbwstuttgart/syntaxtree/statement/LocalOrFieldVarOrClassname.java
index 7945ea6d..cc4953ee 100755
--- a/src/de/dhbwstuttgart/syntaxtree/statement/LocalOrFieldVarOrClassname.java
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/LocalOrFieldVarOrClassname.java
@@ -25,21 +25,21 @@ import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
public class LocalOrFieldVarOrClassname extends Expression
{
- private final String name;
+ private final String expression;
private boolean isFieldAccess = false;
private boolean isClassAccess = false;
public LocalOrFieldVarOrClassname(String n, Token offset)
{
super(TypePlaceholder.fresh(offset),offset);
- this.name = n;
+ this.expression = n;
}
public LocalOrFieldVarOrClassname(Expr e1, String access)
{
super(TypePlaceholder.fresh(null),null);
- this.name = n;
+ this.expression = access;
}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/LongLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/LongLiteral.java
deleted file mode 100755
index 4e445fa9..00000000
--- a/src/de/dhbwstuttgart/syntaxtree/statement/LongLiteral.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package de.dhbwstuttgart.syntaxtree.statement;
-import java.util.Hashtable;
-
-import org.apache.bcel.generic.ClassGen;
-import org.apache.bcel.generic.ConstantPoolGen;
-import org.apache.bcel.generic.InstructionList;
-import org.apache.bcel.generic.LDC2_W;
-
-
-
-
-public class LongLiteral extends Literal
-{
- private long Long;
-
-
- public LongLiteral()
- {
- super(null,-1);
-
- }
-
- public void set_Long(long i)
- {
- this.Long = i;
- }
-
- public long get_Long()
- {
- return Long;
- }
-
- /*
- public void sc_check(Menge classname, Hashtable ch, Hashtable bh, boolean ext, Hashtable parach, Hashtable parabh)
- {
- parserlog.debug("SC -> Semantik-Check f�r LongLiteral wurde aufgerufen --> nichts zu tun!");
- }
- */
-
- public String get_Name()
- {
- return null;
- }
-
-}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/NegativeExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/NegativeExpr.java
index 60fed3bb..9dfccc8d 100755
--- a/src/de/dhbwstuttgart/syntaxtree/statement/NegativeExpr.java
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/NegativeExpr.java
@@ -2,6 +2,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable;
import java.util.Iterator;
+import org.antlr.v4.runtime.Token;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.InstructionList;
@@ -9,9 +10,9 @@ import org.apache.bcel.generic.InstructionList;
public class NegativeExpr extends UnaryExpr
{
- public NegativeExpr(int offset,int variableLength)
+ public NegativeExpr(Token offset)
{
- super(offset,variableLength);
+ super(offset);
}
private UnaryMinus neg;
public Expr expr;
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/NotExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/NotExpr.java
index c020a1ef..51f0f0e6 100755
--- a/src/de/dhbwstuttgart/syntaxtree/statement/NotExpr.java
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/NotExpr.java
@@ -1,11 +1,13 @@
package de.dhbwstuttgart.syntaxtree.statement;
+import org.antlr.v4.runtime.Token;
+
public class NotExpr extends UnaryExpr
{
- public NotExpr(int offset,int variableLength)
+ public NotExpr(Token offset)
{
- super(offset,variableLength);
+ super(offset);
}
private UnaryNot not;
public Expr expr;
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Null.java b/src/de/dhbwstuttgart/syntaxtree/statement/Null.java
deleted file mode 100755
index 54732307..00000000
--- a/src/de/dhbwstuttgart/syntaxtree/statement/Null.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package de.dhbwstuttgart.syntaxtree.statement;
-import java.util.Hashtable;
-
-import org.apache.bcel.generic.ClassGen;
-import org.apache.bcel.generic.InstructionConstants;
-import org.apache.bcel.generic.InstructionFactory;
-import org.apache.bcel.generic.InstructionList;
-
-
-
-
-
-public class Null extends Literal
-{
-
-
- public Null()
- {
- super(null,-1);
- //this.setType(new Type("__NULL__",this,getOffset()));
- }
-
- public String get_Name()
- {
- return null;
- }
-
- /*
- public void sc_check(Menge classname, Hashtable ch, Hashtable bh, boolean ext, Hashtable parach, Hashtable parabh)
- {
- if(ext)
- parserlog.debug(" ---Null---");
- }
- */
-
-
-}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/PositivExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/PositivExpr.java
index 2e68d963..dae69169 100755
--- a/src/de/dhbwstuttgart/syntaxtree/statement/PositivExpr.java
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/PositivExpr.java
@@ -1,11 +1,13 @@
package de.dhbwstuttgart.syntaxtree.statement;
+import org.antlr.v4.runtime.Token;
+
public class PositivExpr extends UnaryExpr
{
- public PositivExpr(int offset,int variableLength)
+ public PositivExpr(Token offset)
{
- super(offset,variableLength);
+ super(offset);
}
protected UnaryPlus plus;
public Expr expr;
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/PreDecExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/PreDecExpr.java
index d7277a61..415b2f37 100755
--- a/src/de/dhbwstuttgart/syntaxtree/statement/PreDecExpr.java
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/PreDecExpr.java
@@ -2,6 +2,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable;
import java.util.Iterator;
+import org.antlr.v4.runtime.Token;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.InstructionList;
@@ -11,9 +12,9 @@ import org.apache.bcel.generic.InstructionList;
public class PreDecExpr extends UnaryExpr
{
- public PreDecExpr(int offset,int variableLength)
+ public PreDecExpr(Token offset)
{
- super(offset,variableLength);
+ super(offset);
}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/PreIncExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/PreIncExpr.java
index cd1b6f2a..eb46b668 100755
--- a/src/de/dhbwstuttgart/syntaxtree/statement/PreIncExpr.java
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/PreIncExpr.java
@@ -1,11 +1,13 @@
package de.dhbwstuttgart.syntaxtree.statement;
+import org.antlr.v4.runtime.Token;
+
public class PreIncExpr extends UnaryExpr
{
- public PreIncExpr(int offset,int variableLength)
+ public PreIncExpr(Token offset)
{
- super(offset,variableLength);
+ super(offset);
}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/StringLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/StringLiteral.java
deleted file mode 100755
index 93b29713..00000000
--- a/src/de/dhbwstuttgart/syntaxtree/statement/StringLiteral.java
+++ /dev/null
@@ -1,48 +0,0 @@
-
-package de.dhbwstuttgart.syntaxtree.statement;
-
-
-
-
-
-
-import java.util.Hashtable;
-
-import org.apache.bcel.classfile.ConstantPool;
-import org.apache.bcel.generic.ClassGen;
-import org.apache.bcel.generic.ConstantPoolGen;
-import org.apache.bcel.generic.InstructionFactory;
-import org.apache.bcel.generic.InstructionList;
-import org.apache.bcel.generic.LDC;
-
-
-
-public class StringLiteral extends Literal
-{
- private String string;
-
- public StringLiteral()
- {
- super(null,-1);
- // #JB# 20.04.2005
- }
-
- /*
- public void sc_check(Menge classname, Hashtable ch, Hashtable bh, boolean ext, Hashtable parach, Hashtable parabh)
- {
- if(ext)
- parserlog.debug(" ---StringLiteral---");
- }
- */
-
- public void set_String( String s)
- {
- this.string = s;
- }
-
- public String get_Name()
- {
- return null;
- }
-
-}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Super.java b/src/de/dhbwstuttgart/syntaxtree/statement/Super.java
new file mode 100755
index 00000000..a7777e91
--- /dev/null
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/Super.java
@@ -0,0 +1,12 @@
+package de.dhbwstuttgart.syntaxtree.statement;
+
+import org.antlr.v4.runtime.Token;
+
+public class Super extends Expression
+{
+ public Super(Token offset)
+ {
+ super(null,null);
+ }
+
+}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/literal/BoolLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/literal/BoolLiteral.java
new file mode 100755
index 00000000..a6d907a9
--- /dev/null
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/literal/BoolLiteral.java
@@ -0,0 +1,22 @@
+package de.dhbwstuttgart.syntaxtree.statement.literal;
+
+import de.dhbwstuttgart.syntaxtree.statement.literal.Literal;
+import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
+import org.antlr.v4.runtime.Token;
+
+
+public class BoolLiteral extends Literal
+{
+
+ private boolean value;
+
+ public BoolLiteral(RefTypeOrTPH type, boolean value, Token offset)
+ {
+ super(type,offset);
+ this.value = value;
+ }
+
+
+
+
+}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/literal/CharLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/literal/CharLiteral.java
new file mode 100755
index 00000000..6b970bdb
--- /dev/null
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/literal/CharLiteral.java
@@ -0,0 +1,17 @@
+package de.dhbwstuttgart.syntaxtree.statement.literal;
+import de.dhbwstuttgart.syntaxtree.statement.literal.Literal;
+import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
+import org.antlr.v4.runtime.Token;
+
+
+public class CharLiteral extends Literal
+{
+ private char value;
+
+ public CharLiteral(RefTypeOrTPH type, char value, Token offset)
+ {
+ super(type,offset);
+ this.value = value;
+ }
+
+}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/literal/Literal.java b/src/de/dhbwstuttgart/syntaxtree/statement/literal/Literal.java
new file mode 100755
index 00000000..d50437a7
--- /dev/null
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/literal/Literal.java
@@ -0,0 +1,13 @@
+package de.dhbwstuttgart.syntaxtree.statement.literal;
+
+
+import de.dhbwstuttgart.syntaxtree.statement.Expression;
+import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
+import org.antlr.v4.runtime.Token;
+
+public abstract class Literal extends Expression
+{
+ public Literal(RefTypeOrTPH type, Token offset) {
+ super(type, offset);
+ }
+}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/literal/Null.java b/src/de/dhbwstuttgart/syntaxtree/statement/literal/Null.java
new file mode 100755
index 00000000..d5dce23e
--- /dev/null
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/literal/Null.java
@@ -0,0 +1,16 @@
+package de.dhbwstuttgart.syntaxtree.statement.literal;
+
+import de.dhbwstuttgart.syntaxtree.statement.literal.Literal;
+import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
+import org.antlr.v4.runtime.Token;
+
+
+public class Null extends Literal
+{
+
+ public Null(RefTypeOrTPH type, Token offset)
+ {
+ super(type,offset);
+ }
+
+}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/literal/NumberLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/literal/NumberLiteral.java
new file mode 100755
index 00000000..d82a207a
--- /dev/null
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/literal/NumberLiteral.java
@@ -0,0 +1,18 @@
+package de.dhbwstuttgart.syntaxtree.statement.literal;
+
+import de.dhbwstuttgart.syntaxtree.type.RefType;
+import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
+import org.antlr.v4.runtime.Token;
+
+
+public class NumberLiteral extends Literal
+{
+ private Number value;
+
+ public NumberLiteral(RefTypeOrTPH type, Number value, Token offset)
+ {
+ super(type,offset);
+ this.value = value;
+ }
+
+}
diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/literal/StringLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/literal/StringLiteral.java
new file mode 100755
index 00000000..7cb2b7af
--- /dev/null
+++ b/src/de/dhbwstuttgart/syntaxtree/statement/literal/StringLiteral.java
@@ -0,0 +1,19 @@
+
+package de.dhbwstuttgart.syntaxtree.statement.literal;
+
+import de.dhbwstuttgart.syntaxtree.type.RefType;
+import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
+import org.antlr.v4.runtime.Token;
+
+
+public class StringLiteral extends Literal
+{
+ private String value;
+
+ public StringLiteral(RefType type, String value, Token offset)
+ {
+ super(type,offset);
+ this.value = value;
+ }
+
+}