Resolved some remaining chicken and egg when parsing BNF nodes
This commit is contained in:
@@ -373,15 +373,15 @@ class ExecutionContext:
|
||||
:param predicate: what execution context to keep
|
||||
:param get_obj: lambda to compute what to return
|
||||
:param start_with_self: include the current execution context in the search
|
||||
:param stop: stop the search if matched
|
||||
:param stop: condition to stop
|
||||
:return:
|
||||
"""
|
||||
current = self if start_with_self else self._parent
|
||||
while current:
|
||||
if stop and stop(current):
|
||||
break
|
||||
|
||||
if predicate is None or predicate(current):
|
||||
yield current if get_obj is None else get_obj(current)
|
||||
|
||||
if stop and stop(current):
|
||||
break
|
||||
|
||||
current = current._parent
|
||||
|
||||
Reference in New Issue
Block a user