panproto-expr-parser 0.39.0

Haskell-style surface syntax parser for panproto expressions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Lex and parse a real migration field-transform expression.

use panproto_expr_parser::{parse, tokenize};

const SRC: &str = "\\record -> record.text ++ \" (alt: \" ++ record.alt ++ \")\"";

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let tokens = tokenize(SRC)?;
    println!("{} tokens", tokens.len());
    let expr = parse(&tokens).map_err(|e| format!("{e:?}"))?;
    println!("parsed: {expr:?}");
    Ok(())
}