def _collect_refs(self, item_val, acc=None, no_opt=False):
if acc is None:
acc = deque()
from gramfuzz.fields import Opt
if no_opt and (isinstance(item_val, Opt) or item_val.shortest_is_nothing):
return acc
from gramfuzz.fields import Ref
if isinstance(item_val, Ref):
acc.append(item_val)
if hasattr(item_val, "values"):
for val in item_val.values:
self._collect_refs(val, acc)
return acc
# --------------------------------------
# public, but intended for internal use
# --------------------------------------
评论列表
文章目录