Added some basic handling of package declarations.

This commit is contained in:
Jakob Herrmann 2016-12-15 15:01:57 +01:00
parent b0a6585252
commit e1d68291c9

View File

@ -4,12 +4,21 @@ import de.dhbwstuttgart.syntaxtree.*;
public class CompilationUnitEvaluator extends Java8BaseListener{
@Override
public void enterCompilationUnit(Java8Parser.CompilationUnitContext ctx) {
System.out.println("Entering compilationUnit...");
System.out.println("SourceFile(");
}
@Override
public void exitCompilationUnit(Java8Parser.CompilationUnitContext ctx) {
System.out.println("sourceFile(");
System.out.println(ctx.packageDeclaration().Identifier());
System.out.println(")");
}
@Override
public void enterPackageDeclaration(Java8Parser.PackageDeclarationContext ctx) {
System.out.println("package(");
}
@Override
public void exitPackageDeclaration(Java8Parser.PackageDeclarationContext ctx) {
System.out.println(ctx.Identifier());
System.out.println(")");
}
}