Skip to main content

parse

Function parse 

Source
pub fn parse(source: &str) -> Result<Program, FiddlerError>
Expand description

Parse FiddlerScript source without executing it.

Runs the lexer and parser but does not create an interpreter or execute any code. Use this to validate script syntax at configuration time.

Returns the parsed Program AST on success, or a FiddlerError describing the first lex or parse error encountered.

ยงExample

use fiddler_script::parse;

// Valid script parses successfully
assert!(parse("let x = 10;").is_ok());

// Syntax errors are caught without execution
assert!(parse("let x = ;").is_err());