mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Reorganize the parser/AST code
The code is now organized by syntax: `menu {}` in one file, `style` in another, etc. This should make it easier to add syntax in the future.
This commit is contained in:
parent
dc7c0cabd8
commit
bfd9daf6a9
10 changed files with 486 additions and 344 deletions
|
@ -197,3 +197,18 @@ def docs(*args, **kwargs):
|
|||
return Docs(func, *args, **kwargs)
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
class BaseAttribute(AstNode):
|
||||
""" A helper class for attribute syntax of the form `name: literal_value;`"""
|
||||
|
||||
tag_name: str = ""
|
||||
|
||||
def emit_xml(self, xml: XmlEmitter):
|
||||
xml.start_tag(
|
||||
self.tag_name,
|
||||
name=self.tokens["name"],
|
||||
translatable="yes" if self.tokens["translatable"] else None,
|
||||
)
|
||||
xml.put_text(str(self.tokens["value"]))
|
||||
xml.end_tag()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue