mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Update grammar_grapher with the new forced (&&) directive (#31704)
This commit is contained in:
parent
eafec26ae5
commit
7f07b5ee9c
1 changed files with 3 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue