Documentation
¶
Overview ¶
Package value lowers source scalars into ir.Value, keeping numeric literals as their exact source text so nothing rounds through float64.
Classification is by wire spelling alone, independent of any surrounding schema type — the Type-vs-Value split — which is why the package needs nothing from the compiler above it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromNode ¶
FromNode converts a YAML node into an ir.Value. Numeric literals are kept as their exact source text (the no-float64 escape), object member order is preserved, and alias nodes are followed.
The error return does report spec-level problems, and a source document reaches three of them: a default nested past the depth cap, a !!binary whose payload is not base64, and a scalar carrying a tag this package does not lower (`!!python/object`). It stays an error rather than a diagnostic because the caller decides what one means — constraints.go reports a bad numeric bound at error severity under its own code, while an example or a default that will not convert is a warning — and because the provenance a diagnostic needs is the caller's, not this package's. What this package knows is that the conversion failed and why (GitHub #169).
func NumericLiteral ¶
NumericLiteral converts a numeric-tagged YAML scalar into the BigVal of the value YAML resolved it to, which is not what its source text means in base 10. YAML takes an !!int's base from its prefix and drops "_" separators, so 0644 is 420 and 0x1f is 31; passing that spelling to NewBigVal — a base-10 decimal literal — reads 0644 back as 644 instead.
Only !!int is decoded, and every !!int yaml.v3 resolves fits int64 or uint64, so that decode is exact. A !!float keeps its text, because decoding one would round it through float64 and lose the arbitrary precision BigVal exists to preserve; only its separators are dropped.
Types ¶
This section is empty.