xin

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatError

func FormatError(e InterpreterError) string

func NewVm

func NewVm() (*Vm, InterpreterError)

Types

type FormValue

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

func (FormValue) Equal

func (v FormValue) Equal(o Value) bool

func (FormValue) Repr

func (v FormValue) Repr() string

func (FormValue) String

func (v FormValue) String() string

type FracValue

type FracValue float64

func (FracValue) Equal

func (v FracValue) Equal(o Value) bool

func (FracValue) Repr

func (v FracValue) Repr() string

func (FracValue) String

func (v FracValue) String() string

type Frame

type Frame struct {
	Vm     *Vm
	Scope  map[string]Value
	Parent *Frame
	// contains filtered or unexported fields
}

func (*Frame) Get

func (fr *Frame) Get(name string, pos position) (Value, InterpreterError)

func (*Frame) Put

func (fr *Frame) Put(name string, val Value)

func (*Frame) String

func (fr *Frame) String() string

type IncorrectNumberOfArgsError

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

func (IncorrectNumberOfArgsError) Error

type IntValue

type IntValue int64

func (IntValue) Equal

func (v IntValue) Equal(o Value) bool

func (IntValue) Repr

func (v IntValue) Repr() string

func (IntValue) String

func (v IntValue) String() string

type InterpreterError

type InterpreterError interface {
	error
	// contains filtered or unexported methods
}

type InvalidBindError

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

func (InvalidBindError) Error

func (e InvalidBindError) Error() string

type InvalidFormError

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

func (InvalidFormError) Error

func (e InvalidFormError) Error() string

type InvalidIfConditionError

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

func (InvalidIfConditionError) Error

func (e InvalidIfConditionError) Error() string

type InvalidIfError

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

func (InvalidIfError) Error

func (e InvalidIfError) Error() string

type InvalidImportError

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

func (InvalidImportError) Error

func (e InvalidImportError) Error() string

type InvalidStreamCallbackError

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

func (InvalidStreamCallbackError) Error

type LazyValue

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

func (LazyValue) Equal

func (v LazyValue) Equal(o Value) bool

func (LazyValue) Repr

func (v LazyValue) Repr() string

func (LazyValue) String

func (v LazyValue) String() string

type MapValue

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

func NewMapValue

func NewMapValue() MapValue

func (MapValue) Equal

func (v MapValue) Equal(o Value) bool

func (MapValue) Repr

func (v MapValue) Repr() string

func (MapValue) String

func (v MapValue) String() string

type MismatchedArgumentsError

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

func (MismatchedArgumentsError) Error

func (e MismatchedArgumentsError) Error() string

type NativeFormValue

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

func (NativeFormValue) Equal

func (v NativeFormValue) Equal(o Value) bool

func (NativeFormValue) Repr

func (v NativeFormValue) Repr() string

func (NativeFormValue) String

func (v NativeFormValue) String() string

type RuntimeError

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

func (RuntimeError) Error

func (e RuntimeError) Error() string

type StreamValue

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

func NewStream

func NewStream() StreamValue

func (StreamValue) Equal

func (v StreamValue) Equal(o Value) bool

func (StreamValue) Repr

func (v StreamValue) Repr() string

func (StreamValue) String

func (v StreamValue) String() string

type StringValue

type StringValue []byte

func (StringValue) Equal

func (v StringValue) Equal(o Value) bool

func (StringValue) Repr

func (v StringValue) Repr() string

func (StringValue) String

func (v StringValue) String() string

type UndefinedNameError

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

func (UndefinedNameError) Error

func (e UndefinedNameError) Error() string

type UnexpectedCharacterError

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

func (UnexpectedCharacterError) Error

func (e UnexpectedCharacterError) Error() string

type UnexpectedEndingError

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

func (UnexpectedEndingError) Error

func (e UnexpectedEndingError) Error() string

type UnexpectedTokenError

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

func (UnexpectedTokenError) Error

func (e UnexpectedTokenError) Error() string

type Value

type Value interface {
	// String is stable, string representation of a Xin value
	// that can be used to back the to-string type conversion of values
	String() string

	// Repr is an unstable, human-readable representation of Xin values used for
	// debugging and the repl, should not be considered a stable API
	// to be used in the language internally.
	Repr() string

	Equal(Value) bool
}

Value represents a value in the Xin runtime.

It is important that Value types are: (1) freely copyable without losing information

(i.e. copying Values around should not alter language semantics)

(2) hashable, for use as a MapValue key. StringValue is a special

exception to this case, where a proxy Value type is used instead
which is hashable.

type VecValue

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

func NewVecValue

func NewVecValue(items []Value) VecValue

func (VecValue) Equal

func (v VecValue) Equal(o Value) bool

func (VecValue) Repr

func (v VecValue) Repr() string

func (VecValue) String

func (v VecValue) String() string

type Vm

type Vm struct {
	Frame *Frame

	sync.Mutex
	// contains filtered or unexported fields
}

func (*Vm) Eval

func (vm *Vm) Eval(path string, r io.Reader) (Value, InterpreterError)

func (*Vm) Exec

func (vm *Vm) Exec(path string) InterpreterError

Jump to

Keyboard shortcuts

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