mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
Fix lookahead of soft keywords in the PEG parser (GH-20436)
Automerge-Triggered-By: @gvanrossum
This commit is contained in:
parent
21fda91f8d
commit
404b23b85b
4 changed files with 31 additions and 2 deletions
|
|
@ -432,3 +432,15 @@ def test_soft_keywords_parse(self) -> None:
|
|||
self.check_input_strings_for_grammar(valid_cases, invalid_cases)
|
||||
"""
|
||||
self.run_test(grammar_source, test_source)
|
||||
|
||||
def test_soft_keywords_lookahead(self) -> None:
|
||||
grammar_source = """
|
||||
start: &"if" "if" expr '+' expr NEWLINE
|
||||
expr: NAME
|
||||
"""
|
||||
test_source = """
|
||||
valid_cases = ["if if + if"]
|
||||
invalid_cases = ["if if"]
|
||||
self.check_input_strings_for_grammar(valid_cases, invalid_cases)
|
||||
"""
|
||||
self.run_test(grammar_source, test_source)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue