Skip to main content

bel_format/
lib.rs

1//! Biological Expression Language (BEL) - POC AST & Parser
2#![allow(unused)]
3pub(crate) mod parser_utils;
4pub mod parser;
5
6pub fn from_str(source: &str) -> (Vec<parser::Ast>, Vec<parser::ErrorReport>) {
7    parser::parse_lines(source, false)
8}
9
10/// Try to parse the given value form a `&str`, or
11/// fail with an error message printed to stdout.
12pub fn from_str_or_panic(source: &str) -> Vec<parser::Ast> {
13    let (result, errors) = parser::parse_lines(source, true);
14    if !errors.is_empty() {
15        panic!("[crate bel-format] parser failed");
16    }
17    result
18}
19