Documentation ¶
Overview ¶
Package ngcore presents a Neugram interpreter interface and the associated machinery that depends on the state of the interpreter, such as code completion.
This package is designed for embedding Neugram into a program.
Index ¶
- type Error
- type History
- type Neugram
- type Session
- func (s *Session) Close()
- func (s *Session) Completer(mode, line string, pos int) (prefix string, completions []string, suffix string)
- func (s *Session) Display(w io.Writer, vals []reflect.Value)
- func (s *Session) Exec(src []byte) ([]reflect.Value, error)
- func (s *Session) Run(ctx context.Context, startInShell bool, sigint chan os.Signal) error
- func (s *Session) RunScript(r io.Reader) (parser.ParserState, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type History ¶
type History struct { Name string // path to the shell's history file // contains filtered or unexported fields }
History represents a shell (POSIX, Neugram) history.
type Neugram ¶
type Neugram struct {
// contains filtered or unexported fields
}
func (*Neugram) GetOrNewSession ¶
func (*Neugram) GetSession ¶
type Session ¶
type Session struct { Parser *parser.Parser Program *eval.Program ShellState *shell.State ParserState parser.ParserState // Stdin, Stdout, and Stderr are the stdio to hook up to evaluator. // Nominally Stdout and Stderr are io.Writers. // If these interfaces have the concrete type *os.File the underlying // file descriptor is passed directly to shell jobs. Stdin *os.File Stdout *os.File Stderr *os.File ExecCount int // number of statements executed Liner *liner.State History struct { Ng History Sh History } // contains filtered or unexported fields }
func (*Session) Exec ¶
Exec returns the evaluation of the content of src and an error, if any. If src contains multiple statements, Exec returns the value of the last one.
Click to show internal directories.
Click to hide internal directories.