begin/end block-scope iterate

This commit is contained in:
John Kerl 2016-10-03 18:47:09 -04:00
parent 4ed8e1b5c5
commit 0d9ea319b8
4 changed files with 6 additions and 5 deletions

View file

@ -496,7 +496,7 @@ static sllv_t* mapper_put_or_filter_process(lrec_t* pinrec, context_t* pctx, voi
};
string_array_free(pregex_captures);
mlr_dsl_cst_handle_base_statement_list(pstate->pcst->pbegin_statements, &variables, &cst_outputs);
mlr_dsl_cst_handle_statement_block(pstate->pcst->pbegin_statements, &variables, &cst_outputs);
pstate->at_begin = FALSE;
}
@ -523,7 +523,7 @@ static sllv_t* mapper_put_or_filter_process(lrec_t* pinrec, context_t* pctx, voi
.pwriter_opts = pstate->pwriter_opts,
};
mlr_dsl_cst_handle_base_statement_list(pstate->pcst->pend_statements, &variables, &cst_outputs);
mlr_dsl_cst_handle_statement_block(pstate->pcst->pend_statements, &variables, &cst_outputs);
string_array_free(pregex_captures);
sllv_append(poutrecs, NULL);
@ -555,7 +555,7 @@ static sllv_t* mapper_put_or_filter_process(lrec_t* pinrec, context_t* pctx, voi
.pwriter_opts = pstate->pwriter_opts,
};
mlr_dsl_cst_handle_base_statement_list(pstate->pcst->pmain_statements, &variables, &cst_outputs);
mlr_dsl_cst_handle_statement_block(pstate->pcst->pmain_statements, &variables, &cst_outputs);
if (should_emit_rec && !pstate->put_output_disabled) {
// Write the output fields from the typed overlay back to the lrec.

View file

@ -264,7 +264,7 @@ void mlr_dsl_cst_free(mlr_dsl_cst_t* pcst);
void mlr_dsl_cst_statement_free(mlr_dsl_cst_statement_t* pstatement);
// Top-level entry point, e.g. from mapper_put.
void mlr_dsl_cst_handle_base_statement_list(
void mlr_dsl_cst_handle_statement_block(
sllv_t* pcst_statements, // block bodies for begin, main, end; cond, if, for, while
variables_t* pvars,
cst_outputs_t* pcst_outputs);

View file

@ -1962,7 +1962,7 @@ static void cst_statement_vararg_free(mlr_dsl_cst_statement_vararg_t* pvararg) {
// xxx copy to ..._for_filter
// xxx rename to ..._for_put
void mlr_dsl_cst_handle_base_statement_list(
void mlr_dsl_cst_handle_statement_block(
sllv_t* pcst_statements,
variables_t* pvars,
cst_outputs_t* pcst_outputs)

View file

@ -26,6 +26,7 @@ FUNCTIONALITY FOR 4.6.0:
k all else -> main-statements list
k sllv_pop/append to make it quick
k cst_pre_analyze_t struct or some such?
* begin/end -> statement lists, and UT the lexical scoping.
? ctor-0 frindex field @ mlr_dsl_ast_node_t?
o 2nd AST pass: analyze each for max depth: local def, write, read. adapt existing lmhsv/resolve logic.
o 3rd AST pass: rewrite localvar names w/ frame-relative indices