summaryrefslogtreecommitdiff
path: root/unix/main.c
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-10-20 17:42:00 +0100
committerDamien <damien.p.george@gmail.com>2013-10-20 17:42:00 +0100
commitfa2162bc77b22fd135fd059219191ac91449b3fa (patch)
tree07f29c54a32a3b3650917cd22a99184f1aa242e0 /unix/main.c
parent27fb45eb1c95f9cc02f4ed1b9d573ece0d4c1a18 (diff)
Integrate new lexer stream with stm framework.
Diffstat (limited to 'unix/main.c')
-rw-r--r--unix/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/unix/main.c b/unix/main.c
index e3999db68..f7b06d4f8 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -68,8 +68,11 @@ void do_repl() {
line = line3;
}
}
+
py_lexer_t *lex = py_lexer_new_from_str_len("<stdin>", line, strlen(line), false);
py_parse_node_t pn = py_parse(lex, PY_PARSE_SINGLE_INPUT);
+ py_lexer_free(lex);
+
if (pn != PY_PARSE_NODE_NULL) {
//py_parse_node_show(pn, 0);
bool comp_ok = py_compile(pn, true);
@@ -111,6 +114,8 @@ void do_file(const char *file) {
// compile
py_parse_node_t pn = py_parse(lex, PY_PARSE_FILE_INPUT);
+ py_lexer_free(lex);
+
if (pn != PY_PARSE_NODE_NULL) {
//printf("----------------\n");
//parse_node_show(pn, 0);
@@ -118,8 +123,6 @@ void do_file(const char *file) {
bool comp_ok = py_compile(pn, false);
//printf("----------------\n");
- py_lexer_free(lex);
-
#if MICROPY_EMIT_CPYTHON
if (!comp_ok) {
printf("compile error\n");