bpo-40939: Clean and adapt the peg_generator directory after deleting the old parser (GH-20822)

This commit is contained in:
Pablo Galindo 2020-06-12 01:55:35 +01:00 committed by GitHub
parent b4282dd150
commit 756180b4bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 304 deletions

View file

@ -14,8 +14,7 @@ INITIAL_NESTING_DEPTH, or NESTED_INCR_AMT variables.
Usage: python -m scripts.find_max_nesting
"""
import sys
from _peg_parser import parse_string
import ast
GRAMMAR_FILE = "data/python.gram"
INITIAL_NESTING_DEPTH = 10
@ -28,9 +27,8 @@ ENDC = "\033[0m"
def check_nested_expr(nesting_depth: int) -> bool:
expr = f"{'(' * nesting_depth}0{')' * nesting_depth}"
try:
parse_string(expr)
ast.parse(expr)
print(f"Nesting depth of {nesting_depth} is successful")
return True
except Exception as err: