diff --git a/parso/python/grammar38.txt b/parso/python/grammar38.txt index 7f7391a..6aceb50 100644 --- a/parso/python/grammar38.txt +++ b/parso/python/grammar38.txt @@ -153,5 +153,5 @@ strings: (STRING | fstring)+ fstring: FSTRING_START fstring_content* FSTRING_END fstring_content: FSTRING_STRING | fstring_expr fstring_conversion: '!' NAME -fstring_expr: '{' testlist [ fstring_conversion ] [ fstring_format_spec ] '}' +fstring_expr: '{' testlist ['='] [ fstring_conversion ] [ fstring_format_spec ] '}' fstring_format_spec: ':' fstring_content* diff --git a/test/failing_examples.py b/test/failing_examples.py index c2cc930..71629da 100644 --- a/test/failing_examples.py +++ b/test/failing_examples.py @@ -146,7 +146,7 @@ FAILING_EXAMPLES = [ # Now nested parsing "f'{continue}'", "f'{1;1}'", - "f'{a=3}'", + "f'{a*=3}'", "f'{b\"\" \"\"}'", ] diff --git a/test/test_fstring.py b/test/test_fstring.py index 9f91533..df3f10f 100644 --- a/test/test_fstring.py +++ b/test/test_fstring.py @@ -7,7 +7,7 @@ from parso.python.tokenize import tokenize @pytest.fixture def grammar(): - return load_grammar(version='3.6') + return load_grammar(version='3.8') @pytest.mark.parametrize( @@ -31,6 +31,10 @@ def grammar(): '{{{1}', '1{{2{{3', '}}', + + # New Python 3.8 syntax f'{a=}' + '{a=}', + '{a()=}', ] ) def test_valid(code, grammar):