Converts a token stream into a Wikidot SyntaxTree.
The parser consumes tokens produced by the Lexer and emits a
tree of Element nodes. Block-level rules are tried in priority
order; when none match, the fallback paragraph rule collects inline
tokens until the next blank line.
After the main parse pass, two post-processing steps run:
Span-strip merging — [[span_]] elements that set
_paragraphStrip are merged with adjacent paragraphs.
Internal-flag cleanup — all _-prefixed bookkeeping fields
are removed from the final AST.
For most use-cases the standalone parse function is simpler
than constructing a Parser directly.
Converts a token stream into a Wikidot SyntaxTree.
The parser consumes tokens produced by the
Lexerand emits a tree of Element nodes. Block-level rules are tried in priority order; when none match, the fallback paragraph rule collects inline tokens until the next blank line.After the main parse pass, two post-processing steps run:
[[span_]]elements that set_paragraphStripare merged with adjacent paragraphs._-prefixed bookkeeping fields are removed from the final AST.For most use-cases the standalone parse function is simpler than constructing a
Parserdirectly.