Skip to main content

parse_document

Function parse_document 

Source
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:

  1. Lexing: Tokenizes the source text
  2. Analysis: Performs syntactic analysis to produce IR nodes
  3. Building: Constructs the root session tree from IR nodes (assembling wraps it in a Document and 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)?;