pub fn parse_dbml_unchecked(input: &str) -> Result<SchemaBlock<'_>, Error<Rule>>Expand description
Parses the entire DBML text and returns an unsanitized Abstract Syntax Tree (AST).
§Arguments
input- A string slice containing the DBML text to parse.
§Returns
A ParserResult<SchemaBlock>, which is an alias for pest’s ParseResult type
representing the result of parsing. It contains the unsanitized abstract syntax tree (AST)
representing the parsed DBML.
§Errors
This function can return parsing errors if the input text does not conform to the DBML grammar. It may also panic if an unexpected parsing rule is encountered, which should be considered a bug.
§Examples
use dbml_rs::parse_dbml_unchecked;
let dbml_text = r#"
Table users {
id int
username varchar
}
"#;
let result = parse_dbml_unchecked(dbml_text);
assert!(result.is_ok());
let ast = result.unwrap();
// Now `ast` contains the unsanitized abstract syntax tree (AST) of the parsed DBML text.