Documentation
¶
Index ¶
- func Equal(left, right Value) bool
- func Greater(left, right Value) (bool, error)
- func GreaterEqual(left, right Value) (bool, error)
- func IsArray(v Value) bool
- func IsBool(v Value) bool
- func IsNull(v Value) bool
- func IsNumber(v Value) bool
- func IsObject(v Value) bool
- func IsString(v Value) bool
- func Less(left, right Value) (bool, error)
- func LessEqual(left, right Value) (bool, error)
- func NotEqual(left, right Value) bool
- func ToBool(v Value) bool
- func ToNumber(v Value) (float64, error)
- func ToString(v Value) (string, error)
- type ArrayValue
- type BoolValue
- type Func
- type NullValue
- type NumberValue
- type ObjectValue
- type Scope
- func (s *Scope) DefineTemplate(name string, tmpl *Template)
- func (s *Scope) Get(name string) (Value, error)
- func (s *Scope) GetFunction(name string) (Func, bool)
- func (s *Scope) GetTemplate(name string) (*Template, error)
- func (s *Scope) Link(other *Scope)
- func (s *Scope) Set(name string, val Value)
- func (s *Scope) SetFunction(name string, f Func)
- func (s *Scope) SetGlobal(name string, val Value)
- type StringValue
- type Template
- type Value
- type ValueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GreaterEqual ¶
GreaterEqual returns true if left >= right (numeric comparison)
Types ¶
type ArrayValue ¶
type ArrayValue struct {
Elements []Value
}
ArrayValue represents an array of values
func NewArray ¶
func NewArray(elements ...Value) *ArrayValue
func (*ArrayValue) IsTruthy ¶
func (a *ArrayValue) IsTruthy() bool
func (*ArrayValue) String ¶
func (a *ArrayValue) String() string
func (*ArrayValue) Type ¶
func (a *ArrayValue) Type() ValueType
type NumberValue ¶
type NumberValue struct {
Value float64
}
NumberValue represents a numeric value
func NewNumber ¶
func NewNumber(n float64) *NumberValue
func (*NumberValue) IsTruthy ¶
func (n *NumberValue) IsTruthy() bool
func (*NumberValue) String ¶
func (n *NumberValue) String() string
func (*NumberValue) Type ¶
func (n *NumberValue) Type() ValueType
type ObjectValue ¶
ObjectValue represents an object (map of string keys to values)
func NewObject ¶
func NewObject() *ObjectValue
func (*ObjectValue) Get ¶
func (o *ObjectValue) Get(key string) (Value, bool)
Get retrieves a field from the object
func (*ObjectValue) IsTruthy ¶
func (o *ObjectValue) IsTruthy() bool
func (*ObjectValue) Set ¶
func (o *ObjectValue) Set(key string, val Value)
Set sets a field in the object
func (*ObjectValue) String ¶
func (o *ObjectValue) String() string
func (*ObjectValue) Type ¶
func (o *ObjectValue) Type() ValueType
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope manages variable bindings and template definitions
func (*Scope) DefineTemplate ¶
DefineTemplate registers a template in the current scope
func (*Scope) GetTemplate ¶
GetTemplate retrieves a template from this scope or parent scopes
func (*Scope) SetFunction ¶
type StringValue ¶
type StringValue struct {
Value string
}
StringValue represents a string value
func NewString ¶
func NewString(s string) *StringValue
func (*StringValue) IsTruthy ¶
func (s *StringValue) IsTruthy() bool
func (*StringValue) String ¶
func (s *StringValue) String() string
func (*StringValue) Type ¶
func (s *StringValue) Type() ValueType
type Template ¶
type Template struct {
Name string
Body []parser.Node // The AST nodes to evaluate
Filename string // Source file where template was defined
}
Template represents a user-defined template
Click to show internal directories.
Click to hide internal directories.