scanner

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

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

Scanner represents a scanner is a JSchema scanning state machine. Callers call scan.reset() and then pass bytes in one at a time by calling scan.step(&scan, c) for each byte. The return value, referred to as an opcode, tells the caller about significant parsing events like beginning and ending literals, objects, and arrays, so that the caller can follow along if it wishes. The return value scanEnd indicates that a single top-level JSON value has been completed, *before* the byte that just got passed in. (The indication must be delayed in order to recognize the end of numbers: is 123 a whole value or the beginning of 12345e+6?).

func NewSchemaScanner

func NewSchemaScanner(file *fs.File, allowNonSpaceByteAfterTopLevelValue bool) *Scanner

func (*Scanner) Length

func (s *Scanner) Length() uint

func (*Scanner) Next

func (s *Scanner) Next() (lexeme.LexEvent, bool)

Next reads schema byte by byte. Panic if an invalid jSchema structure is found. Stops if it detects lexical events. Returns pointer to found lexeme event, or nil if you have complete reading.

Jump to

Keyboard shortcuts

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