summaryrefslogtreecommitdiffstatshomepage
path: root/stm
diff options
context:
space:
mode:
Diffstat (limited to 'stm')
-rw-r--r--stm/lexerfatfs.c2
-rw-r--r--stm/main.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/stm/lexerfatfs.c b/stm/lexerfatfs.c
index bf82349f35..026173db25 100644
--- a/stm/lexerfatfs.c
+++ b/stm/lexerfatfs.c
@@ -49,7 +49,7 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
f_read(&fb->fp, fb->buf, sizeof(fb->buf), &n);
fb->len = n;
fb->pos = 0;
- return mp_lexer_new(filename, fb, (mp_lexer_stream_next_char_t)file_buf_next_char, (mp_lexer_stream_close_t)file_buf_close);
+ return mp_lexer_new(qstr_from_str(filename), fb, (mp_lexer_stream_next_char_t)file_buf_next_char, (mp_lexer_stream_close_t)file_buf_close);
}
/******************************************************************************/
diff --git a/stm/main.c b/stm/main.c
index 4114ec1979..d2754a2e6a 100644
--- a/stm/main.c
+++ b/stm/main.c
@@ -378,7 +378,7 @@ void do_repl(void) {
}
}
- mp_lexer_t *lex = mp_lexer_new_from_str_len("<stdin>", vstr_str(&line), vstr_len(&line), 0);
+ mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, vstr_str(&line), vstr_len(&line), 0);
qstr parse_exc_id;
const char *parse_exc_msg;
mp_parse_node_t pn = mp_parse(lex, MP_PARSE_SINGLE_INPUT, &parse_exc_id, &parse_exc_msg);
@@ -393,6 +393,7 @@ void do_repl(void) {
// parse okay
mp_lexer_free(lex);
mp_obj_t module_fun = mp_compile(pn, source_name, true);
+ mp_parse_node_free(pn);
if (module_fun != mp_const_none) {
nlr_buf_t nlr;
uint32_t start = sys_tick_counter;
@@ -439,6 +440,8 @@ bool do_file(const char *filename) {
mp_lexer_free(lex);
mp_obj_t module_fun = mp_compile(pn, source_name, false);
+ mp_parse_node_free(pn);
+
if (module_fun == mp_const_none) {
return false;
}