Merge branch 'Tests' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
commit
44c2f551de
58
.lib/Kurzdokumentation.md
Normal file
58
.lib/Kurzdokumentation.md
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# Kurzdokumentation
|
||||||
|
|
||||||
|
## Aufgabenverteilung
|
||||||
|
|
||||||
|
### Maximilian Stahl und Jannik Rombach:
|
||||||
|
- **Scanner**
|
||||||
|
- **Parser**
|
||||||
|
- **AST**
|
||||||
|
- **AstBuilder**
|
||||||
|
- **Modul: ast**
|
||||||
|
- Alle
|
||||||
|
- **Modul: parser**
|
||||||
|
- Alle
|
||||||
|
- **Modul: visitor**
|
||||||
|
- Alle
|
||||||
|
- **Testmodul: parser**
|
||||||
|
- AstBuildertest.java
|
||||||
|
- Helper.java
|
||||||
|
- **Testfiles: singleFeatureTests**
|
||||||
|
- Alle
|
||||||
|
|
||||||
|
### Johannes Ehlert:
|
||||||
|
- **Semantische Analyse**
|
||||||
|
- **Modul: semantic**
|
||||||
|
- **Modul: typecheck**
|
||||||
|
- **Testmodul: parser**
|
||||||
|
- AstBuildertest.java
|
||||||
|
- **Testfiles: typedAstFeatureTests**
|
||||||
|
- Großteil
|
||||||
|
- **Testfiles: typedAstExceptionsTests**
|
||||||
|
- Großteil
|
||||||
|
|
||||||
|
### David Große:
|
||||||
|
- **Bytecodegenerator**
|
||||||
|
- **Modul: bytecode**
|
||||||
|
- Alle
|
||||||
|
|
||||||
|
### Lucas Janker:
|
||||||
|
- **Tests**
|
||||||
|
- **Modul: main**
|
||||||
|
- Alle
|
||||||
|
- **Testmodul: main**
|
||||||
|
- Alle
|
||||||
|
- **Testmodul: parser**
|
||||||
|
- ScannerTest.java
|
||||||
|
- ParserTest.java
|
||||||
|
- **Testmodul: semantic**
|
||||||
|
- **Testfiles: combinedFeatureTests**
|
||||||
|
- Alle
|
||||||
|
- **Testfiles: failureTests**
|
||||||
|
- Alle
|
||||||
|
- **Testfiles: Alle**
|
||||||
|
- Refactoring
|
||||||
|
- **Ordnerstrukturen**
|
||||||
|
- Großteil
|
||||||
|
- **Build**
|
||||||
|
- **Makefile**
|
||||||
|
- **Dokumentation**
|
8
pom.xml
8
pom.xml
@ -20,7 +20,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<version>5.9.3</version> <!-- Change the version as needed -->
|
<version>5.11.0-M2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -44,6 +44,12 @@
|
|||||||
<version>3.26.0</version>
|
<version>3.26.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>5.11.0-M2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
|
@ -22,12 +22,10 @@ public class CalculationNode extends BinaryNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setOperator(String operator) {
|
private void setOperator(String operator) {
|
||||||
if(operator != null) {
|
if(operator.equals("+")) {
|
||||||
if(operator.equals("+")) {
|
this.operator = EnumLineOperator.PLUS;
|
||||||
this.operator = EnumLineOperator.PLUS;
|
} else if(operator.equals("-")) {
|
||||||
} else if(operator.equals("-")) {
|
this.operator = EnumLineOperator.MINUS;
|
||||||
this.operator = EnumLineOperator.MINUS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,10 +10,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ConstructorNode extends MethodNode {
|
public class ConstructorNode extends MethodNode implements Visitable {
|
||||||
|
public AccessModifierNode accessType;
|
||||||
|
public String identifier;
|
||||||
|
public List<ParameterNode> parameters = new ArrayList<>();
|
||||||
|
public BlockNode block;
|
||||||
|
|
||||||
public ConstructorNode(String accessType, String identifier, BlockNode block) {
|
public ConstructorNode(String accessType, String identifier, BlockNode block) {
|
||||||
this.accesModifier = new AccessModifierNode(accessType);
|
this.accessType = new AccessModifierNode(accessType);
|
||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
this.block = block;
|
this.block = block;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public class MethodNode implements MemberNode, Visitable {
|
|||||||
public AccessModifierNode accesModifier;
|
public AccessModifierNode accesModifier;
|
||||||
private ITypeNode type;
|
private ITypeNode type;
|
||||||
public Boolean voidType;
|
public Boolean voidType;
|
||||||
protected String identifier;
|
private String identifier;
|
||||||
public List<ParameterNode> parameters = new ArrayList<>();
|
public List<ParameterNode> parameters = new ArrayList<>();
|
||||||
public BlockNode block;
|
public BlockNode block;
|
||||||
|
|
||||||
|
@ -13,6 +13,11 @@ public class WhileNode implements IStatementNode {
|
|||||||
this.block = block;
|
this.block = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void test() {
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypeCheckResult accept(SemanticVisitor visitor) {
|
public TypeCheckResult accept(SemanticVisitor visitor) {
|
||||||
return visitor.analyze(this);
|
return visitor.analyze(this);
|
||||||
|
@ -53,7 +53,7 @@ public class MethodCodeGen implements bytecode.visitor.MethodVisitor {
|
|||||||
@Override
|
@Override
|
||||||
public void visit(ConstructorNode constructorNode) {
|
public void visit(ConstructorNode constructorNode) {
|
||||||
methodVisitor =
|
methodVisitor =
|
||||||
classWriter.visitMethod(mapper.mapAccessTypeToOpcode(constructorNode.accesModifier),
|
classWriter.visitMethod(mapper.mapAccessTypeToOpcode(constructorNode.accessType),
|
||||||
"<init>",
|
"<init>",
|
||||||
mapper.generateMethodDescriptor(new BaseType(TypeEnum.VOID), constructorNode.parameters),
|
mapper.generateMethodDescriptor(new BaseType(TypeEnum.VOID), constructorNode.parameters),
|
||||||
null,
|
null,
|
||||||
|
@ -13,6 +13,7 @@ import org.antlr.v4.runtime.tree.ParseTree;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,9 +21,9 @@ import java.nio.file.Paths;
|
|||||||
* <p> <code> cd .\src\test\ </code>
|
* <p> <code> cd .\src\test\ </code>
|
||||||
* <p> <code> make clean compile-raupenpiler </code>
|
* <p> <code> make clean compile-raupenpiler </code>
|
||||||
* <p> Start Raupenpiler using jar:
|
* <p> Start Raupenpiler using jar:
|
||||||
* <p> <code> java.exe -jar path_to_jar\JavaCompiler-1.0-jar-with-dependencies.jar 'path_to_input_file.java' 'path_to_output_directory' </code>
|
* <p> <code> java.exe -DgenJar=true_OR_false -DgenClass=true_OR_false -jar path_to_jar\JavaCompiler-1.0-jar-with-dependencies.jar 'path_to_input_file.java' 'path_to_output_directory' </code>
|
||||||
* <p> Example (jar needs to be in the target directory, compile with make or mvn package first):
|
* <p> Example (jar needs to be in the target directory, compile with make or mvn package first):
|
||||||
* <code> java.exe -jar .\target\JavaCompiler-1.0-jar-with-dependencies.jar 'src/main/resources/input/CompilerInput.java' 'src/main/resources/output' </code>
|
* <code> java.exe -DgenJar=true -DgenClass=true -jar .\target\JavaCompiler-1.0-jar-with-dependencies.jar 'src/main/resources/input/CompilerInput.java' 'src/main/resources/output' </code>
|
||||||
*/
|
*/
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
@ -91,15 +92,19 @@ public class Main {
|
|||||||
|
|
||||||
/*------------------------- Semantic Analyzer -> typed AST -------------------------*/
|
/*------------------------- Semantic Analyzer -> typed AST -------------------------*/
|
||||||
// Use the SemanticAnalyzer to generate a typed AST
|
// Use the SemanticAnalyzer to generate a typed AST
|
||||||
//ASTNode typedAst = SemanticAnalyzer.generateTast(abstractSyntaxTree);
|
ASTNode typedAst = SemanticAnalyzer.generateTast(abstractSyntaxTree);
|
||||||
// Log the typed AST
|
// Log the typed AST
|
||||||
RaupenLogger.logSemanticAnalyzer(abstractSyntaxTree);
|
RaupenLogger.logSemanticAnalyzer(typedAst);
|
||||||
|
|
||||||
/*------------------------- Bytecode Generator -> Bytecode -------------------------*/
|
/*------------------------- Bytecode Generator -> Bytecode -------------------------*/
|
||||||
// Use the ByteCodeGenerator to generate bytecode from the typed AST and output it to the specified directory
|
// Use the ByteCodeGenerator to generate bytecode from the typed AST and output it to the specified directory
|
||||||
ByteCodeGenerator byteCodeGenerator = new ByteCodeGenerator(outputDirectoryPath, true, true);
|
|
||||||
assert abstractSyntaxTree != null;
|
final boolean genJar = Optional.ofNullable(System.getProperty("genJar")).map(String::toLowerCase).map(Boolean::parseBoolean).orElse(true);
|
||||||
byteCodeGenerator.visit((ProgramNode) abstractSyntaxTree);
|
final boolean genClass = Optional.ofNullable(System.getProperty("genClass")).map(String::toLowerCase).map(Boolean::parseBoolean).orElse(true);
|
||||||
|
|
||||||
|
ByteCodeGenerator byteCodeGenerator = new ByteCodeGenerator(outputDirectoryPath, genJar, genClass);
|
||||||
|
assert typedAst != null;
|
||||||
|
byteCodeGenerator.visit((ProgramNode) typedAst);
|
||||||
// Log the bytecode generation
|
// Log the bytecode generation
|
||||||
RaupenLogger.logBytecodeGenerator();
|
RaupenLogger.logBytecodeGenerator();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,10 @@ package parser.astBuilder;
|
|||||||
import ast.*;
|
import ast.*;
|
||||||
|
|
||||||
import ast.expressions.IExpressionNode;
|
import ast.expressions.IExpressionNode;
|
||||||
import ast.expressions.binaryexpressions.*;
|
import ast.expressions.binaryexpressions.CalculationNode;
|
||||||
|
import ast.expressions.binaryexpressions.DotNode;
|
||||||
|
import ast.expressions.binaryexpressions.DotSubstractionNode;
|
||||||
|
import ast.expressions.binaryexpressions.NonCalculationNode;
|
||||||
import ast.expressions.unaryexpressions.MemberAccessNode;
|
import ast.expressions.unaryexpressions.MemberAccessNode;
|
||||||
import ast.expressions.unaryexpressions.NotNode;
|
import ast.expressions.unaryexpressions.NotNode;
|
||||||
import ast.expressions.unaryexpressions.UnaryNode;
|
import ast.expressions.unaryexpressions.UnaryNode;
|
||||||
@ -11,7 +14,6 @@ import ast.members.*;
|
|||||||
import ast.parameters.ParameterNode;
|
import ast.parameters.ParameterNode;
|
||||||
import ast.statementexpressions.AssignNode;
|
import ast.statementexpressions.AssignNode;
|
||||||
import ast.statementexpressions.AssignableNode;
|
import ast.statementexpressions.AssignableNode;
|
||||||
import ast.statementexpressions.IStatementExpressionNode;
|
|
||||||
import ast.statementexpressions.NewDeclarationNode;
|
import ast.statementexpressions.NewDeclarationNode;
|
||||||
import ast.statementexpressions.crementexpressions.CrementType;
|
import ast.statementexpressions.crementexpressions.CrementType;
|
||||||
import ast.statementexpressions.crementexpressions.DecrementNode;
|
import ast.statementexpressions.crementexpressions.DecrementNode;
|
||||||
@ -73,12 +75,7 @@ public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ASTNode visitConstructorDeclaration(SimpleJavaParser.ConstructorDeclarationContext ctx) {
|
public ASTNode visitConstructorDeclaration(SimpleJavaParser.ConstructorDeclarationContext ctx) {
|
||||||
ConstructorNode constructorNode;
|
ConstructorNode constructorNode = new ConstructorNode(ctx.AccessModifier().getText(), ctx.Identifier().getText(), (BlockNode) visit(ctx.blockStatement()));
|
||||||
if(ctx.AccessModifier() != null) {
|
|
||||||
constructorNode = new ConstructorNode(ctx.AccessModifier().getText(), ctx.Identifier().getText(), (BlockNode) visit(ctx.blockStatement()));
|
|
||||||
} else {
|
|
||||||
constructorNode = new ConstructorNode("public", ctx.Identifier().getText(), (BlockNode) visit(ctx.blockStatement()));
|
|
||||||
}
|
|
||||||
if(ctx.parameterList() != null) {
|
if(ctx.parameterList() != null) {
|
||||||
for(SimpleJavaParser.ParameterContext parameter : ctx.parameterList().parameter()) {
|
for(SimpleJavaParser.ParameterContext parameter : ctx.parameterList().parameter()) {
|
||||||
constructorNode.addParameter((ParameterNode) visit(parameter));
|
constructorNode.addParameter((ParameterNode) visit(parameter));
|
||||||
@ -167,8 +164,6 @@ public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
|
|||||||
return visitForStatement(ctx.forStatement());
|
return visitForStatement(ctx.forStatement());
|
||||||
} else if(ctx.ifElseStatement() != null) {
|
} else if(ctx.ifElseStatement() != null) {
|
||||||
return visitIfElseStatement(ctx.ifElseStatement());
|
return visitIfElseStatement(ctx.ifElseStatement());
|
||||||
} else if(ctx.switchStatement() != null) {
|
|
||||||
return visitSwitchStatement(ctx.switchStatement());
|
|
||||||
} else if(ctx.statementExpression() != null) {
|
} else if(ctx.statementExpression() != null) {
|
||||||
return visitStatementExpression(ctx.statementExpression());
|
return visitStatementExpression(ctx.statementExpression());
|
||||||
}
|
}
|
||||||
@ -182,12 +177,7 @@ public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ASTNode visitLocalVariableDeclaration(SimpleJavaParser.LocalVariableDeclarationContext ctx) {
|
public ASTNode visitLocalVariableDeclaration(SimpleJavaParser.LocalVariableDeclarationContext ctx) {
|
||||||
if(ctx.Assign() != null) {
|
return new LocalVariableDeclarationNode(createTypeNode(ctx.type().getText()), ctx.Identifier().getText(), ctx.Assign().getText(), (IExpressionNode) visit(ctx.expression()));
|
||||||
return new LocalVariableDeclarationNode(createTypeNode(ctx.type().getText()), ctx.Identifier().getText(), ctx.Assign().getText(), (IExpressionNode) visit(ctx.expression()));
|
|
||||||
} else {
|
|
||||||
return new LocalVariableDeclarationNode(createTypeNode(ctx.type().getText()), ctx.Identifier().getText(), null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -219,60 +209,46 @@ public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ASTNode visitForStatement(SimpleJavaParser.ForStatementContext ctx) {
|
public ASTNode visitForStatement(SimpleJavaParser.ForStatementContext ctx) {
|
||||||
|
|
||||||
List<IStatementNode> statements = new ArrayList<>();
|
List<IStatementNode> statements = new ArrayList<>();
|
||||||
|
|
||||||
// Initialisierung
|
//init
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (ctx.localVariableDeclaration() != null) {
|
if(ctx.localVariableDeclaration() != null) {
|
||||||
statements.add((IStatementNode) visit(ctx.localVariableDeclaration()));
|
statements.add((IStatementNode) visit(ctx.localVariableDeclaration()));
|
||||||
} else if (ctx.statementExpression(i) != null) {
|
} else if(ctx.statementExpression(i) != null){
|
||||||
statements.add((IStatementNode) visit(ctx.statementExpression(i)));
|
statements.add((IStatementNode) visit(ctx.statementExpression(i)));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bedingung
|
//condition
|
||||||
IExpressionNode condition = (IExpressionNode) visit(ctx.expression());
|
IExpressionNode condition = (IExpressionNode) visit(ctx.expression());
|
||||||
|
|
||||||
// Inkrement
|
//ink
|
||||||
IStatementExpressionNode crement = null;
|
IStatementNode crement = null;
|
||||||
boolean isPrefix = false;
|
if(ctx.statementExpression(i) != null){
|
||||||
if (ctx.statementExpression(i) != null) {
|
crement = (IStatementNode) visit(ctx.statementExpression(i));
|
||||||
crement = (IStatementExpressionNode) visit(ctx.statementExpression(i));
|
|
||||||
|
|
||||||
if (crement instanceof IncrementNode) {
|
|
||||||
isPrefix = ((IncrementNode) crement).crementType == CrementType.PREFIX;
|
|
||||||
} else if (crement instanceof DecrementNode) {
|
|
||||||
isPrefix = ((DecrementNode) crement).crementType == CrementType.PREFIX;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockNode forBlock = (BlockNode) visit(ctx.blockStatement());
|
BlockNode forBlock = new BlockNode();
|
||||||
|
|
||||||
// While-Schleife
|
BlockNode forStatements = (BlockNode) visit(ctx.blockStatement());
|
||||||
BlockNode whileBody = new BlockNode();
|
if(forStatements != null) {
|
||||||
|
forBlock.addStatement((IStatementNode) forStatements);
|
||||||
// Prä-Inkrement: Das Inkrement kommt vor dem Block
|
|
||||||
if (crement != null && isPrefix) {
|
|
||||||
whileBody.addStatement((IStatementNode) crement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block Statements der For-Schleife in den While-Block kopieren
|
if(crement != null){
|
||||||
for (IStatementNode statement : forBlock.statements) {
|
BlockNode forCrement = new BlockNode();
|
||||||
whileBody.addStatement(statement);
|
forCrement.addStatement((crement));
|
||||||
|
forBlock.addStatement(forCrement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post-Inkrement: Das Inkrement kommt nach dem Block
|
WhileNode While = new WhileNode(condition, forBlock);
|
||||||
if (crement != null && !isPrefix) {
|
|
||||||
whileBody.addStatement((IStatementNode) crement);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bedingung der While-Schleife
|
statements.add(While);
|
||||||
WhileNode whileNode = new WhileNode(condition, whileBody);
|
|
||||||
|
|
||||||
statements.add(whileNode);
|
|
||||||
|
|
||||||
BlockNode resultBlock = new BlockNode();
|
BlockNode resultBlock = new BlockNode();
|
||||||
for (IStatementNode statement : statements) {
|
for(IStatementNode statement : statements) {
|
||||||
resultBlock.addStatement((IStatementNode) statement);
|
resultBlock.addStatement((IStatementNode) statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,49 +296,6 @@ public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ASTNode visitSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx) {
|
|
||||||
UnaryNode switchExpression = (UnaryNode) visit(ctx.expression());
|
|
||||||
|
|
||||||
List<IfNode> ifNodes = new ArrayList<>();
|
|
||||||
|
|
||||||
for (SimpleJavaParser.CaseStatementContext caseCtx : ctx.caseStatement()) {
|
|
||||||
IExpressionNode caseExpression = (IExpressionNode) visit(caseCtx.value());
|
|
||||||
|
|
||||||
// Condition as NonCalculationNode -> Equals Expression
|
|
||||||
NonCalculationNode condition = new NonCalculationNode(switchExpression, "==", caseExpression);
|
|
||||||
|
|
||||||
BlockNode caseBlock = new BlockNode();
|
|
||||||
for (SimpleJavaParser.StatementContext stmtCtx : caseCtx.statement()) {
|
|
||||||
caseBlock.addStatement((IStatementNode) visit(stmtCtx));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Each case as if
|
|
||||||
IfNode ifNode = new IfNode(condition, caseBlock);
|
|
||||||
ifNodes.add(ifNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if has Default
|
|
||||||
ElseNode defaulElseNode = null;
|
|
||||||
if (ctx.defaultStatement() != null) {
|
|
||||||
BlockNode defaultBlock = new BlockNode();
|
|
||||||
for (SimpleJavaParser.StatementContext stmtCtx : ctx.defaultStatement().statement()) {
|
|
||||||
defaultBlock.addStatement((IStatementNode) visit(stmtCtx));
|
|
||||||
}
|
|
||||||
// Default als letztes Else Statement
|
|
||||||
defaulElseNode = new ElseNode(defaultBlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
IfElseNode ifElseNode = new IfElseNode(ifNodes.getFirst(),defaulElseNode);
|
|
||||||
ifNodes.removeFirst();
|
|
||||||
|
|
||||||
for (IfNode ifNode : ifNodes){
|
|
||||||
ifElseNode.addElseIfStatement(ifNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ifElseNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ASTNode visitAssign(SimpleJavaParser.AssignContext ctx) {
|
public ASTNode visitAssign(SimpleJavaParser.AssignContext ctx) {
|
||||||
return new AssignNode((AssignableNode) visit(ctx.assignableExpression()), (IExpressionNode) visit(ctx.expression()));
|
return new AssignNode((AssignableNode) visit(ctx.assignableExpression()), (IExpressionNode) visit(ctx.expression()));
|
||||||
|
File diff suppressed because one or more lines are too long
@ -41,18 +41,14 @@ Else=40
|
|||||||
For=41
|
For=41
|
||||||
Return=42
|
Return=42
|
||||||
New=43
|
New=43
|
||||||
Switch=44
|
CharValue=44
|
||||||
Case=45
|
IntValue=45
|
||||||
Default=46
|
BooleanValue=46
|
||||||
Colon=47
|
NullValue=47
|
||||||
CharValue=48
|
Identifier=48
|
||||||
IntValue=49
|
WS=49
|
||||||
BooleanValue=50
|
InlineComment=50
|
||||||
NullValue=51
|
MultilineComment=51
|
||||||
Identifier=52
|
|
||||||
WS=53
|
|
||||||
InlineComment=54
|
|
||||||
MultilineComment=55
|
|
||||||
'++'=1
|
'++'=1
|
||||||
'--'=2
|
'--'=2
|
||||||
'void'=3
|
'void'=3
|
||||||
@ -91,8 +87,4 @@ MultilineComment=55
|
|||||||
'for'=41
|
'for'=41
|
||||||
'return'=42
|
'return'=42
|
||||||
'new'=43
|
'new'=43
|
||||||
'switch'=44
|
'null'=47
|
||||||
'case'=45
|
|
||||||
'default'=46
|
|
||||||
':'=47
|
|
||||||
'null'=51
|
|
||||||
|
@ -252,42 +252,6 @@ public class SimpleJavaBaseListener implements SimpleJavaListener {
|
|||||||
* <p>The default implementation does nothing.</p>
|
* <p>The default implementation does nothing.</p>
|
||||||
*/
|
*/
|
||||||
@Override public void exitElseStatement(SimpleJavaParser.ElseStatementContext ctx) { }
|
@Override public void exitElseStatement(SimpleJavaParser.ElseStatementContext ctx) { }
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>The default implementation does nothing.</p>
|
|
||||||
*/
|
|
||||||
@Override public void enterSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx) { }
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>The default implementation does nothing.</p>
|
|
||||||
*/
|
|
||||||
@Override public void exitSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx) { }
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>The default implementation does nothing.</p>
|
|
||||||
*/
|
|
||||||
@Override public void enterCaseStatement(SimpleJavaParser.CaseStatementContext ctx) { }
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>The default implementation does nothing.</p>
|
|
||||||
*/
|
|
||||||
@Override public void exitCaseStatement(SimpleJavaParser.CaseStatementContext ctx) { }
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>The default implementation does nothing.</p>
|
|
||||||
*/
|
|
||||||
@Override public void enterDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx) { }
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>The default implementation does nothing.</p>
|
|
||||||
*/
|
|
||||||
@Override public void exitDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx) { }
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
*
|
||||||
|
@ -152,27 +152,6 @@ public class SimpleJavaBaseVisitor<T> extends AbstractParseTreeVisitor<T> implem
|
|||||||
* {@link #visitChildren} on {@code ctx}.</p>
|
* {@link #visitChildren} on {@code ctx}.</p>
|
||||||
*/
|
*/
|
||||||
@Override public T visitElseStatement(SimpleJavaParser.ElseStatementContext ctx) { return visitChildren(ctx); }
|
@Override public T visitElseStatement(SimpleJavaParser.ElseStatementContext ctx) { return visitChildren(ctx); }
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>The default implementation returns the result of calling
|
|
||||||
* {@link #visitChildren} on {@code ctx}.</p>
|
|
||||||
*/
|
|
||||||
@Override public T visitSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx) { return visitChildren(ctx); }
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>The default implementation returns the result of calling
|
|
||||||
* {@link #visitChildren} on {@code ctx}.</p>
|
|
||||||
*/
|
|
||||||
@Override public T visitCaseStatement(SimpleJavaParser.CaseStatementContext ctx) { return visitChildren(ctx); }
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>The default implementation returns the result of calling
|
|
||||||
* {@link #visitChildren} on {@code ctx}.</p>
|
|
||||||
*/
|
|
||||||
@Override public T visitDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx) { return visitChildren(ctx); }
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
*
|
||||||
|
File diff suppressed because one or more lines are too long
@ -23,9 +23,9 @@ public class SimpleJavaLexer extends Lexer {
|
|||||||
Less=20, GreaterEqual=21, LessEqual=22, Equal=23, NotEqual=24, Not=25,
|
Less=20, GreaterEqual=21, LessEqual=22, Equal=23, NotEqual=24, Not=25,
|
||||||
And=26, Or=27, Dot=28, OpenRoundBracket=29, ClosedRoundBracket=30, OpenCurlyBracket=31,
|
And=26, Or=27, Dot=28, OpenRoundBracket=29, ClosedRoundBracket=30, OpenCurlyBracket=31,
|
||||||
ClosedCurlyBracket=32, Semicolon=33, Comma=34, Class=35, This=36, While=37,
|
ClosedCurlyBracket=32, Semicolon=33, Comma=34, Class=35, This=36, While=37,
|
||||||
Do=38, If=39, Else=40, For=41, Return=42, New=43, Switch=44, Case=45,
|
Do=38, If=39, Else=40, For=41, Return=42, New=43, CharValue=44, IntValue=45,
|
||||||
Default=46, Colon=47, CharValue=48, IntValue=49, BooleanValue=50, NullValue=51,
|
BooleanValue=46, NullValue=47, Identifier=48, WS=49, InlineComment=50,
|
||||||
Identifier=52, WS=53, InlineComment=54, MultilineComment=55;
|
MultilineComment=51;
|
||||||
public static String[] channelNames = {
|
public static String[] channelNames = {
|
||||||
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
|
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
|
||||||
};
|
};
|
||||||
@ -42,10 +42,9 @@ public class SimpleJavaLexer extends Lexer {
|
|||||||
"GreaterEqual", "LessEqual", "Equal", "NotEqual", "Not", "And", "Or",
|
"GreaterEqual", "LessEqual", "Equal", "NotEqual", "Not", "And", "Or",
|
||||||
"Dot", "OpenRoundBracket", "ClosedRoundBracket", "OpenCurlyBracket",
|
"Dot", "OpenRoundBracket", "ClosedRoundBracket", "OpenCurlyBracket",
|
||||||
"ClosedCurlyBracket", "Semicolon", "Comma", "Class", "This", "While",
|
"ClosedCurlyBracket", "Semicolon", "Comma", "Class", "This", "While",
|
||||||
"Do", "If", "Else", "For", "Return", "New", "Switch", "Case", "Default",
|
"Do", "If", "Else", "For", "Return", "New", "CharValue", "IntValue",
|
||||||
"Colon", "CharValue", "IntValue", "BooleanValue", "NullValue", "Alphabetic",
|
"BooleanValue", "NullValue", "Alphabetic", "Numeric", "ValidIdentSymbols",
|
||||||
"Numeric", "ValidIdentSymbols", "Identifier", "WS", "InlineComment",
|
"Identifier", "WS", "InlineComment", "MultilineComment"
|
||||||
"MultilineComment"
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static final String[] ruleNames = makeRuleNames();
|
public static final String[] ruleNames = makeRuleNames();
|
||||||
@ -57,8 +56,7 @@ public class SimpleJavaLexer extends Lexer {
|
|||||||
"'+'", "'-'", "'*'", "'%'", "'/'", "'>'", "'<'", "'>='", "'<='", "'=='",
|
"'+'", "'-'", "'*'", "'%'", "'/'", "'>'", "'<'", "'>='", "'<='", "'=='",
|
||||||
"'!='", "'!'", "'&&'", "'||'", "'.'", "'('", "')'", "'{'", "'}'", "';'",
|
"'!='", "'!'", "'&&'", "'||'", "'.'", "'('", "')'", "'{'", "'}'", "';'",
|
||||||
"','", "'class'", "'this'", "'while'", "'do'", "'if'", "'else'", "'for'",
|
"','", "'class'", "'this'", "'while'", "'do'", "'if'", "'else'", "'for'",
|
||||||
"'return'", "'new'", "'switch'", "'case'", "'default'", "':'", null,
|
"'return'", "'new'", null, null, null, "'null'"
|
||||||
null, null, "'null'"
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
private static final String[] _LITERAL_NAMES = makeLiteralNames();
|
private static final String[] _LITERAL_NAMES = makeLiteralNames();
|
||||||
@ -70,9 +68,9 @@ public class SimpleJavaLexer extends Lexer {
|
|||||||
"Greater", "Less", "GreaterEqual", "LessEqual", "Equal", "NotEqual",
|
"Greater", "Less", "GreaterEqual", "LessEqual", "Equal", "NotEqual",
|
||||||
"Not", "And", "Or", "Dot", "OpenRoundBracket", "ClosedRoundBracket",
|
"Not", "And", "Or", "Dot", "OpenRoundBracket", "ClosedRoundBracket",
|
||||||
"OpenCurlyBracket", "ClosedCurlyBracket", "Semicolon", "Comma", "Class",
|
"OpenCurlyBracket", "ClosedCurlyBracket", "Semicolon", "Comma", "Class",
|
||||||
"This", "While", "Do", "If", "Else", "For", "Return", "New", "Switch",
|
"This", "While", "Do", "If", "Else", "For", "Return", "New", "CharValue",
|
||||||
"Case", "Default", "Colon", "CharValue", "IntValue", "BooleanValue",
|
"IntValue", "BooleanValue", "NullValue", "Identifier", "WS", "InlineComment",
|
||||||
"NullValue", "Identifier", "WS", "InlineComment", "MultilineComment"
|
"MultilineComment"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
|
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
|
||||||
@ -134,7 +132,7 @@ public class SimpleJavaLexer extends Lexer {
|
|||||||
public ATN getATN() { return _ATN; }
|
public ATN getATN() { return _ATN; }
|
||||||
|
|
||||||
public static final String _serializedATN =
|
public static final String _serializedATN =
|
||||||
"\u0004\u00007\u01bb\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
|
"\u0004\u00003\u019d\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
|
||||||
"\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004"+
|
"\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004"+
|
||||||
"\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007"+
|
"\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007"+
|
||||||
"\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b"+
|
"\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b"+
|
||||||
@ -149,263 +147,245 @@ public class SimpleJavaLexer extends Lexer {
|
|||||||
"&\u0002\'\u0007\'\u0002(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002+\u0007"+
|
"&\u0002\'\u0007\'\u0002(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002+\u0007"+
|
||||||
"+\u0002,\u0007,\u0002-\u0007-\u0002.\u0007.\u0002/\u0007/\u00020\u0007"+
|
"+\u0002,\u0007,\u0002-\u0007-\u0002.\u0007.\u0002/\u0007/\u00020\u0007"+
|
||||||
"0\u00021\u00071\u00022\u00072\u00023\u00073\u00024\u00074\u00025\u0007"+
|
"0\u00021\u00071\u00022\u00072\u00023\u00073\u00024\u00074\u00025\u0007"+
|
||||||
"5\u00026\u00076\u00027\u00077\u00028\u00078\u00029\u00079\u0001\u0000"+
|
"5\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0001"+
|
||||||
"\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002"+
|
"\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0003"+
|
||||||
"\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003"+
|
|
||||||
"\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003"+
|
"\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003"+
|
||||||
"\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0005"+
|
"\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004"+
|
||||||
"\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0006"+
|
"\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006"+
|
||||||
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
||||||
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
||||||
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
||||||
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
||||||
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
||||||
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
|
||||||
"\u0001\u0006\u0003\u0006\u00ba\b\u0006\u0001\u0007\u0001\u0007\u0001\u0007"+
|
"\u0001\u0006\u0001\u0006\u0003\u0006\u00b2\b\u0006\u0001\u0007\u0001\u0007"+
|
||||||
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
||||||
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
||||||
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
||||||
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
||||||
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
||||||
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
|
||||||
"\u0001\b\u0001\b\u0001\b\u0003\b\u00e6\b\b\u0001\t\u0001\t\u0003\t\u00ea"+
|
"\u0001\u0007\u0001\b\u0001\b\u0001\b\u0003\b\u00de\b\b\u0001\t\u0001\t"+
|
||||||
"\b\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0003\n\u00f2\b\n"+
|
"\u0003\t\u00e2\b\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0003"+
|
||||||
"\u0001\u000b\u0001\u000b\u0003\u000b\u00f6\b\u000b\u0001\f\u0001\f\u0001"+
|
"\n\u00ea\b\n\u0001\u000b\u0001\u000b\u0003\u000b\u00ee\b\u000b\u0001\f"+
|
||||||
"\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f\u0001\u0010"+
|
"\u0001\f\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f"+
|
||||||
"\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0013"+
|
"\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012"+
|
||||||
"\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015"+
|
"\u0001\u0013\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015"+
|
||||||
"\u0001\u0015\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017"+
|
"\u0001\u0015\u0001\u0015\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0017"+
|
||||||
"\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u0019"+
|
"\u0001\u0017\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019"+
|
||||||
"\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001b\u0001\u001b\u0001\u001c"+
|
"\u0001\u0019\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001b\u0001\u001b"+
|
||||||
"\u0001\u001c\u0001\u001d\u0001\u001d\u0001\u001e\u0001\u001e\u0001\u001f"+
|
"\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d\u0001\u001e\u0001\u001e"+
|
||||||
"\u0001\u001f\u0001 \u0001 \u0001!\u0001!\u0001\"\u0001\"\u0001\"\u0001"+
|
"\u0001\u001f\u0001\u001f\u0001 \u0001 \u0001!\u0001!\u0001\"\u0001\"\u0001"+
|
||||||
"\"\u0001\"\u0001\"\u0001#\u0001#\u0001#\u0001#\u0001#\u0001$\u0001$\u0001"+
|
"\"\u0001\"\u0001\"\u0001\"\u0001#\u0001#\u0001#\u0001#\u0001#\u0001$\u0001"+
|
||||||
"$\u0001$\u0001$\u0001$\u0001%\u0001%\u0001%\u0001&\u0001&\u0001&\u0001"+
|
"$\u0001$\u0001$\u0001$\u0001$\u0001%\u0001%\u0001%\u0001&\u0001&\u0001"+
|
||||||
"\'\u0001\'\u0001\'\u0001\'\u0001\'\u0001(\u0001(\u0001(\u0001(\u0001)"+
|
"&\u0001\'\u0001\'\u0001\'\u0001\'\u0001\'\u0001(\u0001(\u0001(\u0001("+
|
||||||
"\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001*\u0001*\u0001*\u0001"+
|
"\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001*\u0001*\u0001"+
|
||||||
"*\u0001+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001,\u0001,\u0001"+
|
"*\u0001*\u0001+\u0001+\u0005+\u014f\b+\n+\f+\u0152\t+\u0001+\u0001+\u0001"+
|
||||||
",\u0001,\u0001,\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001"+
|
",\u0003,\u0157\b,\u0001,\u0004,\u015a\b,\u000b,\f,\u015b\u0001-\u0001"+
|
||||||
"-\u0001.\u0001.\u0001/\u0001/\u0005/\u016d\b/\n/\f/\u0170\t/\u0001/\u0001"+
|
"-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0003-\u0167\b-\u0001"+
|
||||||
"/\u00010\u00030\u0175\b0\u00010\u00040\u0178\b0\u000b0\f0\u0179\u0001"+
|
".\u0001.\u0001.\u0001.\u0001.\u0001/\u0001/\u00010\u00010\u00011\u0001"+
|
||||||
"1\u00011\u00011\u00011\u00011\u00011\u00011\u00011\u00011\u00031\u0185"+
|
"1\u00011\u00031\u0175\b1\u00012\u00012\u00052\u0179\b2\n2\f2\u017c\t2"+
|
||||||
"\b1\u00012\u00012\u00012\u00012\u00012\u00013\u00013\u00014\u00014\u0001"+
|
"\u00013\u00043\u017f\b3\u000b3\f3\u0180\u00013\u00013\u00014\u00014\u0001"+
|
||||||
"5\u00015\u00015\u00035\u0193\b5\u00016\u00016\u00056\u0197\b6\n6\f6\u019a"+
|
"4\u00014\u00054\u0189\b4\n4\f4\u018c\t4\u00014\u00014\u00015\u00015\u0001"+
|
||||||
"\t6\u00017\u00047\u019d\b7\u000b7\f7\u019e\u00017\u00017\u00018\u0001"+
|
"5\u00015\u00055\u0194\b5\n5\f5\u0197\t5\u00015\u00015\u00015\u00015\u0001"+
|
||||||
"8\u00018\u00018\u00058\u01a7\b8\n8\f8\u01aa\t8\u00018\u00018\u00019\u0001"+
|
"5\u0001\u0195\u00006\u0001\u0001\u0003\u0002\u0005\u0003\u0007\u0004\t"+
|
||||||
"9\u00019\u00019\u00059\u01b2\b9\n9\f9\u01b5\t9\u00019\u00019\u00019\u0001"+
|
"\u0005\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b\u0017\f"+
|
||||||
"9\u00019\u0001\u01b3\u0000:\u0001\u0001\u0003\u0002\u0005\u0003\u0007"+
|
"\u0019\r\u001b\u000e\u001d\u000f\u001f\u0010!\u0011#\u0012%\u0013\'\u0014"+
|
||||||
"\u0004\t\u0005\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b"+
|
")\u0015+\u0016-\u0017/\u00181\u00193\u001a5\u001b7\u001c9\u001d;\u001e"+
|
||||||
"\u0017\f\u0019\r\u001b\u000e\u001d\u000f\u001f\u0010!\u0011#\u0012%\u0013"+
|
"=\u001f? A!C\"E#G$I%K&M\'O(Q)S*U+W,Y-[.]/_\u0000a\u0000c\u0000e0g1i2k"+
|
||||||
"\'\u0014)\u0015+\u0016-\u0017/\u00181\u00193\u001a5\u001b7\u001c9\u001d"+
|
"3\u0001\u0000\u0005\u0002\u0000\n\n\r\r\u0002\u0000AZaz\u0001\u000009"+
|
||||||
";\u001e=\u001f? A!C\"E#G$I%K&M\'O(Q)S*U+W,Y-[.]/_0a1c2e3g\u0000i\u0000"+
|
"\u0002\u0000$$__\u0003\u0000\t\n\r\r \u01af\u0000\u0001\u0001\u0000\u0000"+
|
||||||
"k\u0000m4o5q6s7\u0001\u0000\u0005\u0002\u0000\n\n\r\r\u0002\u0000AZaz"+
|
"\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000"+
|
||||||
"\u0001\u000009\u0002\u0000$$__\u0003\u0000\t\n\r\r \u01cd\u0000\u0001"+
|
"\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005"+
|
"\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001"+
|
"\u000f\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000"+
|
"\u0013\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u000f\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000"+
|
"\u0017\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u0013\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000"+
|
"\u001b\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u0017\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000"+
|
"\u001f\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001"+
|
||||||
"\u0000\u0000\u0000\u001b\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000"+
|
"\u0000\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000"+
|
||||||
"\u0000\u0000\u0000\u001f\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000"+
|
"\u0000\u0000\u0000)\u0001\u0000\u0000\u0000\u0000+\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000#\u0001\u0000\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000"+
|
"\u0000-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000\u0000\u00001"+
|
||||||
"\'\u0001\u0000\u0000\u0000\u0000)\u0001\u0000\u0000\u0000\u0000+\u0001"+
|
"\u0001\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u00005\u0001\u0000"+
|
||||||
"\u0000\u0000\u0000\u0000-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000"+
|
"\u0000\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u00001\u0001\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u0000"+
|
"\u0000;\u0001\u0000\u0000\u0000\u0000=\u0001\u0000\u0000\u0000\u0000?"+
|
||||||
"5\u0001\u0000\u0000\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001"+
|
"\u0001\u0000\u0000\u0000\u0000A\u0001\u0000\u0000\u0000\u0000C\u0001\u0000"+
|
||||||
"\u0000\u0000\u0000\u0000;\u0001\u0000\u0000\u0000\u0000=\u0001\u0000\u0000"+
|
"\u0000\u0000\u0000E\u0001\u0000\u0000\u0000\u0000G\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000?\u0001\u0000\u0000\u0000\u0000A\u0001\u0000\u0000\u0000\u0000"+
|
"\u0000I\u0001\u0000\u0000\u0000\u0000K\u0001\u0000\u0000\u0000\u0000M"+
|
||||||
"C\u0001\u0000\u0000\u0000\u0000E\u0001\u0000\u0000\u0000\u0000G\u0001"+
|
"\u0001\u0000\u0000\u0000\u0000O\u0001\u0000\u0000\u0000\u0000Q\u0001\u0000"+
|
||||||
"\u0000\u0000\u0000\u0000I\u0001\u0000\u0000\u0000\u0000K\u0001\u0000\u0000"+
|
"\u0000\u0000\u0000S\u0001\u0000\u0000\u0000\u0000U\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000M\u0001\u0000\u0000\u0000\u0000O\u0001\u0000\u0000\u0000\u0000"+
|
"\u0000W\u0001\u0000\u0000\u0000\u0000Y\u0001\u0000\u0000\u0000\u0000["+
|
||||||
"Q\u0001\u0000\u0000\u0000\u0000S\u0001\u0000\u0000\u0000\u0000U\u0001"+
|
"\u0001\u0000\u0000\u0000\u0000]\u0001\u0000\u0000\u0000\u0000e\u0001\u0000"+
|
||||||
"\u0000\u0000\u0000\u0000W\u0001\u0000\u0000\u0000\u0000Y\u0001\u0000\u0000"+
|
"\u0000\u0000\u0000g\u0001\u0000\u0000\u0000\u0000i\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000[\u0001\u0000\u0000\u0000\u0000]\u0001\u0000\u0000\u0000\u0000"+
|
"\u0000k\u0001\u0000\u0000\u0000\u0001m\u0001\u0000\u0000\u0000\u0003p"+
|
||||||
"_\u0001\u0000\u0000\u0000\u0000a\u0001\u0000\u0000\u0000\u0000c\u0001"+
|
"\u0001\u0000\u0000\u0000\u0005s\u0001\u0000\u0000\u0000\u0007x\u0001\u0000"+
|
||||||
"\u0000\u0000\u0000\u0000e\u0001\u0000\u0000\u0000\u0000m\u0001\u0000\u0000"+
|
"\u0000\u0000\t\u0080\u0001\u0000\u0000\u0000\u000b\u0085\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000o\u0001\u0000\u0000\u0000\u0000q\u0001\u0000\u0000\u0000\u0000"+
|
"\u0000\r\u00b1\u0001\u0000\u0000\u0000\u000f\u00b3\u0001\u0000\u0000\u0000"+
|
||||||
"s\u0001\u0000\u0000\u0000\u0001u\u0001\u0000\u0000\u0000\u0003x\u0001"+
|
"\u0011\u00dd\u0001\u0000\u0000\u0000\u0013\u00e1\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u0005{\u0001\u0000\u0000\u0000\u0007\u0080\u0001\u0000"+
|
"\u0015\u00e9\u0001\u0000\u0000\u0000\u0017\u00ed\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\t\u0088\u0001\u0000\u0000\u0000\u000b\u008d\u0001\u0000\u0000"+
|
"\u0019\u00ef\u0001\u0000\u0000\u0000\u001b\u00f1\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\r\u00b9\u0001\u0000\u0000\u0000\u000f\u00bb\u0001\u0000\u0000\u0000"+
|
"\u001d\u00f3\u0001\u0000\u0000\u0000\u001f\u00f5\u0001\u0000\u0000\u0000"+
|
||||||
"\u0011\u00e5\u0001\u0000\u0000\u0000\u0013\u00e9\u0001\u0000\u0000\u0000"+
|
"!\u00f7\u0001\u0000\u0000\u0000#\u00f9\u0001\u0000\u0000\u0000%\u00fb"+
|
||||||
"\u0015\u00f1\u0001\u0000\u0000\u0000\u0017\u00f5\u0001\u0000\u0000\u0000"+
|
"\u0001\u0000\u0000\u0000\'\u00fd\u0001\u0000\u0000\u0000)\u00ff\u0001"+
|
||||||
"\u0019\u00f7\u0001\u0000\u0000\u0000\u001b\u00f9\u0001\u0000\u0000\u0000"+
|
"\u0000\u0000\u0000+\u0102\u0001\u0000\u0000\u0000-\u0105\u0001\u0000\u0000"+
|
||||||
"\u001d\u00fb\u0001\u0000\u0000\u0000\u001f\u00fd\u0001\u0000\u0000\u0000"+
|
"\u0000/\u0108\u0001\u0000\u0000\u00001\u010b\u0001\u0000\u0000\u00003"+
|
||||||
"!\u00ff\u0001\u0000\u0000\u0000#\u0101\u0001\u0000\u0000\u0000%\u0103"+
|
"\u010d\u0001\u0000\u0000\u00005\u0110\u0001\u0000\u0000\u00007\u0113\u0001"+
|
||||||
"\u0001\u0000\u0000\u0000\'\u0105\u0001\u0000\u0000\u0000)\u0107\u0001"+
|
"\u0000\u0000\u00009\u0115\u0001\u0000\u0000\u0000;\u0117\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000+\u010a\u0001\u0000\u0000\u0000-\u010d\u0001\u0000\u0000"+
|
"\u0000=\u0119\u0001\u0000\u0000\u0000?\u011b\u0001\u0000\u0000\u0000A"+
|
||||||
"\u0000/\u0110\u0001\u0000\u0000\u00001\u0113\u0001\u0000\u0000\u00003"+
|
"\u011d\u0001\u0000\u0000\u0000C\u011f\u0001\u0000\u0000\u0000E\u0121\u0001"+
|
||||||
"\u0115\u0001\u0000\u0000\u00005\u0118\u0001\u0000\u0000\u00007\u011b\u0001"+
|
"\u0000\u0000\u0000G\u0127\u0001\u0000\u0000\u0000I\u012c\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u00009\u011d\u0001\u0000\u0000\u0000;\u011f\u0001\u0000\u0000"+
|
"\u0000K\u0132\u0001\u0000\u0000\u0000M\u0135\u0001\u0000\u0000\u0000O"+
|
||||||
"\u0000=\u0121\u0001\u0000\u0000\u0000?\u0123\u0001\u0000\u0000\u0000A"+
|
"\u0138\u0001\u0000\u0000\u0000Q\u013d\u0001\u0000\u0000\u0000S\u0141\u0001"+
|
||||||
"\u0125\u0001\u0000\u0000\u0000C\u0127\u0001\u0000\u0000\u0000E\u0129\u0001"+
|
"\u0000\u0000\u0000U\u0148\u0001\u0000\u0000\u0000W\u014c\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000G\u012f\u0001\u0000\u0000\u0000I\u0134\u0001\u0000\u0000"+
|
"\u0000Y\u0156\u0001\u0000\u0000\u0000[\u0166\u0001\u0000\u0000\u0000]"+
|
||||||
"\u0000K\u013a\u0001\u0000\u0000\u0000M\u013d\u0001\u0000\u0000\u0000O"+
|
"\u0168\u0001\u0000\u0000\u0000_\u016d\u0001\u0000\u0000\u0000a\u016f\u0001"+
|
||||||
"\u0140\u0001\u0000\u0000\u0000Q\u0145\u0001\u0000\u0000\u0000S\u0149\u0001"+
|
"\u0000\u0000\u0000c\u0174\u0001\u0000\u0000\u0000e\u0176\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000U\u0150\u0001\u0000\u0000\u0000W\u0154\u0001\u0000\u0000"+
|
"\u0000g\u017e\u0001\u0000\u0000\u0000i\u0184\u0001\u0000\u0000\u0000k"+
|
||||||
"\u0000Y\u015b\u0001\u0000\u0000\u0000[\u0160\u0001\u0000\u0000\u0000]"+
|
"\u018f\u0001\u0000\u0000\u0000mn\u0005+\u0000\u0000no\u0005+\u0000\u0000"+
|
||||||
"\u0168\u0001\u0000\u0000\u0000_\u016a\u0001\u0000\u0000\u0000a\u0174\u0001"+
|
"o\u0002\u0001\u0000\u0000\u0000pq\u0005-\u0000\u0000qr\u0005-\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000c\u0184\u0001\u0000\u0000\u0000e\u0186\u0001\u0000\u0000"+
|
"r\u0004\u0001\u0000\u0000\u0000st\u0005v\u0000\u0000tu\u0005o\u0000\u0000"+
|
||||||
"\u0000g\u018b\u0001\u0000\u0000\u0000i\u018d\u0001\u0000\u0000\u0000k"+
|
"uv\u0005i\u0000\u0000vw\u0005d\u0000\u0000w\u0006\u0001\u0000\u0000\u0000"+
|
||||||
"\u0192\u0001\u0000\u0000\u0000m\u0194\u0001\u0000\u0000\u0000o\u019c\u0001"+
|
"xy\u0005b\u0000\u0000yz\u0005o\u0000\u0000z{\u0005o\u0000\u0000{|\u0005"+
|
||||||
"\u0000\u0000\u0000q\u01a2\u0001\u0000\u0000\u0000s\u01ad\u0001\u0000\u0000"+
|
"l\u0000\u0000|}\u0005e\u0000\u0000}~\u0005a\u0000\u0000~\u007f\u0005n"+
|
||||||
"\u0000uv\u0005+\u0000\u0000vw\u0005+\u0000\u0000w\u0002\u0001\u0000\u0000"+
|
"\u0000\u0000\u007f\b\u0001\u0000\u0000\u0000\u0080\u0081\u0005c\u0000"+
|
||||||
"\u0000xy\u0005-\u0000\u0000yz\u0005-\u0000\u0000z\u0004\u0001\u0000\u0000"+
|
"\u0000\u0081\u0082\u0005h\u0000\u0000\u0082\u0083\u0005a\u0000\u0000\u0083"+
|
||||||
"\u0000{|\u0005v\u0000\u0000|}\u0005o\u0000\u0000}~\u0005i\u0000\u0000"+
|
"\u0084\u0005r\u0000\u0000\u0084\n\u0001\u0000\u0000\u0000\u0085\u0086"+
|
||||||
"~\u007f\u0005d\u0000\u0000\u007f\u0006\u0001\u0000\u0000\u0000\u0080\u0081"+
|
"\u0005i\u0000\u0000\u0086\u0087\u0005n\u0000\u0000\u0087\u0088\u0005t"+
|
||||||
"\u0005b\u0000\u0000\u0081\u0082\u0005o\u0000\u0000\u0082\u0083\u0005o"+
|
"\u0000\u0000\u0088\f\u0001\u0000\u0000\u0000\u0089\u008a\u0005p\u0000"+
|
||||||
"\u0000\u0000\u0083\u0084\u0005l\u0000\u0000\u0084\u0085\u0005e\u0000\u0000"+
|
"\u0000\u008a\u008b\u0005u\u0000\u0000\u008b\u008c\u0005b\u0000\u0000\u008c"+
|
||||||
"\u0085\u0086\u0005a\u0000\u0000\u0086\u0087\u0005n\u0000\u0000\u0087\b"+
|
"\u008d\u0005l\u0000\u0000\u008d\u008e\u0005i\u0000\u0000\u008e\u00b2\u0005"+
|
||||||
"\u0001\u0000\u0000\u0000\u0088\u0089\u0005c\u0000\u0000\u0089\u008a\u0005"+
|
"c\u0000\u0000\u008f\u0090\u0005p\u0000\u0000\u0090\u0091\u0005r\u0000"+
|
||||||
"h\u0000\u0000\u008a\u008b\u0005a\u0000\u0000\u008b\u008c\u0005r\u0000"+
|
"\u0000\u0091\u0092\u0005i\u0000\u0000\u0092\u0093\u0005v\u0000\u0000\u0093"+
|
||||||
"\u0000\u008c\n\u0001\u0000\u0000\u0000\u008d\u008e\u0005i\u0000\u0000"+
|
"\u0094\u0005a\u0000\u0000\u0094\u0095\u0005t\u0000\u0000\u0095\u00b2\u0005"+
|
||||||
"\u008e\u008f\u0005n\u0000\u0000\u008f\u0090\u0005t\u0000\u0000\u0090\f"+
|
"e\u0000\u0000\u0096\u0097\u0005p\u0000\u0000\u0097\u0098\u0005u\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u0091\u0092\u0005p\u0000\u0000\u0092\u0093\u0005"+
|
"\u0000\u0098\u0099\u0005b\u0000\u0000\u0099\u009a\u0005l\u0000\u0000\u009a"+
|
||||||
"u\u0000\u0000\u0093\u0094\u0005b\u0000\u0000\u0094\u0095\u0005l\u0000"+
|
"\u009b\u0005i\u0000\u0000\u009b\u009c\u0005c\u0000\u0000\u009c\u009d\u0005"+
|
||||||
"\u0000\u0095\u0096\u0005i\u0000\u0000\u0096\u00ba\u0005c\u0000\u0000\u0097"+
|
" \u0000\u0000\u009d\u009e\u0005s\u0000\u0000\u009e\u009f\u0005t\u0000"+
|
||||||
"\u0098\u0005p\u0000\u0000\u0098\u0099\u0005r\u0000\u0000\u0099\u009a\u0005"+
|
"\u0000\u009f\u00a0\u0005a\u0000\u0000\u00a0\u00a1\u0005t\u0000\u0000\u00a1"+
|
||||||
"i\u0000\u0000\u009a\u009b\u0005v\u0000\u0000\u009b\u009c\u0005a\u0000"+
|
"\u00a2\u0005i\u0000\u0000\u00a2\u00b2\u0005c\u0000\u0000\u00a3\u00a4\u0005"+
|
||||||
"\u0000\u009c\u009d\u0005t\u0000\u0000\u009d\u00ba\u0005e\u0000\u0000\u009e"+
|
"p\u0000\u0000\u00a4\u00a5\u0005r\u0000\u0000\u00a5\u00a6\u0005i\u0000"+
|
||||||
"\u009f\u0005p\u0000\u0000\u009f\u00a0\u0005u\u0000\u0000\u00a0\u00a1\u0005"+
|
"\u0000\u00a6\u00a7\u0005v\u0000\u0000\u00a7\u00a8\u0005a\u0000\u0000\u00a8"+
|
||||||
"b\u0000\u0000\u00a1\u00a2\u0005l\u0000\u0000\u00a2\u00a3\u0005i\u0000"+
|
"\u00a9\u0005t\u0000\u0000\u00a9\u00aa\u0005e\u0000\u0000\u00aa\u00ab\u0005"+
|
||||||
"\u0000\u00a3\u00a4\u0005c\u0000\u0000\u00a4\u00a5\u0005 \u0000\u0000\u00a5"+
|
" \u0000\u0000\u00ab\u00ac\u0005s\u0000\u0000\u00ac\u00ad\u0005t\u0000"+
|
||||||
"\u00a6\u0005s\u0000\u0000\u00a6\u00a7\u0005t\u0000\u0000\u00a7\u00a8\u0005"+
|
"\u0000\u00ad\u00ae\u0005a\u0000\u0000\u00ae\u00af\u0005t\u0000\u0000\u00af"+
|
||||||
"a\u0000\u0000\u00a8\u00a9\u0005t\u0000\u0000\u00a9\u00aa\u0005i\u0000"+
|
"\u00b0\u0005i\u0000\u0000\u00b0\u00b2\u0005c\u0000\u0000\u00b1\u0089\u0001"+
|
||||||
"\u0000\u00aa\u00ba\u0005c\u0000\u0000\u00ab\u00ac\u0005p\u0000\u0000\u00ac"+
|
"\u0000\u0000\u0000\u00b1\u008f\u0001\u0000\u0000\u0000\u00b1\u0096\u0001"+
|
||||||
"\u00ad\u0005r\u0000\u0000\u00ad\u00ae\u0005i\u0000\u0000\u00ae\u00af\u0005"+
|
"\u0000\u0000\u0000\u00b1\u00a3\u0001\u0000\u0000\u0000\u00b2\u000e\u0001"+
|
||||||
"v\u0000\u0000\u00af\u00b0\u0005a\u0000\u0000\u00b0\u00b1\u0005t\u0000"+
|
"\u0000\u0000\u0000\u00b3\u00b4\u0005p\u0000\u0000\u00b4\u00b5\u0005u\u0000"+
|
||||||
"\u0000\u00b1\u00b2\u0005e\u0000\u0000\u00b2\u00b3\u0005 \u0000\u0000\u00b3"+
|
"\u0000\u00b5\u00b6\u0005b\u0000\u0000\u00b6\u00b7\u0005l\u0000\u0000\u00b7"+
|
||||||
"\u00b4\u0005s\u0000\u0000\u00b4\u00b5\u0005t\u0000\u0000\u00b5\u00b6\u0005"+
|
"\u00b8\u0005i\u0000\u0000\u00b8\u00b9\u0005c\u0000\u0000\u00b9\u00ba\u0005"+
|
||||||
"a\u0000\u0000\u00b6\u00b7\u0005t\u0000\u0000\u00b7\u00b8\u0005i\u0000"+
|
" \u0000\u0000\u00ba\u00bb\u0005s\u0000\u0000\u00bb\u00bc\u0005t\u0000"+
|
||||||
"\u0000\u00b8\u00ba\u0005c\u0000\u0000\u00b9\u0091\u0001\u0000\u0000\u0000"+
|
"\u0000\u00bc\u00bd\u0005a\u0000\u0000\u00bd\u00be\u0005t\u0000\u0000\u00be"+
|
||||||
"\u00b9\u0097\u0001\u0000\u0000\u0000\u00b9\u009e\u0001\u0000\u0000\u0000"+
|
"\u00bf\u0005i\u0000\u0000\u00bf\u00c0\u0005c\u0000\u0000\u00c0\u00c1\u0005"+
|
||||||
"\u00b9\u00ab\u0001\u0000\u0000\u0000\u00ba\u000e\u0001\u0000\u0000\u0000"+
|
" \u0000\u0000\u00c1\u00c2\u0005v\u0000\u0000\u00c2\u00c3\u0005o\u0000"+
|
||||||
"\u00bb\u00bc\u0005p\u0000\u0000\u00bc\u00bd\u0005u\u0000\u0000\u00bd\u00be"+
|
"\u0000\u00c3\u00c4\u0005i\u0000\u0000\u00c4\u00c5\u0005d\u0000\u0000\u00c5"+
|
||||||
"\u0005b\u0000\u0000\u00be\u00bf\u0005l\u0000\u0000\u00bf\u00c0\u0005i"+
|
"\u00c6\u0005 \u0000\u0000\u00c6\u00c7\u0005m\u0000\u0000\u00c7\u00c8\u0005"+
|
||||||
"\u0000\u0000\u00c0\u00c1\u0005c\u0000\u0000\u00c1\u00c2\u0005 \u0000\u0000"+
|
"a\u0000\u0000\u00c8\u00c9\u0005i\u0000\u0000\u00c9\u00ca\u0005n\u0000"+
|
||||||
"\u00c2\u00c3\u0005s\u0000\u0000\u00c3\u00c4\u0005t\u0000\u0000\u00c4\u00c5"+
|
"\u0000\u00ca\u00cb\u0005(\u0000\u0000\u00cb\u00cc\u0005S\u0000\u0000\u00cc"+
|
||||||
"\u0005a\u0000\u0000\u00c5\u00c6\u0005t\u0000\u0000\u00c6\u00c7\u0005i"+
|
"\u00cd\u0005t\u0000\u0000\u00cd\u00ce\u0005r\u0000\u0000\u00ce\u00cf\u0005"+
|
||||||
"\u0000\u0000\u00c7\u00c8\u0005c\u0000\u0000\u00c8\u00c9\u0005 \u0000\u0000"+
|
"i\u0000\u0000\u00cf\u00d0\u0005n\u0000\u0000\u00d0\u00d1\u0005g\u0000"+
|
||||||
"\u00c9\u00ca\u0005v\u0000\u0000\u00ca\u00cb\u0005o\u0000\u0000\u00cb\u00cc"+
|
"\u0000\u00d1\u00d2\u0005[\u0000\u0000\u00d2\u00d3\u0005]\u0000\u0000\u00d3"+
|
||||||
"\u0005i\u0000\u0000\u00cc\u00cd\u0005d\u0000\u0000\u00cd\u00ce\u0005 "+
|
"\u00d4\u0005 \u0000\u0000\u00d4\u00d5\u0005a\u0000\u0000\u00d5\u00d6\u0005"+
|
||||||
"\u0000\u0000\u00ce\u00cf\u0005m\u0000\u0000\u00cf\u00d0\u0005a\u0000\u0000"+
|
"r\u0000\u0000\u00d6\u00d7\u0005g\u0000\u0000\u00d7\u00d8\u0005s\u0000"+
|
||||||
"\u00d0\u00d1\u0005i\u0000\u0000\u00d1\u00d2\u0005n\u0000\u0000\u00d2\u00d3"+
|
"\u0000\u00d8\u00d9\u0005)\u0000\u0000\u00d9\u0010\u0001\u0000\u0000\u0000"+
|
||||||
"\u0005(\u0000\u0000\u00d3\u00d4\u0005S\u0000\u0000\u00d4\u00d5\u0005t"+
|
"\u00da\u00de\u0003\u001f\u000f\u0000\u00db\u00de\u0003#\u0011\u0000\u00dc"+
|
||||||
"\u0000\u0000\u00d5\u00d6\u0005r\u0000\u0000\u00d6\u00d7\u0005i\u0000\u0000"+
|
"\u00de\u0003!\u0010\u0000\u00dd\u00da\u0001\u0000\u0000\u0000\u00dd\u00db"+
|
||||||
"\u00d7\u00d8\u0005n\u0000\u0000\u00d8\u00d9\u0005g\u0000\u0000\u00d9\u00da"+
|
"\u0001\u0000\u0000\u0000\u00dd\u00dc\u0001\u0000\u0000\u0000\u00de\u0012"+
|
||||||
"\u0005[\u0000\u0000\u00da\u00db\u0005]\u0000\u0000\u00db\u00dc\u0005 "+
|
"\u0001\u0000\u0000\u0000\u00df\u00e2\u0003\u001b\r\u0000\u00e0\u00e2\u0003"+
|
||||||
"\u0000\u0000\u00dc\u00dd\u0005a\u0000\u0000\u00dd\u00de\u0005r\u0000\u0000"+
|
"\u001d\u000e\u0000\u00e1\u00df\u0001\u0000\u0000\u0000\u00e1\u00e0\u0001"+
|
||||||
"\u00de\u00df\u0005g\u0000\u0000\u00df\u00e0\u0005s\u0000\u0000\u00e0\u00e1"+
|
"\u0000\u0000\u0000\u00e2\u0014\u0001\u0000\u0000\u0000\u00e3\u00ea\u0003"+
|
||||||
"\u0005)\u0000\u0000\u00e1\u0010\u0001\u0000\u0000\u0000\u00e2\u00e6\u0003"+
|
"%\u0012\u0000\u00e4\u00ea\u0003\'\u0013\u0000\u00e5\u00ea\u0003)\u0014"+
|
||||||
"\u001f\u000f\u0000\u00e3\u00e6\u0003#\u0011\u0000\u00e4\u00e6\u0003!\u0010"+
|
"\u0000\u00e6\u00ea\u0003+\u0015\u0000\u00e7\u00ea\u0003-\u0016\u0000\u00e8"+
|
||||||
"\u0000\u00e5\u00e2\u0001\u0000\u0000\u0000\u00e5\u00e3\u0001\u0000\u0000"+
|
"\u00ea\u0003/\u0017\u0000\u00e9\u00e3\u0001\u0000\u0000\u0000\u00e9\u00e4"+
|
||||||
"\u0000\u00e5\u00e4\u0001\u0000\u0000\u0000\u00e6\u0012\u0001\u0000\u0000"+
|
"\u0001\u0000\u0000\u0000\u00e9\u00e5\u0001\u0000\u0000\u0000\u00e9\u00e6"+
|
||||||
"\u0000\u00e7\u00ea\u0003\u001b\r\u0000\u00e8\u00ea\u0003\u001d\u000e\u0000"+
|
"\u0001\u0000\u0000\u0000\u00e9\u00e7\u0001\u0000\u0000\u0000\u00e9\u00e8"+
|
||||||
"\u00e9\u00e7\u0001\u0000\u0000\u0000\u00e9\u00e8\u0001\u0000\u0000\u0000"+
|
"\u0001\u0000\u0000\u0000\u00ea\u0016\u0001\u0000\u0000\u0000\u00eb\u00ee"+
|
||||||
"\u00ea\u0014\u0001\u0000\u0000\u0000\u00eb\u00f2\u0003%\u0012\u0000\u00ec"+
|
"\u00033\u0019\u0000\u00ec\u00ee\u00035\u001a\u0000\u00ed\u00eb\u0001\u0000"+
|
||||||
"\u00f2\u0003\'\u0013\u0000\u00ed\u00f2\u0003)\u0014\u0000\u00ee\u00f2"+
|
"\u0000\u0000\u00ed\u00ec\u0001\u0000\u0000\u0000\u00ee\u0018\u0001\u0000"+
|
||||||
"\u0003+\u0015\u0000\u00ef\u00f2\u0003-\u0016\u0000\u00f0\u00f2\u0003/"+
|
"\u0000\u0000\u00ef\u00f0\u0005=\u0000\u0000\u00f0\u001a\u0001\u0000\u0000"+
|
||||||
"\u0017\u0000\u00f1\u00eb\u0001\u0000\u0000\u0000\u00f1\u00ec\u0001\u0000"+
|
"\u0000\u00f1\u00f2\u0005+\u0000\u0000\u00f2\u001c\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\u00f1\u00ed\u0001\u0000\u0000\u0000\u00f1\u00ee\u0001\u0000"+
|
"\u00f3\u00f4\u0005-\u0000\u0000\u00f4\u001e\u0001\u0000\u0000\u0000\u00f5"+
|
||||||
"\u0000\u0000\u00f1\u00ef\u0001\u0000\u0000\u0000\u00f1\u00f0\u0001\u0000"+
|
"\u00f6\u0005*\u0000\u0000\u00f6 \u0001\u0000\u0000\u0000\u00f7\u00f8\u0005"+
|
||||||
"\u0000\u0000\u00f2\u0016\u0001\u0000\u0000\u0000\u00f3\u00f6\u00033\u0019"+
|
"%\u0000\u0000\u00f8\"\u0001\u0000\u0000\u0000\u00f9\u00fa\u0005/\u0000"+
|
||||||
"\u0000\u00f4\u00f6\u00035\u001a\u0000\u00f5\u00f3\u0001\u0000\u0000\u0000"+
|
"\u0000\u00fa$\u0001\u0000\u0000\u0000\u00fb\u00fc\u0005>\u0000\u0000\u00fc"+
|
||||||
"\u00f5\u00f4\u0001\u0000\u0000\u0000\u00f6\u0018\u0001\u0000\u0000\u0000"+
|
"&\u0001\u0000\u0000\u0000\u00fd\u00fe\u0005<\u0000\u0000\u00fe(\u0001"+
|
||||||
"\u00f7\u00f8\u0005=\u0000\u0000\u00f8\u001a\u0001\u0000\u0000\u0000\u00f9"+
|
"\u0000\u0000\u0000\u00ff\u0100\u0005>\u0000\u0000\u0100\u0101\u0005=\u0000"+
|
||||||
"\u00fa\u0005+\u0000\u0000\u00fa\u001c\u0001\u0000\u0000\u0000\u00fb\u00fc"+
|
"\u0000\u0101*\u0001\u0000\u0000\u0000\u0102\u0103\u0005<\u0000\u0000\u0103"+
|
||||||
"\u0005-\u0000\u0000\u00fc\u001e\u0001\u0000\u0000\u0000\u00fd\u00fe\u0005"+
|
"\u0104\u0005=\u0000\u0000\u0104,\u0001\u0000\u0000\u0000\u0105\u0106\u0005"+
|
||||||
"*\u0000\u0000\u00fe \u0001\u0000\u0000\u0000\u00ff\u0100\u0005%\u0000"+
|
"=\u0000\u0000\u0106\u0107\u0005=\u0000\u0000\u0107.\u0001\u0000\u0000"+
|
||||||
"\u0000\u0100\"\u0001\u0000\u0000\u0000\u0101\u0102\u0005/\u0000\u0000"+
|
"\u0000\u0108\u0109\u0005!\u0000\u0000\u0109\u010a\u0005=\u0000\u0000\u010a"+
|
||||||
"\u0102$\u0001\u0000\u0000\u0000\u0103\u0104\u0005>\u0000\u0000\u0104&"+
|
"0\u0001\u0000\u0000\u0000\u010b\u010c\u0005!\u0000\u0000\u010c2\u0001"+
|
||||||
"\u0001\u0000\u0000\u0000\u0105\u0106\u0005<\u0000\u0000\u0106(\u0001\u0000"+
|
"\u0000\u0000\u0000\u010d\u010e\u0005&\u0000\u0000\u010e\u010f\u0005&\u0000"+
|
||||||
"\u0000\u0000\u0107\u0108\u0005>\u0000\u0000\u0108\u0109\u0005=\u0000\u0000"+
|
"\u0000\u010f4\u0001\u0000\u0000\u0000\u0110\u0111\u0005|\u0000\u0000\u0111"+
|
||||||
"\u0109*\u0001\u0000\u0000\u0000\u010a\u010b\u0005<\u0000\u0000\u010b\u010c"+
|
"\u0112\u0005|\u0000\u0000\u01126\u0001\u0000\u0000\u0000\u0113\u0114\u0005"+
|
||||||
"\u0005=\u0000\u0000\u010c,\u0001\u0000\u0000\u0000\u010d\u010e\u0005="+
|
".\u0000\u0000\u01148\u0001\u0000\u0000\u0000\u0115\u0116\u0005(\u0000"+
|
||||||
"\u0000\u0000\u010e\u010f\u0005=\u0000\u0000\u010f.\u0001\u0000\u0000\u0000"+
|
"\u0000\u0116:\u0001\u0000\u0000\u0000\u0117\u0118\u0005)\u0000\u0000\u0118"+
|
||||||
"\u0110\u0111\u0005!\u0000\u0000\u0111\u0112\u0005=\u0000\u0000\u01120"+
|
"<\u0001\u0000\u0000\u0000\u0119\u011a\u0005{\u0000\u0000\u011a>\u0001"+
|
||||||
"\u0001\u0000\u0000\u0000\u0113\u0114\u0005!\u0000\u0000\u01142\u0001\u0000"+
|
"\u0000\u0000\u0000\u011b\u011c\u0005}\u0000\u0000\u011c@\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u0115\u0116\u0005&\u0000\u0000\u0116\u0117\u0005&\u0000\u0000"+
|
"\u0000\u011d\u011e\u0005;\u0000\u0000\u011eB\u0001\u0000\u0000\u0000\u011f"+
|
||||||
"\u01174\u0001\u0000\u0000\u0000\u0118\u0119\u0005|\u0000\u0000\u0119\u011a"+
|
"\u0120\u0005,\u0000\u0000\u0120D\u0001\u0000\u0000\u0000\u0121\u0122\u0005"+
|
||||||
"\u0005|\u0000\u0000\u011a6\u0001\u0000\u0000\u0000\u011b\u011c\u0005."+
|
"c\u0000\u0000\u0122\u0123\u0005l\u0000\u0000\u0123\u0124\u0005a\u0000"+
|
||||||
"\u0000\u0000\u011c8\u0001\u0000\u0000\u0000\u011d\u011e\u0005(\u0000\u0000"+
|
"\u0000\u0124\u0125\u0005s\u0000\u0000\u0125\u0126\u0005s\u0000\u0000\u0126"+
|
||||||
"\u011e:\u0001\u0000\u0000\u0000\u011f\u0120\u0005)\u0000\u0000\u0120<"+
|
"F\u0001\u0000\u0000\u0000\u0127\u0128\u0005t\u0000\u0000\u0128\u0129\u0005"+
|
||||||
"\u0001\u0000\u0000\u0000\u0121\u0122\u0005{\u0000\u0000\u0122>\u0001\u0000"+
|
"h\u0000\u0000\u0129\u012a\u0005i\u0000\u0000\u012a\u012b\u0005s\u0000"+
|
||||||
"\u0000\u0000\u0123\u0124\u0005}\u0000\u0000\u0124@\u0001\u0000\u0000\u0000"+
|
"\u0000\u012bH\u0001\u0000\u0000\u0000\u012c\u012d\u0005w\u0000\u0000\u012d"+
|
||||||
"\u0125\u0126\u0005;\u0000\u0000\u0126B\u0001\u0000\u0000\u0000\u0127\u0128"+
|
"\u012e\u0005h\u0000\u0000\u012e\u012f\u0005i\u0000\u0000\u012f\u0130\u0005"+
|
||||||
"\u0005,\u0000\u0000\u0128D\u0001\u0000\u0000\u0000\u0129\u012a\u0005c"+
|
"l\u0000\u0000\u0130\u0131\u0005e\u0000\u0000\u0131J\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u012a\u012b\u0005l\u0000\u0000\u012b\u012c\u0005a\u0000\u0000"+
|
"\u0000\u0132\u0133\u0005d\u0000\u0000\u0133\u0134\u0005o\u0000\u0000\u0134"+
|
||||||
"\u012c\u012d\u0005s\u0000\u0000\u012d\u012e\u0005s\u0000\u0000\u012eF"+
|
"L\u0001\u0000\u0000\u0000\u0135\u0136\u0005i\u0000\u0000\u0136\u0137\u0005"+
|
||||||
"\u0001\u0000\u0000\u0000\u012f\u0130\u0005t\u0000\u0000\u0130\u0131\u0005"+
|
"f\u0000\u0000\u0137N\u0001\u0000\u0000\u0000\u0138\u0139\u0005e\u0000"+
|
||||||
"h\u0000\u0000\u0131\u0132\u0005i\u0000\u0000\u0132\u0133\u0005s\u0000"+
|
"\u0000\u0139\u013a\u0005l\u0000\u0000\u013a\u013b\u0005s\u0000\u0000\u013b"+
|
||||||
"\u0000\u0133H\u0001\u0000\u0000\u0000\u0134\u0135\u0005w\u0000\u0000\u0135"+
|
"\u013c\u0005e\u0000\u0000\u013cP\u0001\u0000\u0000\u0000\u013d\u013e\u0005"+
|
||||||
"\u0136\u0005h\u0000\u0000\u0136\u0137\u0005i\u0000\u0000\u0137\u0138\u0005"+
|
"f\u0000\u0000\u013e\u013f\u0005o\u0000\u0000\u013f\u0140\u0005r\u0000"+
|
||||||
"l\u0000\u0000\u0138\u0139\u0005e\u0000\u0000\u0139J\u0001\u0000\u0000"+
|
"\u0000\u0140R\u0001\u0000\u0000\u0000\u0141\u0142\u0005r\u0000\u0000\u0142"+
|
||||||
"\u0000\u013a\u013b\u0005d\u0000\u0000\u013b\u013c\u0005o\u0000\u0000\u013c"+
|
"\u0143\u0005e\u0000\u0000\u0143\u0144\u0005t\u0000\u0000\u0144\u0145\u0005"+
|
||||||
"L\u0001\u0000\u0000\u0000\u013d\u013e\u0005i\u0000\u0000\u013e\u013f\u0005"+
|
"u\u0000\u0000\u0145\u0146\u0005r\u0000\u0000\u0146\u0147\u0005n\u0000"+
|
||||||
"f\u0000\u0000\u013fN\u0001\u0000\u0000\u0000\u0140\u0141\u0005e\u0000"+
|
"\u0000\u0147T\u0001\u0000\u0000\u0000\u0148\u0149\u0005n\u0000\u0000\u0149"+
|
||||||
"\u0000\u0141\u0142\u0005l\u0000\u0000\u0142\u0143\u0005s\u0000\u0000\u0143"+
|
"\u014a\u0005e\u0000\u0000\u014a\u014b\u0005w\u0000\u0000\u014bV\u0001"+
|
||||||
"\u0144\u0005e\u0000\u0000\u0144P\u0001\u0000\u0000\u0000\u0145\u0146\u0005"+
|
"\u0000\u0000\u0000\u014c\u0150\u0005\'\u0000\u0000\u014d\u014f\b\u0000"+
|
||||||
"f\u0000\u0000\u0146\u0147\u0005o\u0000\u0000\u0147\u0148\u0005r\u0000"+
|
"\u0000\u0000\u014e\u014d\u0001\u0000\u0000\u0000\u014f\u0152\u0001\u0000"+
|
||||||
"\u0000\u0148R\u0001\u0000\u0000\u0000\u0149\u014a\u0005r\u0000\u0000\u014a"+
|
"\u0000\u0000\u0150\u014e\u0001\u0000\u0000\u0000\u0150\u0151\u0001\u0000"+
|
||||||
"\u014b\u0005e\u0000\u0000\u014b\u014c\u0005t\u0000\u0000\u014c\u014d\u0005"+
|
"\u0000\u0000\u0151\u0153\u0001\u0000\u0000\u0000\u0152\u0150\u0001\u0000"+
|
||||||
"u\u0000\u0000\u014d\u014e\u0005r\u0000\u0000\u014e\u014f\u0005n\u0000"+
|
"\u0000\u0000\u0153\u0154\u0005\'\u0000\u0000\u0154X\u0001\u0000\u0000"+
|
||||||
"\u0000\u014fT\u0001\u0000\u0000\u0000\u0150\u0151\u0005n\u0000\u0000\u0151"+
|
"\u0000\u0155\u0157\u0003\u001d\u000e\u0000\u0156\u0155\u0001\u0000\u0000"+
|
||||||
"\u0152\u0005e\u0000\u0000\u0152\u0153\u0005w\u0000\u0000\u0153V\u0001"+
|
"\u0000\u0156\u0157\u0001\u0000\u0000\u0000\u0157\u0159\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u0154\u0155\u0005s\u0000\u0000\u0155\u0156\u0005w\u0000"+
|
"\u0000\u0158\u015a\u0003a0\u0000\u0159\u0158\u0001\u0000\u0000\u0000\u015a"+
|
||||||
"\u0000\u0156\u0157\u0005i\u0000\u0000\u0157\u0158\u0005t\u0000\u0000\u0158"+
|
"\u015b\u0001\u0000\u0000\u0000\u015b\u0159\u0001\u0000\u0000\u0000\u015b"+
|
||||||
"\u0159\u0005c\u0000\u0000\u0159\u015a\u0005h\u0000\u0000\u015aX\u0001"+
|
"\u015c\u0001\u0000\u0000\u0000\u015cZ\u0001\u0000\u0000\u0000\u015d\u015e"+
|
||||||
"\u0000\u0000\u0000\u015b\u015c\u0005c\u0000\u0000\u015c\u015d\u0005a\u0000"+
|
"\u0005t\u0000\u0000\u015e\u015f\u0005r\u0000\u0000\u015f\u0160\u0005u"+
|
||||||
"\u0000\u015d\u015e\u0005s\u0000\u0000\u015e\u015f\u0005e\u0000\u0000\u015f"+
|
"\u0000\u0000\u0160\u0167\u0005e\u0000\u0000\u0161\u0162\u0005f\u0000\u0000"+
|
||||||
"Z\u0001\u0000\u0000\u0000\u0160\u0161\u0005d\u0000\u0000\u0161\u0162\u0005"+
|
"\u0162\u0163\u0005a\u0000\u0000\u0163\u0164\u0005l\u0000\u0000\u0164\u0165"+
|
||||||
"e\u0000\u0000\u0162\u0163\u0005f\u0000\u0000\u0163\u0164\u0005a\u0000"+
|
"\u0005s\u0000\u0000\u0165\u0167\u0005e\u0000\u0000\u0166\u015d\u0001\u0000"+
|
||||||
"\u0000\u0164\u0165\u0005u\u0000\u0000\u0165\u0166\u0005l\u0000\u0000\u0166"+
|
"\u0000\u0000\u0166\u0161\u0001\u0000\u0000\u0000\u0167\\\u0001\u0000\u0000"+
|
||||||
"\u0167\u0005t\u0000\u0000\u0167\\\u0001\u0000\u0000\u0000\u0168\u0169"+
|
"\u0000\u0168\u0169\u0005n\u0000\u0000\u0169\u016a\u0005u\u0000\u0000\u016a"+
|
||||||
"\u0005:\u0000\u0000\u0169^\u0001\u0000\u0000\u0000\u016a\u016e\u0005\'"+
|
"\u016b\u0005l\u0000\u0000\u016b\u016c\u0005l\u0000\u0000\u016c^\u0001"+
|
||||||
"\u0000\u0000\u016b\u016d\b\u0000\u0000\u0000\u016c\u016b\u0001\u0000\u0000"+
|
"\u0000\u0000\u0000\u016d\u016e\u0007\u0001\u0000\u0000\u016e`\u0001\u0000"+
|
||||||
"\u0000\u016d\u0170\u0001\u0000\u0000\u0000\u016e\u016c\u0001\u0000\u0000"+
|
"\u0000\u0000\u016f\u0170\u0007\u0002\u0000\u0000\u0170b\u0001\u0000\u0000"+
|
||||||
"\u0000\u016e\u016f\u0001\u0000\u0000\u0000\u016f\u0171\u0001\u0000\u0000"+
|
"\u0000\u0171\u0175\u0003_/\u0000\u0172\u0175\u0003a0\u0000\u0173\u0175"+
|
||||||
"\u0000\u0170\u016e\u0001\u0000\u0000\u0000\u0171\u0172\u0005\'\u0000\u0000"+
|
"\u0007\u0003\u0000\u0000\u0174\u0171\u0001\u0000\u0000\u0000\u0174\u0172"+
|
||||||
"\u0172`\u0001\u0000\u0000\u0000\u0173\u0175\u0003\u001d\u000e\u0000\u0174"+
|
"\u0001\u0000\u0000\u0000\u0174\u0173\u0001\u0000\u0000\u0000\u0175d\u0001"+
|
||||||
"\u0173\u0001\u0000\u0000\u0000\u0174\u0175\u0001\u0000\u0000\u0000\u0175"+
|
"\u0000\u0000\u0000\u0176\u017a\u0003_/\u0000\u0177\u0179\u0003c1\u0000"+
|
||||||
"\u0177\u0001\u0000\u0000\u0000\u0176\u0178\u0003i4\u0000\u0177\u0176\u0001"+
|
"\u0178\u0177\u0001\u0000\u0000\u0000\u0179\u017c\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u0178\u0179\u0001\u0000\u0000\u0000\u0179\u0177\u0001"+
|
"\u017a\u0178\u0001\u0000\u0000\u0000\u017a\u017b\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u0179\u017a\u0001\u0000\u0000\u0000\u017ab\u0001\u0000"+
|
"\u017bf\u0001\u0000\u0000\u0000\u017c\u017a\u0001\u0000\u0000\u0000\u017d"+
|
||||||
"\u0000\u0000\u017b\u017c\u0005t\u0000\u0000\u017c\u017d\u0005r\u0000\u0000"+
|
"\u017f\u0007\u0004\u0000\u0000\u017e\u017d\u0001\u0000\u0000\u0000\u017f"+
|
||||||
"\u017d\u017e\u0005u\u0000\u0000\u017e\u0185\u0005e\u0000\u0000\u017f\u0180"+
|
"\u0180\u0001\u0000\u0000\u0000\u0180\u017e\u0001\u0000\u0000\u0000\u0180"+
|
||||||
"\u0005f\u0000\u0000\u0180\u0181\u0005a\u0000\u0000\u0181\u0182\u0005l"+
|
"\u0181\u0001\u0000\u0000\u0000\u0181\u0182\u0001\u0000\u0000\u0000\u0182"+
|
||||||
"\u0000\u0000\u0182\u0183\u0005s\u0000\u0000\u0183\u0185\u0005e\u0000\u0000"+
|
"\u0183\u00063\u0000\u0000\u0183h\u0001\u0000\u0000\u0000\u0184\u0185\u0005"+
|
||||||
"\u0184\u017b\u0001\u0000\u0000\u0000\u0184\u017f\u0001\u0000\u0000\u0000"+
|
"/\u0000\u0000\u0185\u0186\u0005/\u0000\u0000\u0186\u018a\u0001\u0000\u0000"+
|
||||||
"\u0185d\u0001\u0000\u0000\u0000\u0186\u0187\u0005n\u0000\u0000\u0187\u0188"+
|
"\u0000\u0187\u0189\b\u0000\u0000\u0000\u0188\u0187\u0001\u0000\u0000\u0000"+
|
||||||
"\u0005u\u0000\u0000\u0188\u0189\u0005l\u0000\u0000\u0189\u018a\u0005l"+
|
"\u0189\u018c\u0001\u0000\u0000\u0000\u018a\u0188\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\u018af\u0001\u0000\u0000\u0000\u018b\u018c\u0007\u0001\u0000"+
|
"\u018a\u018b\u0001\u0000\u0000\u0000\u018b\u018d\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u018ch\u0001\u0000\u0000\u0000\u018d\u018e\u0007\u0002\u0000\u0000"+
|
"\u018c\u018a\u0001\u0000\u0000\u0000\u018d\u018e\u00064\u0000\u0000\u018e"+
|
||||||
"\u018ej\u0001\u0000\u0000\u0000\u018f\u0193\u0003g3\u0000\u0190\u0193"+
|
"j\u0001\u0000\u0000\u0000\u018f\u0190\u0005/\u0000\u0000\u0190\u0191\u0005"+
|
||||||
"\u0003i4\u0000\u0191\u0193\u0007\u0003\u0000\u0000\u0192\u018f\u0001\u0000"+
|
"*\u0000\u0000\u0191\u0195\u0001\u0000\u0000\u0000\u0192\u0194\t\u0000"+
|
||||||
"\u0000\u0000\u0192\u0190\u0001\u0000\u0000\u0000\u0192\u0191\u0001\u0000"+
|
"\u0000\u0000\u0193\u0192\u0001\u0000\u0000\u0000\u0194\u0197\u0001\u0000"+
|
||||||
"\u0000\u0000\u0193l\u0001\u0000\u0000\u0000\u0194\u0198\u0003g3\u0000"+
|
"\u0000\u0000\u0195\u0196\u0001\u0000\u0000\u0000\u0195\u0193\u0001\u0000"+
|
||||||
"\u0195\u0197\u0003k5\u0000\u0196\u0195\u0001\u0000\u0000\u0000\u0197\u019a"+
|
"\u0000\u0000\u0196\u0198\u0001\u0000\u0000\u0000\u0197\u0195\u0001\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u0198\u0196\u0001\u0000\u0000\u0000\u0198\u0199"+
|
"\u0000\u0000\u0198\u0199\u0005*\u0000\u0000\u0199\u019a\u0005/\u0000\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u0199n\u0001\u0000\u0000\u0000\u019a\u0198\u0001"+
|
"\u019a\u019b\u0001\u0000\u0000\u0000\u019b\u019c\u00065\u0000\u0000\u019c"+
|
||||||
"\u0000\u0000\u0000\u019b\u019d\u0007\u0004\u0000\u0000\u019c\u019b\u0001"+
|
"l\u0001\u0000\u0000\u0000\u000f\u0000\u00b1\u00dd\u00e1\u00e9\u00ed\u0150"+
|
||||||
"\u0000\u0000\u0000\u019d\u019e\u0001\u0000\u0000\u0000\u019e\u019c\u0001"+
|
"\u0156\u015b\u0166\u0174\u017a\u0180\u018a\u0195\u0001\u0006\u0000\u0000";
|
||||||
"\u0000\u0000\u0000\u019e\u019f\u0001\u0000\u0000\u0000\u019f\u01a0\u0001"+
|
|
||||||
"\u0000\u0000\u0000\u01a0\u01a1\u00067\u0000\u0000\u01a1p\u0001\u0000\u0000"+
|
|
||||||
"\u0000\u01a2\u01a3\u0005/\u0000\u0000\u01a3\u01a4\u0005/\u0000\u0000\u01a4"+
|
|
||||||
"\u01a8\u0001\u0000\u0000\u0000\u01a5\u01a7\b\u0000\u0000\u0000\u01a6\u01a5"+
|
|
||||||
"\u0001\u0000\u0000\u0000\u01a7\u01aa\u0001\u0000\u0000\u0000\u01a8\u01a6"+
|
|
||||||
"\u0001\u0000\u0000\u0000\u01a8\u01a9\u0001\u0000\u0000\u0000\u01a9\u01ab"+
|
|
||||||
"\u0001\u0000\u0000\u0000\u01aa\u01a8\u0001\u0000\u0000\u0000\u01ab\u01ac"+
|
|
||||||
"\u00068\u0000\u0000\u01acr\u0001\u0000\u0000\u0000\u01ad\u01ae\u0005/"+
|
|
||||||
"\u0000\u0000\u01ae\u01af\u0005*\u0000\u0000\u01af\u01b3\u0001\u0000\u0000"+
|
|
||||||
"\u0000\u01b0\u01b2\t\u0000\u0000\u0000\u01b1\u01b0\u0001\u0000\u0000\u0000"+
|
|
||||||
"\u01b2\u01b5\u0001\u0000\u0000\u0000\u01b3\u01b4\u0001\u0000\u0000\u0000"+
|
|
||||||
"\u01b3\u01b1\u0001\u0000\u0000\u0000\u01b4\u01b6\u0001\u0000\u0000\u0000"+
|
|
||||||
"\u01b5\u01b3\u0001\u0000\u0000\u0000\u01b6\u01b7\u0005*\u0000\u0000\u01b7"+
|
|
||||||
"\u01b8\u0005/\u0000\u0000\u01b8\u01b9\u0001\u0000\u0000\u0000\u01b9\u01ba"+
|
|
||||||
"\u00069\u0000\u0000\u01bat\u0001\u0000\u0000\u0000\u000f\u0000\u00b9\u00e5"+
|
|
||||||
"\u00e9\u00f1\u00f5\u016e\u0174\u0179\u0184\u0192\u0198\u019e\u01a8\u01b3"+
|
|
||||||
"\u0001\u0006\u0000\u0000";
|
|
||||||
public static final ATN _ATN =
|
public static final ATN _ATN =
|
||||||
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
|
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
|
||||||
static {
|
static {
|
||||||
|
@ -41,18 +41,14 @@ Else=40
|
|||||||
For=41
|
For=41
|
||||||
Return=42
|
Return=42
|
||||||
New=43
|
New=43
|
||||||
Switch=44
|
CharValue=44
|
||||||
Case=45
|
IntValue=45
|
||||||
Default=46
|
BooleanValue=46
|
||||||
Colon=47
|
NullValue=47
|
||||||
CharValue=48
|
Identifier=48
|
||||||
IntValue=49
|
WS=49
|
||||||
BooleanValue=50
|
InlineComment=50
|
||||||
NullValue=51
|
MultilineComment=51
|
||||||
Identifier=52
|
|
||||||
WS=53
|
|
||||||
InlineComment=54
|
|
||||||
MultilineComment=55
|
|
||||||
'++'=1
|
'++'=1
|
||||||
'--'=2
|
'--'=2
|
||||||
'void'=3
|
'void'=3
|
||||||
@ -91,8 +87,4 @@ MultilineComment=55
|
|||||||
'for'=41
|
'for'=41
|
||||||
'return'=42
|
'return'=42
|
||||||
'new'=43
|
'new'=43
|
||||||
'switch'=44
|
'null'=47
|
||||||
'case'=45
|
|
||||||
'default'=46
|
|
||||||
':'=47
|
|
||||||
'null'=51
|
|
||||||
|
@ -207,36 +207,6 @@ public interface SimpleJavaListener extends ParseTreeListener {
|
|||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
void exitElseStatement(SimpleJavaParser.ElseStatementContext ctx);
|
void exitElseStatement(SimpleJavaParser.ElseStatementContext ctx);
|
||||||
/**
|
|
||||||
* Enter a parse tree produced by {@link SimpleJavaParser#switchStatement}.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
void enterSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx);
|
|
||||||
/**
|
|
||||||
* Exit a parse tree produced by {@link SimpleJavaParser#switchStatement}.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
void exitSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx);
|
|
||||||
/**
|
|
||||||
* Enter a parse tree produced by {@link SimpleJavaParser#caseStatement}.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
void enterCaseStatement(SimpleJavaParser.CaseStatementContext ctx);
|
|
||||||
/**
|
|
||||||
* Exit a parse tree produced by {@link SimpleJavaParser#caseStatement}.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
void exitCaseStatement(SimpleJavaParser.CaseStatementContext ctx);
|
|
||||||
/**
|
|
||||||
* Enter a parse tree produced by {@link SimpleJavaParser#defaultStatement}.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
void enterDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx);
|
|
||||||
/**
|
|
||||||
* Exit a parse tree produced by {@link SimpleJavaParser#defaultStatement}.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
void exitDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx);
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by {@link SimpleJavaParser#statementExpression}.
|
* Enter a parse tree produced by {@link SimpleJavaParser#statementExpression}.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -130,24 +130,6 @@ public interface SimpleJavaVisitor<T> extends ParseTreeVisitor<T> {
|
|||||||
* @return the visitor result
|
* @return the visitor result
|
||||||
*/
|
*/
|
||||||
T visitElseStatement(SimpleJavaParser.ElseStatementContext ctx);
|
T visitElseStatement(SimpleJavaParser.ElseStatementContext ctx);
|
||||||
/**
|
|
||||||
* Visit a parse tree produced by {@link SimpleJavaParser#switchStatement}.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
* @return the visitor result
|
|
||||||
*/
|
|
||||||
T visitSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx);
|
|
||||||
/**
|
|
||||||
* Visit a parse tree produced by {@link SimpleJavaParser#caseStatement}.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
* @return the visitor result
|
|
||||||
*/
|
|
||||||
T visitCaseStatement(SimpleJavaParser.CaseStatementContext ctx);
|
|
||||||
/**
|
|
||||||
* Visit a parse tree produced by {@link SimpleJavaParser#defaultStatement}.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
* @return the visitor result
|
|
||||||
*/
|
|
||||||
T visitDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx);
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by {@link SimpleJavaParser#statementExpression}.
|
* Visit a parse tree produced by {@link SimpleJavaParser#statementExpression}.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
@ -7,7 +7,7 @@ classDeclaration: AccessModifier? 'class' Identifier OpenCurlyBracket memberDecl
|
|||||||
memberDeclaration: constructorDeclaration | fieldDeclaration | methodDeclaration;
|
memberDeclaration: constructorDeclaration | fieldDeclaration | methodDeclaration;
|
||||||
|
|
||||||
constructorDeclaration: AccessModifier? Identifier OpenRoundBracket parameterList? ClosedRoundBracket blockStatement;
|
constructorDeclaration: AccessModifier? Identifier OpenRoundBracket parameterList? ClosedRoundBracket blockStatement;
|
||||||
fieldDeclaration: AccessModifier? type Identifier (Assign expression)? Semicolon;
|
fieldDeclaration: AccessModifier? type Identifier Semicolon;
|
||||||
methodDeclaration: MainMethodDeclaration blockStatement | AccessModifier? (type | Void) Identifier OpenRoundBracket parameterList? ClosedRoundBracket blockStatement;
|
methodDeclaration: MainMethodDeclaration blockStatement | AccessModifier? (type | Void) Identifier OpenRoundBracket parameterList? ClosedRoundBracket blockStatement;
|
||||||
|
|
||||||
parameterList: parameter (Comma parameter)*;
|
parameterList: parameter (Comma parameter)*;
|
||||||
@ -22,7 +22,6 @@ statement: returnStatement Semicolon
|
|||||||
| doWhileStatement
|
| doWhileStatement
|
||||||
| forStatement
|
| forStatement
|
||||||
| ifElseStatement
|
| ifElseStatement
|
||||||
| switchStatement
|
|
||||||
| statementExpression Semicolon;
|
| statementExpression Semicolon;
|
||||||
|
|
||||||
blockStatement: OpenCurlyBracket statement* ClosedCurlyBracket;
|
blockStatement: OpenCurlyBracket statement* ClosedCurlyBracket;
|
||||||
@ -39,10 +38,6 @@ ifStatement: If OpenRoundBracket expression ClosedRoundBracket blockStatement;
|
|||||||
elseIfStatement: Else If OpenRoundBracket expression ClosedRoundBracket blockStatement;
|
elseIfStatement: Else If OpenRoundBracket expression ClosedRoundBracket blockStatement;
|
||||||
elseStatement: Else blockStatement;
|
elseStatement: Else blockStatement;
|
||||||
|
|
||||||
switchStatement: Switch OpenRoundBracket expression ClosedRoundBracket OpenCurlyBracket caseStatement+ defaultStatement? ClosedCurlyBracket;
|
|
||||||
caseStatement: Case value Colon statement*;
|
|
||||||
defaultStatement: Default Colon statement*;
|
|
||||||
|
|
||||||
statementExpression: assign | newDeclaration | methodCall | crementExpression;
|
statementExpression: assign | newDeclaration | methodCall | crementExpression;
|
||||||
assign: assignableExpression Assign expression;
|
assign: assignableExpression Assign expression;
|
||||||
newDeclaration: New Identifier OpenRoundBracket argumentList ClosedRoundBracket;
|
newDeclaration: New Identifier OpenRoundBracket argumentList ClosedRoundBracket;
|
||||||
@ -158,10 +153,6 @@ Else: 'else';
|
|||||||
For: 'for';
|
For: 'for';
|
||||||
Return: 'return';
|
Return: 'return';
|
||||||
New: 'new';
|
New: 'new';
|
||||||
Switch: 'switch';
|
|
||||||
Case: 'case';
|
|
||||||
Default: 'default';
|
|
||||||
Colon: ':';
|
|
||||||
|
|
||||||
// Werte
|
// Werte
|
||||||
CharValue: '\'' ~[\r\n]* '\'';
|
CharValue: '\'' ~[\r\n]* '\'';
|
||||||
|
@ -16,7 +16,7 @@ public class Scope {
|
|||||||
|
|
||||||
public void addLocalVar(String name, ITypeNode type) {
|
public void addLocalVar(String name, ITypeNode type) {
|
||||||
if (this.contains(name)) {
|
if (this.contains(name)) {
|
||||||
SemanticAnalyzer.errors.add(new AlreadyDeclaredException("Duplicate local variable " + name));
|
throw new AlreadyDeclaredException("Variable " + name + " already exists in this scope");
|
||||||
}
|
}
|
||||||
localVars.peek().put(name, type);
|
localVars.peek().put(name, type);
|
||||||
}
|
}
|
||||||
|
@ -114,49 +114,53 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypeCheckResult analyze(MethodNode methodNode) {
|
public TypeCheckResult analyze(MethodNode methodNode) {
|
||||||
|
if (methodNode instanceof ConstructorNode) {
|
||||||
|
return new TypeCheckResult(true, new BaseType(TypeEnum.VOID));
|
||||||
|
} else {
|
||||||
|
|
||||||
var valid = true;
|
var valid = true;
|
||||||
|
|
||||||
for (var otherMethod : currentClass.getMethods()) {
|
for (var otherMethod : currentClass.getMethods()) {
|
||||||
if (Objects.equals(otherMethod, methodNode))
|
if (Objects.equals(otherMethod, methodNode))
|
||||||
break;
|
break;
|
||||||
if (otherMethod.isSame(methodNode)) {
|
if (otherMethod.isSame(methodNode)) {
|
||||||
errors.add(new AlreadyDeclaredException(
|
errors.add(new AlreadyDeclaredException(
|
||||||
"Method " + methodNode.getIdentifier() + " is already defined in class "
|
"Method " + methodNode.getIdentifier() + " is already defined in class "
|
||||||
+ currentClass.identifier));
|
+ currentClass.identifier));
|
||||||
valid = false;
|
valid = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
currentScope.pushScope();
|
currentScope.pushScope();
|
||||||
for (var parameter : methodNode.getParameters()) {
|
for (var parameter : methodNode.getParameters()) {
|
||||||
var result = parameter.accept(this);
|
var result = parameter.accept(this);
|
||||||
|
valid = valid && result.isValid();
|
||||||
|
try {
|
||||||
|
currentScope.addLocalVar(parameter.identifier, parameter.type);
|
||||||
|
} catch (AlreadyDeclaredException e) {
|
||||||
|
errors.add(new AlreadyDeclaredException(parameter.identifier));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
currentMethodReturnType = methodNode.getType();
|
||||||
|
currentNullType = currentMethodReturnType;
|
||||||
|
|
||||||
|
var result = methodNode.block.accept(this);
|
||||||
valid = valid && result.isValid();
|
valid = valid && result.isValid();
|
||||||
try {
|
currentScope.popScope();
|
||||||
currentScope.addLocalVar(parameter.identifier, parameter.type);
|
ITypeNode resultType = result.getType();
|
||||||
} catch (AlreadyDeclaredException e) {
|
|
||||||
errors.add(new AlreadyDeclaredException(parameter.identifier));
|
if (resultType == null) {
|
||||||
|
resultType = new BaseType(TypeEnum.VOID);
|
||||||
|
}
|
||||||
|
if (methodNode.getType() == null) {
|
||||||
|
methodNode.setType(new BaseType(TypeEnum.VOID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new TypeCheckResult(valid, resultType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentMethodReturnType = methodNode.getType();
|
|
||||||
currentNullType = currentMethodReturnType;
|
|
||||||
|
|
||||||
var result = methodNode.block.accept(this);
|
|
||||||
valid = valid && result.isValid();
|
|
||||||
currentScope.popScope();
|
|
||||||
ITypeNode resultType = result.getType();
|
|
||||||
|
|
||||||
if (resultType == null) {
|
|
||||||
resultType = new BaseType(TypeEnum.VOID);
|
|
||||||
}
|
|
||||||
if (methodNode.getType() == null) {
|
|
||||||
methodNode.setType(new BaseType(TypeEnum.VOID));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new TypeCheckResult(valid, resultType);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -229,7 +233,7 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
}
|
}
|
||||||
for (IStatementNode statementNode : blockNode.statements) {
|
for (IStatementNode statementNode : blockNode.statements) {
|
||||||
var result = statementNode.accept(this);
|
var result = statementNode.accept(this);
|
||||||
if (!(statementNode instanceof IncrementNode) && !(statementNode instanceof DecrementNode)) {
|
if(!(statementNode instanceof IncrementNode) && !(statementNode instanceof DecrementNode)){
|
||||||
if (result.getType() != null) {
|
if (result.getType() != null) {
|
||||||
if (blockReturnType == null) {
|
if (blockReturnType == null) {
|
||||||
blockReturnType = result.getType();
|
blockReturnType = result.getType();
|
||||||
@ -255,9 +259,6 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
if (currentFields.get(toCheck.identifier) != null) {
|
if (currentFields.get(toCheck.identifier) != null) {
|
||||||
var type = currentFields.get(toCheck.identifier);
|
var type = currentFields.get(toCheck.identifier);
|
||||||
toCheck.setTypeNode(type);
|
toCheck.setTypeNode(type);
|
||||||
MemberAccessNode memberAccessNode = new MemberAccessNode(false);
|
|
||||||
memberAccessNode.identifiers.add(currentClass.identifier);
|
|
||||||
toCheck.memberAccess = memberAccessNode;
|
|
||||||
return new TypeCheckResult(true, type);
|
return new TypeCheckResult(true, type);
|
||||||
} else if (currentScope.getLocalVar(toCheck.identifier) != null) {
|
} else if (currentScope.getLocalVar(toCheck.identifier) != null) {
|
||||||
var type = currentScope.getLocalVar(toCheck.identifier);
|
var type = currentScope.getLocalVar(toCheck.identifier);
|
||||||
@ -419,7 +420,6 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
case PLUS, MINUS:
|
case PLUS, MINUS:
|
||||||
if (calcRes.getType() instanceof BaseType calcType && dotRes.getType() instanceof BaseType dotType &&
|
if (calcRes.getType() instanceof BaseType calcType && dotRes.getType() instanceof BaseType dotType &&
|
||||||
calcType.getTypeEnum().equals(TypeEnum.INT) && dotType.getTypeEnum().equals(TypeEnum.INT)) {
|
calcType.getTypeEnum().equals(TypeEnum.INT) && dotType.getTypeEnum().equals(TypeEnum.INT)) {
|
||||||
calcNode.setType(new BaseType(TypeEnum.INT));
|
|
||||||
return new TypeCheckResult(true, new BaseType(TypeEnum.INT));
|
return new TypeCheckResult(true, new BaseType(TypeEnum.INT));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -427,12 +427,10 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
calcNode.setType(calcRes.getType());
|
|
||||||
return new TypeCheckResult(calcRes.isValid(), calcRes.getType());
|
return new TypeCheckResult(calcRes.isValid(), calcRes.getType());
|
||||||
}
|
}
|
||||||
} else if (calcNode.dotExpression != null) {
|
} else if (calcNode.dotExpression != null) {
|
||||||
var dotRes = calcNode.dotExpression.accept(this);
|
var dotRes = calcNode.dotExpression.accept(this);
|
||||||
calcNode.setType(dotRes.getType());
|
|
||||||
return new TypeCheckResult(dotRes.isValid(), dotRes.getType());
|
return new TypeCheckResult(dotRes.isValid(), dotRes.getType());
|
||||||
}
|
}
|
||||||
return new TypeCheckResult(false, null);
|
return new TypeCheckResult(false, null);
|
||||||
@ -475,7 +473,6 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
case LESS, LESS_EQUAL, GREATER, GREATER_EQUAL:
|
case LESS, LESS_EQUAL, GREATER, GREATER_EQUAL:
|
||||||
if (expResult.getType() instanceof BaseType expResultType && expResultType.getTypeEnum().equals(TypeEnum.INT) &&
|
if (expResult.getType() instanceof BaseType expResultType && expResultType.getTypeEnum().equals(TypeEnum.INT) &&
|
||||||
unaryResult.getType() instanceof BaseType unaryResultType && unaryResultType.getTypeEnum().equals(TypeEnum.INT)) {
|
unaryResult.getType() instanceof BaseType unaryResultType && unaryResultType.getTypeEnum().equals(TypeEnum.INT)) {
|
||||||
nonCalculationNode.setType(new BaseType(TypeEnum.BOOL));
|
|
||||||
return new TypeCheckResult(true, new BaseType(TypeEnum.BOOL));
|
return new TypeCheckResult(true, new BaseType(TypeEnum.BOOL));
|
||||||
} else {
|
} else {
|
||||||
errors.add(new TypeMismatchException("Both types must be Integer"));
|
errors.add(new TypeMismatchException("Both types must be Integer"));
|
||||||
@ -484,7 +481,6 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
case OR, AND:
|
case OR, AND:
|
||||||
if (expResult.getType() instanceof BaseType expResultType && expResultType.getTypeEnum().equals(TypeEnum.INT) &&
|
if (expResult.getType() instanceof BaseType expResultType && expResultType.getTypeEnum().equals(TypeEnum.INT) &&
|
||||||
unaryResult.getType() instanceof BaseType unaryResultType && unaryResultType.getTypeEnum().equals(TypeEnum.INT)) {
|
unaryResult.getType() instanceof BaseType unaryResultType && unaryResultType.getTypeEnum().equals(TypeEnum.INT)) {
|
||||||
nonCalculationNode.setType(new BaseType(TypeEnum.BOOL));
|
|
||||||
return new TypeCheckResult(true, new BaseType(TypeEnum.BOOL));
|
return new TypeCheckResult(true, new BaseType(TypeEnum.BOOL));
|
||||||
} else {
|
} else {
|
||||||
errors.add(new TypeMismatchException("Both types must be Boolean"));
|
errors.add(new TypeMismatchException("Both types must be Boolean"));
|
||||||
@ -493,7 +489,6 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
case EQUAL, NOT_EQUAL:
|
case EQUAL, NOT_EQUAL:
|
||||||
if (expResult.getType() instanceof BaseType expResultType && unaryResult.getType() instanceof BaseType unaryResultType
|
if (expResult.getType() instanceof BaseType expResultType && unaryResult.getType() instanceof BaseType unaryResultType
|
||||||
&& Objects.equals(expResultType, unaryResultType)) {
|
&& Objects.equals(expResultType, unaryResultType)) {
|
||||||
nonCalculationNode.setType(new BaseType(TypeEnum.BOOL));
|
|
||||||
return new TypeCheckResult(true, new BaseType(TypeEnum.BOOL));
|
return new TypeCheckResult(true, new BaseType(TypeEnum.BOOL));
|
||||||
} else {
|
} else {
|
||||||
errors.add(new TypeMismatchException("Both types must be the same"));
|
errors.add(new TypeMismatchException("Both types must be the same"));
|
||||||
@ -509,13 +504,9 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
|
|
||||||
if (unary.identifier != null) {
|
if (unary.identifier != null) {
|
||||||
if (currentScope.contains(unary.identifier)) {
|
if (currentScope.contains(unary.identifier)) {
|
||||||
var type = currentScope.getLocalVar(unary.identifier);
|
return new TypeCheckResult(valid, currentScope.getLocalVar(unary.identifier));
|
||||||
unary.setType(type);
|
|
||||||
return new TypeCheckResult(valid, type);
|
|
||||||
} else if (currentFields.get(unary.identifier) != null) {
|
} else if (currentFields.get(unary.identifier) != null) {
|
||||||
var type = currentFields.get(unary.identifier);
|
return new TypeCheckResult(valid, currentFields.get(unary.identifier));
|
||||||
unary.setType(type);
|
|
||||||
return new TypeCheckResult(valid, type);
|
|
||||||
} else if (unary.statement != null) {
|
} else if (unary.statement != null) {
|
||||||
var result = unary.statement.accept(this);
|
var result = unary.statement.accept(this);
|
||||||
unary.setType(result.getType());
|
unary.setType(result.getType());
|
||||||
@ -525,19 +516,15 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
}
|
}
|
||||||
} else if (unary.statement != null) {
|
} else if (unary.statement != null) {
|
||||||
var result = unary.statement.accept(this);
|
var result = unary.statement.accept(this);
|
||||||
unary.setType(result.getType());
|
|
||||||
return new TypeCheckResult(result.isValid(), result.getType());
|
return new TypeCheckResult(result.isValid(), result.getType());
|
||||||
} else if (unary.value != null) {
|
} else if (unary.value != null) {
|
||||||
var result = unary.value.accept(this);
|
var result = unary.value.accept(this);
|
||||||
unary.setType(result.getType());
|
|
||||||
return new TypeCheckResult(result.isValid(), result.getType());
|
return new TypeCheckResult(result.isValid(), result.getType());
|
||||||
} else if (unary.memberAccess != null) {
|
} else if (unary.memberAccess != null) {
|
||||||
var result = unary.memberAccess.accept(this);
|
var result = unary.memberAccess.accept(this);
|
||||||
unary.setType(result.getType());
|
|
||||||
return new TypeCheckResult(result.isValid(), result.getType());
|
return new TypeCheckResult(result.isValid(), result.getType());
|
||||||
} else if (unary.expression != null) {
|
} else if (unary.expression != null) {
|
||||||
var result = unary.expression.accept(this);
|
var result = unary.expression.accept(this);
|
||||||
unary.setType(result.getType());
|
|
||||||
return new TypeCheckResult(result.isValid(), result.getType());
|
return new TypeCheckResult(result.isValid(), result.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,10 +536,6 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
|
|
||||||
ITypeNode currentType = null;
|
ITypeNode currentType = null;
|
||||||
|
|
||||||
if (memberAccessNode.thisExpr) {
|
|
||||||
currentType = new ReferenceType(currentClass.identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String s : memberAccessNode.identifiers) {
|
for (String s : memberAccessNode.identifiers) {
|
||||||
if (currentType == null) {
|
if (currentType == null) {
|
||||||
if (currentScope.getLocalVar(s) != null) {
|
if (currentScope.getLocalVar(s) != null) {
|
||||||
@ -570,7 +553,7 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
var currentTypeClass = context.getClass(reference.getIdentifier());
|
var currentTypeClass = context.getClass(reference.getIdentifier());
|
||||||
|
|
||||||
var currentField = currentTypeClass.getField(s);
|
var currentField = currentTypeClass.getField(s);
|
||||||
if (currentField.getAccessModifier().accessType == EnumAccessModifierNode.PUBLIC || memberAccessNode.thisExpr) {
|
if (currentField.getAccessModifier().accessType == EnumAccessModifierNode.PUBLIC) {
|
||||||
currentType = currentField.getType();
|
currentType = currentField.getType();
|
||||||
} else {
|
} else {
|
||||||
errors.add(new NotVisibleException("This field is not visible"));
|
errors.add(new NotVisibleException("This field is not visible"));
|
||||||
|
@ -4,15 +4,13 @@ import ast.members.FieldNode;
|
|||||||
import ast.type.*;
|
import ast.type.*;
|
||||||
import ast.type.type.*;
|
import ast.type.type.*;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class FieldContext {
|
public class FieldContext {
|
||||||
|
|
||||||
private AccessModifierNode accessModifier;
|
private AccessModifierNode accessModifier;
|
||||||
private ITypeNode type;
|
private ITypeNode type;
|
||||||
|
|
||||||
public FieldContext(FieldNode field) {
|
public FieldContext(FieldNode field) {
|
||||||
accessModifier = Objects.requireNonNullElseGet(field.accessTypeNode, () -> new AccessModifierNode("private"));
|
accessModifier = field.accessTypeNode;
|
||||||
type = field.type;
|
type = field.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,15 +2,13 @@ public class Compiler {
|
|||||||
public int add(int i, int j) {
|
public int add(int i, int j) {
|
||||||
return i+j;
|
return i+j;
|
||||||
}
|
}
|
||||||
public static void main(String[] args) {
|
|
||||||
int a = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Node {
|
public class Node {
|
||||||
public void main() {
|
public void main() {
|
||||||
Compiler compiler = new Compiler();
|
Compiler compiler = new Compiler();
|
||||||
int i = compiler.add(5, 8);
|
int i = compiler.add(5, 8);
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
@ -9,8 +9,8 @@ compile-javac:
|
|||||||
|
|
||||||
compile-raupenpiler:
|
compile-raupenpiler:
|
||||||
cd ../.. ; mvn -DskipTests install
|
cd ../.. ; mvn -DskipTests install
|
||||||
cd ../.. ; mvn exec:java -Dexec.mainClass="main.Main" -Dexec.args="'src/main/resources/input/CompilerInput.java' 'src/main/resources/output' "
|
cd ../.. ; mvn exec:java -DgenJar=true -DgenClass=true -Dexec.mainClass="main.Main" -Dexec.args="'src/main/resources/input/CompilerInput.java' 'src/main/resources/output'"
|
||||||
# cp ../main/resources/output/CompilerInput.class .java/resources/output/raupenpiler
|
cp ../main/resources/output/CompilerInput.class .java/resources/output/raupenpiler
|
||||||
|
|
||||||
test: compile-javac compile-raupenpiler test-javac test-raupenpiler
|
test: compile-javac compile-raupenpiler test-javac test-raupenpiler
|
||||||
|
|
||||||
@ -36,8 +36,10 @@ clean:
|
|||||||
rm -f ./resources/output/raupenpiler/*.class
|
rm -f ./resources/output/raupenpiler/*.class
|
||||||
# clean logs
|
# clean logs
|
||||||
rm -f ../main/resources/logs/*.log
|
rm -f ../main/resources/logs/*.log
|
||||||
# clean test/main folders from .class files for End-to-End tests
|
# clean test/java/main folders from .class files for End-to-End tests
|
||||||
rm -f ./java/main/*.class
|
rm -f ./java/main/*.class
|
||||||
# clean javac output from featureTests
|
# clean javac output from combinedFeatureTests
|
||||||
rm -f ./resources/input/featureTests/*.class
|
rm -f ./resources/input/combinedFeatureTests/*.class
|
||||||
|
rm -f ./resources/input/singleFeatureTests/*.class
|
||||||
|
rm -f ./resources/input/typedAstFeatureTests/*.class
|
||||||
|
|
||||||
|
@ -1,177 +1,95 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
import ast.ASTNode;
|
import java.lang.reflect.Constructor;
|
||||||
import ast.ProgramNode;
|
import java.lang.reflect.Field;
|
||||||
import bytecode.ByteCodeGenerator;
|
import java.lang.reflect.Method;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.antlr.v4.runtime.CharStream;
|
|
||||||
import org.antlr.v4.runtime.CommonTokenStream;
|
import javax.tools.JavaCompiler;
|
||||||
import org.antlr.v4.runtime.tree.ParseTree;
|
import javax.tools.ToolProvider;
|
||||||
import parser.astBuilder.ASTBuilder;
|
|
||||||
import parser.generated.SimpleJavaLexer;
|
|
||||||
import parser.generated.SimpleJavaParser;
|
|
||||||
import semantic.SemanticAnalyzer;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.mockito.Mockito.*;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class E2EReflectionsTest {
|
public class E2EReflectionsTest {
|
||||||
|
|
||||||
|
|
||||||
private CharStream mockInputCharStream;
|
|
||||||
private String outputDirectoryPath;
|
|
||||||
private SimpleJavaLexer mockLexer;
|
|
||||||
private CommonTokenStream mockTokenStream;
|
|
||||||
private SimpleJavaParser mockParser;
|
|
||||||
private ParseTree mockParseTree;
|
|
||||||
private ASTBuilder mockASTBuilder;
|
|
||||||
private ASTNode mockASTNode;
|
|
||||||
private SemanticAnalyzer mockSemanticAnalyzer;
|
|
||||||
private ASTNode mockTypedAST;
|
|
||||||
private ByteCodeGenerator mockByteCodeGenerator;
|
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
public void setUp() {
|
|
||||||
mockInputCharStream = mock(CharStream.class);
|
|
||||||
outputDirectoryPath = "path/to/output";
|
|
||||||
mockLexer = mock(SimpleJavaLexer.class);
|
|
||||||
mockTokenStream = mock(CommonTokenStream.class);
|
|
||||||
mockParser = mock(SimpleJavaParser.class);
|
|
||||||
mockParseTree = mock(ParseTree.class);
|
|
||||||
mockASTBuilder = mock(ASTBuilder.class);
|
|
||||||
mockASTNode = mock(ASTNode.class);
|
|
||||||
mockSemanticAnalyzer = mock(SemanticAnalyzer.class);
|
|
||||||
mockTypedAST = mock(ASTNode.class);
|
|
||||||
mockByteCodeGenerator = mock(ByteCodeGenerator.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompileFile() throws Exception {
|
public void AllFeaturesClassExampleTest(){
|
||||||
// Mock the dependencies
|
try {
|
||||||
SimpleJavaLexer mockLexer = mock(SimpleJavaLexer.class);
|
Main.main(new String[]{"src/test/resources/input/combinedFeatureTests/AllFeaturesClassExample.java", "src/test/resources/output/raupenpiler"});
|
||||||
CommonTokenStream mockTokenStream = mock(CommonTokenStream.class);
|
// Get the system Java compiler
|
||||||
SimpleJavaParser mockParser = mock(SimpleJavaParser.class);
|
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
||||||
ParseTree mockParseTree = mock(ParseTree.class);
|
// Assert that the compiler is available
|
||||||
ASTBuilder mockASTBuilder = mock(ASTBuilder.class);
|
assertNotNull(javac, "Java Compiler is not available");
|
||||||
ASTNode mockASTNode = mock(ASTNode.class);
|
javac.run(null, null, null, "src/test/resources/input/combinedFeatureTests/AllFeaturesClassExample.java");
|
||||||
SemanticAnalyzer mockSemanticAnalyzer = mock(SemanticAnalyzer.class);
|
|
||||||
ASTNode mockTypedAST = mock(ASTNode.class);
|
|
||||||
ByteCodeGenerator mockByteCodeGenerator = mock(ByteCodeGenerator.class);
|
|
||||||
|
|
||||||
// Mock the behavior
|
Class<?> clazz = Class.forName("src.resources.input.combinedFeatureTests.AllFeaturesClassExample");
|
||||||
when(mockLexer.nextToken()).thenReturn(null);
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
when(mockTokenStream.getTokens()).thenReturn(new ArrayList<>());
|
// Class<?> clazz = classLoader.loadClass("main.AllFeaturesClassExample");
|
||||||
when(mockParser.program()).thenReturn((SimpleJavaParser.ProgramContext) mockParseTree);
|
|
||||||
when(mockASTBuilder.visit(mockParseTree)).thenReturn(mockASTNode);
|
|
||||||
when(SemanticAnalyzer.generateTast(mockASTNode)).thenReturn(mockTypedAST);
|
|
||||||
|
|
||||||
// Use reflection to invoke the compileFile method
|
// Class Name
|
||||||
Method compileFileMethod = main.Main.class.getDeclaredMethod("compileFile", CharStream.class, String.class);
|
assertEquals("main.AllFeaturesClassExample", clazz.getName());
|
||||||
compileFileMethod.setAccessible(true);
|
|
||||||
|
|
||||||
compileFileMethod.invoke(null, mockInputCharStream, outputDirectoryPath);
|
// Constructors
|
||||||
|
Constructor<?>[] actualConstructors = clazz.getDeclaredConstructors();
|
||||||
|
assertTrue(actualConstructors.length > 0, "No constructors found");
|
||||||
|
|
||||||
// Verify each step
|
Constructor<?> expectedConstructor = clazz.getConstructor(int.class, boolean.class, char.class);
|
||||||
verify(mockLexer, times(1)).nextToken();
|
|
||||||
verify(mockTokenStream, times(1)).getTokens();
|
boolean constructorFound = false;
|
||||||
verify(mockParser, times(1)).program();
|
for (Constructor<?> constructor : actualConstructors) {
|
||||||
verify(mockASTBuilder, times(1)).visit(mockParseTree);
|
if (constructor.equals(expectedConstructor)) {
|
||||||
verify(mockSemanticAnalyzer, times(1)).generateTast(mockASTNode);
|
constructorFound = true;
|
||||||
verify(mockByteCodeGenerator, times(1)).visit((ProgramNode) mockTypedAST);
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertTrue(constructorFound, "Expected constructor not found in actual constructors");
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
Method[] actualMethodNames = clazz.getDeclaredMethods();
|
||||||
|
assertTrue(actualMethodNames.length > 0);
|
||||||
|
for (Method method : actualMethodNames) {
|
||||||
|
System.out.println("Method: " + method.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Method Names
|
||||||
|
String[] expectedMethodNames = {
|
||||||
|
"controlStructures",
|
||||||
|
"logicalOperations",
|
||||||
|
"add",
|
||||||
|
"subtract",
|
||||||
|
"multiply",
|
||||||
|
"divide",
|
||||||
|
"modulo",
|
||||||
|
"main"
|
||||||
|
};
|
||||||
|
|
||||||
|
for (Method method : actualMethodNames) {
|
||||||
|
assertTrue(Arrays.asList(expectedMethodNames).contains(method.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields
|
||||||
|
Field[] actualFields = clazz.getDeclaredFields();
|
||||||
|
assertTrue(actualFields.length > 0, "No fields found");
|
||||||
|
|
||||||
|
Field expectedField = clazz.getDeclaredField("c");
|
||||||
|
assertEquals(expectedField.getType(), char.class);
|
||||||
|
|
||||||
|
boolean fieldFound = false;
|
||||||
|
for (Field field : actualFields) {
|
||||||
|
if (field.equals(expectedField)) {
|
||||||
|
fieldFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertTrue(fieldFound, "Expected field not found in actual fields");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Test
|
|
||||||
public void testCompileFile2() throws Exception {
|
|
||||||
// Mock the behavior
|
|
||||||
when(mockLexer.nextToken()).thenReturn(null);
|
|
||||||
when(mockTokenStream.getTokens()).thenReturn(new ArrayList<>());
|
|
||||||
when(mockParser.program()).thenReturn((SimpleJavaParser.ProgramContext) mockParseTree);
|
|
||||||
when(mockASTBuilder.visit(mockParseTree)).thenReturn(mockASTNode);
|
|
||||||
when(SemanticAnalyzer.generateTast(mockASTNode)).thenReturn(mockTypedAST);
|
|
||||||
|
|
||||||
// Use reflection to invoke the compileFile method
|
|
||||||
Method compileFileMethod = main.Main.class.getDeclaredMethod("compileFile", CharStream.class, String.class);
|
|
||||||
compileFileMethod.setAccessible(true);
|
|
||||||
|
|
||||||
compileFileMethod.invoke(null, mockInputCharStream, outputDirectoryPath);
|
|
||||||
|
|
||||||
// Verify each step
|
|
||||||
verify(mockLexer, times(1)).nextToken();
|
|
||||||
verify(mockTokenStream, times(1)).getTokens();
|
|
||||||
verify(mockParser, times(1)).program();
|
|
||||||
verify(mockASTBuilder, times(1)).visit(mockParseTree);
|
|
||||||
verify(mockSemanticAnalyzer, times(1)).generateTast(mockASTNode);
|
|
||||||
verify(mockByteCodeGenerator, times(1)).visit((ProgramNode) mockTypedAST);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLexer() {
|
|
||||||
// Mock the behavior
|
|
||||||
when(mockLexer.nextToken()).thenReturn(null);
|
|
||||||
|
|
||||||
// Test the lexer
|
|
||||||
SimpleJavaLexer lexer = new SimpleJavaLexer(mockInputCharStream);
|
|
||||||
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
|
|
||||||
tokenStream.fill();
|
|
||||||
|
|
||||||
assertNotNull(tokenStream.getTokens());
|
|
||||||
verify(mockLexer, atLeastOnce()).nextToken();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testParser() {
|
|
||||||
// Mock the behavior
|
|
||||||
when(mockParser.program()).thenReturn((SimpleJavaParser.ProgramContext) mockParseTree);
|
|
||||||
|
|
||||||
// Test the parser
|
|
||||||
SimpleJavaParser parser = new SimpleJavaParser(mockTokenStream);
|
|
||||||
ParseTree parseTree = parser.program();
|
|
||||||
|
|
||||||
assertNotNull(parseTree);
|
|
||||||
verify(mockParser, times(1)).program();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testASTBuilder() {
|
|
||||||
// Mock the behavior
|
|
||||||
when(mockASTBuilder.visit(mockParseTree)).thenReturn(mockASTNode);
|
|
||||||
|
|
||||||
// Test the AST builder
|
|
||||||
ASTBuilder astBuilder = new ASTBuilder();
|
|
||||||
ASTNode abstractSyntaxTree = astBuilder.visit(mockParseTree);
|
|
||||||
|
|
||||||
assertNotNull(abstractSyntaxTree);
|
|
||||||
verify(mockASTBuilder, times(1)).visit(mockParseTree);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSemanticAnalyzer() {
|
|
||||||
// Mock the behavior
|
|
||||||
when(SemanticAnalyzer.generateTast(mockASTNode)).thenReturn(mockTypedAST);
|
|
||||||
|
|
||||||
// Test the semantic analyzer
|
|
||||||
ASTNode typedAst = SemanticAnalyzer.generateTast(mockASTNode);
|
|
||||||
|
|
||||||
assertNotNull(typedAst);
|
|
||||||
verify(mockSemanticAnalyzer, times(1)).generateTast(mockASTNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testByteCodeGenerator() {
|
|
||||||
// Test the bytecode generator
|
|
||||||
ByteCodeGenerator byteCodeGenerator = new ByteCodeGenerator(outputDirectoryPath, true, true);
|
|
||||||
byteCodeGenerator.visit((ProgramNode) mockTypedAST);
|
|
||||||
|
|
||||||
verify(mockByteCodeGenerator, times(1)).visit((ProgramNode) mockTypedAST);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
package main;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import javax.tools.JavaCompiler;
|
|
||||||
import javax.tools.ToolProvider;
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class FailureTest {
|
|
||||||
/**
|
|
||||||
* This test method checks if invalid Java files fail to compile as expected.
|
|
||||||
* It uses the JavaCompiler from the ToolProvider to compile the files.
|
|
||||||
* The test passes if all the files fail to compile.
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void areTestFilesActuallyFailTest() {
|
|
||||||
// Get the system Java compiler
|
|
||||||
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
|
||||||
// Assert that the compiler is available
|
|
||||||
assertNotNull(javac, "Java Compiler is not available");
|
|
||||||
|
|
||||||
String directoryPath = "src/test/resources/input/failureTests";
|
|
||||||
File folder = new File(directoryPath);
|
|
||||||
|
|
||||||
if (folder.isDirectory()) {
|
|
||||||
File[] files = folder.listFiles((dir, name) -> name.endsWith(".java"));
|
|
||||||
|
|
||||||
if (files != null) {
|
|
||||||
for (File file : files) {
|
|
||||||
// Try to compile the file and get the result
|
|
||||||
// The run method returns 0 if the compilation was successful, and non-zero otherwise
|
|
||||||
int result = javac.run(null, null, null, file.getPath());
|
|
||||||
|
|
||||||
// Assert that the compilation failed (i.e., the result is non-zero)
|
|
||||||
assertTrue(result != 0, "Expected compilation failure for " + file.getName());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
System.out.println("No files found in the directory.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
System.out.println("The provided path is not a directory.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
|||||||
package main;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import javax.tools.JavaCompiler;
|
|
||||||
import javax.tools.ToolProvider;
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
public class FeatureTest {
|
|
||||||
/**
|
|
||||||
* This test method checks if valid Java files compile successfully.
|
|
||||||
* It uses the JavaCompiler from the ToolProvider to compile the files.
|
|
||||||
* The test passes if all the files compile without errors.
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void areTestFilesActuallyValid() {
|
|
||||||
// Get the system Java compiler
|
|
||||||
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
|
||||||
// Assert that the compiler is available
|
|
||||||
assertNotNull(javac, "Java Compiler is not available");
|
|
||||||
|
|
||||||
String directoryPath = "src/test/resources/input/featureTests";
|
|
||||||
File folder = new File(directoryPath);
|
|
||||||
|
|
||||||
if (folder.isDirectory()) {
|
|
||||||
File[] files = folder.listFiles((dir, name) -> name.endsWith(".java"));
|
|
||||||
|
|
||||||
if (files != null) {
|
|
||||||
for (File file : files) {
|
|
||||||
// Try to compile the file and get the result
|
|
||||||
// The run method returns 0 if the compilation was successful, and non-zero otherwise
|
|
||||||
int result = javac.run(null, null, null, file.getPath());
|
|
||||||
|
|
||||||
// Assert that the compilation succeeded (i.e., the result is zero)
|
|
||||||
assertEquals(0, result, "Expected compilation success for " + file.getName());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
System.out.println("No files found in the directory.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
System.out.println("The provided path is not a directory.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
104
src/test/java/main/InputFilesTest.java
Normal file
104
src/test/java/main/InputFilesTest.java
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
package main;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import javax.tools.JavaCompiler;
|
||||||
|
import javax.tools.ToolProvider;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
public class InputFilesTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test method checks if valid Java files compile successfully.
|
||||||
|
* It uses the JavaCompiler from the ToolProvider to compile the files.
|
||||||
|
* The test passes if all the files compile without errors.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void areTestFilesActuallyValid() throws IOException {
|
||||||
|
// Get the system Java compiler
|
||||||
|
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
||||||
|
// Assert that the compiler is available
|
||||||
|
assertNotNull(javac, "Java Compiler is not available");
|
||||||
|
|
||||||
|
File folder1 = new File("src/test/resources/input/combinedFeatureTests");
|
||||||
|
File folder2 = new File("src/test/resources/input/singleFeatureTests");
|
||||||
|
File folder3 = new File("src/test/resources/input/typedAstFeatureTests");
|
||||||
|
|
||||||
|
List<File> files = getJavaFilesFromDirectory(folder1);
|
||||||
|
files.addAll(getJavaFilesFromDirectory(folder2));
|
||||||
|
files.addAll(getJavaFilesFromDirectory(folder3));
|
||||||
|
|
||||||
|
if (!files.isEmpty()) {
|
||||||
|
for (File file : files) {
|
||||||
|
// Try to compile the file and get the result
|
||||||
|
int result = javac.run(null, null, null, file.getPath());
|
||||||
|
|
||||||
|
// Assert that the compilation succeeded (i.e., the result is zero)
|
||||||
|
assertEquals(0, result, "Expected compilation success for " + file.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println("No files found in the directories.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test method checks if invalid Java files fail to compile as expected.
|
||||||
|
* It uses the JavaCompiler from the ToolProvider to compile the files.
|
||||||
|
* The test passes if all the files fail to compile.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void areTestFilesActuallyFails() throws IOException {
|
||||||
|
// Get the system Java compiler
|
||||||
|
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
||||||
|
// Assert that the compiler is available
|
||||||
|
assertNotNull(javac, "Java Compiler is not available");
|
||||||
|
|
||||||
|
|
||||||
|
File folder1 = new File("src/test/resources/input/failureTests");
|
||||||
|
File folder2 = new File("src/test/resources/input/typedAstExceptionsTest");
|
||||||
|
|
||||||
|
List<File> files = getJavaFilesFromDirectory(folder1);
|
||||||
|
files.addAll(getJavaFilesFromDirectory(folder2));
|
||||||
|
|
||||||
|
|
||||||
|
if (!files.isEmpty()) {
|
||||||
|
for (File file : files) {
|
||||||
|
// Try to compile the file and get the result
|
||||||
|
// The run method returns 0 if the compilation was successful, and non-zero otherwise
|
||||||
|
int result = javac.run(null, null, null, file.getPath());
|
||||||
|
|
||||||
|
// Assert that the compilation failed (i.e., the result is non-zero)
|
||||||
|
assertTrue(result != 0, "Expected compilation failure for " + file.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println("No files found in the directory.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to get all .java files from a directory.
|
||||||
|
*
|
||||||
|
* @param directory the directory to search for .java files
|
||||||
|
* @return a list of .java files
|
||||||
|
* @throws IOException if an I/O error occurs
|
||||||
|
*/
|
||||||
|
private List<File> getJavaFilesFromDirectory(File directory) throws IOException {
|
||||||
|
if (directory.isDirectory()) {
|
||||||
|
return Files.list(directory.toPath())
|
||||||
|
.filter(path -> path.toString().endsWith(".java"))
|
||||||
|
.map(java.nio.file.Path::toFile)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
System.out.println("The provided path is not a directory: " + directory.getPath());
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
145
src/test/java/main/ReflectionsTest.java
Normal file
145
src/test/java/main/ReflectionsTest.java
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
package main;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.antlr.v4.runtime.CharStream;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
|
||||||
|
public class ReflectionsTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSimpleJavaLexerClass() throws ClassNotFoundException, NoSuchMethodException {
|
||||||
|
Class<?> clazz = Class.forName("parser.generated.SimpleJavaLexer");
|
||||||
|
|
||||||
|
// Class Name
|
||||||
|
assertEquals("parser.generated.SimpleJavaLexer", clazz.getName());
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
Constructor<?>[] actualConstructors = clazz.getDeclaredConstructors();
|
||||||
|
assertTrue(actualConstructors.length > 0, "No constructors found");
|
||||||
|
|
||||||
|
Constructor<?> expectedConstructor = clazz.getConstructor(CharStream.class);
|
||||||
|
|
||||||
|
boolean constructorFound = false;
|
||||||
|
for (Constructor<?> constructor : actualConstructors) {
|
||||||
|
if (constructor.equals(expectedConstructor)) {
|
||||||
|
constructorFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertTrue(constructorFound, "Expected constructor not found in actual constructors");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
Method[] actualMethodNames = clazz.getDeclaredMethods();
|
||||||
|
assertTrue(actualMethodNames.length > 0);
|
||||||
|
Arrays.stream(actualMethodNames).forEach(method -> System.out.println("Method: " + method.getName()));
|
||||||
|
|
||||||
|
List<String> expectedMethodNames = Arrays.asList(
|
||||||
|
"getTokenNames",
|
||||||
|
"getVocabulary",
|
||||||
|
"getGrammarFileName",
|
||||||
|
"getRuleNames",
|
||||||
|
"getSerializedATN",
|
||||||
|
"getChannelNames",
|
||||||
|
"getModeNames",
|
||||||
|
"getATN",
|
||||||
|
"makeRuleNames",
|
||||||
|
"makeLiteralNames",
|
||||||
|
"makeSymbolicNames"
|
||||||
|
);
|
||||||
|
|
||||||
|
for (Method method : actualMethodNames) {
|
||||||
|
assertTrue(expectedMethodNames.contains(method.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String expectedMethodName : expectedMethodNames) {
|
||||||
|
boolean methodFound = false;
|
||||||
|
for (Method method : actualMethodNames) {
|
||||||
|
if (method.getName().equals(expectedMethodName)) {
|
||||||
|
methodFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertTrue(methodFound, "Expected method " + expectedMethodName + " not found in actual methods");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Fields
|
||||||
|
Field[] actualFieldNames = clazz.getDeclaredFields();
|
||||||
|
assertTrue(actualFieldNames.length > 0);
|
||||||
|
Arrays.stream(actualFieldNames).forEach(field -> System.out.println("Field: " + field.getName()));
|
||||||
|
|
||||||
|
List<String> expectedFieldNames = Arrays.asList(
|
||||||
|
"_decisionToDFA",
|
||||||
|
"_sharedContextCache",
|
||||||
|
"channelNames",
|
||||||
|
"modeNames",
|
||||||
|
"ruleNames",
|
||||||
|
"_LITERAL_NAMES",
|
||||||
|
"_SYMBOLIC_NAMES",
|
||||||
|
"VOCABULARY",
|
||||||
|
"tokenNames",
|
||||||
|
"_serializedATN",
|
||||||
|
"_ATN"
|
||||||
|
);
|
||||||
|
|
||||||
|
for (Field field : actualFieldNames) {
|
||||||
|
assertTrue(expectedFieldNames.contains(field.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSimpleJavaParserClass() throws ClassNotFoundException {
|
||||||
|
Class<?> clazz = Class.forName("parser.generated.SimpleJavaParser");
|
||||||
|
|
||||||
|
// Class Name
|
||||||
|
assertEquals("parser.generated.SimpleJavaParser", clazz.getName());
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
Constructor<?>[] constructors = clazz.getDeclaredConstructors();
|
||||||
|
assertTrue(constructors.length > 0);
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
Method[] methods = clazz.getDeclaredMethods();
|
||||||
|
assertTrue(methods.length > 0);
|
||||||
|
Arrays.stream(methods).forEach(method -> System.out.println("Method: " + method.getName()));
|
||||||
|
|
||||||
|
// Fields
|
||||||
|
Field[] fields = clazz.getDeclaredFields();
|
||||||
|
assertTrue(fields.length > 0);
|
||||||
|
Arrays.stream(fields).forEach(field -> System.out.println("Field: " + field.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testASTBuilderClass() throws ClassNotFoundException {
|
||||||
|
Class<?> clazz = Class.forName("parser.astBuilder.ASTBuilder");
|
||||||
|
|
||||||
|
// Class Name
|
||||||
|
assertEquals("parser.astBuilder.ASTBuilder", clazz.getName());
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
Constructor<?>[] constructors = clazz.getDeclaredConstructors();
|
||||||
|
assertTrue(constructors.length > 0);
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
Method[] methods = clazz.getDeclaredMethods();
|
||||||
|
assertTrue(methods.length > 0);
|
||||||
|
Arrays.stream(methods).forEach(method -> System.out.println("Method: " + method.getName()));
|
||||||
|
|
||||||
|
// Fields
|
||||||
|
Field[] fields = clazz.getDeclaredFields();
|
||||||
|
assertTrue(fields.length > 0);
|
||||||
|
Arrays.stream(fields).forEach(field -> System.out.println("Field: " + field.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Similarly, you can add tests for SemanticAnalyzer and ByteCodeGenerator
|
||||||
|
}
|
@ -1,142 +1,148 @@
|
|||||||
package parser;
|
package parser;
|
||||||
|
|
||||||
|
|
||||||
import ast.ASTNode;
|
import ast.ASTNode;
|
||||||
import ast.ClassNode;
|
import ast.ClassNode;
|
||||||
import ast.ProgramNode;
|
import ast.ProgramNode;
|
||||||
import ast.expressions.IExpressionNode;
|
import ast.expressions.IExpressionNode;
|
||||||
import ast.expressions.binaryexpressions.CalculationNode;
|
|
||||||
import ast.expressions.binaryexpressions.DotNode;
|
|
||||||
import ast.expressions.binaryexpressions.DotSubstractionNode;
|
|
||||||
import ast.expressions.binaryexpressions.NonCalculationNode;
|
|
||||||
import ast.expressions.unaryexpressions.MemberAccessNode;
|
import ast.expressions.unaryexpressions.MemberAccessNode;
|
||||||
import ast.expressions.unaryexpressions.UnaryNode;
|
import ast.expressions.unaryexpressions.UnaryNode;
|
||||||
import ast.members.*;
|
import ast.members.ConstructorNode;
|
||||||
|
import ast.members.FieldNode;
|
||||||
|
import ast.members.MemberNode;
|
||||||
|
import ast.members.MethodNode;
|
||||||
import ast.parameters.ParameterNode;
|
import ast.parameters.ParameterNode;
|
||||||
import ast.statementexpressions.AssignNode;
|
import ast.statementexpressions.AssignNode;
|
||||||
import ast.statementexpressions.AssignableNode;
|
import ast.statementexpressions.AssignableNode;
|
||||||
import ast.statementexpressions.crementexpressions.CrementType;
|
|
||||||
import ast.statementexpressions.crementexpressions.DecrementNode;
|
|
||||||
import ast.statementexpressions.crementexpressions.IncrementNode;
|
|
||||||
import ast.statementexpressions.NewDeclarationNode;
|
|
||||||
import ast.statementexpressions.methodcallstatementnexpressions.MethodCallNode;
|
import ast.statementexpressions.methodcallstatementnexpressions.MethodCallNode;
|
||||||
import ast.statements.*;
|
|
||||||
import ast.statementexpressions.methodcallstatementnexpressions.TargetNode;
|
|
||||||
import ast.statements.BlockNode;
|
import ast.statements.BlockNode;
|
||||||
import ast.statements.LocalVariableDeclarationNode;
|
import ast.statements.IStatementNode;
|
||||||
import ast.statements.ReturnNode;
|
import ast.statements.ReturnNode;
|
||||||
import ast.type.AccessModifierNode;
|
import ast.type.AccessModifierNode;
|
||||||
import ast.type.EnumValueNode;
|
import ast.type.EnumValueNode;
|
||||||
import ast.type.ValueNode;
|
import ast.type.ValueNode;
|
||||||
import ast.type.type.BaseType;
|
import ast.type.type.BaseType;
|
||||||
import ast.type.type.ReferenceType;
|
import ast.type.type.ITypeNode;
|
||||||
import ast.type.type.TypeEnum;
|
import ast.type.type.TypeEnum;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.antlr.v4.runtime.CharStream;
|
||||||
|
import org.antlr.v4.runtime.CharStreams;
|
||||||
|
import org.antlr.v4.runtime.CommonTokenStream;
|
||||||
|
import org.antlr.v4.runtime.tree.ParseTree;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import parser.astBuilder.ASTBuilder;
|
||||||
|
import parser.generated.SimpleJavaLexer;
|
||||||
|
import parser.generated.SimpleJavaParser;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Member;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
@DisplayName("Untyped Abstract Syntax Tree")
|
@DisplayName("Untyped Abstract Syntax Tree")
|
||||||
class AstBuilderTest {
|
class AstBuilderTest {
|
||||||
|
|
||||||
|
private final static String directoryPath = "src/test/resources/input/singleFeatureTests/";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Empty Class Test")
|
@DisplayName("Empty Class Test")
|
||||||
public void emptyClassTest(){
|
public void emptyClassTest() {
|
||||||
ClassNode emptyClass = Helper.generateEmptyClass("TestClass");
|
ClassNode emptyClass = Helper.generateEmptyClass("EmptyClass");
|
||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(emptyClass);
|
expected.addClass(emptyClass);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/EmptyClass.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "EmptyClass.java");
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Multiple Empty Classes Test")
|
@DisplayName("Multiple Empty Classes Test")
|
||||||
public void multipleEmptyClassesTest() {
|
public void multipleEmptyClassesTest() {
|
||||||
ClassNode class1 = Helper.generateEmptyClass("TestClass1");
|
ClassNode class1 = Helper.generateEmptyClass("MultipleClasses");
|
||||||
ClassNode class2 = Helper.generateEmptyClass("TestClass2");
|
ClassNode class2 = Helper.generateEmptyClass("TestClass2");
|
||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
expected.addClass(class2);
|
expected.addClass(class2);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/MultipleClasses.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "MultipleClasses.java");
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Empty Class Test with Constructor")
|
@DisplayName("Empty Class Test with Constructor")
|
||||||
public void emptyClassWithConstructorTest() {
|
public void emptyClassWithConstructorTest() {
|
||||||
ClassNode class1 = Helper.generateEmptyClass("TestClass");
|
ClassNode class1 = Helper.generateEmptyClass("EmptyClassWithConstructor");
|
||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/EmptyClassWithConstructor.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "EmptyClassWithConstructor.java");
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Field Test")
|
@DisplayName("Field Test")
|
||||||
public void fieldTest() {
|
public void fieldTest() {
|
||||||
ClassNode class1 = Helper.generateEmptyClass("TestClass");
|
ClassNode class1 = Helper.generateEmptyClass("Field");
|
||||||
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/Field.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "Field.java");
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Field Test with Accessmodifier")
|
@DisplayName("Field Test with Accessmodifier")
|
||||||
public void fieldTestWithModifier() {
|
public void fieldTestWithModifier() {
|
||||||
ClassNode class1 = Helper.generateEmptyClass("TestClass");
|
ClassNode class1 = Helper.generateEmptyClass("FieldWithAccessModifier");
|
||||||
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/FieldWithAccessModifier.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "FieldWithAccessModifier.java");
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Commments Ignore Test")
|
@DisplayName("Comments Ignore Test")
|
||||||
public void commmentsIgnoreTest(){
|
public void commentsIgnoreTest() {
|
||||||
ClassNode class1 = Helper.generateEmptyClass("TestClass");
|
ClassNode class1 = Helper.generateEmptyClass("Comments");
|
||||||
class1.addMember(new FieldNode(new AccessModifierNode("private"), new BaseType(TypeEnum.INT), "a"));
|
class1.addMember(new FieldNode(new AccessModifierNode("private"), new BaseType(TypeEnum.INT), "a"));
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/Comments.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "Comments.java");
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Constructor Paramerter Test")
|
@DisplayName("Constructor Parameter Test")
|
||||||
public void constructorParameterTest(){
|
public void constructorParameterTest() {
|
||||||
BlockNode block = new BlockNode();
|
BlockNode block = new BlockNode();
|
||||||
block.addStatement(new ReturnNode(null));
|
block.addStatement(new ReturnNode(null));
|
||||||
ConstructorNode constructor = new ConstructorNode("public", "TestClass", block);
|
ConstructorNode constructor = new ConstructorNode("public", "ConstructorParameter", block);
|
||||||
constructor.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
constructor.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
||||||
constructor.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "b"));
|
constructor.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "b"));
|
||||||
|
|
||||||
ClassNode class1 = new ClassNode("public", "TestClass");
|
ClassNode class1 = new ClassNode("public", "ConstructorParameter");
|
||||||
class1.addMember(constructor);
|
class1.addMember(constructor);
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/ConstructorParameter.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "ConstructorParameter.java");
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("This Dot Test")
|
@DisplayName("This Dot Test")
|
||||||
public void thisDotTest(){
|
public void thisDotTest() {
|
||||||
BlockNode block = new BlockNode();
|
BlockNode block = new BlockNode();
|
||||||
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
||||||
memberAccess.addIdentifier("a");
|
memberAccess.addIdentifier("a");
|
||||||
@ -148,23 +154,23 @@ class AstBuilderTest {
|
|||||||
|
|
||||||
block.addStatement(new AssignNode(assignable, expression));
|
block.addStatement(new AssignNode(assignable, expression));
|
||||||
block.addStatement(new ReturnNode(null));
|
block.addStatement(new ReturnNode(null));
|
||||||
ConstructorNode constructor = new ConstructorNode("public", "TestClass", block);
|
ConstructorNode constructor = new ConstructorNode("public", "ThisDot", block);
|
||||||
|
|
||||||
ClassNode class1 = new ClassNode("public", "TestClass");
|
ClassNode class1 = new ClassNode("public", "ThisDot");
|
||||||
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
||||||
class1.addMember(constructor);
|
class1.addMember(constructor);
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/ThisDot.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "ThisDot.java");
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Constructor This Dot Test")
|
@DisplayName("Constructor This Dot Test")
|
||||||
public void constructorThisDotTest(){
|
public void constructorThisDotTest() {
|
||||||
BlockNode block = new BlockNode();
|
BlockNode block = new BlockNode();
|
||||||
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
||||||
memberAccess.addIdentifier("a");
|
memberAccess.addIdentifier("a");
|
||||||
@ -175,25 +181,25 @@ class AstBuilderTest {
|
|||||||
|
|
||||||
block.addStatement(new AssignNode(assignable, expression));
|
block.addStatement(new AssignNode(assignable, expression));
|
||||||
block.addStatement(new ReturnNode(null));
|
block.addStatement(new ReturnNode(null));
|
||||||
ConstructorNode constructor = new ConstructorNode("public", "TestClass", block);
|
ConstructorNode constructor = new ConstructorNode("public", "ConstructorThisDot", block);
|
||||||
constructor.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
constructor.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
||||||
|
|
||||||
ClassNode class1 = new ClassNode("public", "TestClass");
|
ClassNode class1 = new ClassNode("public", "ConstructorThisDot");
|
||||||
class1.addMember(new FieldNode(new AccessModifierNode("private"), new BaseType(TypeEnum.INT), "a"));
|
class1.addMember(new FieldNode(new AccessModifierNode("private"), new BaseType(TypeEnum.INT), "a"));
|
||||||
class1.addMember(constructor);
|
class1.addMember(constructor);
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/ConstructorThisDot.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "ConstructorThisDot.java");
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Void Methoden Test")
|
@DisplayName("Void Methoden Test")
|
||||||
public void voidMethodenTest(){
|
public void voidMethodenTest() {
|
||||||
ClassNode class1 = Helper.generateEmptyClass("TestClass");
|
ClassNode class1 = Helper.generateEmptyClass("VoidMethod");
|
||||||
BlockNode block = new BlockNode();
|
BlockNode block = new BlockNode();
|
||||||
block.addStatement(new ReturnNode(null));
|
block.addStatement(new ReturnNode(null));
|
||||||
class1.addMember(new MethodNode("public", null, true, "test", block));
|
class1.addMember(new MethodNode("public", null, true, "test", block));
|
||||||
@ -201,14 +207,14 @@ class AstBuilderTest {
|
|||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/VoidMethod.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "VoidMethod.java");
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Constructor Method call Test")
|
@DisplayName("Constructor Method call Test")
|
||||||
public void constructorMethodCallTest(){
|
public void constructorMethodCallTest() {
|
||||||
BlockNode blockCon = new BlockNode();
|
BlockNode blockCon = new BlockNode();
|
||||||
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
||||||
memberAccess.addIdentifier("a");
|
memberAccess.addIdentifier("a");
|
||||||
@ -219,13 +225,13 @@ class AstBuilderTest {
|
|||||||
|
|
||||||
blockCon.addStatement(new AssignNode(assignable, expression));
|
blockCon.addStatement(new AssignNode(assignable, expression));
|
||||||
blockCon.addStatement(new ReturnNode(null));
|
blockCon.addStatement(new ReturnNode(null));
|
||||||
ConstructorNode constructor = new ConstructorNode("public", "TestClass", blockCon);
|
ConstructorNode constructor = new ConstructorNode("public", "ConstructorMethodCall", blockCon);
|
||||||
|
|
||||||
BlockNode blockMethod = new BlockNode();
|
BlockNode blockMethod = new BlockNode();
|
||||||
blockMethod.addStatement(new ReturnNode(new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "1"))));
|
blockMethod.addStatement(new ReturnNode(new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "1"))));
|
||||||
MethodNode method = new MethodNode("public", new BaseType(TypeEnum.INT), false, "testMethod", blockMethod);
|
MethodNode method = new MethodNode("public", new BaseType(TypeEnum.INT), false, "testMethod", blockMethod);
|
||||||
|
|
||||||
ClassNode class1 = new ClassNode("public", "TestClass");
|
ClassNode class1 = new ClassNode("public", "ConstructorMethodCall");
|
||||||
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
||||||
class1.addMember(constructor);
|
class1.addMember(constructor);
|
||||||
class1.addMember(method);
|
class1.addMember(method);
|
||||||
@ -233,14 +239,14 @@ class AstBuilderTest {
|
|||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/ConstructorMethodCall.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "ConstructorMethodCall.java");
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Constructor Method call Parameters Test")
|
@DisplayName("Constructor Method call Parameters Test")
|
||||||
public void constructorMethodCallParametersTest(){
|
public void constructorMethodCallParametersTest() {
|
||||||
BlockNode blockCon = new BlockNode();
|
BlockNode blockCon = new BlockNode();
|
||||||
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
||||||
memberAccess.addIdentifier("a");
|
memberAccess.addIdentifier("a");
|
||||||
@ -253,7 +259,7 @@ class AstBuilderTest {
|
|||||||
|
|
||||||
blockCon.addStatement(new AssignNode(assignable, expression));
|
blockCon.addStatement(new AssignNode(assignable, expression));
|
||||||
blockCon.addStatement(new ReturnNode(null));
|
blockCon.addStatement(new ReturnNode(null));
|
||||||
ConstructorNode constructor = new ConstructorNode("public", "TestClass", blockCon);
|
ConstructorNode constructor = new ConstructorNode("public", "ConstructorMethodCallParameters", blockCon);
|
||||||
constructor.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
constructor.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
||||||
|
|
||||||
BlockNode blockMethod = new BlockNode();
|
BlockNode blockMethod = new BlockNode();
|
||||||
@ -261,7 +267,7 @@ class AstBuilderTest {
|
|||||||
MethodNode method = new MethodNode("public", new BaseType(TypeEnum.INT), false, "testMethod", blockMethod);
|
MethodNode method = new MethodNode("public", new BaseType(TypeEnum.INT), false, "testMethod", blockMethod);
|
||||||
method.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
method.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
||||||
|
|
||||||
ClassNode class1 = new ClassNode("public", "TestClass");
|
ClassNode class1 = new ClassNode("public", "ConstructorMethodCallParameters");
|
||||||
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
||||||
class1.addMember(constructor);
|
class1.addMember(constructor);
|
||||||
class1.addMember(method);
|
class1.addMember(method);
|
||||||
@ -269,14 +275,14 @@ class AstBuilderTest {
|
|||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/ConstructorMethodCallParameters.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "ConstructorMethodCallParameters.java");
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Char Test")
|
@DisplayName("Char Test")
|
||||||
public void charTest(){
|
public void charTest() {
|
||||||
BlockNode blockCon = new BlockNode();
|
BlockNode blockCon = new BlockNode();
|
||||||
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
||||||
memberAccess.addIdentifier("a");
|
memberAccess.addIdentifier("a");
|
||||||
@ -289,7 +295,7 @@ class AstBuilderTest {
|
|||||||
|
|
||||||
blockCon.addStatement(new AssignNode(assignable, expression));
|
blockCon.addStatement(new AssignNode(assignable, expression));
|
||||||
blockCon.addStatement(new ReturnNode(null));
|
blockCon.addStatement(new ReturnNode(null));
|
||||||
ConstructorNode constructor = new ConstructorNode("public", "TestClass", blockCon);
|
ConstructorNode constructor = new ConstructorNode("public", "Char", blockCon);
|
||||||
constructor.addParameter(new ParameterNode(new BaseType(TypeEnum.CHAR), "a"));
|
constructor.addParameter(new ParameterNode(new BaseType(TypeEnum.CHAR), "a"));
|
||||||
|
|
||||||
BlockNode blockMethod = new BlockNode();
|
BlockNode blockMethod = new BlockNode();
|
||||||
@ -297,7 +303,7 @@ class AstBuilderTest {
|
|||||||
MethodNode method = new MethodNode("public", new BaseType(TypeEnum.CHAR), false, "testMethod", blockMethod);
|
MethodNode method = new MethodNode("public", new BaseType(TypeEnum.CHAR), false, "testMethod", blockMethod);
|
||||||
method.addParameter(new ParameterNode(new BaseType(TypeEnum.CHAR), "a"));
|
method.addParameter(new ParameterNode(new BaseType(TypeEnum.CHAR), "a"));
|
||||||
|
|
||||||
ClassNode class1 = new ClassNode("public", "TestClass");
|
ClassNode class1 = new ClassNode("public", "Char");
|
||||||
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.CHAR), "a"));
|
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.CHAR), "a"));
|
||||||
class1.addMember(constructor);
|
class1.addMember(constructor);
|
||||||
class1.addMember(method);
|
class1.addMember(method);
|
||||||
@ -305,14 +311,14 @@ class AstBuilderTest {
|
|||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/Char.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "Char.java");
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Null Test")
|
@DisplayName("Null Test")
|
||||||
public void nullTest(){
|
public void nullTest() {
|
||||||
BlockNode blockCon = new BlockNode();
|
BlockNode blockCon = new BlockNode();
|
||||||
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
MemberAccessNode memberAccess = new MemberAccessNode(true);
|
||||||
memberAccess.addIdentifier("a");
|
memberAccess.addIdentifier("a");
|
||||||
@ -321,288 +327,82 @@ class AstBuilderTest {
|
|||||||
|
|
||||||
blockCon.addStatement(new AssignNode(assignable, new UnaryNode(new ValueNode(EnumValueNode.NULL_VALUE, "null"))));
|
blockCon.addStatement(new AssignNode(assignable, new UnaryNode(new ValueNode(EnumValueNode.NULL_VALUE, "null"))));
|
||||||
blockCon.addStatement(new ReturnNode(null));
|
blockCon.addStatement(new ReturnNode(null));
|
||||||
ConstructorNode constructor = new ConstructorNode("public", "TestClass", blockCon);
|
ConstructorNode constructor = new ConstructorNode("public", "Null", blockCon);
|
||||||
|
|
||||||
ClassNode class1 = new ClassNode("public", "TestClass");
|
ClassNode class1 = new ClassNode("public", "Null");
|
||||||
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
class1.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
||||||
class1.addMember(constructor);
|
class1.addMember(constructor);
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(class1);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/Null.java");
|
ASTNode actual = Helper.generateAST(directoryPath + "Null.java");
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Self Reference Test")
|
@DisplayName("Self Reference Test")
|
||||||
public void selfReferneceTest(){
|
public void selfReferneceTest() {
|
||||||
|
|
||||||
ClassNode testClass = Helper.generateEmptyClass("TestClass");
|
//assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
|
|
||||||
MemberNode testClassObject = new FieldNode(new AccessModifierNode("public"), new ReferenceType("TestClass"),"testClass");
|
|
||||||
|
|
||||||
BlockNode testMethod1Block = new BlockNode();
|
|
||||||
testMethod1Block.addStatement(new ReturnNode(new UnaryNode(new MethodCallNode(new TargetNode(true), "testMethod2"))));
|
|
||||||
MethodNode testMethod1 = new MethodNode("public", new BaseType(TypeEnum.INT), false, "testMethod1", testMethod1Block);
|
|
||||||
|
|
||||||
BlockNode testMethod2Block = new BlockNode();
|
|
||||||
testMethod2Block.addStatement(new ReturnNode(new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE,"1"))));
|
|
||||||
MethodNode testMethod2 = new MethodNode("public", new BaseType(TypeEnum.INT), false, "testMethod2", testMethod2Block);
|
|
||||||
|
|
||||||
BlockNode testMethod3Block = new BlockNode();
|
|
||||||
testMethod3Block.addStatement(new LocalVariableDeclarationNode(new ReferenceType("TestClass"),"testClass1", "=", new UnaryNode(new NewDeclarationNode("TestClass")))); // Assing einfach "=" ?
|
|
||||||
MemberAccessNode methodAccess = new MemberAccessNode(false);
|
|
||||||
methodAccess.addIdentifier("testClass1");
|
|
||||||
methodAccess.addIdentifier("testClass");
|
|
||||||
TargetNode methodTarget = new TargetNode(methodAccess);
|
|
||||||
testMethod3Block.addStatement(new ReturnNode(new UnaryNode(new MethodCallNode(methodTarget,"testMethod1"))));
|
|
||||||
MethodNode testMethod3 = new MethodNode("public", new BaseType(TypeEnum.INT), false, "testMethod3", testMethod3Block);
|
|
||||||
|
|
||||||
testClass.addMember(testClassObject);
|
|
||||||
testClass.addMember(testMethod1);
|
|
||||||
testClass.addMember(testMethod2);
|
|
||||||
testClass.addMember(testMethod3);
|
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
|
||||||
expected.addClass(testClass);
|
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/SelfReference.java");
|
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Variable Compare Test")
|
@DisplayName("Variable Compare Test")
|
||||||
public void variableCompareTest(){
|
public void variableCompareTest() {
|
||||||
ClassNode class1 = Helper.generateEmptyClass("TestClass");
|
|
||||||
UnaryNode trueValue = new UnaryNode(new ValueNode(EnumValueNode.BOOLEAN_VALUE,"true"));
|
|
||||||
UnaryNode falseValue = new UnaryNode(new ValueNode(EnumValueNode.BOOLEAN_VALUE,"false"));
|
|
||||||
|
|
||||||
BlockNode trueBlock = new BlockNode();
|
//assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
trueBlock.addStatement(new ReturnNode(trueValue));
|
|
||||||
MethodNode trueMethod = new MethodNode("public", new BaseType(TypeEnum.BOOL), false, "trueMethod", trueBlock);
|
|
||||||
|
|
||||||
BlockNode falseBlock = new BlockNode();
|
|
||||||
falseBlock.addStatement(new ReturnNode(falseValue));
|
|
||||||
MethodNode falseMethod = new MethodNode("public", new BaseType(TypeEnum.BOOL), false, "falseMethod", falseBlock);
|
|
||||||
|
|
||||||
BlockNode trueAndTrueBlock = new BlockNode();
|
|
||||||
trueAndTrueBlock.addStatement(new ReturnNode(new NonCalculationNode(trueValue, "&&", trueValue)));
|
|
||||||
MethodNode trueAndTrueMethod = new MethodNode("public", new BaseType(TypeEnum.BOOL), false, "trueAndTrueMethod", trueAndTrueBlock);
|
|
||||||
|
|
||||||
BlockNode trueAndFalseBlock = new BlockNode();
|
|
||||||
trueAndFalseBlock.addStatement(new ReturnNode(new NonCalculationNode(trueValue, "&&", falseValue)));
|
|
||||||
MethodNode trueAndFalseMethod = new MethodNode("public", new BaseType(TypeEnum.BOOL), false, "trueAndFalseMethod", trueAndFalseBlock);
|
|
||||||
|
|
||||||
BlockNode falseAndFalseBlock = new BlockNode();
|
|
||||||
falseAndFalseBlock.addStatement(new ReturnNode(new NonCalculationNode(falseValue, "&&", falseValue)));
|
|
||||||
MethodNode falseAndFalseMethod = new MethodNode("public", new BaseType(TypeEnum.BOOL), false, "falseAndFalseMethod", falseAndFalseBlock);
|
|
||||||
|
|
||||||
BlockNode trueOrTrueBlock = new BlockNode();
|
|
||||||
trueOrTrueBlock.addStatement(new ReturnNode(new NonCalculationNode(trueValue, "||", trueValue)));
|
|
||||||
MethodNode trueOrFalseMethod = new MethodNode("public", new BaseType(TypeEnum.BOOL), false, "trueOrTrueMethod", trueOrTrueBlock);
|
|
||||||
|
|
||||||
BlockNode falseOrFalseBlock = new BlockNode();
|
|
||||||
falseOrFalseBlock.addStatement(new ReturnNode(new NonCalculationNode(falseValue, "||", falseValue)));
|
|
||||||
MethodNode falseOrFalseMethod = new MethodNode("public", new BaseType(TypeEnum.BOOL), false, "falseOrFalseMethod", falseOrFalseBlock);
|
|
||||||
|
|
||||||
class1.addMember(trueMethod);
|
|
||||||
class1.addMember(falseMethod);
|
|
||||||
class1.addMember(trueAndTrueMethod);
|
|
||||||
class1.addMember(trueAndFalseMethod);
|
|
||||||
class1.addMember(falseAndFalseMethod);
|
|
||||||
class1.addMember(trueOrFalseMethod);
|
|
||||||
class1.addMember(falseOrFalseMethod);
|
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
|
||||||
expected.addClass(class1);
|
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/variableCompare.java");
|
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Variable Calculation Test")
|
@DisplayName("Variable Calculation Test")
|
||||||
public void variableCalculationTest(){
|
public void variableCalculationTest() {
|
||||||
ClassNode class1 = Helper.generateEmptyClass("TestClass");
|
|
||||||
|
|
||||||
BlockNode aPlusBBlock = new BlockNode();
|
//assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
aPlusBBlock.addStatement(new ReturnNode(new CalculationNode(new CalculationNode(new DotNode(new DotSubstractionNode("a"))), "+", new DotNode(new DotSubstractionNode("b")))));
|
|
||||||
MethodNode aPlusBMethod = new MethodNode("public", new BaseType(TypeEnum.INT), false, "aPlusB", aPlusBBlock);
|
|
||||||
aPlusBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
|
||||||
aPlusBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "b"));
|
|
||||||
|
|
||||||
BlockNode aMinusBBlock = new BlockNode();
|
|
||||||
aMinusBBlock.addStatement(new ReturnNode(new CalculationNode(new CalculationNode(new DotNode(new DotSubstractionNode("a"))), "-", new DotNode(new DotSubstractionNode("b")))));
|
|
||||||
MethodNode aMinusBMethod = new MethodNode("public", new BaseType(TypeEnum.INT), false, "aMinusB", aMinusBBlock);
|
|
||||||
aMinusBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
|
||||||
aMinusBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "b"));
|
|
||||||
|
|
||||||
BlockNode aTimeBBlock = new BlockNode();
|
|
||||||
aTimeBBlock.addStatement(new ReturnNode(new CalculationNode(new DotNode(new DotNode(new DotSubstractionNode("a")), "*", new DotSubstractionNode("b")))));
|
|
||||||
MethodNode aTimeBMethod = new MethodNode("public", new BaseType(TypeEnum.INT), false, "aTimeB", aTimeBBlock);
|
|
||||||
aTimeBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
|
||||||
aTimeBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "b"));
|
|
||||||
|
|
||||||
BlockNode aDivBBlock = new BlockNode();
|
|
||||||
aDivBBlock.addStatement(new ReturnNode(new CalculationNode(new DotNode(new DotNode(new DotSubstractionNode("a")), "/", new DotSubstractionNode("b")))));
|
|
||||||
MethodNode aDivBMethod = new MethodNode("public", new BaseType(TypeEnum.INT), false, "aDivB", aDivBBlock);
|
|
||||||
aDivBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
|
||||||
aDivBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "b"));
|
|
||||||
|
|
||||||
BlockNode complexCalcBlock = new BlockNode();
|
|
||||||
complexCalcBlock.addStatement(new ReturnNode(new CalculationNode(null, null, new DotNode(new DotNode(new DotNode(new DotNode(new DotSubstractionNode("a")), "*", new DotSubstractionNode("b")), "/", new DotSubstractionNode(new ValueNode(EnumValueNode.INT_VALUE, "1"))), "*", new DotSubstractionNode(new ValueNode(EnumValueNode.INT_VALUE, "3"))))));
|
|
||||||
MethodNode complexCalcMethod = new MethodNode("public", new BaseType(TypeEnum.INT), false, "complexCalc", complexCalcBlock);
|
|
||||||
complexCalcMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
|
||||||
complexCalcMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "b"));
|
|
||||||
|
|
||||||
BlockNode aSmallerBBlock = new BlockNode();
|
|
||||||
aSmallerBBlock.addStatement(new ReturnNode(new NonCalculationNode(new UnaryNode("a"), "<", new UnaryNode("b"))));
|
|
||||||
MethodNode aSmallerBMethod = new MethodNode("public", new BaseType(TypeEnum.BOOL), false, "aSmallerB", aSmallerBBlock);
|
|
||||||
aSmallerBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
|
||||||
aSmallerBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "b"));
|
|
||||||
|
|
||||||
BlockNode aGreaterBBlock = new BlockNode();
|
|
||||||
aGreaterBBlock.addStatement(new ReturnNode(new NonCalculationNode(new UnaryNode("a"), ">", new UnaryNode("b"))));
|
|
||||||
MethodNode aGreaterBMethod = new MethodNode("public", new BaseType(TypeEnum.BOOL), false, "aGreaterB", aGreaterBBlock);
|
|
||||||
aGreaterBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
|
||||||
aGreaterBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "b"));
|
|
||||||
|
|
||||||
BlockNode aEqualsBBlock = new BlockNode();
|
|
||||||
aEqualsBBlock.addStatement(new ReturnNode(new NonCalculationNode(new UnaryNode("a"), "==", new UnaryNode("b"))));
|
|
||||||
MethodNode aEqualsBMethod = new MethodNode("public", new BaseType(TypeEnum.BOOL), false, "aEqualsB", aEqualsBBlock);
|
|
||||||
aEqualsBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "a"));
|
|
||||||
aEqualsBMethod.addParameter(new ParameterNode(new BaseType(TypeEnum.INT), "b"));
|
|
||||||
|
|
||||||
class1.addMember(aPlusBMethod);
|
|
||||||
class1.addMember(aMinusBMethod);
|
|
||||||
class1.addMember(aTimeBMethod);
|
|
||||||
class1.addMember(aDivBMethod);
|
|
||||||
class1.addMember(complexCalcMethod);
|
|
||||||
class1.addMember(aSmallerBMethod);
|
|
||||||
class1.addMember(aGreaterBMethod);
|
|
||||||
class1.addMember(aEqualsBMethod);
|
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
|
||||||
expected.addClass(class1);
|
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/variableCalculation.java");
|
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Main Method Test")
|
@DisplayName("Main Method Test")
|
||||||
public void mainMethodTest(){
|
public void mainMethodTest() {
|
||||||
ClassNode class1 = Helper.generateEmptyClass("TestClass");
|
|
||||||
|
|
||||||
BlockNode block = new BlockNode();
|
//assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
block.addStatement(new ReturnNode(null));
|
|
||||||
|
|
||||||
class1.addMember(new MainMethodNode(block));
|
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
|
||||||
expected.addClass(class1);
|
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/MainMethod.java");
|
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("While Test")
|
@DisplayName("While Test")
|
||||||
public void whileTest(){
|
public void whileTest() {
|
||||||
NonCalculationNode condition = new NonCalculationNode(new UnaryNode("i"), ">", new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "0")));
|
|
||||||
|
|
||||||
BlockNode whileBlock = new BlockNode();
|
//assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
whileBlock.addStatement(new DecrementNode(CrementType.SUFFIX, new AssignableNode("i")));
|
|
||||||
|
|
||||||
WhileNode whileStatement = new WhileNode(condition, whileBlock);
|
|
||||||
|
|
||||||
BlockNode blockCon = new BlockNode();
|
|
||||||
blockCon.addStatement(new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "i", "=", new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "10"))));
|
|
||||||
blockCon.addStatement(whileStatement);
|
|
||||||
blockCon.addStatement(new ReturnNode(null));
|
|
||||||
ConstructorNode constructor = new ConstructorNode("public", "TestClass", blockCon);
|
|
||||||
|
|
||||||
ClassNode class1 = new ClassNode("public", "TestClass");
|
|
||||||
class1.addMember(constructor);
|
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
|
||||||
expected.addClass(class1);
|
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/While.java");
|
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Do While Test")
|
@DisplayName("Do While Test")
|
||||||
public void doWhileTest(){
|
public void doWhileTest() {
|
||||||
NonCalculationNode condition = new NonCalculationNode(new UnaryNode("i"), "<", new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "10")));
|
|
||||||
|
|
||||||
BlockNode whileBlock = new BlockNode();
|
//assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
whileBlock.addStatement(new IncrementNode(CrementType.SUFFIX, new AssignableNode("i")));
|
|
||||||
|
|
||||||
WhileNode whileStatement = new WhileNode(condition, whileBlock);
|
|
||||||
|
|
||||||
BlockNode blockDoWhile = new BlockNode();
|
|
||||||
blockDoWhile.addStatement(whileBlock);
|
|
||||||
blockDoWhile.addStatement(whileStatement);
|
|
||||||
|
|
||||||
BlockNode blockCon = new BlockNode();
|
|
||||||
blockCon.addStatement(new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "i", "=", new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "0"))));
|
|
||||||
blockCon.addStatement(blockDoWhile);
|
|
||||||
blockCon.addStatement(new ReturnNode(null));
|
|
||||||
ConstructorNode constructor = new ConstructorNode("public", "TestClass", blockCon);
|
|
||||||
|
|
||||||
ClassNode class1 = new ClassNode("public", "TestClass");
|
|
||||||
class1.addMember(constructor);
|
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
|
||||||
expected.addClass(class1);
|
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/DoWhile.java");
|
|
||||||
|
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("For Test")
|
@DisplayName("For Test")
|
||||||
public void forTest(){
|
public void forTest() {
|
||||||
LocalVariableDeclarationNode forDeclaration = new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "i", "=", new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "0")));
|
|
||||||
|
|
||||||
AssignableNode assignable = new AssignableNode("i");
|
//assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
IncrementNode increment = new IncrementNode(CrementType.SUFFIX, assignable);
|
}
|
||||||
|
|
||||||
LocalVariableDeclarationNode declaration = new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "a", null, null);
|
//Noch nicht speziell Increment nur zum Development Testen per Debug
|
||||||
|
@Test
|
||||||
BlockNode whileBlock = new BlockNode();
|
@DisplayName("Increment Test")
|
||||||
whileBlock.addStatement(declaration);
|
public void incrementTest() {
|
||||||
whileBlock.addStatement(increment);
|
ClassNode classNode = Helper.generateEmptyClass("Increment");
|
||||||
|
classNode.addMember(new FieldNode(new AccessModifierNode("public"), new BaseType(TypeEnum.INT), "a"));
|
||||||
WhileNode whileStatement = new WhileNode(new NonCalculationNode(new UnaryNode("i"), "<", new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "10"))), whileBlock);
|
|
||||||
|
|
||||||
BlockNode forStatement = new BlockNode();
|
|
||||||
forStatement.addStatement(forDeclaration);
|
|
||||||
forStatement.addStatement(whileStatement);
|
|
||||||
|
|
||||||
BlockNode blockCon = new BlockNode();
|
|
||||||
blockCon.addStatement(forStatement);
|
|
||||||
blockCon.addStatement(new ReturnNode(null));
|
|
||||||
ConstructorNode constructor = new ConstructorNode("public", "TestClass", blockCon);
|
|
||||||
|
|
||||||
ClassNode class1 = new ClassNode("public", "TestClass");
|
|
||||||
class1.addMember(constructor);
|
|
||||||
|
|
||||||
ProgramNode expected = new ProgramNode();
|
ProgramNode expected = new ProgramNode();
|
||||||
expected.addClass(class1);
|
expected.addClass(classNode);
|
||||||
|
|
||||||
ASTNode actual = Helper.generateAST("src/test/resources/input/javaCases/For.java");
|
|
||||||
|
|
||||||
|
ASTNode actual = Helper.generateAST(directoryPath + "Increment.java");
|
||||||
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -38,17 +38,14 @@ public class EndToTypedAstTest {
|
|||||||
|
|
||||||
CharStream codeCharStream = null;
|
CharStream codeCharStream = null;
|
||||||
try {
|
try {
|
||||||
codeCharStream = CharStreams.fromPath(Paths.get("src/test/resources/input/typedAstFeaturesTests/CorrectTest.java"));
|
codeCharStream = CharStreams.fromPath(Paths.get("src/test/resources/input/typedAstFeatureTests/CorrectTest.java"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
SimpleJavaLexer lexer = new SimpleJavaLexer(codeCharStream);
|
SimpleJavaLexer lexer = new SimpleJavaLexer(codeCharStream);
|
||||||
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
|
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
|
||||||
|
|
||||||
SimpleJavaParser parser = new SimpleJavaParser(tokenStream);
|
SimpleJavaParser parser = new SimpleJavaParser(tokenStream);
|
||||||
ParseTree parseTree = parser.program(); // parse the input
|
ParseTree parseTree = parser.program();
|
||||||
|
|
||||||
/* ------------------------- AST builder -> AST ------------------------- */
|
|
||||||
ASTBuilder astBuilder = new ASTBuilder();
|
ASTBuilder astBuilder = new ASTBuilder();
|
||||||
ProgramNode abstractSyntaxTree = (ProgramNode) astBuilder.visit(parseTree);
|
ProgramNode abstractSyntaxTree = (ProgramNode) astBuilder.visit(parseTree);
|
||||||
|
|
||||||
@ -115,7 +112,7 @@ public class EndToTypedAstTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void featureTest() {
|
public void featureTest() {
|
||||||
String directoryPath = "src/test/resources/input/typedAstFeaturesTests";
|
String directoryPath = "src/test/resources/input/typedAstFeatureTests";
|
||||||
File folder = new File(directoryPath);
|
File folder = new File(directoryPath);
|
||||||
if (folder.isDirectory()) {
|
if (folder.isDirectory()) {
|
||||||
File[] files = folder.listFiles((_, name) -> name.endsWith(".java"));
|
File[] files = folder.listFiles((_, name) -> name.endsWith(".java"));
|
||||||
|
@ -2,112 +2,4 @@ package semantic;
|
|||||||
|
|
||||||
public class SemanticTest {
|
public class SemanticTest {
|
||||||
|
|
||||||
|
}
|
||||||
public void test(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void test(int a, boolean b){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void test(boolean b, int a){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Test
|
|
||||||
// public void alreadyDeclaredLocalFieldVar() {
|
|
||||||
// ProgramNode programNode = new ProgramNode();
|
|
||||||
// List<ClassNode> classList = new ArrayList<>();
|
|
||||||
// AccessTypeNode accessTypeNode = new AccessTypeNode(EnumAccessTypeNode.PUBLIC);
|
|
||||||
// ClassNode classNode = new ClassNode(accessTypeNode, "testClass");
|
|
||||||
//
|
|
||||||
// SemanticAnalyzer semanticAnalyzer = new SemanticAnalyzer();
|
|
||||||
// ASTNode tast = semanticAnalyzer.generateTast(ast);
|
|
||||||
//
|
|
||||||
// MemberNode memberNode2 = new FieldNode(accessTypeNode, new BaseTypeNode(EnumTypeNode.INT), "testVar");
|
|
||||||
// classNode.members.add(memberNode2);
|
|
||||||
//
|
|
||||||
// classList.add(classNode);
|
|
||||||
// programNode.classes = classList;
|
|
||||||
//
|
|
||||||
// ASTNode typedAst = SemanticAnalyzer.generateTast(programNode);
|
|
||||||
//
|
|
||||||
// assertEquals(1, SemanticAnalyzer.errors.size());
|
|
||||||
// assertInstanceOf(AlreadyDeclaredException.class, SemanticAnalyzer.errors.getFirst());
|
|
||||||
// assertNull(typedAst);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void shouldWorkWithNoError() {
|
|
||||||
// ProgramNode programNode = new ProgramNode();
|
|
||||||
// List<ClassNode> classList = new ArrayList<>();
|
|
||||||
// AccessTypeNode accessTypeNode = new AccessTypeNode(EnumAccessTypeNode.PUBLIC);
|
|
||||||
// ClassNode classNode = new ClassNode(accessTypeNode, "testClass");
|
|
||||||
//
|
|
||||||
// SemanticAnalyzer semanticAnalyzer = new SemanticAnalyzer();
|
|
||||||
// ASTNode tast = semanticAnalyzer.generateTast(ast);
|
|
||||||
//
|
|
||||||
// assertEquals(semanticAnalyzer.errors.size(), 0);
|
|
||||||
// assertNotNull(tast);
|
|
||||||
//
|
|
||||||
// MemberNode memberNode3 = getMemberNode(accessTypeNode);
|
|
||||||
// classNode.members.add(memberNode3);
|
|
||||||
//
|
|
||||||
// classList.add(classNode);
|
|
||||||
// programNode.classes = classList;
|
|
||||||
//
|
|
||||||
// ASTNode typedAst = SemanticAnalyzer.generateTast(programNode);
|
|
||||||
//
|
|
||||||
// assertEquals(0, SemanticAnalyzer.errors.size());
|
|
||||||
// assertEquals(programNode, typedAst);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * This method is used to create a MemberNode representing a method.
|
|
||||||
// * It first creates a list of ParameterNodes and adds a ParameterNode to it.
|
|
||||||
// * Then, it creates a ParameterListNode using the list of ParameterNodes.
|
|
||||||
// * After that, it creates a list of StatementNodes and adds a StatementNode to it by calling the getStatementNode method.
|
|
||||||
// * Finally, it creates a MethodNode using the provided AccessTypeNode, a BaseTypeNode representing the return type of the method,
|
|
||||||
// * the method name, the ParameterListNode, and the list of StatementNodes, and returns this MethodNode.
|
|
||||||
// *
|
|
||||||
// * @param accessTypeNode The AccessTypeNode representing the access type of the method.
|
|
||||||
// * @return The created MemberNode representing the method.
|
|
||||||
// */
|
|
||||||
//private static MemberNode getMemberNode(AccessTypeNode accessTypeNode) {
|
|
||||||
// List<ParameterNode> parameterNodeList = new ArrayList<>();
|
|
||||||
// ParameterNode parameterNode1 = new ParameterNode(new BaseTypeNode(EnumTypeNode.INT), "param1");
|
|
||||||
// parameterNodeList.add(parameterNode1);
|
|
||||||
// ParameterListNode parameterListNode = new ParameterListNode(parameterNodeList);
|
|
||||||
//
|
|
||||||
// List<StatementNode> statementNodeList = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// StatementNode statementNode1 = getStatementNode();
|
|
||||||
// statementNodeList.add(statementNode1);
|
|
||||||
//
|
|
||||||
// return new MethodNode(accessTypeNode, new BaseTypeNode(EnumTypeNode.INT), "testVar2", parameterListNode, statementNodeList);
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * This method is used to create a StatementNode for an assignment operation.
|
|
||||||
// * It first creates two IdentifierExpressionNodes for 'this' and 'objectVar'.
|
|
||||||
// * Then, it creates a BinaryExpressionNode to represent the operation 'this.objectVar'.
|
|
||||||
// * After that, it creates a LiteralNode to represent the integer value 1.
|
|
||||||
// * Finally, it creates another BinaryExpressionNode to represent the assignment operation 'this.objectVar = 1',
|
|
||||||
// * and wraps this expression in an AssignmentStatementNode.
|
|
||||||
// *
|
|
||||||
// * @return The created AssignmentStatementNode representing the assignment operation 'this.objectVar = 1'.
|
|
||||||
// */
|
|
||||||
//private static StatementNode getStatementNode() {
|
|
||||||
// ExpressionNode expressionNodeObjectVariableLeft = new IdentifierExpressionNode("this");
|
|
||||||
// ExpressionNode expressionNodeObjectVariableRight = new IdentifierExpressionNode("objectVar");
|
|
||||||
//
|
|
||||||
// ExpressionNode expressionNodeLeft = new BinaryExpressionNode(expressionNodeObjectVariableLeft, expressionNodeObjectVariableRight, ExpresssionOperator.DOT);
|
|
||||||
//
|
|
||||||
// ExpressionNode expressionNodeRight = new LiteralNode(1);
|
|
||||||
//
|
|
||||||
// BinaryExpressionNode expressionNode = new BinaryExpressionNode(expressionNodeLeft, expressionNodeRight, ExpresssionOperator.ASSIGNMENT);
|
|
||||||
//
|
|
||||||
// return new AssignmentStatementNode(expressionNode);
|
|
||||||
//}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
public class CombinedExample {
|
|
||||||
int number;
|
|
||||||
boolean flag;
|
|
||||||
char letter;
|
|
||||||
|
|
||||||
public CombinedExample(int number, boolean flag, char letter) {
|
|
||||||
this.number = number;
|
|
||||||
this.flag = flag;
|
|
||||||
this.letter = letter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void displayValues() {
|
|
||||||
System.out.println("Number: " + number);
|
|
||||||
System.out.println("Flag: " + flag);
|
|
||||||
System.out.println("Letter: " + letter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
CombinedExample obj = new CombinedExample(10, true, 'X');
|
|
||||||
obj.displayValues();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
public class CompilerInput {
|
|
||||||
|
|
||||||
public int a;
|
|
||||||
|
|
||||||
public static int testMethod(char x){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Test {
|
|
||||||
|
|
||||||
public static int testMethod(char x, int a){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
public class MoreFeaturesClassExample {
|
|
||||||
int hallo;
|
|
||||||
private class Inner {
|
|
||||||
int hallo2;
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,7 +4,7 @@ public class AllFeaturesClassExample {
|
|||||||
char c;
|
char c;
|
||||||
|
|
||||||
// Konstruktor
|
// Konstruktor
|
||||||
AllFeaturesClassExample(int a, boolean b, char c) {
|
public AllFeaturesClassExample(int a, boolean b, char c) {
|
||||||
this.a = a;
|
this.a = a;
|
||||||
this.b = b;
|
this.b = b;
|
||||||
this.c = c;
|
this.c = c;
|
||||||
@ -14,47 +14,54 @@ public class AllFeaturesClassExample {
|
|||||||
void controlStructures() {
|
void controlStructures() {
|
||||||
// if-else Anweisung
|
// if-else Anweisung
|
||||||
if (a > 10) {
|
if (a > 10) {
|
||||||
// System.out.println("a ist größer als 10");
|
|
||||||
} else {
|
} else {
|
||||||
// System.out.println("a ist nicht größer als 10");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// while Schleife
|
// while Schleife
|
||||||
while (a > 0) {
|
while (a > 0) {
|
||||||
// System.out.println("a ist " + a);
|
|
||||||
a--;
|
a--;
|
||||||
}
|
}
|
||||||
|
int c = 0;
|
||||||
// for Schleife
|
// for Schleife
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
// System.out.println("for Schleife Iteration: " + i);
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Methode zur Arbeit mit logischen Operatoren
|
// Methode zur Arbeit mit logischen Operatoren
|
||||||
void logicalOperations() {
|
void logicalOperations() {
|
||||||
// Logische UND-Operation
|
// Logische UND-Operation
|
||||||
if (b && a > 5) {
|
if (b && a > 5) {
|
||||||
// System.out.println("a ist größer als 5 und b ist wahr");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logische ODER-Operation
|
// Logische ODER-Operation
|
||||||
if (b || a < 5) {
|
if (b || a < 5) {
|
||||||
// System.out.println("b ist wahr oder a ist kleiner als 5");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mathOperations() {
|
int add(int a, int b) {
|
||||||
// Addition
|
return a + b;
|
||||||
int sum = a + 5;
|
}
|
||||||
// Subtraktion
|
|
||||||
int difference = a - 5;
|
int subtract(int a, int b) {
|
||||||
// Multiplikation
|
return a - b;
|
||||||
int product = a * 5;
|
}
|
||||||
// Division
|
|
||||||
int quotient = a / 5;
|
int multiply(int a, int b) {
|
||||||
// Modulo
|
return a * b;
|
||||||
int remainder = a % 5;
|
}
|
||||||
|
|
||||||
|
int divide(int a, int b) {
|
||||||
|
return a / b;
|
||||||
|
}
|
||||||
|
|
||||||
|
int modulo(int a, int b) {
|
||||||
|
return a % b;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean greaterThan(int a, int b) {
|
||||||
|
return a > b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +0,0 @@
|
|||||||
class TestClass {
|
|
||||||
public TestClass(int a, int b){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
class TestClass{
|
|
||||||
|
|
||||||
private int a;
|
|
||||||
|
|
||||||
public TestClass(int a){
|
|
||||||
this.a = a;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
class TestClass {}
|
|
@ -1,5 +0,0 @@
|
|||||||
public class TestClass {
|
|
||||||
public TestClass() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
public class TestClass {
|
|
||||||
int a;
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
public class TestClass {
|
|
||||||
public int a;
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
class TestClass1 {}
|
|
||||||
|
|
||||||
class TestClass2{}
|
|
@ -1,8 +0,0 @@
|
|||||||
class TestClass{
|
|
||||||
|
|
||||||
int a;
|
|
||||||
|
|
||||||
public TestClass(){
|
|
||||||
this.a = null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
class TestClass{
|
|
||||||
|
|
||||||
TestClass testClass;
|
|
||||||
|
|
||||||
int testMethod1() {
|
|
||||||
return this.testMethod2();
|
|
||||||
}
|
|
||||||
|
|
||||||
int testMethod2() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int testMethod3(){
|
|
||||||
TestClass testClass1 = new TestClass();
|
|
||||||
return testClass1.testClass.testMethod1();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
class TestClass{
|
|
||||||
|
|
||||||
TestClasd (){
|
|
||||||
switch (a){
|
|
||||||
case 1:
|
|
||||||
b = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
class TestClass{
|
|
||||||
void test(){}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
class TestClass{
|
|
||||||
|
|
||||||
boolean trueMethod() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean falseMethod(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean trueAndTrueMethod(){
|
|
||||||
return true && true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean trueAndFalseMethod(){
|
|
||||||
return true && false;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean falseAndFalseMethod(){
|
|
||||||
return false && false;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean trueOrTrueMethod(){
|
|
||||||
return true || true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean falseOrFalseMethod(){
|
|
||||||
return false || false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +1,8 @@
|
|||||||
class TestClass{
|
class Char {
|
||||||
|
|
||||||
char a;
|
char a;
|
||||||
|
|
||||||
public TestClass(char a){
|
public Char(char a){
|
||||||
this.a = testMethod(a);
|
this.a = testMethod(a);
|
||||||
}
|
}
|
||||||
|
|
@ -3,6 +3,6 @@
|
|||||||
Mutliple Line Comment. Ignore
|
Mutliple Line Comment. Ignore
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class TestClass{
|
class Comments{
|
||||||
private int a; // Ignore
|
private int a; // Ignore
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
class TestClass {
|
public class ConstructorMethodCall {
|
||||||
|
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
public TestClass(){
|
public ConstructorMethodCall(){
|
||||||
this.a = testMethod();
|
this.a = testMethod();
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
class TestClass {
|
class ConstructorMethodCallParameters {
|
||||||
|
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
public TestClass(int a){
|
public ConstructorMethodCallParameters(int a){
|
||||||
this.a = testMethod(a);
|
this.a = testMethod(a);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
class ConstructorParameter {
|
||||||
|
public ConstructorParameter(int a, int b){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
class ConstructorThisDot {
|
||||||
|
|
||||||
|
private int a;
|
||||||
|
|
||||||
|
public ConstructorThisDot(int a){
|
||||||
|
this.a = a;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
class TestClass{
|
class DoWhile{
|
||||||
|
|
||||||
public TestClass(){
|
public DoWhile(){
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
do{
|
do{
|
@ -0,0 +1 @@
|
|||||||
|
class EmptyClass {}
|
@ -0,0 +1,5 @@
|
|||||||
|
public class EmptyClassWithConstructor {
|
||||||
|
public EmptyClassWithConstructor() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
3
src/test/resources/input/singleFeatureTests/Field.java
Normal file
3
src/test/resources/input/singleFeatureTests/Field.java
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class Field {
|
||||||
|
int a;
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
public class FieldWithAccessModifier {
|
||||||
|
public int a;
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
class TestClass{
|
class For{
|
||||||
|
|
||||||
public TestClass(){
|
public For(){
|
||||||
for(int i = 0; i < 10; i++){
|
for(int i = 0; i < 10; i++){
|
||||||
int a;
|
int a;
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ public class Increment {
|
|||||||
public void increment(int p) {
|
public void increment(int p) {
|
||||||
test = p++;
|
test = p++;
|
||||||
|
|
||||||
for(int i = 1; i<=10, i++) {
|
for(int i = 1; i<=10; i++) {
|
||||||
int a = 5;
|
int a = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
class TestClass{
|
class MainMethod{
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
}
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
class MultipleClasses {}
|
||||||
|
|
||||||
|
class TestClass2{}
|
8
src/test/resources/input/singleFeatureTests/Null.java
Normal file
8
src/test/resources/input/singleFeatureTests/Null.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
class Null{
|
||||||
|
|
||||||
|
int a;
|
||||||
|
|
||||||
|
public Null(){
|
||||||
|
// this.a = null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
class SelfReference{
|
||||||
|
|
||||||
|
SelfReference selfReference;
|
||||||
|
|
||||||
|
int testMethod1() {
|
||||||
|
return this.testMethod2();
|
||||||
|
}
|
||||||
|
|
||||||
|
int testMethod2() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int testMehtod3(){
|
||||||
|
SelfReference selfReference1 = new SelfReference();
|
||||||
|
return selfReference1.selfReference.testMethod1();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
class TestClass{
|
class ThisDot {
|
||||||
|
|
||||||
public int a;
|
public int a;
|
||||||
|
|
||||||
public TestClass() {
|
public ThisDot() {
|
||||||
this.a = 1;
|
this.a = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
class TestClass{
|
class VariableCalculationTest{
|
||||||
|
|
||||||
int aPlusB(int a, int b){
|
int aPlusB(int a, int b){
|
||||||
return a + b;
|
return a + b;
|
||||||
@ -16,8 +16,8 @@ class TestClass{
|
|||||||
return a / b;
|
return a / b;
|
||||||
}
|
}
|
||||||
|
|
||||||
int complexCalc (int a, int b){
|
int colmplexCalc (int a, int b){
|
||||||
return a * b / 1 * 3;
|
return a * (b / 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean aSmallerB (int a, int b){
|
boolean aSmallerB (int a, int b){
|
@ -0,0 +1,30 @@
|
|||||||
|
class VariableCompareTest{
|
||||||
|
|
||||||
|
boolean trueMethod(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean falseMethod(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean trueAndTrue(){
|
||||||
|
return trueMethod() && trueMethod();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean trueAndFalse(){
|
||||||
|
return trueMethod() && falseMethod();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean falseAndFalse(){
|
||||||
|
return falseMethod() && falseMethod();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean trueOrFalse(){
|
||||||
|
return trueMethod() || falseMethod();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean falseOrFalse(){
|
||||||
|
return falseMethod() || falseMethod();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
class VoidMethod{
|
||||||
|
void test(){}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
class TestClass{
|
class While{
|
||||||
|
|
||||||
public TestClass(){
|
public While(){
|
||||||
int i = 10;
|
int i = 10;
|
||||||
|
|
||||||
while ( i > 0){
|
while ( i > 0){
|
@ -1,12 +0,0 @@
|
|||||||
// @expected: AlreadyDeclaredException
|
|
||||||
public class AllFeaturesClassExample {
|
|
||||||
|
|
||||||
public AllFeaturesClassExample(boolean b){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public AllFeaturesClassExample(boolean b){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
// @expected: TypeMismatchException
|
|
||||||
public class AllFeaturesClassExample {
|
|
||||||
int x;
|
|
||||||
|
|
||||||
public boolean test(boolean x){
|
|
||||||
return this.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
public class Test {
|
public class CallMethodFromObjekt {
|
||||||
|
|
||||||
public int firstInt;
|
public int firstInt;
|
||||||
public Car ca;
|
public Car ca;
|
||||||
@ -7,7 +7,6 @@ public class Test {
|
|||||||
return ca.getSpeed();
|
return ca.getSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Car{
|
public class Car{
|
||||||
|
|
||||||
@ -17,4 +16,5 @@ public class Car{
|
|||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
public class Test{
|
public class CorrectMemberAccess{
|
||||||
|
|
||||||
public Car c;
|
public Car c;
|
||||||
|
|
||||||
@ -6,9 +6,8 @@ public class Test{
|
|||||||
return c.getSpeed();
|
return c.getSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Car{
|
private class Car{
|
||||||
|
|
||||||
private int speed;
|
private int speed;
|
||||||
|
|
||||||
@ -16,4 +15,5 @@ public class Car{
|
|||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
public class Test{
|
public class CorrectMethodParameter{
|
||||||
|
|
||||||
public void test(int x){
|
public void test(int x){
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
public class Test{
|
public class CorrectNonCalcTest{
|
||||||
|
|
||||||
public void test(boolean b){
|
public void test(boolean b){
|
||||||
if(b == true){
|
if(b == true){
|
@ -1,4 +1,4 @@
|
|||||||
public class Example {
|
public class CorrectReturnType {
|
||||||
|
|
||||||
public static int testMethod(int x){
|
public static int testMethod(int x){
|
||||||
return x;
|
return x;
|
@ -0,0 +1,21 @@
|
|||||||
|
public class CorrectTest {
|
||||||
|
int a;
|
||||||
|
boolean b;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
public void controlStructures(int adf, boolean bool) {
|
||||||
|
if (a > (10 + 8)) {
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
while (a > adf) {
|
||||||
|
a--;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
public class AllFeaturesClassExample {
|
public class FullTest {
|
||||||
int a;
|
int a;
|
||||||
boolean b;
|
boolean b;
|
||||||
char c;
|
char c;
|
||||||
@ -18,7 +18,7 @@ public class AllFeaturesClassExample {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// void logicalOperations() {
|
// void logicalOperations() {
|
||||||
// // Logische UND-Operation
|
// // Logische UND-Operation
|
||||||
@ -62,3 +62,4 @@ public class Car {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
public class Car{
|
public class IfExpressionBoolean{
|
||||||
|
|
||||||
public void test(boolean boo){
|
public void test(boolean boo){
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
public class Car{
|
public class IfReturn{
|
||||||
|
|
||||||
public int getSpeed(boolean bool, int a, int b){
|
public int getSpeed(boolean bool, int a, int b){
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
public class Test{
|
public class SelectRightOverloadedMethod{
|
||||||
|
|
||||||
public int i;
|
public int i;
|
||||||
public boolean b;
|
public boolean b;
|
@ -1,4 +1,4 @@
|
|||||||
public class Car{
|
public class ThisDotMethod{
|
||||||
|
|
||||||
private int speed;
|
private int speed;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
public class Car{
|
public class VoidReturnTypeIF{
|
||||||
|
|
||||||
private int speed;
|
private int speed;
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
public class AllFeaturesClassExample {
|
|
||||||
|
|
||||||
public AllFeaturesClassExample(boolean b){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public AllFeaturesClassExample(boolean b, int a){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user