From 085f666ca14aad3b02259f8601214b79747fd374 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 8 Apr 2020 23:24:30 +0200 Subject: [PATCH] Add more tokens that can break parens to tokenizer --- parso/python/tokenize.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/parso/python/tokenize.py b/parso/python/tokenize.py index 36a6ad4..f8ce09a 100644 --- a/parso/python/tokenize.py +++ b/parso/python/tokenize.py @@ -257,13 +257,14 @@ def _create_token_collection(version_info): fstring_pattern_map[t + quote] = quote ALWAYS_BREAK_TOKENS = (';', 'import', 'class', 'def', 'try', 'except', - 'finally', 'while', 'with', 'return') + 'finally', 'while', 'with', 'return', 'continue', + 'break', 'del', 'pass', 'global', 'assert') if version_info >= (3, 5): - ALWAYS_BREAK_TOKENS += ('async',) + ALWAYS_BREAK_TOKENS += ('async', 'nonlocal') pseudo_token_compiled = _compile(PseudoToken) return TokenCollection( pseudo_token_compiled, single_quoted, triple_quoted, endpats, - whitespace, fstring_pattern_map, ALWAYS_BREAK_TOKENS + whitespace, fstring_pattern_map, set(ALWAYS_BREAK_TOKENS) )