lexeme

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

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 ConvertError added in v0.2.0

func ConvertError(lex LexEvent, err any) kit.JSchemaError

func NewError added in v0.2.0

func NewError(lex LexEvent, e *errs.Err) kit.JSchemaError

Types

type LexEvent

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

LexEvent the flow of lexical events is generated by the scanner. Events can be used to build tokens, or for other analysis of the structure of the scanned document.

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

LexEventType available lexeme event types. gen:Stringer e Unknown lexical event type

const (
	LiteralBegin                 LexEventType = iota // literal-begin
	LiteralEnd                                       // literal-end
	ObjectBegin                                      // object-begin
	ObjectEnd                                        // object-end
	ObjectKeyBegin                                   // key-begin
	ObjectKeyEnd                                     // key-end
	ObjectValueBegin                                 // value-begin
	ObjectValueEnd                                   // value-end
	ArrayBegin                                       // array-begin
	ArrayEnd                                         // array-end
	ArrayItemBegin                                   // item-begin
	ArrayItemEnd                                     // item-end
	InlineAnnotationBegin                            // inline-annotation-begin
	InlineAnnotationEnd                              // inline-annotation-end
	InlineAnnotationTextBegin                        // inline-annotation-text-begin
	InlineAnnotationTextEnd                          // inline-annotation-text-end
	MultiLineAnnotationBegin                         // multi-line-annotation-begin
	MultiLineAnnotationEnd                           // multi-line-annotation-end
	MultiLineAnnotationTextBegin                     // multi-line-annotation-text-begin
	MultiLineAnnotationTextEnd                       // multi-line-annotation-text-end
	NewLine                                          // new-line

	// TypesShortcutBegin indicates that "type" or "or" shortcut was began.
	TypesShortcutBegin // types-shortcut-begin

	// TypesShortcutEnd indicates that "type" or "or" shortcut was ended.
	TypesShortcutEnd // types-shortcut-end

	KeyShortcutBegin // key-shortcut-begin
	KeyShortcutEnd   // key-shortcut-end

	// MixedValueBegin indicates that here can be anything: scalar, array, or object.
	MixedValueBegin // mixed-value-begin
	MixedValueEnd   // mixed-value-end

	// EndTop character after the last closing JSON or SCHEMA lexeme event.
	EndTop // end-top
)

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