mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add properties to AST types
I want to have a cleaner API that relies less on the specifics of the grammar and parser.
This commit is contained in:
parent
0b7dbaf90d
commit
6938267952
4 changed files with 34 additions and 10 deletions
|
@ -39,6 +39,10 @@ class Menu(AstNode):
|
|||
def tag(self) -> str:
|
||||
return self.tokens["tag"]
|
||||
|
||||
@property
|
||||
def items(self) -> T.List[T.Union["Menu", "MenuAttribute"]]:
|
||||
return self.children
|
||||
|
||||
@validate("menu")
|
||||
def has_id(self):
|
||||
if self.tokens["tag"] == "menu" and self.tokens["id"] is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue