diff options
author | Damien George <damien@micropython.org> | 2022-03-31 14:26:36 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-04-14 22:45:42 +1000 |
commit | 24bc1f61f9c73e922cda2cb429d9ace0a85cff94 (patch) | |
tree | 3e8e962071a65e9ebbdca109636099a54d286954 /py/parse.c | |
parent | e52f14d05772b670847c0692a635a5ec223c5e57 (diff) |
py/parse: Print const object value in mp_parse_node_print.
To give more information when printing the parse tree.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/parse.c')
-rw-r--r-- | py/parse.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/py/parse.c b/py/parse.c index f0e0a165c..8f0a25cf2 100644 --- a/py/parse.c +++ b/py/parse.c @@ -394,10 +394,12 @@ void mp_parse_node_print(const mp_print_t *print, mp_parse_node_t pn, size_t ind if (MP_PARSE_NODE_STRUCT_KIND(pns) == RULE_const_object) { mp_obj_t obj = mp_parse_node_extract_const_object(pns); #if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_D - mp_printf(print, "literal const(%016llx)\n", obj); + mp_printf(print, "literal const(%016llx)=", obj); #else - mp_printf(print, "literal const(%p)\n", obj); + mp_printf(print, "literal const(%p)=", obj); #endif + mp_obj_print_helper(print, obj, PRINT_REPR); + mp_printf(print, "\n"); } else { size_t n = MP_PARSE_NODE_STRUCT_NUM_NODES(pns); #if MICROPY_DEBUG_PARSE_RULE_NAME |