script: Index | Files | Directories

package script

import ""


Package Files

bool.go collection.go float.go for.go functions.go go.go if.go int.go language.go lists.go loops.go main.go native.go print.go script.go string.go structures.go tables.go types.go value.go var.go


const (
    Equals         = "=="
    LessThan       = "<"
    MoreThan       = ">"
    LessThanEquals = "<="
    MoreThanEquals = ">="

    Plus1  = "++"
    Minus1 = "--"

    PlusEquals     = "+="
    MinusEquals    = "-="
    OverEquals     = "/="
    LeftOverEquals = "%="
    TimesEquals    = "*="

For loop constants.

func GoTypeOf Uses

func GoTypeOf(value Value) reflect.Type

func GoValueOf Uses

func GoValueOf(value Value) interface{}

type AnyBool Uses

type AnyBool interface {
    BoolFromCtx(AnyCtx) Bool

AnyBool is anything that can retrieve a script.Bool.

type AnyCtx Uses

type AnyCtx interface {
    RootCtx() Ctx

type AnyString Uses

type AnyString interface {
    StringFromCtx(AnyCtx) String

AnyString needs to return a String from this package.

type AnyValue Uses

type AnyValue interface {
    ValueFromCtx(AnyCtx) Value

type Argument Uses

type Argument struct {
    Name string

type Bool Uses

type Bool struct {

func (Bool) BoolFromCtx Uses

func (b Bool) BoolFromCtx(AnyCtx) Bool

BoolFromCtx implements AnyBool.

type Collection Uses

type Collection interface {
    Make(Ctx, Collection,

Collection is a collection value.

type Ctx Uses

type Ctx struct {
    // contains filtered or unexported fields

Ctx is the script ctx.

func NewCtx Uses

func NewCtx() Ctx

func (Ctx) Bool Uses

func (q Ctx) Bool(literal bool) Bool

func (Ctx) Break Uses

func (q Ctx) Break()

func (Ctx) DefineFunc Uses

func (q Ctx) DefineFunc(function interface{}, strings ...string)

DefineFunc defines a new function from a *func(...) ...

func (Ctx) DefineType Uses

func (q Ctx) DefineType(metatype EmptyType, reciever ...string)

DefineStruct defines a type with the included methods given a metatype. Takes an optional reciever name.

func (Ctx) Equals Uses

func (q Ctx) Equals(other Int) ForLoopCondition

func (Ctx) EqualsL Uses

func (q Ctx) EqualsL(other int) ForLoopCondition

func (Ctx) For Uses

func (q Ctx) For(set Int, condition ForLoopCondition, action ForLoopAction, f func(Int))

For is a traditional for loop.

func (Ctx) ForL Uses

func (q Ctx) ForL(set int, condition ForLoopCondition, action ForLoopAction, f func(Int))

ForL is the literal version of For.

func (Ctx) ID Uses

func (ctx Ctx) ID(prefix string) string

func (Ctx) If Uses

func (q Ctx) If(condition AnyBool, f func()) *ElseIfChain

func (Ctx) IfL Uses

func (q Ctx) IfL(condition bool, f func()) *ElseIfChain

func (Ctx) Int Uses

func (q Ctx) Int(literal Int

Int returns a new Int from a Go int.

func (Ctx) IntList Uses

func (q Ctx) IntList(elements ...Int) IntList

IntList returns a new array of ints from given Ints.

func (Ctx) IntListL Uses

func (q Ctx) IntListL(elements IntList

IntListL returns a new array of ints from given literal elements.

func (Ctx) IntTable Uses

func (q Ctx) IntTable(elements map[String]Int) IntTable

IntTable returns a new table of ints from given Ints.

func (Ctx) IntTableL Uses

func (q Ctx) IntTableL(elements map[string]int) IntTable

IntTableL returns a new table of ints from given literal elements.

func (Ctx) LeftOverEquals Uses

func (q Ctx) LeftOverEquals(other Int) ForLoopAction

LeftOverEquals forloop action %=

func (Ctx) LeftOverEqualsL Uses

func (q Ctx) LeftOverEqualsL(other int) ForLoopAction

LeftOverEqualsL is the literal version of LeftOverEquals.

func (Ctx) LessThan Uses

func (q Ctx) LessThan(other Int) ForLoopCondition

func (Ctx) LessThanEquals Uses

func (q Ctx) LessThanEquals(other Int) ForLoopCondition

func (Ctx) LessThanEqualsL Uses

func (q Ctx) LessThanEqualsL(other int) ForLoopCondition

func (Ctx) LessThanL Uses

func (q Ctx) LessThanL(other int) ForLoopCondition

LessThanL is the literal version of LessThan.

func (Ctx) Literal Uses

func (q Ctx) Literal(value interface{}) Type

Literal returns the script value of the given Go value.

func (Ctx) Loop Uses

func (q Ctx) Loop(f func())

func (Ctx) Main Uses

func (q Ctx) Main(f func())

Main is the entrypoint to the script.

func (Ctx) Make Uses

func (q Ctx) Make(collection Collection, sizes

Make makes a structured type.

func (Ctx) Minus1 Uses

func (q Ctx) Minus1() ForLoopAction

func (Ctx) MinusEquals Uses

func (q Ctx) MinusEquals(other Int) ForLoopAction

MinusEquals forloop action -=

func (Ctx) MinusEqualsL Uses

func (q Ctx) MinusEqualsL(other int) ForLoopAction

MinusEqualsL is the literal version of MinusEquals.

func (Ctx) MoreThan Uses

func (q Ctx) MoreThan(other Int) ForLoopCondition

func (Ctx) MoreThanEquals Uses

func (q Ctx) MoreThanEquals(other Int) ForLoopCondition

func (Ctx) MoreThanEqualsL Uses

func (q Ctx) MoreThanEqualsL(other int) ForLoopCondition

func (Ctx) MoreThanL Uses

func (q Ctx) MoreThanL(other int) ForLoopCondition

func (Ctx) New Uses

func (q Ctx) New(structures ...EmptyType)

New initialises an empty script.Type derived value.

func (Ctx) Not Uses

func (q Ctx) Not(b Bool) Bool

func (Ctx) OverEquals Uses

func (q Ctx) OverEquals(other Int) ForLoopAction

OverEquals forloop action /=

func (Ctx) OverEqualsL Uses

func (q Ctx) OverEqualsL(other int) ForLoopAction

OverEqualsL is the literal version of OverEquals.

func (Ctx) Plus1 Uses

func (q Ctx) Plus1() ForLoopAction

func (Ctx) PlusEquals Uses

func (q Ctx) PlusEquals(other Int) ForLoopAction

PlusEquals forloop action +=

func (Ctx) PlusEqualsL Uses

func (q Ctx) PlusEqualsL(other int) ForLoopAction

PlusEqualsL is the literal version of PlusEquals.

func (Ctx) Print Uses

func (q Ctx) Print(args ...AnyValue)

Print prints values to Stdout.

func (Ctx) PrintL Uses

func (q Ctx) PrintL(args ...interface{})

PrintL prints literal values to Stdout.

func (Ctx) Return Uses

func (q Ctx) Return(v ...Value)

func (Ctx) RootCtx Uses

func (q Ctx) RootCtx() Ctx

func (Ctx) Set Uses

func (q Ctx) Set(a Value, b Value)

Set sets a value 'a' to be set to value 'b'.

func (Ctx) String Uses

func (q Ctx) String(literal ...string) String

func (Ctx) TimesEquals Uses

func (q Ctx) TimesEquals(other Int) ForLoopAction

TimesEquals forloop action *=

func (Ctx) TimesEqualsL Uses

func (q Ctx) TimesEqualsL(other int) ForLoopAction

TimesEqualsL is the literal version of TimesEquals.

func (Ctx) Var Uses

func (q Ctx) Var(name ...string) Ctx

Var returns a variable with optional name.

func (Ctx) While Uses

func (q Ctx) While(condition Bool, f func())

func (Ctx) WhileL Uses

func (q Ctx) WhileL(condition bool, f func())

type ElseIfChain Uses

type ElseIfChain struct {
    Chain []If
    // contains filtered or unexported fields

func (*ElseIfChain) Else Uses

func (chain *ElseIfChain) Else(f func()) ElseIfEnder

func (*ElseIfChain) ElseIf Uses

func (chain *ElseIfChain) ElseIf(condition Bool, f func()) *ElseIfChain

func (*ElseIfChain) ElseIfL Uses

func (chain *ElseIfChain) ElseIfL(condition bool, f func()) *ElseIfChain

func (*ElseIfChain) End Uses

func (chain *ElseIfChain) End()

type ElseIfEnder Uses

type ElseIfEnder struct {
    ElseIfChain ElseIfChain
    Else        func()

func (ElseIfEnder) End Uses

func (ender ElseIfEnder) End()

type EmptyType Uses

type EmptyType interface {
    // contains filtered or unexported methods

type Field Uses

type Field struct {
    Name string
    Type Value

type Float Uses

type Float struct {

Float is a floating-point number

type ForLoopAction Uses

type ForLoopAction struct {
    Operator string
    Subject  Int

type ForLoopCondition Uses

type ForLoopCondition struct {
    Operator string
    Subject  Int

type Function Uses

type Function struct {
    Name    string
    Args    []Argument
    Returns Value
    Block   func()

type If Uses

type If struct {
    Condition Bool
    Block     func()

type Int Uses

type Int struct {

Int is the default integer type for the language.

func (Int) Equals Uses

func (a Int) Equals(b Int) Bool

func (Int) Plus Uses

func (a Int) Plus(b Int) Int

func (Int) Return Uses

func (a Int) Return(result Int)

func (Int) Set Uses

func (a Int) Set(b Int)

Set sets the integer.

func (Int) SetL Uses

func (a Int) SetL(b int)

Setc sets the integer.

type IntList Uses

type IntList struct {
    L   []Int

    Set func(IntList)

    Index  func(Int) Int
    Mutate func(Int, Int)

IntList is an array of ints.

func (IntList) IndexL Uses

func (array IntList) IndexL(index int) Int

IndexL returns the value at the given literal index in the list.

func (IntList) MutateL Uses

func (array IntList) MutateL(index, mutation int)

MutateL mutates the list with literal values.

type IntTable Uses

type IntTable struct {
    L   map[String]Int

    Set func(IntTable)

    Lookup func(String) Int
    Insert func(String, Int)

IntTable is a table of ints.

func (IntTable) InsertL Uses

func (table IntTable) InsertL(index string, mutation int)

InsertL mutates the list with literal values.

func (IntTable) LookupL Uses

func (table IntTable) LookupL(index string) Int

LookupL returns the value at the given literal index in the list.

type Language Uses

type Language interface {
    Raw(Value) string

    If(If, []If, func())


    Field(Value, string) Result

    RunMethod(Value, string, []Value)
    CallMethod(Value, string, []Value) Result

    DefineVariable(string, Value) Result
    Set(Value, Value)

    Index(Value, Int) Result
    Mutate(Value, Int, Value)

    Lookup(Value, String) Result
    Insert(Value, String, Value)

    For(set Int, condition ForLoopCondition, action ForLoopAction, f func(Int))
    While(Bool, func())

    RunFunction(name string, args []Value)
    CallFunction(name string, args []Value) Result
    Argument(name string, index int) Result

    Plus(Int, Int) Int
    Same(Int, Int) Bool
    Not(Bool) Bool

    Join(String, String) String

Language is a script language implementation.

type List Uses

type List struct {

List type.

func (*List) Make Uses

func (*List) Make(q Ctx, collection Collection, sizes

Make makes a list.

type Native Uses

type Native struct {

Native is a host native type.

type Result Uses

type Result *func() interface{}

type Script Uses

type Script func(Ctx)

Script is a script.

type String Uses

type String struct {

String is a unicode string.

func (String) Join Uses

func (a String) Join(b String) String

func (String) StringFromCtx Uses

func (a String) StringFromCtx(AnyCtx) String

StringFromCtx implements AnyString.

type Struct Uses

type Struct struct {
    Name   string
    Fields []Field

    Reciever string
    Methods  []Function

type Table Uses

type Table struct {

Table type.

func (*Table) Make Uses

func (*Table) Make(q Ctx, collection Collection, sizes

Make makes a table.

type Type Uses

type Type struct {
    Ctx     Ctx
    Runtime *func() interface{}

func NewType Uses

func NewType(q Ctx, runtime func() interface{}) Type

func (Type) Get Uses

func (T Type) Get() interface{}

func (Type) T Uses

func (T Type) T() Type

func (Type) ValueFromCtx Uses

func (T Type) ValueFromCtx(AnyCtx) Value

func (Type) Var Uses

func (T Type) Var(name ...string)

type Value Uses

type Value interface {
    T() Type

type Values Uses

type Values []Value

func (Values) Runtime Uses

func (values Values) Runtime() (result []interface{})

Runtime retrieved the runtime values.

type Variable Uses

type Variable string



Package script imports 5 packages (graph) and is imported by 4 packages. Updated 2020-03-02. Refresh now. Tools for package owners.