Documentation
¶
Index ¶
- func RunEnv(env *lisp.LEnv, prompt, cont string, opts ...Option)
- func RunRepl(prompt string, opts ...Option)
- type Option
- func WithBatch(enabled bool) Option
- func WithCompleter(ac readline.AutoCompleter) Option
- func WithDoneCh(ch <-chan struct{}) Option
- func WithEval(expr string) Option
- func WithEvalFunc(fn func(*lisp.LEnv, *lisp.LVal) *lisp.LVal) Option
- func WithInterruptFunc(fn func()) Option
- func WithJSON(enabled bool) Option
- func WithLineHandler(fn func(line string) bool) Option
- func WithPromptFunc(fn func() (string, string)) Option
- func WithRootDir(dir string) Option
- func WithStderr(stderr io.WriteCloser) Option
- func WithStdin(stdin io.ReadCloser) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶ added in v1.16.3
type Option func(*config)
func WithBatch ¶ added in v1.16.14
WithBatch enables batch mode. The readline prompt and terminal manipulation are suppressed and raw lines are read from stdin. Batch mode auto-enables JSON output unless explicitly overridden.
func WithCompleter ¶ added in v1.24.0
func WithCompleter(ac readline.AutoCompleter) Option
WithCompleter replaces the default symbol completer with a custom readline.AutoCompleter. This allows a debug REPL to include debug command names alongside symbol completions.
func WithDoneCh ¶ added in v1.24.0
func WithDoneCh(ch <-chan struct{}) Option
WithDoneCh sets a channel that, when closed, causes RunEnv to exit cleanly. This allows an external controller (e.g., a debug REPL quit command) to stop the REPL without calling os.Exit.
func WithEval ¶ added in v1.16.14
WithEval sets a single expression to evaluate. The REPL evaluates the expression, prints the result, and exits.
func WithEvalFunc ¶ added in v1.24.0
WithEvalFunc replaces the default env.Eval call in the main REPL loop. This allows a debug REPL to use engine.EvalInContext instead.
func WithInterruptFunc ¶ added in v1.24.0
func WithInterruptFunc(fn func()) Option
WithInterruptFunc sets a function called when Ctrl+C is pressed. This allows a debug REPL to request a pause via the debugger engine.
func WithJSON ¶ added in v1.16.14
WithJSON enables JSON output mode. Each evaluation result is emitted as a single-line JSON object to stdout.
func WithLineHandler ¶ added in v1.24.0
WithLineHandler sets a function that intercepts raw input lines before they reach the parser. If it returns true, the line is consumed and not parsed as Lisp. This allows embedding debug commands (step, continue, break, etc.) in a REPL session.
func WithPromptFunc ¶ added in v1.24.0
WithPromptFunc sets a function that returns the primary and continuation prompt strings dynamically. This allows a debug REPL to show state-aware prompts (e.g., "(dbg) " when paused).
func WithRootDir ¶ added in v1.20.0
WithRootDir confines file access to the given directory tree. When empty, the working directory is used as the root.
func WithStderr ¶ added in v1.16.3
func WithStderr(stderr io.WriteCloser) Option
WithStderr allows overriding the output to the REPL.
func WithStdin ¶ added in v1.16.3
func WithStdin(stdin io.ReadCloser) Option
WithStdin allows overriding the input to the REPL.