Documentation
¶
Overview ¶
Package spec implements `hadron spec ...` — an opinionated layer over the generic node/edge commands for maintaining product-spec nodes that follow the loc-as-citation convention: a spec's loc IS its citation number, <module>:<feature>:<rule>:<flow> (e.g. msg:010:02:03), and each colon level is a real parent/child node. The scheme, the frozen module codes, and the append-only number ledger are governed by a `register` node in the target memory. This package is general — it works on any memory following the convention, addressed by -m/--memory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Citation ¶
type Citation struct {
Product string // 3 lowercase letters, "" in a flat corpus
Module string // 3 lowercase letters, "" for a bare product root
Feature string // 3 digits, "" if absent
Rule string // 2 digits, "" if absent
Flow string // 2 digits, "" if absent
}
Citation is a parsed loc grammar. Flat (legacy): <module>[:<feature>[:<rule>[:<flow>]]] (e.g. msg:010:02). Product-rooted: <product>:<module>[:<feature>[:<rule>[:<flow>]]] (e.g. cli:cha:010:01).
func ParseCitation ¶
ParseCitation parses and validates a citation, returning a Usage error for any malformed segment. The rooting is inferred from segment 2's character class: a second alpha code ⇒ product-rooted (<product>:<module>:…); a 3-digit feature ⇒ flat (<module>:…). A lone alpha code parses as a flat module — callers that need a bare product root build the Citation directly.
func (Citation) InheritedContractLoc ¶
InheritedContractLoc returns the general-provisions contract this citation inherits — the reserved "zero" sibling at its own tier: a rule inherits its feature's :00, a feature inherits its module's :000, and a product-rooted module inherits its product's :gen. ok is false for a flow, a flat module root, a bare product root, or a contract itself (contracts are inheritance sources, not sinks).
func (Citation) IsContract ¶
IsContract reports whether this citation is a reserved general-provisions contract — a feature's rule `00`, a module's feature `000`, or a product's module `gen`. Its siblings at the same tier inherit it.
func (Citation) Level ¶
Level is 0 (bare product root) .. 4 (flow); module is 1, feature 2, rule 3. The product field does not shift levels — a product's module root is still level 1 — so existing level-keyed logic is unchanged.