mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
language: Add expression literals
Add expression literals, so you can set properties of type Gtk.Expression.
This commit is contained in:
parent
b9f58aeab5
commit
8c6f8760f7
29 changed files with 268 additions and 21 deletions
|
@ -134,6 +134,11 @@ class XmlOutput(OutputFormat):
|
|||
self._emit_expression(value.expression, xml)
|
||||
xml.end_tag()
|
||||
|
||||
elif isinstance(value, ExprValue):
|
||||
xml.start_tag("property", **props)
|
||||
self._emit_expression(value.expression, xml)
|
||||
xml.end_tag()
|
||||
|
||||
elif isinstance(value, ObjectValue):
|
||||
xml.start_tag("property", **props)
|
||||
self._emit_object(value.object, xml)
|
||||
|
@ -218,12 +223,6 @@ class XmlOutput(OutputFormat):
|
|||
xml.put_text(
|
||||
"|".join([str(flag.value or flag.name) for flag in value.child.flags])
|
||||
)
|
||||
elif isinstance(value.child, Translated):
|
||||
raise CompilerBugError("translated values must be handled in the parent")
|
||||
elif isinstance(value.child, TypeLiteral):
|
||||
xml.put_text(value.child.type_name.glib_type_name)
|
||||
elif isinstance(value.child, ObjectValue):
|
||||
self._emit_object(value.child.object, xml)
|
||||
else:
|
||||
raise CompilerBugError()
|
||||
|
||||
|
@ -245,6 +244,9 @@ class XmlOutput(OutputFormat):
|
|||
raise CompilerBugError()
|
||||
|
||||
def _emit_literal_expr(self, expr: LiteralExpr, xml: XmlEmitter):
|
||||
if expr.is_this:
|
||||
return
|
||||
|
||||
if expr.is_object:
|
||||
xml.start_tag("constant")
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue