lparser.h Header
Types
| struct | LColor | Represents an ARGB color value. |
| struct | LName | A name is a sequence of expandables, separated by spaces, that represents a segment in a declaration. |
| struct | LDeclaration | A declaration is a specially structured sequence of names that identifies one or more items. |
| struct | LReference | A reference is an expressible sequence of names that identifies one specific declared item. |
| struct | LState | A state is a set of conditions paired with an expression, separated by :. |
| struct | LAttributeNode | An attribute node is a declared expression representing a labeled unit of data, with optional states. |
| struct | LGroupSet | A group set is a group declaration of attribute nodes. Group set declarations contain a group without an item (traversals are still valid), and the attributes in the set are declared within an indented block. |
| struct | LStateSet | A state set applies one set of conditions to a block of attributes and/or group sets. Each expression in the block is that attribute's state value under those conditions, so the attributes can't declare inline states of their own. |
| struct | LLayerNode | A layer node is a declared *thing*, described by the attributes and other layers within it. |
| class | LParser | Build a Layers abstract syntax tree (AST) from a token stream. |
Type Aliases
| using | LExpandable | An expandable is a sequence of words that constitute a name expansion. Expandables with single words do not expand. An empty string represents an empty alternative. |
| using | LValue | A value is an expressible unit of data, either a boolean, number, string of text, or color. |
| using | LExpression | An expression is either a value or a reference to an attribute with a value. |
| using | LConditions | Conditions are one or more single words that, together, represent a state. |
| using | LAttributeNodes | Pluralized identifier for a vector of LAttributeNodes |
| using | LGroupSets | Pluralized identifier for a vector of LGroupSets |
Type Alias Documentation
using LExpandable = std::vector<LString>
An expandable is a sequence of words that constitute a name expansion. Expandables with single words do not expand. An empty string represents an empty alternative.
Label -> {"Label"} // Single word
(Label) -> {"Label"} // Also single word
Text Label -> {"Text"}, {"Label"} // Two expandables, one for each word
(Max,) -> {"Max",""} // Expansion with empty alternative
(Icon,Text) -> {"Icon","Text"} // Expansion
using LValue = std::variant<std::monostate, bool, double, LString, LColor>
A value is an expressible unit of data, either a boolean, number, string of text, or color.
using LExpression = std::variant<LValue, LReference>
using LConditions = std::vector<LString>
Conditions are one or more single words that, together, represent a state.
A set of conditions is preceded by @ and separated by &.
Since conditions are single words, they cannot contain spaces. A multi-word condition can still be achieved using hyphenation.
@Selected // One condition; {"Selected"}
@Mobile&Narrow // Two conditions; {"Mobile","Narrow"}
@Desktop-Large // One condition; {"Desktop-Large"}
@Desktop Large // Invalid; conditions must be single word
using LAttributeNodes = std::vector<LAttributeNode>
Pluralized identifier for a vector of LAttributeNodes
using LGroupSets = std::vector<LGroupSet>
Pluralized identifier for a vector of LGroupSets
Function Documentation
std::string to_string(LColor color)
Converts an LColor to its #AARRGGBB string form.