pub fn parse_one(input: &str) -> Result<(Sexp<'_>, &str), ParseError>
Expand description
Parses a single s-expression, ignoring any trailing text.
This function returns a pair of the parsed s-expression and the tail of the text.
Errors
If the text begins with an invalid s-expression (imbalanced parenthesis, quotes, invalid numbers like 123q, etc.) then the parser will return an error. Any text after the first s-expression doesn’t affect the parsing.
Examples
let (expr, rest) = parse_one("1 (").unwrap();
assert_eq!(rest, " (");