Documentation ¶
Overview ¶
Package repl は対話モード(REPL)時に使われるパッケージです。
// 標準モジュールの読み込み mods := modules.GetModuleMapAll() // REPL インスタンスの作成 tempREPL := repl.REPL{ Prompt: "> ", // 対話モード(REPL)時のプロンプト QuitWord: "bye", // 対話モード(REPL)時の終了キーワード } // REPL の起動(実行) tempREPL.Run(mods, os.Stdin, os.Stdout)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interactor ¶
type Interactor struct { StdIn *bufio.Scanner StdOut *io.Writer FileSet *parser.SourceFileSet Modules *tengo.ModuleMap SymbolTable *tengo.SymbolTable Globals []tengo.Object Constants []tengo.Object }
Interactor は対話モード(REPL)時のループ処理で再利用されるポインタや オブジェクトを保持します。 主に InteractREPL() の引数を少なく(すっきり)させるために使われます。
type REPL ¶
REPL は対話モード(REPL)でスクリプトを実行するためのオブジェクトを定義します。
func (*REPL) InteractREPL ¶
func (r *REPL) InteractREPL(interactor *Interactor) (doContinue, doReturn bool)
InteractREPL は対話モード(REPL)時の、ユーザーの 1 アクションごとの処理です。 標準入力(Interactor オブジェクトの StdIn フィールド)からコードを受け取り、 実行します。
Click to show internal directories.
Click to hide internal directories.