diff --git a/blueprintcompiler/language/gobject_property.py b/blueprintcompiler/language/gobject_property.py index c782d2e..50a7512 100644 --- a/blueprintcompiler/language/gobject_property.py +++ b/blueprintcompiler/language/gobject_property.py @@ -21,15 +21,12 @@ from .binding import Binding from .common import * from .contexts import ValueTypeCtx -from .gtk_menu import menu from .values import ArrayValue, ExprValue, ObjectValue, Value class Property(AstNode): grammar = Statement( - UseIdent("name"), - ":", - AnyOf(Binding, ExprValue, menu, ObjectValue, Value, ArrayValue), + UseIdent("name"), ":", AnyOf(Binding, ExprValue, ObjectValue, Value, ArrayValue) ) @property diff --git a/blueprintcompiler/language/gtk_menu.py b/blueprintcompiler/language/gtk_menu.py index bc38f37..c7ef5f2 100644 --- a/blueprintcompiler/language/gtk_menu.py +++ b/blueprintcompiler/language/gtk_menu.py @@ -60,6 +60,11 @@ class Menu(AstNode): 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: + raise CompileError("Menu requires an ID") + @validate("id") def object_id_not_reserved(self): if self.id in RESERVED_IDS: diff --git a/blueprintcompiler/outputs/xml/__init__.py b/blueprintcompiler/outputs/xml/__init__.py index 32291ee..15850f7 100644 --- a/blueprintcompiler/outputs/xml/__init__.py +++ b/blueprintcompiler/outputs/xml/__init__.py @@ -139,11 +139,6 @@ class XmlOutput(OutputFormat): self._emit_expression(value.expression, xml) xml.end_tag() - elif isinstance(value, Menu): - xml.start_tag("property", **props) - self._emit_menu(value, xml) - xml.end_tag() - elif isinstance(value, ObjectValue): xml.start_tag("property", **props) self._emit_object(value.object, xml) diff --git a/docs/reference/objects.rst b/docs/reference/objects.rst index d759abe..6f76da6 100644 --- a/docs/reference/objects.rst +++ b/docs/reference/objects.rst @@ -58,7 +58,7 @@ Properties .. rst-class:: grammar-block - Property = `> ':' ( :ref:`Binding` | :ref:`ExprValue` | :ref:`Menu` | :ref:`ObjectValue` | :ref:`Value` ) ';' + Property = `> ':' ( :ref:`Binding` | :ref:`ExprValue` | :ref:`ObjectValue` | :ref:`Value` ) ';' Properties specify the details of each object, like a label's text, an image's icon name, or the margins on a container. diff --git a/meson.build b/meson.build index 635fac5..f298d15 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('blueprint-compiler', - version: '0.17.0', + version: '0.16.0', ) prefix = get_option('prefix') diff --git a/tests/samples/inline_menu.blp b/tests/sample_errors/inline_menu.blp similarity index 100% rename from tests/samples/inline_menu.blp rename to tests/sample_errors/inline_menu.blp diff --git a/tests/sample_errors/inline_menu.err b/tests/sample_errors/inline_menu.err new file mode 100644 index 0000000..3115750 --- /dev/null +++ b/tests/sample_errors/inline_menu.err @@ -0,0 +1 @@ +4,15,4,Namespace Gtk does not contain a type called menu \ No newline at end of file diff --git a/tests/samples/menu_no_id.blp b/tests/sample_errors/menu_no_id.blp similarity index 100% rename from tests/samples/menu_no_id.blp rename to tests/sample_errors/menu_no_id.blp diff --git a/tests/sample_errors/menu_no_id.err b/tests/sample_errors/menu_no_id.err new file mode 100644 index 0000000..e97f033 --- /dev/null +++ b/tests/sample_errors/menu_no_id.err @@ -0,0 +1 @@ +3,1,4,Menu requires an ID \ No newline at end of file diff --git a/tests/samples/inline_menu.ui b/tests/samples/inline_menu.ui deleted file mode 100644 index 2910b14..0000000 --- a/tests/samples/inline_menu.ui +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - diff --git a/tests/samples/menu_no_id.ui b/tests/samples/menu_no_id.ui deleted file mode 100644 index 934f6da..0000000 --- a/tests/samples/menu_no_id.ui +++ /dev/null @@ -1,10 +0,0 @@ - - - - - -