johns-branch #12

Merged
i22005 merged 23 commits from johns-branch into main 2024-06-21 16:30:56 +00:00
29 changed files with 74 additions and 81 deletions
Showing only changes of commit d3e9fa9b43 - Show all commits

View File

@ -1,4 +0,0 @@
package ast;
public class IdentifierNode {
}

View File

@ -3,9 +3,9 @@ package ast.expression.binaryexpression;
import ast.ASTNode; import ast.ASTNode;
public class CalculationExpressionNode implements ASTNode { public class CalculationExpressionNode implements ASTNode {
CalculationExpressionNode calculationExpression; public CalculationExpressionNode calculationExpression;
String operator; public String operator;
DotExpressionNode dotExpression; public DotExpressionNode dotExpression;
public CalculationExpressionNode(CalculationExpressionNode calculationExpression, String operator, DotExpressionNode dotExpression) { public CalculationExpressionNode(CalculationExpressionNode calculationExpression, String operator, DotExpressionNode dotExpression) {
this.calculationExpression = calculationExpression; this.calculationExpression = calculationExpression;

View File

@ -3,9 +3,9 @@ package ast.expression.binaryexpression;
import ast.ASTNode; import ast.ASTNode;
public class DotExpressionNode implements ASTNode { public class DotExpressionNode implements ASTNode {
DotExpressionNode dotExpression; public DotExpressionNode dotExpression;
String operator; public String operator;
DotSubstractionExpressionNode dotSubstractionExpression; public DotSubstractionExpressionNode dotSubstractionExpression;
public DotExpressionNode(DotExpressionNode dotExpression, String operator, DotSubstractionExpressionNode dotSubstractionExpression) { public DotExpressionNode(DotExpressionNode dotExpression, String operator, DotSubstractionExpressionNode dotSubstractionExpression) {
this.dotExpression = dotExpression; this.dotExpression = dotExpression;

View File

@ -6,11 +6,11 @@ import ast.statement.statementexpression.methodcallstatementnexpression.MethodCa
import ast.type.ValueNode; import ast.type.ValueNode;
public class DotSubstractionExpressionNode implements ASTNode { public class DotSubstractionExpressionNode implements ASTNode {
ValueNode value; public ValueNode value;
String identifier; public String identifier;
MemberAccessNode memberAccess; public MemberAccessNode memberAccess;
MethodCallStatementExpressionNode methodCall; public MethodCallStatementExpressionNode methodCall;
CalculationExpressionNode calculationExpression; public CalculationExpressionNode calculationExpression;
public DotSubstractionExpressionNode(ValueNode value) { public DotSubstractionExpressionNode(ValueNode value) {
this.value = value; this.value = value;

View File

@ -5,9 +5,9 @@ import ast.expression.ExpressionNode;
import ast.expression.unaryexpression.UnaryExpressionNode; import ast.expression.unaryexpression.UnaryExpressionNode;
public class NonCalculationExpressionNode implements ASTNode { public class NonCalculationExpressionNode implements ASTNode {
UnaryExpressionNode unaryExpression; public UnaryExpressionNode unaryExpression;
String operator; public String operator;
ExpressionNode expression; public ExpressionNode expression;
public NonCalculationExpressionNode(UnaryExpressionNode unaryExpression, String operator, ExpressionNode expression) { public NonCalculationExpressionNode(UnaryExpressionNode unaryExpression, String operator, ExpressionNode expression) {
this.unaryExpression = unaryExpression; this.unaryExpression = unaryExpression;

View File

@ -6,8 +6,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class MemberAccessNode implements ASTNode { public class MemberAccessNode implements ASTNode {
Boolean thisExpr; public Boolean thisExpr;
List<String> identifiers = new ArrayList<>(); public List<String> identifiers = new ArrayList<>();
public MemberAccessNode(Boolean thisExpr) { public MemberAccessNode(Boolean thisExpr) {
this.thisExpr = thisExpr; this.thisExpr = thisExpr;

View File

@ -4,7 +4,7 @@ import ast.ASTNode;
import ast.expression.ExpressionNode; import ast.expression.ExpressionNode;
public class NotExpressionNode implements ASTNode { public class NotExpressionNode implements ASTNode {
ExpressionNode expression; public ExpressionNode expression;
public NotExpressionNode(ExpressionNode expression) { public NotExpressionNode(ExpressionNode expression) {
this.expression = expression; this.expression = expression;

View File

@ -8,13 +8,13 @@ import ast.type.ValueNode;
import java.util.Objects; import java.util.Objects;
public class UnaryExpressionNode implements ASTNode { public class UnaryExpressionNode implements ASTNode {
String thisExp; public String thisExp;
String identifier; public String identifier;
MemberAccessNode memberAccess; public MemberAccessNode memberAccess;
ValueNode value; public ValueNode value;
NotExpressionNode notExpression; public NotExpressionNode notExpression;
StatementNode statement; public StatementNode statement;
ExpressionNode expression; public ExpressionNode expression;
public UnaryExpressionNode(String value) { public UnaryExpressionNode(String value) {
if(Objects.equals(value, "this")) { if(Objects.equals(value, "this")) {

View File

@ -13,12 +13,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class MethodNode implements MemberNode { public class MethodNode implements MemberNode {
AccessModifierNode accesModifier; public AccessModifierNode accesModifier;
TypeNode type; public TypeNode type;
Boolean voidType; public Boolean voidType;
String identifier; public String identifier;
List<ParameterNode> parameters; public List<ParameterNode> parameters;
BlockNode block; public BlockNode block;
public MethodNode() {} public MethodNode() {}

View File

@ -4,8 +4,8 @@ import ast.ASTNode;
import ast.type.TypeNode; import ast.type.TypeNode;
public class ParameterNode implements ASTNode { public class ParameterNode implements ASTNode {
TypeNode type; public TypeNode type;
String identifier; public String identifier;
public ParameterNode(TypeNode type, String identifier) { public ParameterNode(TypeNode type, String identifier) {
this.type = type; this.type = type;

View File

@ -4,10 +4,10 @@ import ast.ASTNode;
import ast.expression.ExpressionNode; import ast.expression.ExpressionNode;
public class ForStatementNode implements ASTNode { public class ForStatementNode implements ASTNode {
ExpressionNode statementExpressionInit; public ExpressionNode statementExpressionInit;
StatementNode localVariableDeclarationInit; public StatementNode localVariableDeclarationInit;
ExpressionNode expression; public ExpressionNode expression;
ExpressionNode statementExpression; public ExpressionNode statementExpression;
public ForStatementNode(ExpressionNode statementExpressionInit, ExpressionNode expression, ExpressionNode statementExpression) { public ForStatementNode(ExpressionNode statementExpressionInit, ExpressionNode expression, ExpressionNode statementExpression) {
this.statementExpressionInit = statementExpressionInit; this.statementExpressionInit = statementExpressionInit;

View File

@ -5,10 +5,10 @@ import ast.expression.ExpressionNode;
import ast.type.TypeNode; import ast.type.TypeNode;
public class LocalVariableDeclarationNode implements ASTNode { public class LocalVariableDeclarationNode implements ASTNode {
TypeNode type; public TypeNode type;
String identifier; public String identifier;
String assign; public String assign;
ExpressionNode expression; public ExpressionNode expression;
public LocalVariableDeclarationNode(TypeNode type, String identifier, String assign, ExpressionNode expression) { public LocalVariableDeclarationNode(TypeNode type, String identifier, String assign, ExpressionNode expression) {
this.type = type; this.type = type;

View File

@ -1,2 +1,4 @@
package ast.statement;public class StatementNode { package ast.statement;
public class StatementNode {
} }

View File

@ -5,8 +5,8 @@ import ast.block.BlockNode;
import ast.expression.ExpressionNode; import ast.expression.ExpressionNode;
public class WhileStatementNode implements ASTNode { public class WhileStatementNode implements ASTNode {
ExpressionNode expression; public ExpressionNode expression;
BlockNode block; public BlockNode block;
public WhileStatementNode(ExpressionNode expression, BlockNode block) { public WhileStatementNode(ExpressionNode expression, BlockNode block) {
this.expression = expression; this.expression = expression;

View File

@ -4,7 +4,7 @@ import ast.ASTNode;
import ast.block.BlockNode; import ast.block.BlockNode;
public class ElseStatementNode implements ASTNode { public class ElseStatementNode implements ASTNode {
BlockNode block; public BlockNode block;
public ElseStatementNode(BlockNode block) { public ElseStatementNode(BlockNode block) {
this.block = block; this.block = block;

View File

@ -6,8 +6,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class IfElseStatementNode implements ASTNode { public class IfElseStatementNode implements ASTNode {
IfStatementNode ifStatement; public IfStatementNode ifStatement;
List<ElseStatementNode> elseStatements = new ArrayList<>(); public List<ElseStatementNode> elseStatements = new ArrayList<>();
public IfElseStatementNode(IfStatementNode ifStatement) { public IfElseStatementNode(IfStatementNode ifStatement) {
this.ifStatement = ifStatement; this.ifStatement = ifStatement;

View File

@ -5,8 +5,8 @@ import ast.block.BlockNode;
import ast.expression.ExpressionNode; import ast.expression.ExpressionNode;
public class IfStatementNode implements ASTNode { public class IfStatementNode implements ASTNode {
ExpressionNode expression; public ExpressionNode expression;
BlockNode block; public BlockNode block;
public IfStatementNode(ExpressionNode expression, BlockNode block) { public IfStatementNode(ExpressionNode expression, BlockNode block) {
this.expression = expression; this.expression = expression;

View File

@ -4,8 +4,8 @@ import ast.ASTNode;
import ast.expression.ExpressionNode; import ast.expression.ExpressionNode;
public class AssignStatementExpressionNode implements ASTNode { public class AssignStatementExpressionNode implements ASTNode {
AssignableExpressionNode assignable; public AssignableExpressionNode assignable;
ExpressionNode expression; public ExpressionNode expression;
public AssignStatementExpressionNode(AssignableExpressionNode assignable, ExpressionNode expression) { public AssignStatementExpressionNode(AssignableExpressionNode assignable, ExpressionNode expression) {
this.assignable = assignable; this.assignable = assignable;

View File

@ -4,8 +4,8 @@ import ast.ASTNode;
import ast.expression.unaryexpression.MemberAccessNode; import ast.expression.unaryexpression.MemberAccessNode;
public class AssignableExpressionNode implements ASTNode { public class AssignableExpressionNode implements ASTNode {
String identifier; public String identifier;
MemberAccessNode memberAccess; public MemberAccessNode memberAccess;
public AssignableExpressionNode(String identifier) { public AssignableExpressionNode(String identifier) {
this.identifier = identifier; this.identifier = identifier;

View File

@ -1,5 +0,0 @@
package ast.statement.statementexpression;
public class IncrementExpression {
}

View File

@ -7,8 +7,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class NewDeclarationStatementExpressionNode implements ASTNode { public class NewDeclarationStatementExpressionNode implements ASTNode {
String identifier; public String identifier;
List<ExpressionNode> expressions = new ArrayList<>(); public List<ExpressionNode> expressions = new ArrayList<>();
public NewDeclarationStatementExpressionNode(String identifier) { public NewDeclarationStatementExpressionNode(String identifier) {
this.identifier = identifier; this.identifier = identifier;

View File

@ -4,8 +4,8 @@ import ast.ASTNode;
import ast.statement.statementexpression.AssignableExpressionNode; import ast.statement.statementexpression.AssignableExpressionNode;
public class DecrementExpressionNode implements ASTNode { public class DecrementExpressionNode implements ASTNode {
CrementType crementType; public CrementType crementType;
AssignableExpressionNode assignableExpression; public AssignableExpressionNode assignableExpression;
public DecrementExpressionNode(CrementType crementType, AssignableExpressionNode assignableExpression) { public DecrementExpressionNode(CrementType crementType, AssignableExpressionNode assignableExpression) {
this.assignableExpression = assignableExpression; this.assignableExpression = assignableExpression;

View File

@ -4,8 +4,8 @@ import ast.ASTNode;
import ast.statement.statementexpression.AssignableExpressionNode; import ast.statement.statementexpression.AssignableExpressionNode;
public class IncrementExpressionNode implements ASTNode { public class IncrementExpressionNode implements ASTNode {
CrementType crementType; public CrementType crementType;
AssignableExpressionNode assignableExpression; public AssignableExpressionNode assignableExpression;
public IncrementExpressionNode(CrementType crementType, AssignableExpressionNode assignableExpression) { public IncrementExpressionNode(CrementType crementType, AssignableExpressionNode assignableExpression) {
this.assignableExpression = assignableExpression; this.assignableExpression = assignableExpression;

View File

@ -7,8 +7,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class ChainedMethodNode implements ASTNode { public class ChainedMethodNode implements ASTNode {
String identifier; public String identifier;
List<ExpressionNode> expressions = new ArrayList<>(); public List<ExpressionNode> expressions = new ArrayList<>();
public ChainedMethodNode(String identifier) { public ChainedMethodNode(String identifier) {
this.identifier = identifier; this.identifier = identifier;

View File

@ -7,10 +7,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class MethodCallStatementExpressionNode implements ASTNode { public class MethodCallStatementExpressionNode implements ASTNode {
TargetNode target; public TargetNode target;
List<ChainedMethodNode> chainedMethods = new ArrayList<>(); public List<ChainedMethodNode> chainedMethods = new ArrayList<>();
String identifier; public String identifier;
List<ExpressionNode> expressions = new ArrayList<>(); public List<ExpressionNode> expressions = new ArrayList<>();
public MethodCallStatementExpressionNode(TargetNode target, String identifier) { public MethodCallStatementExpressionNode(TargetNode target, String identifier) {
this.target = target; this.target = target;

View File

@ -5,10 +5,10 @@ import ast.expression.unaryexpression.MemberAccessNode;
import ast.statement.statementexpression.NewDeclarationStatementExpressionNode; import ast.statement.statementexpression.NewDeclarationStatementExpressionNode;
public class TargetNode implements ASTNode { public class TargetNode implements ASTNode {
Boolean thisTar; public Boolean thisTar;
MemberAccessNode memberAccess; public MemberAccessNode memberAccess;
NewDeclarationStatementExpressionNode newDeclaration; public NewDeclarationStatementExpressionNode newDeclaration;
String identifier; public String identifier;
public TargetNode(Boolean thisTar) { public TargetNode(Boolean thisTar) {
this.thisTar = thisTar; this.thisTar = thisTar;

View File

@ -1,7 +1,7 @@
package ast.type; package ast.type;
public class AccessModifierNode { public class AccessModifierNode {
EnumAccessModifierNode accessType; public EnumAccessModifierNode accessType;
public AccessModifierNode(String accessModifier) { public AccessModifierNode(String accessModifier) {
setModifier(accessModifier); setModifier(accessModifier);

View File

@ -1,7 +1,7 @@
package ast.type; package ast.type;
public class TypeNode { public class TypeNode {
EnumTypeNode type; public EnumTypeNode type;
public TypeNode(String type) { public TypeNode(String type) {
setType(type); setType(type);

View File

@ -3,8 +3,8 @@ package ast.type;
import ast.ASTNode; import ast.ASTNode;
public class ValueNode implements ASTNode { public class ValueNode implements ASTNode {
EnumValueNode valueType; public EnumValueNode valueType;
String value; public String value;
public ValueNode(EnumValueNode valueType, String value) { public ValueNode(EnumValueNode valueType, String value) {
this.valueType = valueType; this.valueType = valueType;