Function flexi_parse::parse_string
source · pub fn parse_string<T: Parse>(source: String) -> Result<T>
Expand description
Scans and parses the given string into the syntax tree node T
.
This function ignores all whitespace.
Examples found in repository?
More examples
examples/lox.rs (lines 627-639)
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640
fn main() {
let _ast: Ast = pretty_unwrap(parse_string(
"
var x = 5;
var y = \"hello\";
x = 6;
y = 4.0;
fun add(x, y) {
return x + y;
}
"
.to_string(),
));
}