Documentation
¶
Overview ¶
Package yini parses YINI configuration documents.
Start in parse.go. Use ParseString to read text, ParseFile to read a file, or ParseReader to read from an io.Reader. Parsing is lenient by default. Set Options.Mode to ModeStrict to apply strict rules.
Results and diagnostics ¶
Check the returned error before using the parsed document. Result contains the document and any warnings or errors, with their line and column numbers. Invalid input may produce an incomplete document. ParseForTooling lets editors inspect that document and its diagnostics without returning a Go error for ordinary input problems. Callers decide how to display diagnostics.
Values and decoding ¶
Use Document.Values to get a map you can change without changing the document. To fill a Go struct, use Document.Decode or Section.Decode. Fields match by name or by yini tags. If decoding fails, the struct is left unchanged.
Source organization ¶
types.go defines documents and diagnostics. decode.go handles Go structs. The other root files read grammar tokens, build values, and track source locations. Generated grammar code is under internal/grammar/generated. Unit tests live beside the code they test. Integration tests and their YINI input files live under tests/integration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DecodeError ¶
DecodeError reports a failure to decode a YINI value into a Go type.
func (*DecodeError) Error ¶
func (e *DecodeError) Error() string
type Diagnostic ¶
Diagnostic describes a problem found while parsing or validating input.
type Document ¶
Document is the structured result of parsing a YINI document. Members at this level are lenient-mode orphan members.
type Member ¶
Member is a key and its parsed value. Values are strings, int64, float64, bool, nil, []any, or map[string]any.
type Options ¶
type Options struct {
Mode Mode
}
Options controls parsing. The zero value selects lenient mode.
type ParseError ¶
type ParseError struct {
Diagnostic Diagnostic
}
ParseError reports a syntax or validation failure. The corresponding Result retains the complete list of diagnostics.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type Position ¶
Position identifies a location in the original input. Lines and columns start at one.
type Result ¶
type Result struct {
Document *Document
Diagnostics []Diagnostic
}
Result contains parsed data and all diagnostics collected from the input. Document may be partial when errors were reported.
func ParseFile ¶
ParseFile reads and parses a UTF-8 YINI file. The filename does not select the parsing mode; a .strict.yini file parsed leniently gets a warning. Parse errors include the file path and can be inspected with errors.As.
func ParseForTooling ¶
ParseForTooling returns diagnostics and any recoverable document content without returning a Go error for normal YINI syntax and validation issues.
func ParseReader ¶
ParseReader parses YINI content from a reader.
func ParseString ¶
ParseString parses inline YINI content. A result with diagnostics is returned even when the input is invalid.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
release-tag
command
|
|
|
test-summary
command
|
|
|
yini-test-adapter
command
|
|
|
internal
|
|