states

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package states contains a state machine for writing your own Generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Machine

type Machine struct {
	Stack []State
	State State
	// contains filtered or unexported fields
}

func (*Machine) Depth

func (sm *Machine) Depth() uint

func (*Machine) Expect

func (sm *Machine) Expect(oneOf ...State)

func (*Machine) ExpectArray

func (sm *Machine) ExpectArray()

func (*Machine) ExpectEnd

func (sm *Machine) ExpectEnd()

func (*Machine) ExpectKey

func (sm *Machine) ExpectKey()

func (*Machine) ExpectRoot

func (sm *Machine) ExpectRoot()

func (*Machine) ExpectValue

func (sm *Machine) ExpectValue()

func (*Machine) Next

func (sm *Machine) Next()

func (*Machine) Pop

func (sm *Machine) Pop()

func (*Machine) Push

func (sm *Machine) Push(next State)

func (*Machine) Reset

func (sm *Machine) Reset()

type State

type State byte
const (
	Root State = iota
	ObjectFirstKey
	ObjectNextKey
	ObjectFirstValue
	ObjectNextValue
	ArrayFirstValue
	ArrayNextValue
	End
)

func (State) Expect

func (state State) Expect(oneOf ...State)

func (State) GoString

func (state State) GoString() string

func (State) In

func (state State) In(oneOf ...State) bool

func (State) IsValid

func (state State) IsValid() bool

func (State) Next

func (state State) Next() State

func (State) String

func (state State) String() string

func (State) Unexpected

func (state State) Unexpected(oneOf ...State) error

Jump to

Keyboard shortcuts

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