ddl

package
v0.0.0-...-aa7a1c6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExpTypeName = map[ExpType]string{
	ExpStr:       "string",
	ExpInt:       "int",
	ExpFloat:     "float",
	ExpBool:      "bool",
	ExpNil:       "nil",
	ExpVar:       "variable",
	ExpOperator:  "operator",
	ExpFunc:      "function",
	ExpCalc:      "calculation",
	ExpMap:       "map",
	ExpInterface: "interface",
}

Functions

This section is empty.

Types

type CSSClass

type CSSClass map[string][]CSSToken

type CSSClassMap

type CSSClassMap map[string]CSSClass

type CSSPropVal

type CSSPropVal []CSSToken

type CSSToken

type CSSToken struct {
	Type      CSSTokenType
	Num       float64
	Unit      CSSUnit
	Str       string
	Variable  string
	Operator  string
	FuncName  string
	Class     string
	Color     string
	Prop      string
	Arguments [][]CSSToken
	Pos       int
}

type CSSTokenType

type CSSTokenType int
const (
	CSSTokenNum CSSTokenType = iota
	CSSTokenStr
	CSSTokenColor
	CSSTokenOperator
	CSSTokenFunc
	CSSTokenVar
	CSSTokenClass
	CSSTokenProp
)

type CSSUnit

type CSSUnit int

type DDLDef

type DDLDef struct {
	TplMap      map[string]*TplNode
	CssClassMap CSSClassMap
}

func ParseDdl

func ParseDdl(ddl string) (DDLDef, error)

type DdlError

type DdlError struct {
	// contains filtered or unexported fields
}

func NewDdlError

func NewDdlError(ddl string, pos int, etype string, vars ...any) *DdlError

func (*DdlError) AddOffset

func (de *DdlError) AddOffset(offset int)

func (*DdlError) Error

func (de *DdlError) Error() string

func (*DdlError) Is

func (de *DdlError) Is(etype string) bool

func (*DdlError) IsCssError

func (de *DdlError) IsCssError() bool

func (*DdlError) IsExpError

func (de *DdlError) IsExpError() bool

func (*DdlError) SetDdl

func (de *DdlError) SetDdl(ddl string)

func (*DdlError) SetPos

func (de *DdlError) SetPos(pos int)

type Exp

type Exp struct {
	Type            ExpType
	Int             int64
	Float           float64
	Str             string
	Bool            bool
	FuncName        string
	FuncParams      []*Exp
	Variable        string
	Operator        string
	Map             map[string]*Exp
	Left            *Exp
	Right           *Exp
	TenaryCondition *Exp
	Pos             int
	Interface       interface{}
}

func ParseExp

func ParseExp(str string) (*Exp, error)

func (*Exp) ActualTypeName

func (e *Exp) ActualTypeName() string

func (*Exp) Equal

func (a *Exp) Equal(b *Exp) bool

func (*Exp) ToString

func (e *Exp) ToString() string

func (*Exp) TypeName

func (e *Exp) TypeName() string

type ExpOperatorDirection

type ExpOperatorDirection int
const (
	LTR ExpOperatorDirection = iota
	RTL
)

type ExpType

type ExpType int
const (
	ExpStr ExpType = iota
	ExpInt
	ExpFloat
	ExpBool
	ExpNil
	ExpVar
	ExpOperator
	ExpFunc
	ExpCalc
	ExpMap
	ExpInterface
)

type TplAttr

type TplAttr struct {
	Pos int
	Exp *Exp
}

type TplFor

type TplFor struct {
	Pos      int
	Idx      string
	IdxPos   int
	Val      string
	ValPos   int
	Range    *Exp
	RangePos int
}

type TplNode

type TplNode struct {
	Type       TplNodeType
	TagName    string
	Parent     *TplNode
	Children   []*TplNode
	Idx        int
	Events     map[string]*TplAttr
	Attrs      map[string]*TplAttr
	Directives map[string]string
	Text       string
	Exp        *Exp
	If         *TplAttr
	ElseIf     *TplAttr
	Else       *TplAttr
	For        *TplFor
	Def        *TplAttr
	Pos        int
}

type TplNodeType

type TplNodeType int
const (
	TplNodeTag TplNodeType = iota
	TplNodeText
	TplNodeExp
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL