This commit is contained in:
laurenz 2024-05-08 14:27:57 +02:00
commit 300b4a5e9b
5 changed files with 90 additions and 22 deletions

View File

@ -52,21 +52,33 @@ public class AbstractSyntax_ClassWithConstructor {
);
List<Statement> statementList = List.of(
new Assignment(
new Id("x"),
new FieldId(
true,
null,
new Id("x")),
new IntLiteral(10)
),
new For(
new Assignment(
new Id("i"),
new FieldId(
false,
null,
new Id("i")),
new IntLiteral(0)
),
new Binary(
new Id("i"),
new FieldId(
false,
null,
new Id("i")),
Operator.LT,
new IntLiteral(6)
),
new Assignment(
new Id("i"),
new FieldId(
false,
null,
new Id("i")),
new Binary(
new Id("i"),
Operator.ADD,
@ -83,7 +95,10 @@ public class AbstractSyntax_ClassWithConstructor {
List.of(
new For(
new Assignment(
new Id("j"),
new FieldId(
false,
null,
new Id("j")),
new IntLiteral(0)
),
new Binary(
@ -92,14 +107,27 @@ public class AbstractSyntax_ClassWithConstructor {
new Id("x")
),
new Assignment(
new Id("j"),
new FieldId(
false,
null,
new Id("j")),
new Binary(
new FieldId(
false,
null,
new Id("j")),
Operator.ADD,
new IntLiteral(1)
)
),
new Block(
List.of(),
List.of(
new Assignment(
new Id("x"),
new FieldId(
true,
null,
new Id("x")),
new Binary(
new Id("x"),
Operator.MUL,
@ -112,6 +140,7 @@ public class AbstractSyntax_ClassWithConstructor {
)
)
)
);
Block block = new Block(
localVariables,

View File

@ -53,7 +53,10 @@ public class AbstractSyntax_ClassWithConstructorAndMethodCall {
List.of(),
List.of(
new Assignment(
new Id("x"),
new FieldId(
true,
null,
new Id("x")),
new IntLiteral(10)
),
new While(
@ -67,7 +70,10 @@ public class AbstractSyntax_ClassWithConstructorAndMethodCall {
List.of(),
List.of(
new Assignment(
new Id("x"),
new FieldId(
true,
null,
new Id("x")),
new Binary(
new Id("x"),
Operator.MUL,

View File

@ -57,7 +57,10 @@ public class AbstractSyntax_ClassWithConstructorWithParameters {
List.of(),
List.of(
new Assignment(
new Id("x"),
new FieldId(
true,
null,
new Id("x")),
new Id("startValue")
),
new While(
@ -75,12 +78,15 @@ public class AbstractSyntax_ClassWithConstructorWithParameters {
),
List.of(
new Assignment(
new Id("innerRepetitions"),
new FieldId(
false,
null,
new Id("innerRepetitions")),
new Id("x")
),
new While(
new Binary(
new Id("repetitions"),
new Id("innerRepetitions"),
Operator.GT,
new IntLiteral(0)
),
@ -88,7 +94,10 @@ public class AbstractSyntax_ClassWithConstructorWithParameters {
List.of(),
List.of(
new Assignment(
new Id("x"),
new FieldId(
true,
null,
new Id("x")),
new Binary(
new Id("x"),
Operator.MUL,
@ -96,7 +105,10 @@ public class AbstractSyntax_ClassWithConstructorWithParameters {
)
),
new Assignment(
new Id("innerRepetitions"),
new FieldId(
false,
null,
new Id("innerRepetitions")),
new Binary(new Id("innerRepetitions"),
Operator.SUB,
new IntLiteral(1))
@ -106,7 +118,10 @@ public class AbstractSyntax_ClassWithConstructorWithParameters {
)
),
new Assignment(
new Id("repetitions"),
new FieldId(
false,
null,
new Id("repetitions")),
new Binary(new Id("repetitions"),
Operator.SUB,
new IntLiteral(1)

View File

@ -53,7 +53,10 @@ class AbstractSyntax_ClassWithMethodAndField {
List.of(),
List.of(
new Assignment(
new Id("c"),
new FieldId(
true,
null,
new Id("c")),
new Id("character")
)
)

View File

@ -63,11 +63,17 @@ public class AbstractSyntax_ClassWithMoreComplexMethodAndMain {
),
List.of(
new Assignment(
new Id("i"),
new FieldId(
false,
null,
new Id("i")),
new IntLiteral(11)
),
new Assignment(
new Id("returnValue"),
new FieldId(
false,
null,
new Id("returnValue")),
new BoolLiteral(false)
),
new While(
@ -80,14 +86,20 @@ public class AbstractSyntax_ClassWithMoreComplexMethodAndMain {
List.of(),
List.of(
new Assignment(
new Id("i"),
new FieldId(
true,
null,
new Id("i")),
new Binary(new Id("i"),
Operator.SUB,
new IntLiteral(1))
),
new Assignment(
new Id("returnValue"),
new FieldId(
false,
null,
new Id("returnValue")),
new Unary(
UnaryOperator.NOT,
new Id("returnValue")
@ -115,7 +127,10 @@ public class AbstractSyntax_ClassWithMoreComplexMethodAndMain {
TypeClassWithMoreComplexMethodAndMain.setObjectType(new Id("ClassWithMoreComplexMethodAndMain"));
List<Statement> statementList = List.of(
new Assignment(
new Id("instance"),
new FieldId(
true,
null,
new Id("instance")),
new New(
TypeClassWithMoreComplexMethodAndMain,
List.of()