{"modulePath":"github.com/go-python/gpython","version":"v0.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package repl\n\nRead Eval Print Loop\n\n## Constants\n\n```go\nconst (\n\tNormalPrompt       = \"\u003e\u003e\u003e \"\n\tContinuationPrompt = \"... \"\n)\n```\nPossible prompts for the REPL\n\n## Types\n\n```go\ntype REPL struct {\n\tContext py.Context\n\tModule  *py.Module\n\t// contains filtered or unexported fields\n}\n```\nRepl state\n\n```go\nfunc New(ctx py.Context) *REPL\n```\nNew create a new REPL and initializes the state machine\n\n```go\nfunc (r *REPL) Completer(line string, pos int) (head string, completions []string, tail string)\n```\nWordCompleter 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!!!\".\n\n```go\nfunc (r *REPL) Run(line string)\n```\nRun runs a single line of the REPL\n\n```go\nfunc (r *REPL) SetUI(term UI)\n```\nSetUI initialises the output user interface\n\n```go\ntype UI interface {\n\t// Set the prompt for the start of line\n\tSetPrompt(string)\n\n\t// Print a line of output\n\tPrint(string)\n}\n```\nUI implements the user interface for the REPL\n\n","path":"github.com/go-python/gpython/repl","name":"repl","synopsis":"Read Eval Print Loop","isRedistributable":true}
