Skip to main content

Module cst

Module cst 

Source
Expand description

The concrete syntax tree of a Links Notation document.

Every byte of a document belongs to exactly one token, so the text of the tree is the document itself, comments, blank lines, indentation, quotes and line endings included. A document is a list of line nodes; a line holds the tokens up to and including its line ending, and a parenthesized group node holds its own parentheses and the lines written between them. A group is part of the line it opens on, however many lines it spans.

The tree records how a document was written; parse_lino_to_links reads what it means. They agree because a document is parsed before its tree is built, and the tokens are read with the same rules the parser uses: comments are found by strip_comments, delimited references by the parser’s own reader and versioned literals by the same prefix.

Structs§

CstNode
One node or token of a concrete syntax tree.

Enums§

CstKind
The kinds of nodes and tokens of a concrete syntax tree.

Functions§

parse_lino_to_cst
Reads a document, with comments, as a lossless concrete syntax tree.
parse_lino_to_cst_with_config
Reads a document the way config says to as a lossless concrete syntax tree; see parse_lino_to_cst.