LLayerNode Struct
Public Members
| LDeclaration | declaration |
| std::optional<LReference> | base |
| std::vector<LLayerNode> | layers |
| LAttributeNodes | attributes |
| LGroupSets | group_sets |
| std::vector<LStateSet> | state_sets |
Detailed Description
A layer node is a declared thing, described by the attributes and other layers within it.
A layer is, at least, a declaration. It can inherit a base layer with <<
followed by a reference, and it can have a definition: a
: that ends the line, followed by an indented block of statements. A :
with an expression after it on the same line declares an attribute instead.
None // Just an empty layer;
// declaration = {
// item = {{"None"}} }
(Cancel,Confirm) Button << Button // Declares two layers;
// declaration = {
// item = {{"Cancel","Confirm"}, {"Button"}} }
// base = {
// item = "Button" }
Label: "Text" // Attribute; an expression immediately follows `:`
Label: // Layer; `:` ends the line and opens the definition
Text: "Text"
The parser sorts a definition's statements into the node's layers,
attributes, group_sets, and
state_sets by kind, keeping their order within each kind.
Button << Box: // declaration = {
Corner Radius: 5 // item = {{"Button"}} }
Layout. // base = {
Direction: "Row" // item = "Box" }
@Pressed: // layers = {
Fill: Theme/Tertiary // { declaration = {
Label: // item = {{"Label"}} }
Text: "Button" // attributes = {
// { declaration = {
// item = {{"Text"}} }
// expression -> value -> string = "Button" } } } }
// attributes = {
// { declaration = {
// item = {{"Corner"}, {"Radius"}} }
// expression -> value -> number = 5 } }
// group_sets = {
// { declaration = {
// group = {{"Layout"}} }
// attributes = {
// { declaration = {
// item = {{"Direction"}} }
// expression -> value -> string = "Row" } } } }
// state_sets = {
// { conditions = {"Pressed"}
// attributes = {
// { declaration = {
// item = {{"Fill"}} }
// expression -> reference = {
// traversal = {"Theme"}
// item = "Tertiary" } } } } }
LParser::parse_file() returns a whole file as a
root layer node with an empty declaration, whose members hold the file's
top-level statements.
The parser only records
base; the engine resolves it and merges the base layer in after loading the set of files it belongs to.
Member Variable Documentation
LDeclaration declaration
Identifies the layer(s) being declared
std::optional<LReference> base
Base layer to inherit from, if any
std::vector<LLayerNode> layers
Child layers declared in the definition
LAttributeNodes attributes
Attributes declared in the definition
LGroupSets group_sets
Group sets declared in the definition
std::vector<LStateSet> state_sets
State sets declared in the definition