Documentation
¶
Index ¶
- func Format() error
- func FormatFiles(dir string, ext string) error
- func RunPackedBinary()
- type CLICustomHandler
- type CLIDebugInterpreter
- func (i *CLIDebugInterpreter) CanHandle(s string) bool
- func (i *CLIDebugInterpreter) Handle(ot OutputTerminal, line string)
- func (i *CLIDebugInterpreter) Interpret() error
- func (i *CLIDebugInterpreter) LoadInitialFile(tid uint64) error
- func (i *CLIDebugInterpreter) ParseArgs() bool
- func (i *CLIDebugInterpreter) StopDebugServer()
- type CLIInputHandler
- type CLIInterpreter
- func (i *CLIInterpreter) CreateRuntimeProvider(name string) error
- func (i *CLIInterpreter) CreateTerm() error
- func (i *CLIInterpreter) HandleInput(ot OutputTerminal, line string, tid uint64)
- func (i *CLIInterpreter) Interpret(interactive bool) error
- func (i *CLIInterpreter) LoadInitialFile(tid uint64) error
- func (i *CLIInterpreter) LoadStdlibPlugins(interactive bool) error
- func (i *CLIInterpreter) ParseArgs() bool
- type CLIPacker
- type OutputTerminal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatFiles ¶
FormatFiles formats all ECAL files in a given directory with a given ending.
func RunPackedBinary ¶
func RunPackedBinary()
RunPackedBinary runs ECAL code is it has been attached to the currently running binary. Exits if attached ECAL code has been executed.
Types ¶
type CLICustomHandler ¶
type CLICustomHandler interface {
CLIInputHandler
/*
LoadInitialFile clears the global scope and reloads the initial file.
*/
LoadInitialFile(tid uint64) error
}
CLICustomHandler is a handler for custom operations.
type CLIDebugInterpreter ¶
type CLIDebugInterpreter struct {
*CLIInterpreter
DebugServerAddr *string // Debug server address
RunDebugServer *bool // Run a debug server
EchoDebugServer *bool // Echo all input and output of the debug server
Interactive *bool // Flag if the interpreter should open a console in the current tty.
BreakOnStart *bool // Flag if the debugger should stop the execution on start
BreakOnError *bool // Flag if the debugger should stop when encountering an error
LogOut io.Writer // Log output
// contains filtered or unexported fields
}
CLIDebugInterpreter is a commandline interpreter with debug capabilities for ECAL.
func NewCLIDebugInterpreter ¶
func NewCLIDebugInterpreter(i *CLIInterpreter) *CLIDebugInterpreter
NewCLIDebugInterpreter wraps an existing CLIInterpreter object and adds capabilities.
func (*CLIDebugInterpreter) CanHandle ¶
func (i *CLIDebugInterpreter) CanHandle(s string) bool
CanHandle checks if a given string can be handled by this handler.
func (*CLIDebugInterpreter) Handle ¶
func (i *CLIDebugInterpreter) Handle(ot OutputTerminal, line string)
Handle handles a given input string.
func (*CLIDebugInterpreter) Interpret ¶
func (i *CLIDebugInterpreter) Interpret() error
Interpret starts the ECAL code interpreter with debug capabilities.
func (*CLIDebugInterpreter) LoadInitialFile ¶
func (i *CLIDebugInterpreter) LoadInitialFile(tid uint64) error
LoadInitialFile clears the global scope and reloads the initial file.
func (*CLIDebugInterpreter) ParseArgs ¶
func (i *CLIDebugInterpreter) ParseArgs() bool
ParseArgs parses the command line arguments.
func (*CLIDebugInterpreter) StopDebugServer ¶
func (i *CLIDebugInterpreter) StopDebugServer()
StopDebugServer stops the debug server if it was started.
type CLIInputHandler ¶
type CLIInputHandler interface {
/*
CanHandle checks if a given string can be handled by this handler.
*/
CanHandle(s string) bool
/*
Handle handles a given input string.
*/
Handle(ot OutputTerminal, input string)
}
CLIInputHandler is a handler object for CLI input.
type CLIInterpreter ¶
type CLIInterpreter struct {
GlobalVS parser.Scope // Global variable scope
RuntimeProvider *interpreter.ECALRuntimeProvider // Runtime provider of the interpreter
CustomHandler CLICustomHandler
CustomWelcomeMessage string
CustomHelpString string
CustomRules []*engine.Rule
EntryFile string // Entry file for the program
LoadPlugins bool // Flag if stdlib plugins should be loaded
Dir *string // Root dir for interpreter
LogFile *string // Logfile (blank for stdout)
LogLevel *string // Log level string (Debug, Info, Error)
Term termutil.ConsoleLineTerminal
LogOut io.Writer
}
CLIInterpreter is a commandline interpreter for ECAL.
func NewCLIInterpreter ¶
func NewCLIInterpreter() *CLIInterpreter
NewCLIInterpreter creates a new commandline interpreter for ECAL.
func (*CLIInterpreter) CreateRuntimeProvider ¶
func (i *CLIInterpreter) CreateRuntimeProvider(name string) error
CreateRuntimeProvider creates the runtime provider of this interpreter. This function expects Dir, LogFile and LogLevel to be set.
func (*CLIInterpreter) CreateTerm ¶
func (i *CLIInterpreter) CreateTerm() error
CreateTerm creates a new console terminal for stdout.
func (*CLIInterpreter) HandleInput ¶
func (i *CLIInterpreter) HandleInput(ot OutputTerminal, line string, tid uint64)
HandleInput handles input to this interpreter. It parses a given input line and outputs on the given output terminal. Requires a thread ID of the executing thread - use the RuntimeProvider to generate a unique one.
func (*CLIInterpreter) Interpret ¶
func (i *CLIInterpreter) Interpret(interactive bool) error
Interpret starts the ECAL code interpreter. Starts an interactive console in the current tty if the interactive flag is set.
func (*CLIInterpreter) LoadInitialFile ¶
func (i *CLIInterpreter) LoadInitialFile(tid uint64) error
LoadInitialFile clears the global scope and reloads the initial file.
func (*CLIInterpreter) LoadStdlibPlugins ¶
func (i *CLIInterpreter) LoadStdlibPlugins(interactive bool) error
LoadStdlibPlugins load plugins from .ecal.json.
func (*CLIInterpreter) ParseArgs ¶
func (i *CLIInterpreter) ParseArgs() bool
ParseArgs parses the command line arguments. Call this after adding custon flags. Returns true if the program should exit.
type CLIPacker ¶
type CLIPacker struct {
EntryFile string // Entry file for the program
Dir *string // Root dir for interpreter (all files will be collected)
SourceBinary *string // Binary which is used by the packer
TargetBinary *string // Binary which will be build by the packer
LogOut io.Writer
}
CLIPacker is a commandline packing tool for ECAL. This tool can build a self contained executable.
type OutputTerminal ¶
type OutputTerminal interface {
/*
WriteString write a string on this terminal.
*/
WriteString(s string)
}
OutputTerminal is a generic output terminal which can write strings.