parser

package
v0.0.0-...-2d5f3dc Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	Execute(handler Handler)
}

func Parse

func Parse(text string) Command
Example
inputPrint := "print your-string-here"
inputSplit := "split"

cmdPrint := Parse(inputPrint)
cmdSplit := Parse(inputSplit)

var handler Handler
handler.Post(cmdPrint)
handler.Post(cmdSplit)
Output:

type Handler

type Handler interface {
	Post(cmd Command)
}

type PrintCmd

type PrintCmd struct {
	Text string
}

func (*PrintCmd) Execute

func (pc *PrintCmd) Execute(handler Handler)

type SplitCmd

type SplitCmd struct {
	Text      string
	Separator string
}

func (*SplitCmd) Execute

func (sc *SplitCmd) Execute(handler Handler)

Jump to

Keyboard shortcuts

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