Recursively yield all descendant nodes in the tree starting at self. The order mimics the order of the underlying linear token stream (i.e. depth first).
(
self: _NodeType, *, include_self: bool = True
)
| 242 | return text |
| 243 | |
| 244 | def walk( |
| 245 | self: _NodeType, *, include_self: bool = True |
| 246 | ) -> Generator[_NodeType, None, None]: |
| 247 | """Recursively yield all descendant nodes in the tree starting at self. |
| 248 | |
| 249 | The order mimics the order of the underlying linear token |
| 250 | stream (i.e. depth first). |
| 251 | """ |
| 252 | if include_self: |
| 253 | yield self |
| 254 | for child in self.children: |
| 255 | yield from child.walk(include_self=True) |
| 256 | |
| 257 | # NOTE: |
| 258 | # The values of the properties defined below directly map to properties |