avyos.dev/pkg/graphics/uiparse
package uiparse
Package Overview
No package-level documentation is provided.
| Export Group | Count |
|---|---|
| Constants | 0 |
| Variables | 0 |
| Functions | 0 |
| Types | 10 |
Types
BuildError
type BuildError struct {
Line int
Element string
Message string
}BuildError represents an error during element tree construction.
Methods
func (e *BuildError) Error() stringComponentDef
type ComponentDef struct {
Name string
Properties []*Property // property declarations with defaults
Signals []SignalDecl // signal declarations
Defaults []*Property // default attribute values
Children []*Node // child element templates (future)
Line int
}ComponentDef represents a component definition.
Document
type Document struct {
Imports []ImportDecl
Components []*ComponentDef
Root *Node // the root element (Window, VBox, etc.)
}Document is the top-level parse result.
Functions
func Parse(source string) (*Document, error)Parse parses a .ui source into a Document.
ImportDecl
type ImportDecl struct {
Path string
Line int
}ImportDecl represents an import statement.
Node
type Node struct {
TypeName string
Properties []*Property
Children []*Node
Line int
}Node represents an element in the UI tree.
Methods
func (n *Node) PropBool(name string, def bool) boolPropBool returns the bool value of a property, or the default.
func (n *Node) PropFloat(name string, def float64) float64PropFloat returns the float value of a property, or the default.
func (n *Node) PropInt(name string, def int) intPropInt returns the int value of a property, or the default.
func (n *Node) PropString(name string) stringPropString returns the string representation of a property.
func (n *Node) PropValue(name string) (Value, bool)PropValue returns the Value for a named property, or zero Value and false.
ParseError
type ParseError struct {
Line int
Column int
Message string
}ParseError represents an error during UI parsing with location info.
Methods
func (e *ParseError) Error() stringProperty
type Property struct {
Name string
Value Value
Line int
}Property is a key-value pair in a Node.
SignalDecl
type SignalDecl struct {
Name string
Line int
}SignalDecl represents a signal declaration inside a component.
Value
type Value struct {
Kind ValueKind
Str string
Int int64
Float float64
Bool bool
}Value is a parsed property value.
ValueKind
type ValueKind intValueKind distinguishes the type of a parsed value.
Constants
const (
ValueString ValueKind = iota
ValueInt
ValueFloat
ValueBool
ValueIdent
)