functions

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewLambdaScope func(fnScope tokens.Scope, callerScope tokens.Scope) LambdaScope

must be registered by directives package

Functions

func Add

func Add(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func And

func And(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Caps

func Caps(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

smart capitaloization of titles ref:https://capitalizemytitle.com/#capitalizationrules

func Ceil

func Ceil(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func CompleteArgs added in v0.2.0

func CompleteArgs(args *tokens.Parens, interf *tokens.Parens) ([]tokens.Token, error)

it is up to the caller to have "args" or "interf" be evaluated at this point

func CompleteArgsAndFillScope added in v0.2.0

func CompleteArgsAndFillScope(scope LambdaScope, args_ *tokens.Parens, interf *tokens.Parens) error

func Contains

func Contains(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Cos

func Cos(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Darken

func Darken(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Dict

func Dict(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Dir

func Dir(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Div

func Div(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Dump

func Dump(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func EQ

func EQ(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Error

func Error(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Eval

func Eval(scope tokens.Scope, key string, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func EvalFun

func EvalFun(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Filter

func Filter(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Find added in v0.2.0

func Find(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Float

func Float(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Floor

func Floor(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func GE

func GE(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func GT

func GT(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Get

func Get(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func HasFun

func HasFun(key string) bool

func IfElse

func IfElse(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

3, or 5, or 7 etc. (last must always be else block

func Int

func Int(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Invert

func Invert(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsAnonFun

func IsAnonFun(t tokens.Token) bool

func IsBool

func IsBool(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsColor

func IsColor(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsDict

func IsDict(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsFloat

func IsFloat(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsFun

func IsFun(t tokens.Token) bool

func IsFunction

func IsFunction(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsInt

func IsInt(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsList

func IsList(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsNull

func IsNull(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsSame

func IsSame(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsString

func IsString(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsType

func IsType(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func IsVar

func IsVar(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

everything except null and undefined

func Items

func Items(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Join

func Join(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Keys

func Keys(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func LE

func LE(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func LT

func LT(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Len

func Len(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Lighten

func Lighten(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func List

func List(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func ListValidNames

func ListValidNames() string

func Lower

func Lower(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Map

func Map(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Max

func Max(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func MaxScreenHeight

func MaxScreenHeight(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func MaxScreenWidth

func MaxScreenWidth(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Merge

func Merge(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func MergeStringDictsInplace

func MergeStringDictsInplace(scope tokens.Scope, res *tokens.StringDict, new *tokens.StringDict, ctx context.Context) error

func Min

func Min(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func MinScreenHeight

func MinScreenHeight(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func MinScreenWidth

func MinScreenWidth(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Mix

func Mix(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Mod

func Mod(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

a%b -> remainder

func Mul

func Mul(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func NE

func NE(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Neg

func Neg(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func NewBinaryInterface added in v0.2.0

func NewBinaryInterface(ctx context.Context) *tokens.Parens

func NewFun

func NewFun(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

eg. function([args..], [body1;body2;body3][-1])

func NewInterface added in v0.2.0

func NewInterface(names []string, ctx context.Context) *tokens.Parens

func NewUnaryInterface added in v0.2.0

func NewUnaryInterface(ctx context.Context) *tokens.Parens

func Not

func Not(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Or

func Or(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Path

func Path(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Pi

func Pi(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Pow

func Pow(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Px

func Px(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Rad

func Rad(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Rand

func Rand(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Replace

func Replace(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Reverse added in v0.2.0

func Reverse(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Round

func Round(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func SVGPathPos

func SVGPathPos(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Seq

func Seq(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

seq(last) // starting at 0 and going up seq(first, last) // increasing seq(first, incr, last) (similar to [first:incr:last] in formula form)

func Sin

func Sin(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Slice

func Slice(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Sort

func Sort(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Split

func Split(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Sqrt

func Sqrt(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Str

func Str(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Sub

func Sub(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Tan

func Tan(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func UniqueID

func UniqueID(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Upper

func Upper(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Values

func Values(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Xor

func Xor(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func Year

func Year(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

Types

type AnonFun

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

func NewAnonFun

func NewAnonFun(scope tokens.Scope, args *tokens.Parens, value tokens.Token, ctx context.Context) *AnonFun

func (*AnonFun) Context

func (f *AnonFun) Context() context.Context

func (*AnonFun) Dump

func (f *AnonFun) Dump(indent string) string

func (*AnonFun) Eval

func (f *AnonFun) Eval(scope tokens.Scope) (tokens.Token, error)

func (*AnonFun) EvalFun

func (f *AnonFun) EvalFun(scope tokens.Scope, args_ *tokens.Parens, ctx context.Context) (tokens.Token, error)

func (*AnonFun) EvalLazy added in v0.2.0

func (f *AnonFun) EvalLazy(tag tokens.FinalTag) (tokens.Token, error)

func (*AnonFun) IsSame

func (a *AnonFun) IsSame(other tokens.Token) bool

func (*AnonFun) Len

func (f *AnonFun) Len() int

type BuiltInFun

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

func NewBuiltInFun

func NewBuiltInFun(name string, ctx context.Context) *BuiltInFun

func (*BuiltInFun) Context

func (f *BuiltInFun) Context() context.Context

func (*BuiltInFun) Dump

func (f *BuiltInFun) Dump(indent string) string

func (*BuiltInFun) Eval

func (f *BuiltInFun) Eval(scope tokens.Scope) (tokens.Token, error)

func (*BuiltInFun) EvalFun

func (f *BuiltInFun) EvalFun(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

func (*BuiltInFun) EvalLazy added in v0.2.0

func (f *BuiltInFun) EvalLazy(tag tokens.FinalTag) (tokens.Token, error)

func (*BuiltInFun) IsSame

func (a *BuiltInFun) IsSame(other tokens.Token) bool

func (*BuiltInFun) Len

func (f *BuiltInFun) Len() int

type BuiltinFunction

type BuiltinFunction func(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)

args are evaluated outside PreEval functions, but scope is needed to check Permissive()

type Fun

type Fun interface {
	tokens.Token
	EvalFun(scope tokens.Scope, args *tokens.Parens, ctx context.Context) (tokens.Token, error)
	Len() int // number of arguments, -1: variable
}

func AssertFun

func AssertFun(t tokens.Token) (Fun, error)

type LambdaScope

type LambdaScope interface {
	Eval(key string, args *tokens.Parens, ctx context.Context) (tokens.Token, error)
	Permissive() bool
	SetVar(name string, v Var) error
}

type Var

type Var struct {
	Value    tokens.Token
	Constant bool
	Auto     bool
	Imported bool
	Exported bool
	Ctx      context.Context
}

func (Var) ToJSTypeValue

func (v Var) ToJSTypeValue() (string, string, error)

Jump to

Keyboard shortcuts

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