Merge branch 'Endabgabe' of https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0 into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
i22007 2024-07-04 20:04:23 -04:00
commit 3628a0a4d8
7 changed files with 18 additions and 4 deletions

View File

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

View File

@ -834,6 +834,12 @@ public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
* *
* @param ctx the dot subtraction expression context * @param ctx the dot subtraction expression context
* @return the AST node for the dot subtraction expression * @return the AST node for the dot subtraction expression
*//**
* Creates an ITypeNode based on the type identifier.
* It handles basic types and reference types.
*
* @param identifier the type identifier
* @return the type node
*/ */
@Override @Override
public ASTNode visitDotSubtractionExpression(SimpleJavaParser.DotSubtractionExpressionContext ctx) { public ASTNode visitDotSubtractionExpression(SimpleJavaParser.DotSubtractionExpressionContext ctx) {

View File

@ -633,7 +633,7 @@ class AstBuilderTest {
LocalVariableDeclarationNode forDeclaration = new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "i", "=", new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "0"))); LocalVariableDeclarationNode forDeclaration = new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "i", "=", new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "0")));
AssignableNode assignable = new AssignableNode("i"); AssignableNode assignable = new AssignableNode("i");
IncrementNode increment = new IncrementNode(CrementType.SUFFIX, assignable); IncrementNode increment = new IncrementNode(CrementType.PREFIX, assignable);
LocalVariableDeclarationNode declaration = new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "a", null, null); LocalVariableDeclarationNode declaration = new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "a", null, null);

View File

@ -1,5 +1,6 @@
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
Person testPerson = new Person(5); Loops loop = new Loops();
System.out.println(loop.For(6));
} }
} }

View File

@ -14,4 +14,11 @@ public class Loops {
} }
return count; return count;
} }
public int For(int a) {
for(int i = 0; i < a; i++) {
}
return i + 2;
}
} }

View File

@ -1,7 +1,7 @@
class For{ class For{
public For(){ public For(){
for(int i = 0; i < 10; i++){ for(int i = 0; i < 10; ++i){
int a; int a;
} }
} }