Integrate new lexer stream with stm framework.

This commit is contained in:
Damien
2013-10-20 17:42:00 +01:00
parent 27fb45eb1c
commit fa2162bc77
10 changed files with 126 additions and 31 deletions

View File

@@ -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");