mocjson

package module
v0.0.0-...-a3abac1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: MIT Imports: 12 Imported by: 0

README

mocjson-go

Moctane JSON serializer/deserializer for golang.

Documentation

Index

Constants

View Source
const (
	ScannerBufSize       = 1024
	ScannerBufRetainSize = 64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

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

func NewLexer

func NewLexer(r io.Reader) Lexer

func (*Lexer) ExpectBeginArray

func (lx *Lexer) ExpectBeginArray() bool

func (*Lexer) ExpectBeginObject

func (lx *Lexer) ExpectBeginObject() bool

func (*Lexer) ExpectBool

func (lx *Lexer) ExpectBool() (bool, bool)

func (*Lexer) ExpectEOF

func (lx *Lexer) ExpectEOF() bool

func (*Lexer) ExpectEndArray

func (lx *Lexer) ExpectEndArray() bool

func (*Lexer) ExpectEndObject

func (lx *Lexer) ExpectEndObject() bool

func (*Lexer) ExpectNameSeparator

func (lx *Lexer) ExpectNameSeparator() bool

func (*Lexer) ExpectNull

func (lx *Lexer) ExpectNull() bool

func (*Lexer) ExpectNumberBytes

func (lx *Lexer) ExpectNumberBytes() ([]byte, bool)

func (*Lexer) ExpectString

func (lx *Lexer) ExpectString() (string, bool)

func (*Lexer) ExpectUint64

func (lx *Lexer) ExpectUint64() (uint64, bool)

func (*Lexer) ExpectValueSeparator

func (lx *Lexer) ExpectValueSeparator() bool

func (*Lexer) NextTokenType

func (lx *Lexer) NextTokenType() TokenType

type Parser

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

func NewParser

func NewParser(r io.Reader) Parser

func (*Parser) Parse

func (pa *Parser) Parse() (any, error)

func (*Parser) ParseArray

func (pa *Parser) ParseArray() ([]any, error)

func (*Parser) ParseBool

func (pa *Parser) ParseBool() (bool, error)

func (*Parser) ParseFloat64

func (pa *Parser) ParseFloat64() (float64, error)

func (*Parser) ParseNull

func (pa *Parser) ParseNull() (any, error)

func (*Parser) ParseObject

func (pa *Parser) ParseObject() (map[string]any, error)

func (*Parser) ParseRat

func (pa *Parser) ParseRat() (*big.Rat, error)

func (*Parser) ParseSampleObject1

func (pa *Parser) ParseSampleObject1() (SampleObject1, error)

func (*Parser) ParseSampleObject2

func (pa *Parser) ParseSampleObject2() (SampleObject2, error)

func (*Parser) ParseSampleObject2Array

func (pa *Parser) ParseSampleObject2Array() ([]SampleObject2, error)

func (*Parser) ParseString

func (pa *Parser) ParseString() (string, error)

func (*Parser) ParseValue

func (pa *Parser) ParseValue() (any, error)

type SampleObject1

type SampleObject1 struct {
	Boolean      bool            `json:"boolean"`
	Float64      float64         `json:"float64"`
	String       string          `json:"string"`
	Object       map[string]any  `json:"object"`
	Array        []any           `json:"array"`
	Any          any             `json:"any"`
	Object2      SampleObject2   `json:"object2"`
	Object2Array []SampleObject2 `json:"object2_array"`
}

type SampleObject2

type SampleObject2 struct {
	Float64 float64        `json:"float64"`
	String  string         `json:"string"`
	Boolean bool           `json:"boolean"`
	Object  map[string]any `json:"object"`
	Array   []any          `json:"array"`
	Any     any            `json:"any"`
}

type Scanner

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

func NewScanner

func NewScanner(r io.Reader) Scanner

func (*Scanner) BufferedLen

func (sc *Scanner) BufferedLen() int

func (*Scanner) CountASCII

func (sc *Scanner) CountASCII() int

func (*Scanner) CountASCIIZero

func (sc *Scanner) CountASCIIZero() int

func (*Scanner) CountDigit

func (sc *Scanner) CountDigit() int

func (*Scanner) CountHex

func (sc *Scanner) CountHex() int

func (*Scanner) CountMultiByteUTF8

func (sc *Scanner) CountMultiByteUTF8() int

func (*Scanner) CountUnescapedASCII

func (sc *Scanner) CountUnescapedASCII() int

func (*Scanner) CountWhiteSpace

func (sc *Scanner) CountWhiteSpace() int

func (*Scanner) Err

func (sc *Scanner) Err() error

func (*Scanner) Load

func (sc *Scanner) Load() bool

func (*Scanner) Peek

func (sc *Scanner) Peek() byte

func (*Scanner) PeekN

func (sc *Scanner) PeekN(n int) []byte

func (*Scanner) Skip

func (sc *Scanner) Skip(n int)

type TokenType

type TokenType int
const (
	TokenTypeInvalid TokenType = iota
	TokenTypeEOF
	TokenTypeBeginArray
	TokenTypeEndArray
	TokenTypeBeginObject
	TokenTypeEndObject
	TokenTypeNameSeparator
	TokenTypeValueSeparator
	TokenTypeNull
	TokenTypeBool
	TokenTypeNumber
	TokenTypeString
)

Jump to

Keyboard shortcuts

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