This commit is contained in:
FelixKrespach 2017-10-01 09:58:56 +02:00
parent 86b2118770
commit 88c78342d5
4 changed files with 12 additions and 9 deletions

View File

@ -11,6 +11,7 @@ public class SwitchStmt extends Statement
{ {
public final Expression expr; public final Expression expr;
public final Block switchBlock; public final Block switchBlock;
public SwitchStmt(RefTypeOrTPHOrWildcardOrGeneric type,Expression expr, Block block, Token offset){ public SwitchStmt(RefTypeOrTPHOrWildcardOrGeneric type,Expression expr, Block block, Token offset){
super(type,offset); super(type,offset);
this.expr=expr; this.expr=expr;

View File

@ -212,7 +212,7 @@ public class OutputGenerator implements ASTVisitor {
@Override @Override
public void visit(BreakStmt breakStmt) public void visit(BreakStmt breakStmt)
{ {
out.append("break" + breakStmt.indentifier+";"); out.append("break"+ " " + breakStmt.indentifier);
} }
@Override @Override
@ -238,8 +238,10 @@ public class OutputGenerator implements ASTVisitor {
@Override @Override
public void visit(IfStmt ifStmt) { public void visit(IfStmt ifStmt) {
out.append("if"); out.append("if (");
ifStmt.expr.accept(this); ifStmt.expr.accept(this);
out.append(")");
//TODO implement to set ; if then block is empty
ifStmt.then_block.accept(this); ifStmt.then_block.accept(this);
out.append("else"); out.append("else");
ifStmt.else_block.accept(this); ifStmt.else_block.accept(this);

View File

@ -2,13 +2,13 @@ class WhileTest
{ {
void methode() void methode()
{ {
Boolean BoolTrue=true; Boolean boolVar=true;
do do
{ {
}while(testTrue); }while(boolVar);
while(test) while(boolVar)
{ {
test = test; test = test;
} }

View File

@ -39,13 +39,13 @@ public class JavaTXCompilerTest extends JavaTXCompiler {
//filesToTest.add(new File(rootDirectory+"Matrix.jav")); //filesToTest.add(new File(rootDirectory+"Matrix.jav"));
//filesToTest.add(new File(rootDirectory+"Import.jav")); //filesToTest.add(new File(rootDirectory+"Import.jav"));
filesToTest.add(new File(rootDirectory+"BreakTest.jav")); //filesToTest.add(new File(rootDirectory+"BreakTest.jav"));
filesToTest.add(new File(rootDirectory+"WhileTest.jav")); //filesToTest.add(new File(rootDirectory+"WhileTest.jav"));
filesToTest.add(new File(rootDirectory+"IfTest.jav")); //filesToTest.add(new File(rootDirectory+"IfTest.jav"));
filesToTest.add(new File(rootDirectory+"AssertTest.jav")); filesToTest.add(new File(rootDirectory+"AssertTest.jav"));
//filesToTest.add(new File(rootDirectory+"PrePostOperationTest.jav")); //filesToTest.add(new File(rootDirectory+"PrePostOperationTest.jav"));
//filesToTest.add(new File(rootDirectory+"SwitchTest.jav")); //filesToTest.add(new File(rootDirectory+"SwitchTest.jav"));
filesToTest.add(new File(rootDirectory+"WhileTest.jav")); //filesToTest.add(new File(rootDirectory+"WhileTest.jav"));
for(File f : filesToTest){ for(File f : filesToTest){
SourceFile sf = this.parse(f); SourceFile sf = this.parse(f);
System.out.println("-------------------------------------|"+f.getName()+"|----------------------------------------------"); System.out.println("-------------------------------------|"+f.getName()+"|----------------------------------------------");