summaryrefslogtreecommitdiffstatshomepage
path: root/py
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 /py
parent27fb45eb1c95f9cc02f4ed1b9d573ece0d4c1a18 (diff)
downloadmicropython-fa2162bc77b22fd135fd059219191ac91449b3fa.tar.gz
micropython-fa2162bc77b22fd135fd059219191ac91449b3fa.zip
Integrate new lexer stream with stm framework.
Diffstat (limited to 'py')
-rw-r--r--py/lexer.c10
-rw-r--r--py/lexer.h4
2 files changed, 7 insertions, 7 deletions
diff --git a/py/lexer.c b/py/lexer.c
index 56f1ed0df4..9ab0641967 100644
--- a/py/lexer.c
+++ b/py/lexer.c
@@ -14,7 +14,7 @@ struct _py_lexer_t {
const char *name; // name of source
void *stream_data; // data for stream
py_lexer_stream_next_char_t stream_next_char; // stream callback to get next char
- py_lexer_stream_free_t stream_free; // stream callback to free
+ py_lexer_stream_close_t stream_close; // stream callback to free
unichar chr0, chr1, chr2; // current cached characters from source
@@ -589,13 +589,13 @@ static void py_lexer_next_token_into(py_lexer_t *lex, py_token_t *tok, bool firs
}
}
-py_lexer_t *py_lexer_new(const char *src_name, void *stream_data, py_lexer_stream_next_char_t stream_next_char, py_lexer_stream_free_t stream_free) {
+py_lexer_t *py_lexer_new(const char *src_name, void *stream_data, py_lexer_stream_next_char_t stream_next_char, py_lexer_stream_close_t stream_close) {
py_lexer_t *lex = m_new(py_lexer_t, 1);
lex->name = src_name; // TODO do we need to strdup this?
lex->stream_data = stream_data;
lex->stream_next_char = stream_next_char;
- lex->stream_free = stream_free;
+ lex->stream_close = stream_close;
lex->line = 1;
lex->column = 1;
lex->emit_dent = 0;
@@ -632,8 +632,8 @@ py_lexer_t *py_lexer_new(const char *src_name, void *stream_data, py_lexer_strea
void py_lexer_free(py_lexer_t *lex) {
if (lex) {
- if (lex->stream_free) {
- lex->stream_free(lex->stream_data);
+ if (lex->stream_close) {
+ lex->stream_close(lex->stream_data);
}
m_free(lex);
}
diff --git a/py/lexer.h b/py/lexer.h
index 889a55e2bd..3472370604 100644
--- a/py/lexer.h
+++ b/py/lexer.h
@@ -122,7 +122,7 @@ typedef struct _py_token_t {
// it can be called again after returning PY_LEXER_CHAR_EOF, and in that case must return PY_LEXER_CHAR_EOF
#define PY_LEXER_CHAR_EOF (-1)
typedef unichar (*py_lexer_stream_next_char_t)(void*);
-typedef void (*py_lexer_stream_free_t)(void*);
+typedef void (*py_lexer_stream_close_t)(void*);
typedef struct _py_lexer_t py_lexer_t;
@@ -130,7 +130,7 @@ void py_token_show(const py_token_t *tok);
void py_token_show_error_prefix(const py_token_t *tok);
bool py_token_show_error(const py_token_t *tok, const char *msg);
-py_lexer_t *py_lexer_new(const char *src_name, void *stream_data, py_lexer_stream_next_char_t stream_next_char, py_lexer_stream_free_t stream_free);
+py_lexer_t *py_lexer_new(const char *src_name, void *stream_data, py_lexer_stream_next_char_t stream_next_char, py_lexer_stream_close_t stream_close);
void py_lexer_free(py_lexer_t *lex);
void py_lexer_to_next(py_lexer_t *lex);
const py_token_t *py_lexer_cur(const py_lexer_t *lex);