mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add StringValue
Makes the grammar more specific in a few places that take only a string literal or translated string.
This commit is contained in:
parent
5bfed72674
commit
ac2a7d9282
8 changed files with 66 additions and 42 deletions
|
@ -22,7 +22,7 @@ from .attributes import BaseTypedAttribute
|
|||
from .gobject_object import ObjectContent, validate_parent_type
|
||||
from .common import *
|
||||
from .contexts import ValueTypeCtx
|
||||
from .values import Value
|
||||
from .values import StringValue
|
||||
|
||||
|
||||
class Item(AstNode):
|
||||
|
@ -31,12 +31,8 @@ class Item(AstNode):
|
|||
return self.tokens["name"]
|
||||
|
||||
@property
|
||||
def value(self) -> Value:
|
||||
return self.children[Value][0]
|
||||
|
||||
@context(ValueTypeCtx)
|
||||
def value_type(self) -> ValueTypeCtx:
|
||||
return ValueTypeCtx(StringType())
|
||||
def value(self) -> StringValue:
|
||||
return self.children[StringValue][0]
|
||||
|
||||
|
||||
item = Group(
|
||||
|
@ -48,7 +44,7 @@ item = Group(
|
|||
":",
|
||||
]
|
||||
),
|
||||
Value,
|
||||
StringValue,
|
||||
],
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue