Code: Select all
void add_script(const char *src)
{
debugf(src);
mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0);
if (lex == NULL) {
debugf("MPY ** MemoryError: lexer could not allocate **");
return;
}
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0)
{
qstr source_name = lex->source_name;
mp_parse_tree_t parse_tree = mp_parse(lex, MP_PARSE_FILE_INPUT);
mp_obj_t module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, true);
mp_call_function_0(module_fun);
nlr_pop();
} else {
// uncaught exception
debugf("MPY ** Uncaught Exception **");
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
}
}
Is there anywhere else I should be looking? I know the scripts are sound because they were each tested individually before trying to load all of them.