Compare commits

...

2 Commits

Author SHA1 Message Date
c315966219 Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 19:45:09 +02:00
c2c4974c76 More Abgabe Tests working 2024-07-04 19:44:59 +02:00
8 changed files with 69 additions and 13 deletions

View File

@ -135,12 +135,12 @@ public class MethodCodeGen implements bytecode.visitor.MethodVisitor {
@Override
public void visit(CalculationNode calculationNode) {
if (calculationNode.dotExpression != null) {
calculationNode.dotExpression.accept(this);
}
if (calculationNode.calculationExpression != null) {
calculationNode.calculationExpression.accept(this);
}
if (calculationNode.dotExpression != null) {
calculationNode.dotExpression.accept(this);
}
if (calculationNode.operator != null) {
switch (calculationNode.operator) {
case PLUS:

View File

@ -39,6 +39,14 @@ public class Main {
System.err.println("Error reading the file: " + e.getMessage());
}
}
else {
try {
CharStream codeCharStream = CharStreams.fromPath(Paths.get("src/test/resources/input/endabgabeTests/Person.java"));
compileFile(codeCharStream, "src/test/resources/input/endabgabeTests");
} catch (IOException e) {
System.err.println("Error reading the file: " + e.getMessage());
}
}
}
/**

View File

@ -66,13 +66,13 @@ public class MiniCompilerLogger {
logger.addHandler(consoleHandler);
// Configure file handler
Handler fileHandler = new FileHandler("src/main/resources/logs/miniCompiler.log");
//Handler fileHandler = new FileHandler("src/main/resources/logs/miniCompiler.log");
// Toggle file logging on/off
fileHandler.setLevel(Level.ALL);
fileHandler.setFormatter(new CustomFormatter());
logger.addHandler(fileHandler);
//fileHandler.setLevel(Level.ALL);
//fileHandler.setFormatter(new CustomFormatter());
//logger.addHandler(fileHandler);
} catch (SecurityException | IOException e) {
} catch (SecurityException e) {
e.printStackTrace();
}
}

View File

@ -0,0 +1,25 @@
public class Calculation {
public int add(int a, int b) {
return a + b;
}
public int sub(int a, int b) {
return a - b;
}
public int mul(int a, int b) {
return a * b;
}
public int div(int a, int b) {
return a / b;
}
public int mod(int a, int b) {
return a % b;
}
public int complexCalculation() {
return 3 - 2 * 2 + 5;
}
}

View File

@ -4,13 +4,13 @@ public class ControlStructures {
return a + b;
}
public cahr checkNumber(int num) {
public char checkNumber(int num) {
if (num > 0) {
return "p";
return 'p';
} else if (num < 0) {
return "n";
return 'n';
} else {
return "z";
return 'z';
}
}
@ -19,7 +19,7 @@ public class ControlStructures {
int uneven = 0;
int i = 0;
while (i < limit) {
if (i % 2 == 0) {
if ((i % 2) == 0) {
even++;
} else {
uneven = uneven + 1;

View File

@ -0,0 +1 @@
public class EmptyClass {}

View File

@ -0,0 +1,17 @@
public class Loops {
public boolean If(int a, int b) {
if(a == b) {
return true;
} else {
return false;
}
}
public int While(int a) {
int count = 0;
while(count < a) {
count++;
}
return count;
}
}

View File

@ -0,0 +1,5 @@
public class Main {
public static void main(String[] args) {
Person testPerson = new Person(5);
}
}