summaryrefslogtreecommitdiff
path: root/shared/runtime/pyexec.c
diff options
context:
space:
mode:
authorAndrew Leech <andrew@alelec.net>2023-10-26 09:02:16 +1100
committerDamien George <damien@micropython.org>2025-11-22 00:00:07 +1100
commit5b3c928f53a0f0e2a1d6178569e594dbe9cf8f92 (patch)
tree5622b16752dc535ffe523030a0058cc25ea6644f /shared/runtime/pyexec.c
parent40df95357c7b3270dc60421a0078fd73b122473f (diff)
unix/main: Use standard pyexec REPL for unix and windows ports.
This improves REPL usage consistency across ports, by utilizing the pyexec code for the unix REPL. Only enabled when MICROPY_USE_READLINE == 1 (the default). Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Diffstat (limited to 'shared/runtime/pyexec.c')
-rw-r--r--shared/runtime/pyexec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c
index cf17bd0dc..237a6f9df 100644
--- a/shared/runtime/pyexec.c
+++ b/shared/runtime/pyexec.c
@@ -37,6 +37,7 @@
#include "py/mphal.h"
#include "shared/readline/readline.h"
#include "shared/runtime/pyexec.h"
+#include "extmod/modplatform.h"
#include "genhdr/mpversion.h"
pyexec_mode_kind_t pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL;
@@ -103,6 +104,14 @@ static int parse_compile_execute(const void *source, mp_parse_input_kind_t input
// source is a lexer, parse and compile the script
qstr source_name = lex->source_name;
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
+ #if defined(MICROPY_UNIX_COVERAGE)
+ // allow to print the parse tree in the coverage build
+ if (mp_verbose_flag >= 3) {
+ printf("----------------\n");
+ mp_parse_node_print(&mp_plat_print, parse_tree.root, 0);
+ printf("----------------\n");
+ }
+ #endif
module_fun = mp_compile(&parse_tree, source_name, exec_flags & EXEC_FLAG_IS_REPL);
#else
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("script compilation not supported"));