8000 Update grammar_grapher with the new forced (&&) directive (#31704) · python/cpython@7f07b5e · GitHub
[go: up one dir, main page]

Skip to content

Commit 7f07b5e

Browse files
authored
Update grammar_grapher with the new forced (&&) directive (#31704)
1 parent eafec26 commit 7f07b5e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Tools/peg_generator/scripts/grammar_grapher.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from pegen.grammar import (
3030
Alt,
3131
Cut,
32+
Forced,
3233
Grammar,
3334
Group,
3435
Leaf,
@@ -60,6 +61,8 @@ def references_for_item(item: Any) -> List[Any]:
6061
return [_ref for _item in item.items for _ref in references_for_item(_item)]
6162
elif isinstance(item, Cut):
6263
return []
64+
elif isinstance(item, Forced):
65+
return references_for_item(item.node)
6366
elif isinstance(item, Group):
6467
return references_for_item(item.rhs)
6568
elif isinstance(item, Lookahead):

0 commit comments

Comments
 (0)
0