atproto_sdl/lower

Lower the parser’s tree to atproto_lexicon/ast: document orchestration, main promotion (@main, NSID-suffix match, or single eligible item, mirroring atproto_mlf’s precedence), and per-def-kind dispatch. Field/item/params lowering lives in lower/fields, xrpc methods in lower/methods, ref resolution in lower/scope, and attribute folding in lower/attrs.

known_docs is accepted for interface parity with atproto_mlf but unused: our grammar’s explicit #fragment marker already disambiguates “def of another doc” from “bare NSID naming that doc’s main”, the one thing mlf needed tree-wide context for.

Values

pub fn lower(
  doc: tree.Document,
  id: String,
) -> Result(ast.LexiconDoc, error.ParseError)
pub fn lower_in_tree(
  doc: tree.Document,
  id: String,
  known_docs: set.Set(String),
) -> Result(ast.LexiconDoc, error.ParseError)

Lower with workspace knowledge: known_docs holds the NSIDs of every document compiled alongside this one. Accepted for interface parity with atproto_mlf; see the module doc for why it doesn’t change resolution here.

Search Document