diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-01 23:30:53 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-07 20:33:00 +0000 |
commit | b4b10fd350852e321624d74983cca286091b55a1 (patch) | |
tree | 7ac4aa40d70be0170a61f649e9d73c42faa4ba33 /py/lexer.c | |
parent | ad2307c92c15f0aa90dbd0741fd2538719d0b5e1 (diff) |
py: Put all global state together in state structures.
This patch consolidates all global variables in py/ core into one place,
in a global structure. Root pointers are all located together to make
GC tracing easier and more efficient.
Diffstat (limited to 'py/lexer.c')
-rw-r--r-- | py/lexer.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/py/lexer.c b/py/lexer.c index ce6aa783a..f4aedb401 100644 --- a/py/lexer.c +++ b/py/lexer.c @@ -27,6 +27,7 @@ #include <stdio.h> #include <assert.h> +#include "py/mpstate.h" #include "py/lexer.h" #define TAB_SIZE (8) @@ -34,8 +35,6 @@ // TODO seems that CPython allows NULL byte in the input stream // don't know if that's intentional or not, but we don't allow it -mp_uint_t mp_optimise_value; - // TODO replace with a call to a standard function STATIC bool str_strn_equal(const char *str, const char *strn, mp_uint_t len) { mp_uint_t i = 0; @@ -662,7 +661,7 @@ STATIC void mp_lexer_next_token_into(mp_lexer_t *lex, bool first_token) { if (str_strn_equal(tok_kw[i], lex->vstr.buf, lex->vstr.len)) { if (i == MP_ARRAY_SIZE(tok_kw) - 1) { // tok_kw[MP_ARRAY_SIZE(tok_kw) - 1] == "__debug__" - lex->tok_kind = (mp_optimise_value == 0 ? MP_TOKEN_KW_TRUE : MP_TOKEN_KW_FALSE); + lex->tok_kind = (MP_STATE_VM(mp_optimise_value) == 0 ? MP_TOKEN_KW_TRUE : MP_TOKEN_KW_FALSE); } else { lex->tok_kind = MP_TOKEN_KW_FALSE + i; } |