Documentation ¶
Overview ¶
COPIED FROM robpike.io/ivy/value/value.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context interface { // Lookup returns the configuration state for evaluation. Config() *config.Config // Lookup returns the value of a symbol. Lookup(name string) Value // Assign assigns the variable the value. The variable must // be defined either in the current function or globally. // Inside a function, new variables become locals. Assign(name string, value Value) // Eval evaluates a list of expressions. Eval(exprs []Expr) []Value // EvalUnaryFn evaluates a unary operator. EvalUnary(op string, right Value) Value // EvalBinary evaluates a binary operator. EvalBinary(left Value, op string, right Value) Value // UserDefined reports whether the specified op is user-defined. UserDefined(op string, isBinary bool) bool }
Context is the execution context for evaluation. The only implementation is ../exec/Context, but the interface is defined separately, here, because of the dependence on Expr and the import cycle that would otherwise result.
type Expr ¶
type Expr interface { // ProgString returns the unambiguous representation of the // expression to be used in program source. ProgString() string }
Expr is the interface for a parsed expression.
type Value ¶
type Value interface { // String is for internal debugging only. It uses default configuration // and puts parentheses around every value so it's clear when it is used. // All user output should call Sprint instead. String() string Sprint(*config.Config) string Eval(Context) Value // ProgString is like String, but suitable for program listing. // For instance, it ignores the user format for numbers and // puts quotes on chars, guaranteeing a correct representation. ProgString() string }
Click to show internal directories.
Click to hide internal directories.