parsing

package
v0.0.0-...-3cd2f5a Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EOF byte = 255
)

Variables

This section is empty.

Functions

func EncodeSymbol

func EncodeSymbol(sym byte, count uint64, content []byte) (symbol []byte)

func EncodeSymbolForFunc

func EncodeSymbolForFunc(fn func() (int, byte, uint64, []byte, error)) (int, []byte, error)

func Eof

func Eof() (int, byte, uint64, []byte, error)

func Err

func Err(err error) (int, byte, uint64, []byte, error)

func GetPossibleDouble

func GetPossibleDouble(r rune, n1 int, sym byte, data []byte, atEOF bool) (advance int, symbol []byte, err error)

func GetRune

func GetRune(data []byte, atEOF bool) (r rune, n int, err error)

func GetSeq

func GetSeq(sym byte, fn func(r rune) bool, data []byte, isEOF bool) (advance int, symbol []byte, err error)

func GetSeq1

func GetSeq1(sym byte, fn func(r rune) bool, data []byte, isEOF bool) (advance int, symbol byte, count uint64, body []byte, err error)

func IsNewLine

func IsNewLine(r rune) bool

func IsSpace

func IsSpace(r rune) bool

func MoreData

func MoreData() (int, byte, uint64, []byte, error)

func SplitWrap

func SplitWrap(fn SplitFunc) func([]byte, bool) (advance int, body []byte, err error)

Types

type Scanner

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

func NewScanner

func NewScanner(r io.Reader, splitFn func([]byte, bool) (int, []byte, error)) *Scanner

func (*Scanner) AtEnd

func (s *Scanner) AtEnd() bool

func (*Scanner) Bytes

func (s *Scanner) Bytes() []byte

func (*Scanner) Err

func (s *Scanner) Err() error

func (*Scanner) NextBytes

func (s *Scanner) NextBytes() []byte

func (*Scanner) NextMore

func (s *Scanner) NextMore() bool

func (*Scanner) NextSymbol

func (s *Scanner) NextSymbol() byte

func (*Scanner) NextText

func (s *Scanner) NextText() string

func (*Scanner) RawBytes

func (s *Scanner) RawBytes() []byte

func (*Scanner) RawPeek

func (s *Scanner) RawPeek() (sym []byte, more bool)

func (*Scanner) Scan

func (s *Scanner) Scan() bool

func (*Scanner) Symbol

func (s *Scanner) Symbol() byte

func (*Scanner) Text

func (s *Scanner) Text() string

type SplitFunc

type SplitFunc func([]byte, bool) (int, byte, uint64, []byte, error)

Jump to

Keyboard shortcuts

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