internal

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewParser

func NewParser() (*participle.Parser[REPLDirective], error)

Types

type ExecDirective added in v0.16.0

type ExecDirective struct {
	RuleID int `parser:"'exec' '#'@Int"`
}

type LetDirective

type LetDirective struct {
	Name string `parser:"'let' @Ident"`
	Expr string `parser:"'=' @Any"`
}

type LoadDirective added in v0.16.0

type LoadDirective struct {
	Path string `parser:"'load' @Path"`
}

type Output

type Output interface {
	Print(string, ...any)
	Println(...any)
	PrintResult(string, ref.Val)
	PrintRule(int, proto.Message) error
	PrintJSON(any)
	PrintYAML(proto.Message, int)
	PrintErr(string, error)
}

type PrinterOutput

type PrinterOutput struct {
	*printer.Printer
	// contains filtered or unexported fields
}

func NewPrinterOutput

func NewPrinterOutput(stdout, stderr io.Writer) *PrinterOutput

func (*PrinterOutput) Print

func (po *PrinterOutput) Print(format string, args ...any)

func (*PrinterOutput) PrintErr

func (po *PrinterOutput) PrintErr(msg string, err error)

func (*PrinterOutput) PrintJSON

func (po *PrinterOutput) PrintJSON(obj any)

func (*PrinterOutput) PrintResult

func (po *PrinterOutput) PrintResult(name string, value ref.Val)

func (*PrinterOutput) PrintRule added in v0.16.0

func (po *PrinterOutput) PrintRule(id int, rule proto.Message) error

func (*PrinterOutput) PrintYAML added in v0.16.0

func (po *PrinterOutput) PrintYAML(obj proto.Message, indent int)

type REPL

type REPL struct {
	// contains filtered or unexported fields
}

func NewREPL

func NewREPL(reader *liner.State, output Output) (*REPL, error)

func (*REPL) Loop

func (r *REPL) Loop() error

type REPLDirective

type REPLDirective struct {
	Exit  bool           `parser:"@('q'|'quit'|'exit')"`
	Reset bool           `parser:"| @'reset'"`
	Vars  bool           `parser:"| @'vars'"`
	Help  bool           `parser:"| @('h' | 'help')"`
	Rules bool           `parser:"| @'rules'"`
	Load  *LoadDirective `parser:"| @@"`
	Exec  *ExecDirective `parser:"| @@"`
	Let   *LetDirective  `parser:"| @@"`
}

Jump to

Keyboard shortcuts

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