parse

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package parse converts configuration text to a tree.Config. It uses an indentation stack and schema.MatchChild. An unknown line creates an isolated stack frame for its children. Fold canonicalizes alternate spellings after parsing. At each level, it applies RespellAs, list continuations, and membership expansion in that order.

Raw block bodies, including blank lines, are preserved exactly from the opener through the terminator. BlockSpans uses the same indentation rules without building a tree so text transforms can exclude raw blocks.

A Fold change is atomic for each line. Each synthesized node matches its rendered text against all definitions at the level with schema.MatchChild. Matching only the intended definition could select an equal-specificity sibling when the rendered result is parsed again.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockSpans

func BlockSpans(s *schema.Schema, text string) []bool

BlockSpans marks lines from each recognized raw-block opener through its terminator or EOF and returns nil when the schema has no blocks.

func Fold

func Fold(cfg *tree.Config, d *diag.Diagnostics)

Fold canonicalizes RespellAs, ListContinues, and Members spellings in that order and leaves a line unchanged when it cannot fold atomically.

func Parse

func Parse(
	s *schema.Schema,
	text string,
	policy diag.Policy,
	d *diag.Diagnostics,
) *tree.Config

Parse builds a tree.Config from already-text-transformed config text.

Types

This section is empty.

Jump to

Keyboard shortcuts

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