Search in sources :

Example 1 with WhileStatementContext

use of org.apache.sysml.parser.pydml.PydmlParser.WhileStatementContext in project incubator-systemml by apache.

the class PydmlSyntacticValidator method exitWhileStatement.

@Override
public void exitWhileStatement(WhileStatementContext ctx) {
    WhileStatement whileStmt = new WhileStatement();
    ConditionalPredicate predicate = new ConditionalPredicate(ctx.predicate.info.expr);
    whileStmt.setPredicate(predicate);
    int line = ctx.start.getLine();
    int col = ctx.start.getCharPositionInLine();
    whileStmt.setAllPositions(currentFile, line, col, line, col);
    if (ctx.body.size() > 0) {
        for (StatementContext stmtCtx : ctx.body) {
            whileStmt.addStatementBlock(getStatementBlock(stmtCtx.info.stmt));
        }
        whileStmt.mergeStatementBlocks();
    }
    ctx.info.stmt = whileStmt;
    setFileLineColumn(ctx.info.stmt, ctx);
}
Also used : WhileStatement(org.apache.sysml.parser.WhileStatement) ConditionalPredicate(org.apache.sysml.parser.ConditionalPredicate) FunctionStatementContext(org.apache.sysml.parser.pydml.PydmlParser.FunctionStatementContext) ImportStatementContext(org.apache.sysml.parser.pydml.PydmlParser.ImportStatementContext) AssignmentStatementContext(org.apache.sysml.parser.pydml.PydmlParser.AssignmentStatementContext) PathStatementContext(org.apache.sysml.parser.pydml.PydmlParser.PathStatementContext) FunctionCallMultiAssignmentStatementContext(org.apache.sysml.parser.pydml.PydmlParser.FunctionCallMultiAssignmentStatementContext) IfStatementContext(org.apache.sysml.parser.pydml.PydmlParser.IfStatementContext) IfdefAssignmentStatementContext(org.apache.sysml.parser.pydml.PydmlParser.IfdefAssignmentStatementContext) ForStatementContext(org.apache.sysml.parser.pydml.PydmlParser.ForStatementContext) StatementContext(org.apache.sysml.parser.pydml.PydmlParser.StatementContext) ParForStatementContext(org.apache.sysml.parser.pydml.PydmlParser.ParForStatementContext) FunctionCallAssignmentStatementContext(org.apache.sysml.parser.pydml.PydmlParser.FunctionCallAssignmentStatementContext) WhileStatementContext(org.apache.sysml.parser.pydml.PydmlParser.WhileStatementContext)

Aggregations

ConditionalPredicate (org.apache.sysml.parser.ConditionalPredicate)1 WhileStatement (org.apache.sysml.parser.WhileStatement)1 AssignmentStatementContext (org.apache.sysml.parser.pydml.PydmlParser.AssignmentStatementContext)1 ForStatementContext (org.apache.sysml.parser.pydml.PydmlParser.ForStatementContext)1 FunctionCallAssignmentStatementContext (org.apache.sysml.parser.pydml.PydmlParser.FunctionCallAssignmentStatementContext)1 FunctionCallMultiAssignmentStatementContext (org.apache.sysml.parser.pydml.PydmlParser.FunctionCallMultiAssignmentStatementContext)1 FunctionStatementContext (org.apache.sysml.parser.pydml.PydmlParser.FunctionStatementContext)1 IfStatementContext (org.apache.sysml.parser.pydml.PydmlParser.IfStatementContext)1 IfdefAssignmentStatementContext (org.apache.sysml.parser.pydml.PydmlParser.IfdefAssignmentStatementContext)1 ImportStatementContext (org.apache.sysml.parser.pydml.PydmlParser.ImportStatementContext)1 ParForStatementContext (org.apache.sysml.parser.pydml.PydmlParser.ParForStatementContext)1 PathStatementContext (org.apache.sysml.parser.pydml.PydmlParser.PathStatementContext)1 StatementContext (org.apache.sysml.parser.pydml.PydmlParser.StatementContext)1 WhileStatementContext (org.apache.sysml.parser.pydml.PydmlParser.WhileStatementContext)1