note_splitter.parser_ module

For converting a list of tokens to a syntax tree.

class note_splitter.parser_.SyntaxTree(tokens_: list[note_splitter.tokens.Token], parse_blocks: bool = True)

Bases: object

An entire file as a syntax tree.

Parameters
  • tokens (list[tokens.Token]) – A list of tokens created from a Lexer object.

  • parse_blocks (bool) – If True, some of the tokens will be grouped together into larger tokens in the resulting syntax tree. Otherwise, the token list will be put into the content attribute unchanged. The syntax tree’s other attributes will still be created.

frontmatter

The file’s optional YAML frontmatter as a Python object.

Type

object | None

content

All the tokens below any frontmatter.

Type

list[tokens.Token]

footnotes

All the footnotes in the file.

Type

list[tokens.Footnote]

__str__() str

Returns the original content of the syntax tree’s raw text.