fiasto 0.2.4

High-performance modern Wilkinson's formula parsing for statistical models. Parses R-style formulas into structured JSON metadata supporting linear models, mixed effects, and complex statistical specifications.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use fiasto::internal::parser::Parser;

// This example intentionally uses a malformed formula so we can see the pretty error output.
fn main() -> Result<(), Box<dyn std::error::Error>> {
    // trailing '+' will cause a parse error
    let input = "y ~ x +";
    let mut parser = Parser::new(input)?;
    match parser.parse_formula() {
        Ok(_) => println!("parsed ok (unexpected)"),
        Err(e) => {
            // Print the colored, pretty error to stderr
            eprintln!("{}", parser.pretty_error(&e));
        }
    }
    Ok(())
}