repl

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: BSD-3-Clause Imports: 5 Imported by: 3

Documentation

Overview

Read Eval Print Loop

Index

Constants

View Source
const (
	NormalPrompt       = ">>> "
	ContinuationPrompt = "... "
)

Possible prompts for the REPL

Variables

This section is empty.

Functions

This section is empty.

Types

type REPL added in v0.0.3

type REPL struct {
	Context py.Context
	Module  *py.Module
	// contains filtered or unexported fields
}

Repl state

func New added in v0.0.3

func New(ctx py.Context) *REPL

New create a new REPL and initializes the state machine

func (*REPL) Completer added in v0.0.3

func (r *REPL) Completer(line string, pos int) (head string, completions []string, tail string)

WordCompleter takes the currently edited line with the cursor position and returns the completion candidates for the partial word to be completed. If the line is "Hello, wo!!!" and the cursor is before the first '!', ("Hello, wo!!!", 9) is passed to the completer which may returns ("Hello, ", {"world", "Word"}, "!!!") to have "Hello, world!!!".

func (*REPL) Run added in v0.0.3

func (r *REPL) Run(line string)

Run runs a single line of the REPL

func (*REPL) SetUI added in v0.0.3

func (r *REPL) SetUI(term UI)

SetUI initialises the output user interface

type UI added in v0.0.3

type UI interface {
	// Set the prompt for the start of line
	SetPrompt(string)

	// Print a line of output
	Print(string)
}

UI implements the user interface for the REPL

Directories

Path Synopsis
Read Eval Print Loop for CLI
Read Eval Print Loop for CLI

Jump to

Keyboard shortcuts

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