summaryrefslogtreecommitdiffstatshomepage
path: root/py/compile.c
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-10-09 15:09:52 +0100
committerDamien <damien.p.george@gmail.com>2013-10-09 15:09:52 +0100
commit91d387de7df9e19bb5b00e6ad4c94790eb3422e3 (patch)
tree1af3603b73c8ab1b2dd917f1654548fc0f1aaafb /py/compile.c
parentff8ed77cc12f707b6b0eb78ccc02bafb20bdf248 (diff)
downloadmicropython-91d387de7df9e19bb5b00e6ad4c94790eb3422e3.tar.gz
micropython-91d387de7df9e19bb5b00e6ad4c94790eb3422e3.zip
Improve indent/dedent error checking and reporting.
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/py/compile.c b/py/compile.c
index f4a5886b0b..3d5a29a192 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -2192,7 +2192,14 @@ void compile_node(compiler_t *comp, py_parse_node_t pn) {
case PY_PARSE_NODE_DECIMAL: EMIT(load_const_dec, arg); break;
case PY_PARSE_NODE_STRING: EMIT(load_const_str, arg, false); break;
case PY_PARSE_NODE_BYTES: EMIT(load_const_str, arg, true); break;
- case PY_PARSE_NODE_TOKEN: EMIT(load_const_tok, arg); break;
+ case PY_PARSE_NODE_TOKEN:
+ if (arg == PY_TOKEN_NEWLINE) {
+ // this can occur when file_input lets through a NEWLINE (eg if file starts with a newline)
+ // do nothing
+ } else {
+ EMIT(load_const_tok, arg);
+ }
+ break;
default: assert(0);
}
} else {