Dextrin.Schema.Docs.Comments (Dextrin v0.3.3)

Copy Markdown View Source

Which comment belongs to which definition, in a .dxns document's lossless tree (Jan, 2026-10-20):

  • the block of comment lines directly above an entry belongs to it, when no blank line separates the block from the entry;
  • a comment on the entry's own line, after it, belongs to it too, and so does every comment line straight below that one.

A block a blank line cuts off from what follows belongs to nothing there; before a document's value, it is the document's own description. A comment's text is its line without the # and the one space after it, and a bare # is a blank line, which separates paragraphs.

Summary

Types

An entry's comment lines: those above it, then those after it.

Functions

For each :map_entry among a container's children, in order, the comment lines attached to it.

A comment's text: without its # and the one space after it.

The comments before a document's value -- what it says about itself -- as text: a blank line between them, like a bare #, separates paragraphs.

Types

attached()

@type attached() :: %{above: [String.t()], after: [String.t()]}

An entry's comment lines: those above it, then those after it.

Functions

attached(children)

@spec attached([Ichor.Syntax.Node.t() | Ichor.Syntax.Token.t()]) :: [attached()]

For each :map_entry among a container's children, in order, the comment lines attached to it.

comment_text(comment)

@spec comment_text(String.t()) :: String.t()

A comment's text: without its # and the one space after it.

iex> Dextrin.Schema.Docs.Comments.comment_text("# a comment")
"a comment"

iex> Dextrin.Schema.Docs.Comments.comment_text("#")
""

leading(children)

@spec leading([Ichor.Syntax.Node.t() | Ichor.Syntax.Token.t()]) :: String.t()

The comments before a document's value -- what it says about itself -- as text: a blank line between them, like a bare #, separates paragraphs.