py: Use preprocessor to detect error reporting level (terse/detailed).

Instead of compiler-level if-logic.  This is necessary to know what error
strings are included in the build at the preprocessor stage, so that string
compression can be implemented.
This commit is contained in:
Jim Mussared
2019-09-26 22:52:04 +10:00
committed by Damien George
parent 312c699491
commit a9a745e4b4
11 changed files with 384 additions and 380 deletions

View File

@@ -2552,21 +2552,21 @@ STATIC void compile_atom_brace_helper(compiler_t *comp, mp_parse_node_struct_t *
compile_node(comp, pn_i);
if (is_dict) {
if (!is_key_value) {
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
compile_syntax_error(comp, (mp_parse_node_t)pns, "invalid syntax");
} else {
compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting key:value for dict");
}
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
compile_syntax_error(comp, (mp_parse_node_t)pns, "invalid syntax");
#else
compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting key:value for dict");
#endif
return;
}
EMIT(store_map);
} else {
if (is_key_value) {
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
compile_syntax_error(comp, (mp_parse_node_t)pns, "invalid syntax");
} else {
compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting just a value for set");
}
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
compile_syntax_error(comp, (mp_parse_node_t)pns, "invalid syntax");
#else
compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting just a value for set");
#endif
return;
}
}