use of org.apache.sysml.parser.dml.DmlParser.IfStatementContext in project incubator-systemml by apache.
the class DmlSyntacticValidator method exitIfStatement.
@Override
public void exitIfStatement(IfStatementContext ctx) {
IfStatement ifStmt = new IfStatement();
ConditionalPredicate predicate = new ConditionalPredicate(ctx.predicate.info.expr);
ifStmt.setConditionalPredicate(predicate);
String fileName = currentFile;
int line = ctx.start.getLine();
int col = ctx.start.getCharPositionInLine();
ifStmt.setAllPositions(fileName, line, col, line, col);
if (ctx.ifBody.size() > 0) {
for (StatementContext stmtCtx : ctx.ifBody) {
ifStmt.addStatementBlockIfBody(getStatementBlock(stmtCtx.info.stmt));
}
ifStmt.mergeStatementBlocksIfBody();
}
if (ctx.elseBody.size() > 0) {
for (StatementContext stmtCtx : ctx.elseBody) {
ifStmt.addStatementBlockElseBody(getStatementBlock(stmtCtx.info.stmt));
}
ifStmt.mergeStatementBlocksElseBody();
}
ctx.info.stmt = ifStmt;
setFileLineColumn(ctx.info.stmt, ctx);
}
Aggregations