lexeme

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CatchLexEventError

func CatchLexEventError(lex LexEvent)

func CatchLexEventErrorWithIncorrectUserType

func CatchLexEventErrorWithIncorrectUserType(lex LexEvent, name string)

func NewLexEventError

func NewLexEventError(lex LexEvent, err errors.Err) errors.DocumentError

Types

type LexEvent

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

func NewLexEvent

func NewLexEvent(t LexEventType, begin, end bytes.Index, file *fs.File) LexEvent

func (LexEvent) Begin

func (lex LexEvent) Begin() bytes.Index

func (LexEvent) End

func (lex LexEvent) End() bytes.Index

func (LexEvent) File

func (lex LexEvent) File() *fs.File

func (LexEvent) String

func (lex LexEvent) String() string

func (LexEvent) Type

func (lex LexEvent) Type() LexEventType

func (LexEvent) Value

func (lex LexEvent) Value() bytes.Bytes

type LexEventType

type LexEventType uint8
const (
	LiteralBegin LexEventType = iota
	LiteralEnd
	ObjectBegin
	ObjectEnd
	ObjectKeyBegin
	ObjectKeyEnd
	ObjectValueBegin
	ObjectValueEnd
	ArrayBegin
	ArrayEnd
	ArrayItemBegin
	ArrayItemEnd
	InlineAnnotationBegin
	InlineAnnotationEnd
	InlineAnnotationTextBegin
	InlineAnnotationTextEnd
	MultiLineAnnotationBegin
	MultiLineAnnotationEnd
	MultiLineAnnotationTextBegin
	MultiLineAnnotationTextEnd
	NewLine

	// TypesShortcutBegin indicates that "type" or "or" shortcut was began.
	TypesShortcutBegin

	// TypesShortcutEnd indicates that "type" or "or" shortcut was ended.
	TypesShortcutEnd

	KeyShortcutBegin
	KeyShortcutEnd

	// MixedValueBegin indicates that here can be anything: scalar, array, or object.
	MixedValueBegin
	MixedValueEnd

	EndTop // character after the last closing JSON or SCHEMA lexeme event
)

func (LexEventType) IsOneOf

func (e LexEventType) IsOneOf(ll ...LexEventType) bool

IsOneOf returns true if given lexeme type is equal to at least one of specified.

func (LexEventType) IsOpening

func (e LexEventType) IsOpening() bool

func (LexEventType) String

func (e LexEventType) String() string

Jump to

Keyboard shortcuts

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