interpreter

package
v0.0.0-...-da6c0b5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REPLCmdDoc = REPLCmd(iota)
	REPLCmdHelp
	REPLCmdTypeVal
	REPLCmdPop
	REPLCmdDump
	REPLCmdFile
	REPLCmdVars
	REPLCmdImports
	REPLCmdTypes
	REPLCmdFuncs
	REPLCmdExit
)
View Source
const (
	Import = Type(iota)
	TypeDecl
	FuncDecl
	VarDecl
	Shell
	Print
	Unknown
	Expr
	Stmt
	Empty
)

Variables

This section is empty.

Functions

func ExtractFuncName

func ExtractFuncName(code string) string

func ExtractTypeName

func ExtractTypeName(code string) string

func IsFuncDecl

func IsFuncDecl(code string) bool

func ShouldContinue

func ShouldContinue(code string) (int, bool)

func StringOf

func StringOf(s map[string]string) string

Types

type ImportData

type ImportData struct {
	Path  string
	Alias string
}

func ExtractImportData

func ExtractImportData(im string) []ImportData

func (ImportData) String

func (i ImportData) String() string

type ImportDatas

type ImportDatas []ImportData

func (ImportDatas) AsDump

func (is ImportDatas) AsDump() string

func (ImportDatas) String

func (is ImportDatas) String() string

type Interpreter

type Interpreter struct {
	Writer io.Writer
	// contains filtered or unexported fields
}

func NewSession

func NewSession(workingDirectory string) (*Interpreter, error)

func (*Interpreter) Eval

func (s *Interpreter) Eval(code string) (string, error)

func (*Interpreter) String

func (s *Interpreter) String() string

type REPLCmd

type REPLCmd uint8

func ParseCmd

func ParseCmd(code string) (REPLCmd, string)

type Type

type Type uint8

func Parse

func Parse(code string) (Type, error)

type Var

type Var struct {
	Name  string
	Type  string
	Value string
}

func NewVar

func NewVar(code string) Var

func (Var) String

func (v Var) String() string

type Vars

type Vars map[string]Var

func (Vars) String

func (vs Vars) String() string

Jump to

Keyboard shortcuts

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