Documentation
¶
Overview ¶
Package brainit a customizable rune interpreter.
Source code and other details for the project are available at GitHub:
https://github.com/rytsh/brainit
Index ¶
- Variables
- type Cset
- type Element
- type Exec
- type Interpreter
- func (i *Interpreter) AddCommand(key rune, fn Exec)
- func (i *Interpreter) AddCommandSet(c Cset)
- func (i *Interpreter) AddLoopCommand(begin rune, end rune, fn Exec)
- func (i *Interpreter) GetValue() rune
- func (i *Interpreter) Init() *Interpreter
- func (i *Interpreter) Interpret(r io.Reader)
- func (i *Interpreter) Next()
- func (i *Interpreter) Prev()
- func (i *Interpreter) SetValue(v rune)
- type LoopKey
- type Memory
Constants ¶
This section is empty.
Variables ¶
var ( ErrExit = errors.New("brainit: exit loop") ErrSkip = errors.New("brainit: not possible case") )
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element struct {
Value interface{}
// contains filtered or unexported fields
}
Element is an struct of duble-linked list.
func (*Element) NewElement ¶
NewElement generate new element and set size of memory.
type Interpreter ¶
type Interpreter struct {
// contains filtered or unexported fields
}
Interpreter is main struct hold all memory, code, executors and stacks.
func NewInterpreter ¶
func NewInterpreter() *Interpreter
NewInterpreter is helps to initialize new interpreter and return it.
func (*Interpreter) AddCommand ¶
func (i *Interpreter) AddCommand(key rune, fn Exec)
AddCommand for record new function to specific key.
func (*Interpreter) AddCommandSet ¶
func (i *Interpreter) AddCommandSet(c Cset)
AddCommandSet for record new command sets
func (*Interpreter) AddLoopCommand ¶
func (i *Interpreter) AddLoopCommand(begin rune, end rune, fn Exec)
AddLoopCommand for record new function to specific loop keys.
func (*Interpreter) GetValue ¶
func (i *Interpreter) GetValue() rune
GetValue is return current value in a current memory.
func (*Interpreter) Init ¶
func (i *Interpreter) Init() *Interpreter
Init is initialize a Interpreter.
func (*Interpreter) SetValue ¶
func (i *Interpreter) SetValue(v rune)
SetValue is setting a value in a current memory.
type Memory ¶
Memory is main struct of linked list.
func NewMemory ¶
func NewMemory(v interface{}) *Memory
NewMemory is a helper function to get a functional memory.
func (*Memory) RemoveUntil ¶
RemoveUntil remove code from front of memory an element.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package commandset is include predefined interpreter commands.
|
Package commandset is include predefined interpreter commands. |