File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -583,6 +583,8 @@ void mp_lexer_to_next(mp_lexer_t *lex) {
583583 // MP_TOKEN_END is used to indicate that this is the first string token
584584 lex -> tok_kind = MP_TOKEN_END ;
585585
586+ bool saw_normal = false, saw_fstring = false;
587+
586588 // Loop to accumulate string/bytes literals
587589 do {
588590 // parse type codes
@@ -619,6 +621,17 @@ void mp_lexer_to_next(mp_lexer_t *lex) {
619621 is_fstring = true;
620622 }
621623
624+ if (is_fstring ) {
625+ saw_fstring = true;
626+ } else {
627+ saw_normal = true;
628+ }
629+
630+ if (saw_fstring && saw_normal ) {
631+ // Can't concatenate f-string with normal string
632+ break ;
633+ }
634+
622635 // Set or check token kind
623636 if (lex -> tok_kind == MP_TOKEN_END ) {
624637 lex -> tok_kind = kind ;
Original file line number Diff line number Diff line change @@ -104,10 +104,10 @@ def foo():
104104x = 10
105105y = 'hi'
106106assert (f'h' f'i' ) == 'hi'
107- assert (f'h' 'i' ) == 'hi'
108- assert ('h' f'i' ) == 'hi'
107+ # assert (f'h' 'i') == 'hi'
108+ # assert ('h' f'i') == 'hi'
109109assert f'{ x :^4} ' == ' 10 '
110- assert ('a' 'b' f'{ x } ' f'str<{ y :^4} >' 'd' 'e' ) == 'ab10str< hi >de'
110+ # assert ('a' 'b' f'{x}' f'str<{y:^4}>' 'd' 'e') == 'ab10str< hi >de'
111111
112112# Other tests
113113assert f'{{{ 4 * 10 } }}' == '{40}'
You can’t perform that action at this time.
0 commit comments