Documentation ¶
Index ¶
- Variables
- func AssertFlag(t Token) error
- func DictHasFlag(d KeyDict, x interface{}) (bool, error)
- func DictOptionString(d KeyDict, x interface{}, def string) (string, error)
- func IsAnyFunction(t Token) bool
- func IsBool(t Token) bool
- func IsColor(t Token) bool
- func IsContainer(t Token) bool
- func IsDict(t Token) bool
- func IsFalseBool(t_ Token) bool
- func IsFlag(t Token) bool
- func IsFloat(t Token) bool
- func IsFunction(t Token, name string) bool
- func IsIndexable(t Token) bool
- func IsInt(t Token) bool
- func IsIntDict(t Token) bool
- func IsIntList(t Token) bool
- func IsIntOrFloat(t Token) bool
- func IsKeyDict(t Token) bool
- func IsLazy(t Token) bool
- func IsList(t Token) bool
- func IsNull(t Token) bool
- func IsParens(t Token) bool
- func IsPrimitive(t Token) bool
- func IsRawDict(t Token) bool
- func IsString(t Token) bool
- func IsStringDict(t Token) bool
- func IsStringList(t Token) bool
- func IsTrueBool(t_ Token) bool
- func ListToString(t Token) (string, error)
- func MergeContexts(ts ...Token) context.Context
- func StringMapToString(m map[string]string, indent string, nl string) string
- type Bool
- type Color
- func (t *Color) Dump(indent string) string
- func (t *Color) Eval(scope Scope) (Token, error)
- func (t *Color) EvalLazy(tag FinalTag) (Token, error)
- func (t *Color) FloatValues() (float64, float64, float64, float64)
- func (t *Color) IsPrimitive() bool
- func (a *Color) IsSame(other Token) bool
- func (t *Color) Values() (r, g, b, a int)
- func (t *Color) Write() string
- type Container
- type Dict
- type DictType
- type DumpableData
- type FinalTag
- type Flag
- type Float
- func AssertAnyIntOrFloat(t Token) (*Float, error)
- func AssertFloat(t Token, unit string) (*Float, error)
- func AssertFractionFloat(t Token) (*Float, error)
- func AssertIntOrFloat(t Token) (*Float, error)
- func DictFloat(d KeyDict, x interface{}) (*Float, error)
- func NewValueFloat(value float64, ctx context.Context) *Float
- func NewValueUnitFloat(value float64, unit string, ctx context.Context) *Float
- type Function
- type Indexable
- type Int
- type IntDict
- func (t *IntDict) Copy(ctx context.Context) (Token, error)
- func (t *IntDict) CopyIntDict(ctx context.Context) (*IntDict, error)
- func (t *IntDict) Delete(x interface{})
- func (t *IntDict) Eval(scope Scope) (Token, error)
- func (t *IntDict) EvalLazy(tag FinalTag) (Token, error)
- func (t *IntDict) Get(x interface{}) (Token, bool)
- func (t *IntDict) GetKeyValue(x interface{}) (*Int, Token, bool)
- func (a *IntDict) IsSame(other Token) bool
- func (t *IntDict) Loop(fn func(key *Int, value Token, last bool) error) error
- func (t *IntDict) Set(x_ interface{}, value Token)
- type KeyDict
- type Lazy
- type List
- func AssertList(t Token) (*List, error)
- func DictList(d KeyDict, x interface{}) (*List, error)
- func GolangSliceToList(x []interface{}, ctx context.Context) (*List, error)
- func NewEmptyList(ctx context.Context) *List
- func NewNilList(n int, ctx context.Context) *List
- func NewValuesList(values interface{}, ctx context.Context) *List
- func ToStringList(t_ Token) (*List, error)
- func (t *List) Append(v Token)
- func (t *List) Copy(ctx context.Context) (Token, error)
- func (t *List) CopyList(ctx context.Context) (*List, error)
- func (t *List) Dump(indent string) string
- func (t *List) Eval(scope Scope) (Token, error)
- func (t *List) EvalLazy(tag FinalTag) (Token, error)
- func (t *List) EvalList(scope Scope) (*List, error)
- func (t *List) Get(x interface{}) (Token, error)
- func (t *List) GetStrings() ([]string, error)
- func (t *List) GetTokens() []Token
- func (a *List) IsSame(other Token) bool
- func (t *List) Len() int
- func (t *List) Loop(fn func(i int, value Token, last bool) error) error
- func (t *List) LoopValues(fn func(t Token) error) error
- type Null
- type Parens
- func (t *Parens) Alts() []Token
- func (t *Parens) AnyLazy() bool
- func (t *Parens) AssertUniqueNames() error
- func (t *Parens) Dump(indent string) string
- func (t *Parens) Eval(scope Scope) (Token, error)
- func (t *Parens) EvalAsArgs(scope Scope) (*Parens, error)
- func (t *Parens) EvalAsArgsLazy(tag FinalTag) (*Parens, error)
- func (t *Parens) EvalLazy(tag FinalTag) (Token, error)
- func (t *Parens) IsSame(other_ Token) bool
- func (t *Parens) Len() int
- func (t *Parens) Loop(fn func(i int, value Token, alt Token) error) error
- func (t *Parens) ToRawDict() *RawDict
- func (t *Parens) Values() []Token
- type Primitive
- type RawDict
- func AssertRawDict(t_ Token) (*RawDict, error)
- func DictRawDict(d KeyDict, x interface{}) (*RawDict, error)
- func GolangStringMapToRawDict(m map[string]interface{}, ctx context.Context) (*RawDict, error)
- func NewEmptyRawDict(ctx context.Context) *RawDict
- func NewValuesRawDict(keys []Token, values []Token, ctx context.Context) *RawDict
- func (t *RawDict) ContainsLazy() bool
- func (t *RawDict) Copy(ctx context.Context) (Token, error)
- func (t *RawDict) Dump(indent string) string
- func (t *RawDict) Eval(scope Scope) (Token, error)
- func (t *RawDict) EvalIntDict(scope Scope) (*IntDict, error)
- func (t *RawDict) EvalLazy(tag FinalTag) (Token, error)
- func (t *RawDict) EvalRawDict(scope Scope) (*RawDict, error)
- func (t *RawDict) EvalRawDictScan(scope Scope, scanFn func(Token, Token) error) (*RawDict, error)
- func (t *RawDict) EvalStringDict(scope Scope) (*StringDict, error)
- func (t *RawDict) EvalStringDictScan(scope Scope, scanFn func(*String, Token) error) (*StringDict, error)
- func (t *RawDict) Get(x interface{}) (Token, bool)
- func (t *RawDict) GetKeyValue(x interface{}) (*String, Token, bool)
- func (t *RawDict) IsEmpty() bool
- func (a *RawDict) IsSame(other Token) bool
- func (t *RawDict) Len() int
- func (t *RawDict) Loop(fn func(key Token, value Token, last bool) error) error
- func (t *RawDict) LoopValues(fn func(t Token) error) error
- func (t *RawDict) Set(key Token, value Token)
- func (t *RawDict) ToIntDict() (*IntDict, error)
- func (t *RawDict) ToStringDict() (*StringDict, error)
- type RawKeyDict
- type Scope
- type String
- func AssertString(t Token) (*String, error)
- func AssertWord(t Token) (*String, error)
- func DictString(d KeyDict, x interface{}) (*String, error)
- func NewDummyContextString(value string) *String
- func NewString(value string, ctx context.Context) (*String, error)
- func NewValueString(value string, ctx context.Context) *String
- func (t *String) Dump(indent string) string
- func (t *String) Eval(scope Scope) (Token, error)
- func (t *String) EvalLazy(tag FinalTag) (Token, error)
- func (t *String) InnerContext() context.Context
- func (a *String) IsSame(other Token) bool
- func (t *String) Len() int
- func (t *String) TrimLeft(prefix string) *String
- func (t *String) Value() string
- func (t *String) Write() string
- type StringDict
- func AssertStringDict(t Token) (*StringDict, error)
- func DictStringDict(d KeyDict, x interface{}) (*StringDict, error)
- func GolangStringMapToStringDict(m map[string]interface{}, ctx context.Context) (*StringDict, error)
- func NewEmptyStringDict(ctx context.Context) *StringDict
- func ToStringDict(t Token) (*StringDict, error)
- func (t *StringDict) AssertOnlyValidKeys(validKeys []string) error
- func (t *StringDict) Copy(ctx context.Context) (Token, error)
- func (t *StringDict) CopyStringDict(ctx context.Context) (*StringDict, error)
- func (t *StringDict) Delete(x interface{})
- func (t *StringDict) Eval(scope Scope) (Token, error)
- func (t *StringDict) EvalLazy(tag FinalTag) (Token, error)
- func (t *StringDict) Get(x interface{}) (Token, bool)
- func (t *StringDict) GetKeyValue(x interface{}) (*String, Token, bool)
- func (a *StringDict) IsSame(other Token) bool
- func (t *StringDict) Loop(fn func(key *String, value Token, last bool) error) error
- func (t *StringDict) MapStringKeys(fn func(k string) string) (*StringDict, error)
- func (t *StringDict) Set(x_ interface{}, value Token)
- func (t *StringDict) ToRaw() *RawDict
- func (t *StringDict) ToString(indent string, nl string) (string, error)
- func (t *StringDict) ToStringMap() (map[string]string, error)
- type Tag
- func NewDirectiveTag(name string, attr *RawDict, children []*Tag, ctx context.Context) *Tag
- func NewScriptTag(name string, attr *RawDict, text string, textCtx, ctx context.Context) *Tag
- func NewTag(name string, attr *RawDict, children []*Tag, ctx context.Context) *Tag
- func NewTextTag(text string, ctx context.Context) *Tag
- func (t *Tag) AppendChild(c *Tag) error
- func (t *Tag) AssertEmpty() error
- func (t *Tag) AssertNoAttributes() error
- func (t *Tag) Attributes(posNames []string) (*StringDict, error)
- func (t *Tag) Children() []*Tag
- func (t *Tag) Dump(indent string) string
- func (t *Tag) Eval(scope Scope) (Token, error)
- func (t *Tag) IsDirective() bool
- func (t *Tag) IsEmpty() bool
- func (t *Tag) IsSame(other Token) bool
- func (t *Tag) IsScript() bool
- func (t *Tag) IsText() bool
- func (t *Tag) Name() string
- func (t *Tag) RawAttributes() *RawDict
- func (t *Tag) Text() string
- func (t *Tag) TextContext() context.Context
- type Token
- type TokenData
Constants ¶
This section is empty.
Variables ¶
var PX_PER_REM = 0
var (
VERBOSITY = 0
)
Functions ¶
func AssertFlag ¶
func DictHasFlag ¶
func IsAnyFunction ¶
func IsContainer ¶
func IsFalseBool ¶
func IsFunction ¶
func IsIndexable ¶
func IsPrimitive ¶
func IsStringDict ¶
func IsStringList ¶
func IsTrueBool ¶
func ListToString ¶ added in v0.4.0
func MergeContexts ¶
Types ¶
type Bool ¶
type Bool struct { TokenData // contains filtered or unexported fields }
func AssertBool ¶
func (*Bool) IsPrimitive ¶
type Color ¶
type Color struct { TokenData // contains filtered or unexported fields }
func AssertColor ¶
func (*Color) IsPrimitive ¶
type Container ¶
type Container interface { Token Len() int Copy(ctx context.Context) (Token, error) LoopValues(func(Token) error) error // indices in list or keys dict are ignored }
func AssertContainer ¶
type Dict ¶
func AssertDict ¶
type DumpableData ¶
type DumpableData struct {
// contains filtered or unexported fields
}
func NewDumpableData ¶
func NewDumpableData(name string) DumpableData
func (*DumpableData) Dump ¶
func (t *DumpableData) Dump(indent string) string
type Float ¶
type Float struct { TokenData // contains filtered or unexported fields }
func AssertAnyIntOrFloat ¶
can contain units, ints converted to non-unit float
func AssertFractionFloat ¶
func NewValueUnitFloat ¶
type Function ¶
type Function struct { TokenData // contains filtered or unexported fields }
func AssertFunction ¶
func NewValueFunction ¶
type Indexable ¶
implemented specifically by directives.PStyle TODO: should this be implemented by RawDict, List etc? (right Get() for those containers is a little different)
func AssertIndexable ¶
type Int ¶
type Int struct { TokenData // contains filtered or unexported fields }
distinct from Float because it is used for indexing in lists
type IntDict ¶
type IntDict struct {
RawDict
}
IntDict is always the result of an evaluation
func AssertIntDict ¶
func DictIntDict ¶
func NewEmptyIntDict ¶
type KeyDict ¶
type KeyDict interface { Dict Get(key interface{}) (Token, bool) Set(key interface{}, value Token) Delete(key interface{}) }
func AssertKeyDict ¶
func DictKeyDict ¶
type Lazy ¶ added in v0.2.0
type Lazy struct { TokenData // contains filtered or unexported fields }
type List ¶
type List struct { TokenData // contains filtered or unexported fields }
func AssertList ¶
func GolangSliceToList ¶
func NewEmptyList ¶
func NewValuesList ¶
func ToStringList ¶
func (*List) GetStrings ¶
ignore first null to accomodate enum attrs
type Parens ¶
type Parens struct { TokenData // contains filtered or unexported fields }
func AssertParens ¶
func NewParensInterf ¶ added in v0.2.0
func (*Parens) AssertUniqueNames ¶ added in v0.2.0
func (*Parens) EvalAsArgs ¶ added in v0.2.0
func (*Parens) EvalAsArgsLazy ¶ added in v0.2.0
type RawDict ¶
type RawDict struct { TokenData // contains filtered or unexported fields }
unevaluated dict, when evaluated becomes IntDict or StringDict
func AssertRawDict ¶
func DictRawDict ¶
func NewEmptyRawDict ¶
func NewValuesRawDict ¶
func (*RawDict) ContainsLazy ¶ added in v0.4.0
func (*RawDict) EvalRawDictScan ¶
func (*RawDict) EvalStringDict ¶
func (t *RawDict) EvalStringDict(scope Scope) (*StringDict, error)
func (*RawDict) EvalStringDictScan ¶
func (*RawDict) ToStringDict ¶
func (t *RawDict) ToStringDict() (*StringDict, error)
without evaluation
type RawKeyDict ¶
type RawKeyDict struct {
RawDict
}
type String ¶
type String struct { TokenData // contains filtered or unexported fields }
func AssertString ¶
func AssertWord ¶ added in v0.2.0
func DictString ¶
func NewDummyContextString ¶
func (*String) InnerContext ¶
type StringDict ¶
type StringDict struct {
RawDict
}
func AssertStringDict ¶
func AssertStringDict(t Token) (*StringDict, error)
func DictStringDict ¶
func DictStringDict(d KeyDict, x interface{}) (*StringDict, error)
func GolangStringMapToStringDict ¶
func GolangStringMapToStringDict(m map[string]interface{}, ctx context.Context) (*StringDict, error)
func NewEmptyStringDict ¶
func NewEmptyStringDict(ctx context.Context) *StringDict
func ToStringDict ¶
func ToStringDict(t Token) (*StringDict, error)
func (*StringDict) AssertOnlyValidKeys ¶
func (t *StringDict) AssertOnlyValidKeys(validKeys []string) error
func (*StringDict) CopyStringDict ¶
func (t *StringDict) CopyStringDict(ctx context.Context) (*StringDict, error)
func (*StringDict) Delete ¶
func (t *StringDict) Delete(x interface{})
try to call this as little as possible
func (*StringDict) EvalLazy ¶ added in v0.2.0
func (t *StringDict) EvalLazy(tag FinalTag) (Token, error)
inplace, returns self
func (*StringDict) Get ¶
func (t *StringDict) Get(x interface{}) (Token, bool)
func (*StringDict) GetKeyValue ¶
func (t *StringDict) GetKeyValue(x interface{}) (*String, Token, bool)
func (*StringDict) IsSame ¶
func (a *StringDict) IsSame(other Token) bool
func (*StringDict) MapStringKeys ¶ added in v0.2.0
func (t *StringDict) MapStringKeys(fn func(k string) string) (*StringDict, error)
func (*StringDict) Set ¶
func (t *StringDict) Set(x_ interface{}, value Token)
this is a raw append method, duplication isnt checked, last entries are all that matters anyway
func (*StringDict) ToRaw ¶
func (t *StringDict) ToRaw() *RawDict
func (*StringDict) ToString ¶ added in v0.4.0
func (t *StringDict) ToString(indent string, nl string) (string, error)
func (*StringDict) ToStringMap ¶ added in v0.4.0
func (t *StringDict) ToStringMap() (map[string]string, error)
type Tag ¶
type Tag struct { TokenData // contains filtered or unexported fields }
for text tag 'attr' and 'children' are nil, and 'text' is set for non-text tag 'text' isnt set
func NewDirectiveTag ¶
func NewScriptTag ¶
func (*Tag) AppendChild ¶
func (*Tag) AssertEmpty ¶
func (*Tag) AssertNoAttributes ¶
func (*Tag) Attributes ¶
func (t *Tag) Attributes(posNames []string) (*StringDict, error)