summaryrefslogtreecommitdiff
path: root/py/lexer.h
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-03-09 09:02:47 -0500
committerJeff Epler <jepler@gmail.com>2020-03-09 09:03:25 -0500
commit473e9c5ffb081ae2750948099ac8288b039d4255 (patch)
treeed62451386a0bd15f0f58b4ca5e98f0a476a0b34 /py/lexer.h
parent32647cd9b41c26003df0bdc385353f6a24b727d7 (diff)
f-strings: Make optional, defaulting to !CIRCUITPY_MINIMAL_BUILD
This should reclaim *most* code space added to handle f-strings. However, there may be some small code growth as parse_string_literal takes a new parameter (which will always be 0, so hopefully the optimizer eliminates it)
Diffstat (limited to 'py/lexer.h')
-rw-r--r--py/lexer.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/py/lexer.h b/py/lexer.h
index 7fe271e84..a3eaa2a7e 100644
--- a/py/lexer.h
+++ b/py/lexer.h
@@ -44,12 +44,14 @@ typedef enum _mp_token_kind_t {
MP_TOKEN_INVALID,
MP_TOKEN_DEDENT_MISMATCH,
MP_TOKEN_LONELY_STRING_OPEN,
+#if MICROPY_COMP_FSTRING_LITERAL
MP_TOKEN_FSTRING_BACKSLASH,
MP_TOKEN_FSTRING_COMMENT,
MP_TOKEN_FSTRING_UNCLOSED,
MP_TOKEN_FSTRING_UNOPENED,
MP_TOKEN_FSTRING_EMPTY_EXP,
MP_TOKEN_FSTRING_RAW,
+#endif
MP_TOKEN_NEWLINE,
MP_TOKEN_INDENT,
@@ -156,7 +158,9 @@ typedef struct _mp_lexer_t {
mp_reader_t reader; // stream source
unichar chr0, chr1, chr2; // current cached characters from source
+#if MICROPY_COMP_FSTRING_LITERAL
unichar chr3, chr4, chr5; // current cached characters from alt source
+#endif
size_t line; // current source line
size_t column; // current source column
@@ -172,9 +176,11 @@ typedef struct _mp_lexer_t {
size_t tok_column; // token source column
mp_token_kind_t tok_kind; // token kind
vstr_t vstr; // token data
+#if MICROPY_COMP_FSTRING_LITERAL
vstr_t vstr_postfix; // postfix to apply to string
bool vstr_postfix_processing;
uint16_t vstr_postfix_idx;
+#endif
} mp_lexer_t;
mp_lexer_t *mp_lexer_new(qstr src_name, mp_reader_t reader);