pub fn parse_document(source: &str) -> Result<Document, String>Expand description
Process source text through the complete pipeline: lex, analyze, and build.
“Parse” here is colloquial — the name covers the whole pipeline (lexing + analysis + building), not just the syntactic phase.
This is the primary entry point for processing lex documents. It performs:
- Lexing: Tokenizes the source text
- Analysis: Performs syntactic analysis to produce IR nodes
- Building: Constructs the root session tree from IR nodes (assembling wraps it in a
Documentand attaches metadata)
§Arguments
source- The source text to process
§Returns
A Document containing the complete AST, or parsing errors.
§Example
ⓘ
use lex_core::lex::parsing::parse_document;
let source = "Hello world\n";
let document = parse_document(source)?;