Function parse

Source
pub fn parse(text: &str, file_id: FileId) -> Vec<SyntaxNode>
Expand description

Parses one or more statements from the given input text, producing a concrete syntax tree (CST).

This is the main entry point for parsing Compose code. It assumes the input starts with a valid statement or leading whitespace. The parser is fault-tolerant, so even if the input contains syntax errors, it will return a complete tree including SyntaxError nodes where appropriate.

§Parameters

  • text: The source text to parse.
  • file_id: An identifier for the file the text originated from, used for diagnostics.

§Returns

A vector of SyntaxNodes representing the parsed statements and any encountered syntax errors as SyntaxErrors.