jsonc

package
Version: v0.0.0-...-96fdd02 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NonZeroNumbers = "1,2,3,4,5,6,7,8,9"
	Numbers        = "0" + NonZeroNumbers
)

Variables

View Source
var ErrDontAdvance = fmt.Errorf(`do-not-advance`)

Functions

func IsNumber

func IsNumber(value string) bool

Types

type ArrayInternalState

type ArrayInternalState = int

type ArrayState

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

func (*ArrayState) Next

func (a *ArrayState) Next(ru rune, f *Filter) error

func (ArrayState) Type

func (ArrayState) Type() TokenType

type Buffer

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

func NewBuffer

func NewBuffer(reader io.Reader, high int, low int) (b *Buffer)

func (*Buffer) ReadRune

func (b *Buffer) ReadRune() (r rune, size int, err error)

type CommentMultiLineState

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

func (*CommentMultiLineState) Next

func (c *CommentMultiLineState) Next(ru rune, f *Filter) error

func (*CommentMultiLineState) Type

func (c *CommentMultiLineState) Type() TokenType

type CommentState

type CommentState struct{}

func (*CommentState) Next

func (*CommentState) Next(ru rune, f *Filter) error

func (*CommentState) Type

func (c *CommentState) Type() TokenType

type Decoder

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

func NewDecoder

func NewDecoder(r io.Reader, opts ...Options) (*Decoder, error)

func (*Decoder) Decode

func (d *Decoder) Decode(v interface{}) error

type Error

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

func Errorf

func Errorf(formatter string, position int, args ...interface{}) Error

func (Error) Error

func (e Error) Error() string

func (Error) Position

func (e Error) Position() int

type Filter

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

func New

func New(r io.Reader, minimize bool, space string) (*Filter, error)

func NewFilter

func NewFilter(ring *Ring, outMinSize int, format bool, space string) *Filter

func (*Filter) Clear

func (f *Filter) Clear()

func (*Filter) Done

func (f *Filter) Done() bool

func (*Filter) Err

func (f *Filter) Err() error

func (*Filter) Read

func (f *Filter) Read(p []byte) (n int, err error)

type KeyNoQuoteState

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

func (*KeyNoQuoteState) Next

func (k *KeyNoQuoteState) Next(ru rune, f *Filter) error

func (*KeyNoQuoteState) Type

func (o *KeyNoQuoteState) Type() TokenType

type KeyState

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

func (*KeyState) Next

func (k *KeyState) Next(ru rune, f *Filter) error

func (*KeyState) Type

func (o *KeyState) Type() TokenType

type NumberState

type NumberState int
const (
	NumberRoot NumberState = iota
	ZeroStart
	Digit
	PlusMinus
)

type ObjInternalState

type ObjInternalState = int
const (
	ObjIntNextAfterComma ObjInternalState = iota
	ObjIntNext
	ObjInternalKey
	ObjInternalDelimiter
	ObjInternalValue
)
const (
	ArrayIntStart ObjInternalState = iota
	ArrayIntValue
	ArrayIntAfterValue
)

type ObjectState

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

func (*ObjectState) Next

func (o *ObjectState) Next(ru rune, f *Filter) error

func (*ObjectState) Type

func (o *ObjectState) Type() TokenType

type Options

type Options = func(dec Decoder)

type ReadRune

type ReadRune func() (r rune, size int, err error)

type Ring

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

func NewRing

func NewRing(maxSize int, minSize int, readRune ReadRune) (r *Ring, err error)

func (*Ring) Advance

func (r *Ring) Advance() error

func (*Ring) Clear

func (r *Ring) Clear(rr ReadRune) (err error)

func (*Ring) Peek

func (r *Ring) Peek() rune

func (*Ring) Pop

func (r *Ring) Pop() error

func (*Ring) Position

func (r *Ring) Position() int

type RootState

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

func (*RootState) Next

func (r *RootState) Next(ru rune, f *Filter) error

func (*RootState) Type

func (r *RootState) Type() TokenType

type State

type State interface {
	Type() TokenType
	Next(r rune, f *Filter) error
}

type TokenType

type TokenType int
const (
	Root             TokenType = iota // 0
	Object                            // 1
	Key                               // 2
	KeyNoQuote                        // 3
	Value                             // 4
	ValueNoQuote                      // 5
	ValueMultiline                    // 6
	Array                             // 7
	Comment                           // 8
	CommentMultiLine                  // 9
)

type ValueMultilineState

type ValueMultilineState struct{}

func (*ValueMultilineState) Next

func (v *ValueMultilineState) Next(ru rune, f *Filter) error

func (*ValueMultilineState) Type

func (v *ValueMultilineState) Type() TokenType

type ValueNoQuoteState

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

func (*ValueNoQuoteState) Next

func (v *ValueNoQuoteState) Next(ru rune, f *Filter) error

func (*ValueNoQuoteState) Type

func (o *ValueNoQuoteState) Type() TokenType

type ValueState

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

func (*ValueState) Next

func (v *ValueState) Next(ru rune, f *Filter) error

func (*ValueState) Type

func (v *ValueState) Type() TokenType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL