mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Improved validation
This commit is contained in:
parent
981c2e3b7d
commit
f1e1811e1f
13 changed files with 51 additions and 13 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
|
||||
from .. import ast
|
||||
from ..ast_utils import AstNode
|
||||
from ..ast_utils import AstNode, validate
|
||||
from ..completions_utils import *
|
||||
from ..lsp_utils import Completion, CompletionItemKind
|
||||
from ..parse_tree import *
|
||||
|
@ -28,6 +28,10 @@ from ..xml_emitter import XmlEmitter
|
|||
|
||||
|
||||
class Styles(AstNode):
|
||||
@validate("styles")
|
||||
def container_is_widget(self):
|
||||
self.validate_parent_type("Gtk", "Widget", "style classes")
|
||||
|
||||
def emit_xml(self, xml: XmlEmitter):
|
||||
xml.start_tag("style")
|
||||
for child in self.children:
|
||||
|
@ -43,7 +47,7 @@ class StyleClass(AstNode):
|
|||
styles = Group(
|
||||
Styles,
|
||||
Statement(
|
||||
Keyword("styles"),
|
||||
Keyword("styles", True),
|
||||
OpenBracket(),
|
||||
Delimited(
|
||||
Group(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue