py: Add MICROPY_ENABLE_COMPILER and MICROPY_PY_BUILTINS_EVAL_EXEC opts.
MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler,
which is useful when only loading of pre-compiled bytecode is supported.
It is enabled by default.
MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin
functions. By default they are only included if MICROPY_ENABLE_COMPILER
is enabled.
Disabling both options saves about 40k of code size on 32-bit x86.
diff --git a/py/lexer.c b/py/lexer.c
index 6bacb9f..89ecc38 100644
--- a/py/lexer.c
+++ b/py/lexer.c
@@ -31,6 +31,8 @@
#include "py/lexer.h"
#include "py/runtime.h"
+#if MICROPY_ENABLE_COMPILER
+
#define TAB_SIZE (8)
// TODO seems that CPython allows NULL byte in the input stream
@@ -785,3 +787,5 @@
printf("\n");
}
#endif
+
+#endif // MICROPY_ENABLE_COMPILER