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

View File

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

View File

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

View File

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

View File

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