summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Chiodini <luca@chiodini.org>2022-03-06 14:26:28 (GMT)
committerGitHub <noreply@github.com>2022-03-06 14:26:28 (GMT)
commit7f07b5ee9c2d17f837c44440bf066c73f92dac14 (patch)
tree0ac279bc8cdcf617443293b19a631007813d190e
parenteafec26ae5327bb23b6dace2650b074c3327dfa0 (diff)
downloadcpython-7f07b5ee9c2d17f837c44440bf066c73f92dac14.zip
cpython-7f07b5ee9c2d17f837c44440bf066c73f92dac14.tar.gz
cpython-7f07b5ee9c2d17f837c44440bf066c73f92dac14.tar.bz2
Update grammar_grapher with the new forced (&&) directive (#31704)
-rwxr-xr-xTools/peg_generator/scripts/grammar_grapher.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Tools/peg_generator/scripts/grammar_grapher.py b/Tools/peg_generator/scripts/grammar_grapher.py
index 4d77123..4a41dfa 100755
--- a/Tools/peg_generator/scripts/grammar_grapher.py
+++ b/Tools/peg_generator/scripts/grammar_grapher.py
@@ -29,6 +29,7 @@ from pegen.build import build_parser
from pegen.grammar import (
Alt,
Cut,
+ Forced,
Grammar,
Group,
Leaf,
@@ -60,6 +61,8 @@ def references_for_item(item: Any) -> List[Any]:
return [_ref for _item in item.items for _ref in references_for_item(_item)]
elif isinstance(item, Cut):
return []
+ elif isinstance(item, Forced):
+ return references_for_item(item.node)
elif isinstance(item, Group):
return references_for_item(item.rhs)
elif isinstance(item, Lookahead):