Documentation ¶
Index ¶
- Variables
- func Apply(scope *Scope)
- func ComputeBinaryOp(xI, yI interface{}, op token.Token) (interface{}, error)
- func DeAssign(tok token.Token) token.Token
- func Fuzz(data []byte) int
- func Highlight(s string) string
- func NewHistory() (*ioHistory, error)
- func Pry(v ...interface{})
- func StringToType(str string) (reflect.Type, error)
- func Type(t interface{}) reflect.Type
- func ValuesToInterfaces(vals []reflect.Value) []interface{}
- type Defer
- type Func
- type InterpretError
- type JSImporter
- type Package
- type Scope
- func (scope *Scope) CheckStatement(node ast.Node) (errs []error)
- func (scope *Scope) ComputeUnaryOp(xI interface{}, op token.Token) (interface{}, error)
- func (scope *Scope) ConfigureTypes(path string, line int) error
- func (scope *Scope) Defer(d *Defer) error
- func (scope *Scope) ExecuteFunc(funExpr ast.Expr, args []interface{}) (interface{}, error)
- func (scope *Scope) Get(name string) (interface{}, bool)
- func (scope *Scope) GetPointer(name string) (val interface{}, exists bool)
- func (scope *Scope) Interpret(expr ast.Node) (interface{}, error)
- func (scope *Scope) InterpretString(exprStr string) (v interface{}, err error)
- func (scope *Scope) Keys() (keys []string)
- func (scope *Scope) NewChild() *Scope
- func (scope *Scope) ParseString(exprStr string) (ast.Node, int, error)
- func (scope *Scope) Render(x ast.Node) string
- func (scope *Scope) Set(name string, val interface{})
- func (scope *Scope) SuggestionsGoCode(line string, index int) ([]string, error)
- func (s *Scope) SuggestionsPry(line string, index int) ([]string, error)
- func (scope *Scope) TypeCheck() (*types.Info, []error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrChanSendFailed occurs when a channel is full or there are no receivers // available. ErrChanSendFailed = errors.New("failed to send, channel full or no receivers") // ErrBranchBreak is an internal error thrown when a for loop breaks. ErrBranchBreak = errors.New("branch break") // ErrBranchContinue is an internal error thrown when a for loop continues. ErrBranchContinue = errors.New("branch continue") )
var ErrChanRecvFailed = errors.New("receive failed: channel closed")
ErrChanRecvFailed occurs when a channel is closed.
var ErrChanRecvInSelect = errors.New("receive failed: in select")
ErrChanRecvInSelect is an internal error that is used to indicate it's in a select statement.
var ErrDivisionByZero = errors.New("division by zero")
Functions ¶
func ComputeBinaryOp ¶
ComputeBinaryOp executes the corresponding binary operation (+, -, etc) on two interfaces.
func Pry ¶
func Pry(v ...interface{})
Pry does nothing. It only exists so running code without go-pry doesn't throw an error.
func StringToType ¶
StringToType returns the reflect.Type corresponding to the type string provided. Ex: StringToType("int")
func ValuesToInterfaces ¶
ValuesToInterfaces converts a slice of []reflect.Value to []interface{}
Types ¶
type InterpretError ¶
type InterpretError struct {
// contains filtered or unexported fields
}
InterpretError is an error returned by the interpreter and shouldn't be passed to the user or running code.
func Append ¶
func Append(arr interface{}, elems ...interface{}) (interface{}, *InterpretError)
Append is a runtime replacement for the append function
func Close ¶
func Close(t interface{}) (interface{}, *InterpretError)
Close is a runtime replacement for the "close" function.
func Len ¶
func Len(t interface{}) (interface{}, *InterpretError)
Len is a runtime replacement for the len function
func Make ¶
func Make(t interface{}, args ...interface{}) (interface{}, *InterpretError)
Make is a runtime replacement for the make function
func (*InterpretError) Error ¶
func (a *InterpretError) Error() error
type JSImporter ¶
JSImporter contains all the information needed to implement a types.Importer in a javascript environment.
type Scope ¶
type Scope struct { Vals map[string]interface{} Parent *Scope Files map[string]*ast.File sync.Mutex // contains filtered or unexported fields }
Scope is a string-interface key-value pair that represents variables/functions in scope.
func (*Scope) CheckStatement ¶
CheckStatement checks if a statement is type safe
func (*Scope) ComputeUnaryOp ¶
ComputeUnaryOp computes the corresponding unary (+x, -x) operation on an interface.
func (*Scope) ConfigureTypes ¶
ConfigureTypes configures the scope type checker
func (*Scope) ExecuteFunc ¶
func (*Scope) GetPointer ¶
GetPointer walks the scope and finds the pointer to the value of interest
func (*Scope) InterpretString ¶
InterpretString interprets a string of go code and returns the result.
func (*Scope) ParseString ¶
ParseString parses go code into the ast nodes.
func (*Scope) Set ¶
Set walks the scope and sets a value in a parent scope if it exists, else current.
func (*Scope) SuggestionsGoCode ¶
SuggestionsGoCode is a suggestion engine that uses gocode for autocomplete.
func (*Scope) SuggestionsPry ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
safebuffer is a goroutine safe bytes.Buffer.
|
safebuffer is a goroutine safe bytes.Buffer. |