use of org.apache.sysml.parser.pydml.PydmlParser.ForStatementContext in project incubator-systemml by apache.
the class PydmlSyntacticValidator method exitForStatement.
@Override
public void exitForStatement(ForStatementContext ctx) {
ForStatement forStmt = new ForStatement();
int line = ctx.start.getLine();
int col = ctx.start.getCharPositionInLine();
DataIdentifier iterVar = new DataIdentifier(ctx.iterVar.getText());
HashMap<String, String> parForParamValues = null;
//1/-1
Expression incrementExpr = null;
if (ctx.iterPred.info.increment != null) {
incrementExpr = ctx.iterPred.info.increment;
}
IterablePredicate predicate = new IterablePredicate(iterVar, ctx.iterPred.info.from, ctx.iterPred.info.to, incrementExpr, parForParamValues, currentFile, line, col, line, col);
forStmt.setPredicate(predicate);
if (ctx.body.size() > 0) {
for (StatementContext stmtCtx : ctx.body) {
forStmt.addStatementBlock(getStatementBlock(stmtCtx.info.stmt));
}
forStmt.mergeStatementBlocks();
}
ctx.info.stmt = forStmt;
setFileLineColumn(ctx.info.stmt, ctx);
}
Aggregations