parse

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidPositionError = errors.New("invalid position")

Functions

func Split

func Split(s string) ([]string, error)

Types

type DefaultState added in v1.6.0

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

func NewState added in v1.6.0

func NewState(args []string) *DefaultState

func (*DefaultState) Advance added in v1.6.0

func (s *DefaultState) Advance() bool

func (*DefaultState) ArgAt added in v1.6.0

func (s *DefaultState) ArgAt(pos int) (string, error)

func (*DefaultState) Args added in v1.6.0

func (s *DefaultState) Args() []string

func (*DefaultState) CurrentArg added in v1.6.0

func (s *DefaultState) CurrentArg() string

func (*DefaultState) CurrentPos added in v1.6.0

func (s *DefaultState) CurrentPos() int

func (*DefaultState) InsertArgsAt added in v1.6.0

func (s *DefaultState) InsertArgsAt(pos int, newArgs ...string)

func (*DefaultState) Len added in v1.6.0

func (s *DefaultState) Len() int

func (*DefaultState) Peek added in v1.6.0

func (s *DefaultState) Peek() string

func (*DefaultState) ReplaceArgs added in v1.6.0

func (s *DefaultState) ReplaceArgs(newArgs ...string)

func (*DefaultState) SetPos added in v1.6.0

func (s *DefaultState) SetPos(pos int)

func (*DefaultState) SkipCurrent added in v1.6.0

func (s *DefaultState) SkipCurrent()

type State added in v1.6.0

type State interface {
	CurrentPos() int
	SetPos(pos int)
	SkipCurrent()
	Args() []string
	InsertArgsAt(pos int, newArgs ...string)
	ReplaceArgs(newArgs ...string)
	CurrentArg() string
	Peek() string
	Advance() bool // New method for advancing to the next argument
	Len() int      // Gets the length of the argument list
}

Jump to

Keyboard shortcuts

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