Move the SCOL for var_assigns and var_decl to the statement rule

This commit is contained in:
Marvin Kaiser
2020-01-14 10:39:46 +01:00
parent f6818b6983
commit 1980e1ba8c
2 changed files with 17 additions and 6 deletions

View File

@@ -23,12 +23,20 @@ public class ContextAnalysis extends KlangBaseVisitor<Node> {
return new Program(funcs, expression);
}
@Override
public Node visitStatement(KlangParser.StatementContext ctx) {
// The first child is the proper context we need to visit
// The second child is either null or just a SCOL!
return this.visit(ctx.getChild(0));
}
@Override
public Node visitBraced_block(KlangParser.Braced_blockContext ctx) {
Statement[] statements = new Statement[ctx.statement().size()];
for (int i = 0; i < ctx.statement().size(); i++) {
Node currentStatement = this.visit(ctx.statement(i));
var stmtCtx = ctx.statement(i);
Node currentStatement = this.visit(stmtCtx);
statements[i] = (Statement) currentStatement;
}