Documentation
¶
Overview ¶
Package source reads a SpecArch YAML file into a node tree that keeps the line of every value, and into the plain value the JSON Schema check needs.
Index ¶
- Constants
- func Child(n *yaml.Node, token string) *yaml.Node
- func Deref(n *yaml.Node) *yaml.Node
- func EscapeToken(s string) string
- func IsMark(line string) bool
- func IsScalar(n *yaml.Node) bool
- func Items(n *yaml.Node) []*yaml.Node
- func Key(n *yaml.Node, key string) *yaml.Node
- func Pointer(tokens ...string) string
- func Resolve(n *yaml.Node, tokens []string) (*yaml.Node, bool)
- func Str(n *yaml.Node) string
- func StripMarks(data []byte) []byte
- func UnescapeToken(s string) string
- func ValueOf(n *yaml.Node) any
- type Doc
- type Pair
- type Problem
Constants ¶
const MarkPrefix = "# specarch-problem:"
MarkPrefix starts every line SpecArch writes into a YAML file to mark a problem at the entry below it (ADR-065, ADR-066). A line that starts with it after its indentation is SpecArch's own; no other line is.
Variables ¶
This section is empty.
Functions ¶
func Child ¶
Child returns the value under key in a mapping, or the item at an index in a sequence, following aliases; nil when there is none.
func Resolve ¶
Resolve follows a pointer's tokens from n. It returns the deepest node it reached and whether it reached the end. For a mapping key it returns the value node.
func StripMarks ¶ added in v0.6.0
StripMarks is a file's text without its problem marks: what the author wrote, which the marks of a run do not change.
Types ¶
type Doc ¶
type Doc struct {
Root *yaml.Node // the top-level mapping, nil when nothing of the file could be read
Value any // the same content as JSON values
Problems []Problem
Held []string // the pointers of the entries that did not parse, kept by their names only or left out
}
Doc is one parsed file.