Documentation
¶
Overview ¶
Package repl includes the types and functions for a Read Eval Print Loop.
Index ¶
- Constants
- Variables
- func FindConfigDir() (dir string)
- func GetScope() *slip.Scope
- func Run()
- func RuneWidth(r rune) int
- func Scope() *slip.Scope
- func SetConfigDir(dir string)
- func SetSizer(hs hasSize)
- func Stop()
- func WordMatch(word string) (words []string, lo, hi int)
- func ZeroMods()
- type Ansi
- type ClearHistory
- type ClearStash
- type Completer
- type Completions
- type EditStash
- type Form
- type Help
- type History
- type LineReader
- type NthHistory
- type NthStash
- type Quit
- type Repl
- type ShowHistory
- type ShowStash
- type Stash
- func (s *Stash) Add(form Form)
- func (s *Stash) Append(b []byte, annotate, tight, raw bool, start, end int) []byte
- func (s *Stash) Clear(start, end int)
- func (s *Stash) Cursor() int
- func (s *Stash) Get() (form Form)
- func (s *Stash) LoadExpanded(filename string)
- func (s *Stash) Nth(n int) (form Form)
- func (s *Stash) SearchBack(target string) Form
- func (s *Stash) SearchForward(target string) (form Form)
- func (s *Stash) SetCursor(pos int)
- func (s *Stash) Size() int
- type Termock
- func (tm *Termock) Append(b []byte) []byte
- func (tm *Termock) Equal(other slip.Object) bool
- func (tm *Termock) Eval(s *slip.Scope, depth int) slip.Object
- func (tm *Termock) Hierarchy() []slip.Symbol
- func (tm *Termock) Input(keys ...string)
- func (tm *Termock) Output() string
- func (tm *Termock) Read(p []byte) (n int, err error)
- func (tm *Termock) Simplify() any
- func (tm *Termock) String() string
- func (tm *Termock) Write(p []byte) (n int, err error)
- type UseStash
Constants ¶
const MAX_DIM = 9999
Variables ¶
var ( Pkg = slip.Package{ Name: "repl", Nicknames: []string{}, Doc: "A package for REPL related functions.", PreSet: slip.DefaultPreSet, } // TheHistory is the single global used by readers (editor and // termReader). TheHistory History TheStash Stash )
var ( // Interactive is set to true when the REPL is interactive. Interactive bool // Trace reflects the value of tracing as set on startup. It does no // reflect the current trace state. Trace bool // DebugEditor if set before Run() is called will log keystrokes to // editor.log when using the editor. DebugEditor bool )
Functions ¶
func FindConfigDir ¶ added in v0.9.5
func FindConfigDir() (dir string)
FindConfigDir finds the preferred config directory.
func SetConfigDir ¶
func SetConfigDir(dir string)
SetConfigDir sets the configuration directory for the configuration and history files.
Types ¶
type ClearHistory ¶ added in v0.9.0
ClearHistory represents the clear-history function.
type ClearStash ¶ added in v0.9.0
ClearStash represents the clear-stash function.
type Completer ¶
type Completer struct {
// contains filtered or unexported fields
}
Completer provides completion choices given a partial word. Words are stored in a slice in sorted order to optimize not only the search for a match but for returing a slice of matches.
type Completions ¶ added in v0.9.5
Completions represents the completions function.
type Form ¶
type Form [][]rune
Form is used to represent slip forms as a sequence of lines which are []rune.
type History ¶
type History struct {
Stash
// contains filtered or unexported fields
}
History keeps a history of forms. Previously added Forms are stored in memory and also to a file.
type LineReader ¶
type LineReader struct {
// contains filtered or unexported fields
}
LineReader is an io.Reader that is optimized for reading lines terminated by a newline character.
func NewLineReader ¶
func NewLineReader(r io.Reader, size uint) *LineReader
NewLineReader creates a new LineReader.
func (*LineReader) Read ¶
func (lr *LineReader) Read(p []byte) (n int, err error)
Read into the provided buffer, p.
func (*LineReader) ReadLine ¶
func (lr *LineReader) ReadLine() ([]byte, error)
ReadLine reads a line. The returned line is the internal buffer so should be copied if it needs to be preserved past the next call to the reader.
type NthHistory ¶ added in v0.9.0
NthHistory represents the nth-history function.
type ShowHistory ¶ added in v0.9.0
ShowHistory represents the show-history function.
type Stash ¶ added in v0.9.0
type Stash struct {
// contains filtered or unexported fields
}
Stash is used for history and general use stashes which are a collection of LISP expressions.
func (*Stash) LoadExpanded ¶ added in v0.9.0
LoadExpanded forms from a file and use that file for updates to history.
func (*Stash) SearchBack ¶ added in v0.9.0
SearchBack for a match to the provided target string starting with the cursor position.
func (*Stash) SearchForward ¶ added in v0.9.0
SearchForward for a match to the provided target string starting with the cursor at the start position.
type Termock ¶
type Termock struct {
// contains filtered or unexported fields
}
Termock is a mock terminal for testing the editor.
func NewTermock ¶
NewTermock creates a new Termock with an initial size described by high and wide.
Source Files
¶
- ansi.go
- bindings.go
- clear-history.go
- clear-stash.go
- completer.go
- completions.go
- dirty.go
- doc.go
- edit-stash.go
- editor.go
- form.go
- hassize.go
- help.go
- history.go
- linereader.go
- nth-history.go
- nth-stash.go
- pkg.go
- point.go
- quit.go
- reader.go
- repl.go
- runewidth.go
- show-history.go
- show-stash.go
- stash.go
- termock.go
- termreader.go
- use-stash.go