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: 7 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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