parser

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check added in v0.36.1

func Check(doc *restfile.Document) error

func Diagnostics added in v1.7.0

func Diagnostics(doc *restfile.Document) diag.Report

func Parse

func Parse(path string, data []byte) *restfile.Document

func WarningTexts added in v0.48.1

func WarningTexts(doc *restfile.Document) []string

WarningTexts renders each parse warning with its source location. Warnings are not fatal, so callers report them beside their results instead of failing.

Types

type SourceLine added in v1.5.5

type SourceLine struct {
	Kind           SourceLineKind
	Directive      directive.Name
	Args           directive.ArgKind
	ScriptArgs     bool
	ScriptKind     restfile.ScriptKind
	ScriptLang     restfile.ScriptLang
	ContentStart   int
	ContentEnd     int
	OptionValueEnd int
	// InExpr is true when a body line continues a {{= }} expression.
	InExpr bool
}

Offsets are rune positions in the source line. OptionValueEnd is zero unless the line starts inside an option value.

func (SourceLine) ContentRange added in v1.5.5

func (l SourceLine) ContentRange(n int) (start, end int, ok bool)

type SourceLineKind added in v1.5.5

type SourceLineKind uint8
const (
	SourceLineCode SourceLineKind = iota
	SourceLineComment
	SourceLineDirective
	SourceLineDirectiveValue
	SourceLineRequestSeparator
	SourceLineLiteral
	SourceLineScript
)

func (SourceLineKind) String added in v1.5.5

func (k SourceLineKind) String() string

type SourceSyntax added in v1.5.5

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

SourceSyntax uses the parser's context rules to classify each line.

func (*SourceSyntax) Classify added in v1.5.5

func (s *SourceSyntax) Classify(source string)

A trailing newline creates an empty final line to match the editor.

func (*SourceSyntax) Len added in v1.5.5

func (s *SourceSyntax) Len() int

func (*SourceSyntax) Line added in v1.5.5

func (s *SourceSyntax) Line(i int) SourceLine

Directories

Path Synopsis
builder
k8s
sse
ssh

Jump to

Keyboard shortcuts

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