Understand the intermediate data representations in go-yaml
mainThe go-yaml processing pipeline transforms data through several intermediate forms. Understanding these forms is essential for debugging or extending the library's internal stages:
- Bytes: Raw input (UTF-8, UTF-16LE, or UTF-16BE) or UTF-8 encoded output.
- Token: Lexical tokens produced by the Scanner. Contains type, position (
Mark), and raw values. - Event: Syntactic events produced by the Parser. Contains resolved tags (full URI), comments, and structural information.
- Node: A tree structure produced by the Composer. Represents the YAML document as a hierarchy of
Nodeobjects (Document, Sequence, Mapping, Scalar, Alias, or Stream). - Repr (Representation Graph): A conceptual stage where
Nodetrees have undergone tag resolution via theresolve()process. - Native Value: The final Go language values (structs, maps, slices, etc.) produced by the Load stack or consumed by the Dump stack.