use of org.apache.sysml.parser.pydml.PydmlParser.StrictParameterizedExpressionContext in project incubator-systemml by apache.
the class PydmlSyntacticValidator method exitParForStatement.
@Override
public void exitParForStatement(ParForStatementContext ctx) {
ParForStatement parForStmt = new ParForStatement();
DataIdentifier iterVar = new DataIdentifier(ctx.iterVar.getText());
HashMap<String, String> parForParamValues = new HashMap<>();
if (ctx.parForParams != null && ctx.parForParams.size() > 0) {
for (StrictParameterizedExpressionContext parForParamCtx : ctx.parForParams) {
String paramVal = parForParamCtx.paramVal.getText();
if (argVals.containsKey(paramVal))
paramVal = argVals.get(paramVal);
parForParamValues.put(parForParamCtx.paramName.getText(), paramVal);
}
}
// 1/-1
Expression incrementExpr = null;
if (ctx.iterPred.info.increment != null) {
incrementExpr = ctx.iterPred.info.increment;
}
IterablePredicate predicate = new IterablePredicate(ctx, iterVar, ctx.iterPred.info.from, ctx.iterPred.info.to, incrementExpr, parForParamValues, currentFile);
parForStmt.setPredicate(predicate);
if (ctx.body.size() > 0) {
for (StatementContext stmtCtx : ctx.body) {
parForStmt.addStatementBlock(getStatementBlock(stmtCtx.info.stmt));
}
parForStmt.mergeStatementBlocks();
}
ctx.info.stmt = parForStmt;
}
use of org.apache.sysml.parser.pydml.PydmlParser.StrictParameterizedExpressionContext in project systemml by apache.
the class PydmlSyntacticValidator method exitParForStatement.
@Override
public void exitParForStatement(ParForStatementContext ctx) {
ParForStatement parForStmt = new ParForStatement();
DataIdentifier iterVar = new DataIdentifier(ctx.iterVar.getText());
HashMap<String, String> parForParamValues = new HashMap<>();
if (ctx.parForParams != null && ctx.parForParams.size() > 0) {
for (StrictParameterizedExpressionContext parForParamCtx : ctx.parForParams) {
String paramVal = parForParamCtx.paramVal.getText();
if (argVals.containsKey(paramVal))
paramVal = argVals.get(paramVal);
parForParamValues.put(parForParamCtx.paramName.getText(), paramVal);
}
}
// 1/-1
Expression incrementExpr = null;
if (ctx.iterPred.info.increment != null) {
incrementExpr = ctx.iterPred.info.increment;
}
IterablePredicate predicate = new IterablePredicate(ctx, iterVar, ctx.iterPred.info.from, ctx.iterPred.info.to, incrementExpr, parForParamValues, currentFile);
parForStmt.setPredicate(predicate);
if (ctx.body.size() > 0) {
for (StatementContext stmtCtx : ctx.body) {
parForStmt.addStatementBlock(getStatementBlock(stmtCtx.info.stmt));
}
parForStmt.mergeStatementBlocks();
}
ctx.info.stmt = parForStmt;
}
Aggregations