lex

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DiagUnexpectedChar is an experimental JSONKit constant.
	DiagUnexpectedChar = "LEX_UNEXPECTED_CHAR"
	// DiagUnterminatedString is an experimental JSONKit constant.
	DiagUnterminatedString = "LEX_UNTERMINATED_STRING"
	// DiagSingleQuoteDisabled is an experimental JSONKit constant.
	DiagSingleQuoteDisabled = "LEX_SINGLE_QUOTE_DISABLED"
	// DiagCommentDisabled is an experimental JSONKit constant.
	DiagCommentDisabled = "LEX_COMMENT_DISABLED"
	// DiagInvalidNumber is an experimental JSONKit constant.
	DiagInvalidNumber = "LEX_INVALID_NUMBER"
	// DiagUnquotedKeyDisabled is an experimental JSONKit constant.
	DiagUnquotedKeyDisabled = "LEX_UNQUOTED_KEY_DISABLED"
	// DiagUnterminatedComment is an experimental JSONKit constant.
	DiagUnterminatedComment = "LEX_UNTERMINATED_BLOCK_COMMENT"
	// DiagNilSource is an experimental JSONKit constant.
	DiagNilSource = "LEX_NIL_SOURCE"
)

Variables

This section is empty.

Functions

func RawBytes

func RawBytes(src source.Source, tok Token) ([]byte, error)

RawBytes is part of the experimental JSONKit API.

func RawString

func RawString(src source.Source, tok Token) (string, error)

RawString is part of the experimental JSONKit API.

Types

type Kind

type Kind uint16

Kind is part of the experimental JSONKit API.

const (
	// KindInvalid is an experimental JSONKit constant.
	KindInvalid Kind = iota
	// KindEOF is an experimental JSONKit constant.
	KindEOF

	// KindLBrace is an experimental JSONKit constant.
	KindLBrace
	// KindRBrace is an experimental JSONKit constant.
	KindRBrace
	// KindLBracket is an experimental JSONKit constant.
	KindLBracket
	// KindRBracket is an experimental JSONKit constant.
	KindRBracket
	// KindColon is an experimental JSONKit constant.
	KindColon
	// KindComma is an experimental JSONKit constant.
	KindComma

	// KindString is an experimental JSONKit constant.
	KindString
	// KindNumber is an experimental JSONKit constant.
	KindNumber
	// KindTrue is an experimental JSONKit constant.
	KindTrue
	// KindFalse is an experimental JSONKit constant.
	KindFalse
	// KindNull is an experimental JSONKit constant.
	KindNull
	// KindIdentifier is an experimental JSONKit constant.
	KindIdentifier

	// KindWhitespace is an experimental JSONKit constant.
	KindWhitespace
	// KindLineComment is an experimental JSONKit constant.
	KindLineComment
	// KindBlockComment is an experimental JSONKit constant.
	KindBlockComment
)

func (Kind) String

func (k Kind) String() string

type RawError

type RawError struct {
	Code RawErrorCode
	Span span.Span
	Len  int64
	Err  error
}

RawError is part of the experimental JSONKit API.

func (*RawError) Error

func (e *RawError) Error() string

type RawErrorCode

type RawErrorCode uint8

RawErrorCode is part of the experimental JSONKit API.

const (
	// RawErrNilSource is an experimental JSONKit constant.
	RawErrNilSource RawErrorCode = iota + 1
	// RawErrBadSpan is an experimental JSONKit constant.
	RawErrBadSpan
	// RawErrSourceRead is an experimental JSONKit constant.
	RawErrSourceRead
)

func (RawErrorCode) String

func (c RawErrorCode) String() string

type Result

type Result struct {
	All         []Token
	Tokens      []Token
	Trivia      []Token
	Diagnostics []diag.Diagnostic
}

Result is part of the experimental JSONKit API.

func Scan

func Scan(src source.Source, p profile.Profile) Result

Scan is part of the experimental JSONKit API.

func ScanAllOnly

func ScanAllOnly(src source.Source, p profile.Profile) Result

ScanAllOnly scans tokens and trivia into the unified All stream. It avoids maintaining split Tokens/Trivia views for internal parse paths.

type Token

type Token struct {
	Kind Kind
	Span span.Span
}

Token is part of the experimental JSONKit API.

Jump to

Keyboard shortcuts

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