Search in sources :

Example 1 with BlockStmtContext

use of kalang.antlr.KalangParser.BlockStmtContext in project kalang by kasonyang.

the class AstBuilder method requireBlock.

private BlockStmt requireBlock(ParserRuleContext stmt) {
    if (stmt instanceof BlockStmtContext) {
        return (BlockStmt) visit(stmt);
    } else {
        BlockStmt bs = newBlock();
        bs.statements.add((Statement) visit(stmt));
        popBlock();
        return bs;
    }
}
Also used : BlockStmtContext(kalang.antlr.KalangParser.BlockStmtContext) BlockStmt(kalang.ast.BlockStmt)

Aggregations

BlockStmtContext (kalang.antlr.KalangParser.BlockStmtContext)1 BlockStmt (kalang.ast.BlockStmt)1