mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
implement variant parsing
This commit is contained in:
parent
bc10ccee0c
commit
be667a2b9c
4 changed files with 139 additions and 16 deletions
|
@ -26,6 +26,7 @@ from .common import *
|
|||
from .contexts import ScopeCtx, ValueTypeCtx
|
||||
from .gobject_object import Object
|
||||
from .types import TypeName
|
||||
from .variant import VarContent
|
||||
|
||||
|
||||
class Translated(AstNode):
|
||||
|
@ -373,7 +374,7 @@ class IdentLiteral(AstNode):
|
|||
|
||||
|
||||
class VariantValue(AstNode):
|
||||
grammar = ["variant", "<", UseQuoted("type"), ">", "(", UseQuoted("value"), ")"]
|
||||
grammar = ["variant", "<", UseQuoted("type"), ">", "(", VarContent, ")"]
|
||||
|
||||
@property
|
||||
def var_type(self) -> str:
|
||||
|
@ -381,7 +382,7 @@ class VariantValue(AstNode):
|
|||
|
||||
@property
|
||||
def var_value(self) -> str:
|
||||
return self.tokens["value"]
|
||||
return self.children[0].content
|
||||
|
||||
@validate()
|
||||
def validate_for_type(self) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue