mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add lookup expressions
This commit is contained in:
parent
d09ee2a62b
commit
012bdf6843
8 changed files with 177 additions and 5 deletions
|
@ -33,7 +33,10 @@ class Children:
|
|||
def __iter__(self):
|
||||
return iter(self._children)
|
||||
def __getitem__(self, key):
|
||||
return [child for child in self._children if isinstance(child, key)]
|
||||
if isinstance(key, int):
|
||||
return self._children[key]
|
||||
else:
|
||||
return [child for child in self._children if isinstance(child, key)]
|
||||
|
||||
|
||||
class AstNode:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue