parse

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

Documentation

Index

Constants

View Source
const (
	// CodeExpectedValue is an experimental JSONKit constant.
	CodeExpectedValue = "PARSE_EXPECTED_VALUE"
	// CodeExpectedColon is an experimental JSONKit constant.
	CodeExpectedColon = "PARSE_EXPECTED_COLON"
	// CodeTrailingComma is an experimental JSONKit constant.
	CodeTrailingComma = "PARSE_TRAILING_COMMA"
	// CodeUnterminatedContainer is an experimental JSONKit constant.
	CodeUnterminatedContainer = "PARSE_UNTERMINATED_CONTAINER"
	// CodeUnquotedKeyDisabled is an experimental JSONKit constant.
	CodeUnquotedKeyDisabled = "PARSE_UNQUOTED_KEY_DISABLED"

	// CodeEmbeddedBlockInvalid is an experimental JSONKit constant.
	CodeEmbeddedBlockInvalid = "JKIT_EMBEDDED_BLOCK_INVALID"
	// CodeEmbeddedTerminatorMissing is an experimental JSONKit constant.
	CodeEmbeddedTerminatorMissing = "JKIT_EMBEDDED_TERMINATOR_MISSING"
	// CodeEmbeddedTerminatorConflict is an experimental JSONKit constant.
	CodeEmbeddedTerminatorConflict = "JKIT_EMBEDDED_TERMINATOR_CONFLICT"
	// CodeEmbeddedHookConflict is an experimental JSONKit constant.
	CodeEmbeddedHookConflict = "JKIT_EMBEDDED_HOOK_CONFLICT"
	// CodeEmbeddedHookInvalidDecision is an experimental JSONKit constant.
	CodeEmbeddedHookInvalidDecision = "JKIT_EMBEDDED_HOOK_INVALID_DECISION"
	// CodeRetentionUnsupported is an experimental JSONKit constant.
	CodeRetentionUnsupported = "JKIT_RETENTION_UNSUPPORTED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EmbeddedBlock

type EmbeddedBlock struct {
	Start          int64
	End            int64
	Terminators    [][]byte
	UseHostOffsets bool
	DiagnosticHook EmbeddedDiagnosticHook
	HookCodes      []string
}

EmbeddedBlock is part of the experimental JSONKit API.

type EmbeddedDiagnosticContext

type EmbeddedDiagnosticContext struct {
	Diagnostic     diag.Diagnostic
	Index          int
	Depth          int
	RecoveryEvents int
}

EmbeddedDiagnosticContext is part of the experimental JSONKit API.

type EmbeddedDiagnosticDecision

type EmbeddedDiagnosticDecision struct {
	Suppress bool
	Replace  *diag.Diagnostic
	EndBlock bool
}

EmbeddedDiagnosticDecision is part of the experimental JSONKit API.

type EmbeddedDiagnosticHook

type EmbeddedDiagnosticHook func(ctx EmbeddedDiagnosticContext) EmbeddedDiagnosticDecision

EmbeddedDiagnosticHook is part of the experimental JSONKit API.

type EmbeddedMetadata

type EmbeddedMetadata struct {
	RequestedStart int64
	RequestedEnd   int64
	EffectiveStart int64
	EffectiveEnd   int64
	TerminatorHit  bool
	TerminatorSpan span.Span
}

EmbeddedMetadata is part of the experimental JSONKit API.

func (EmbeddedMetadata) EffectiveSpan

func (m EmbeddedMetadata) EffectiveSpan() span.Span

func (EmbeddedMetadata) HostToLocal

func (m EmbeddedMetadata) HostToLocal(off int64) (int64, bool)

func (EmbeddedMetadata) LocalToHost

func (m EmbeddedMetadata) LocalToHost(off int64) (int64, bool)

type Options

type Options struct {
	Profile       profile.Profile
	RetentionMode RetentionMode
	EmbeddedBlock *EmbeddedBlock
}

Options is part of the experimental JSONKit API.

type Result

type Result struct {
	Tree        cst.Tree
	Diagnostics []diag.Diagnostic
	Embedded    *EmbeddedMetadata
	Mode        RetentionMode
	Tokens      []lex.Token
	Trivia      []lex.Token
}

Result is part of the experimental JSONKit API.

func Parse

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

Parse is part of the experimental JSONKit API.

func ParseRange

func ParseRange(src source.Source, p profile.Profile, r span.Span) Result

ParseRange is part of the experimental JSONKit API.

func ParseWithOptions

func ParseWithOptions(src source.Source, opts Options) Result

ParseWithOptions is part of the experimental JSONKit API.

type RetentionMode

type RetentionMode uint8

RetentionMode is part of the experimental JSONKit API.

const (
	// RetentionFullCST is an experimental JSONKit constant.
	RetentionFullCST RetentionMode = iota
	// RetentionTokens is an experimental JSONKit constant.
	RetentionTokens
	// RetentionStructural is an experimental JSONKit constant.
	RetentionStructural
	// RetentionWindowedCST is an experimental JSONKit constant.
	RetentionWindowedCST
	// RetentionValidateOnly is an experimental JSONKit constant.
	RetentionValidateOnly
)

func (RetentionMode) String

func (m RetentionMode) String() string

Jump to

Keyboard shortcuts

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