mirror of
https://github.com/python/cpython.git
synced 2024-12-14 04:17:19 +08:00
Update grammar_grapher with the new forced (&&) directive (#31704)
This commit is contained in:
parent
eafec26ae5
commit
7f07b5ee9c
@ -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…
Reference in New Issue
Block a user