Function ess::parser::parse
[−]
[src]
pub fn parse(input: &str) -> (Vec<Sexp>, Option<ParseError>)
Parse a sequence of s-expressions.
This function returns (Vec<Sexp>, Option<ParseError>)
so that it can
return partial results, for when some component parses successfully and a
later part fails.
Errors
If the text contains an invalid s-expression (imbalanced parenthesis, quotes, invalid numbers like 123q, etc.) then the parser will stop and return an error. Every s-expression before that point that successfully parsed will still be returned.
Examples
We can get useful partial results
let (exprs, err) = parse("1 2 3 ( 4"); assert_eq!(exprs.len(), 3); assert!(err.is_some());