|
|
@ -455,9 +455,13 @@ STATIC void mp_lexer_next_token_into(mp_lexer_t *lex, mp_token_t *tok, bool firs |
|
|
|
vstr_add_char(&lex->vstr, CUR_CHAR(lex)); |
|
|
|
} else { |
|
|
|
n_closing = 0; |
|
|
|
if (!is_raw && is_char(lex, '\\')) { |
|
|
|
if (is_char(lex, '\\')) { |
|
|
|
next_char(lex); |
|
|
|
unichar c = CUR_CHAR(lex); |
|
|
|
if (is_raw) { |
|
|
|
// raw strings allow escaping of quotes, but the backslash is also emitted
|
|
|
|
vstr_add_char(&lex->vstr, '\\'); |
|
|
|
} else { |
|
|
|
switch (c) { |
|
|
|
case MP_LEXER_CHAR_EOF: break; // TODO a proper error message?
|
|
|
|
case '\n': c = MP_LEXER_CHAR_EOF; break; // TODO check this works correctly (we are supposed to ignore it
|
|
|
@ -500,6 +504,7 @@ STATIC void mp_lexer_next_token_into(mp_lexer_t *lex, mp_token_t *tok, bool firs |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (c != MP_LEXER_CHAR_EOF) { |
|
|
|
vstr_add_char(&lex->vstr, c); |
|
|
|
} |
|
|
|