Skip to main content

parse_all

Function parse_all 

Source
pub fn parse_all(input: &str) -> (Option<Query>, Diagnostics)
Expand description

Parse a Cypher query string in error-recovery mode, returning all diagnostics discovered during parsing.

Unlike parse, this function does not stop at the first error; it attempts to resynchronise at statement boundaries and continue. The returned Option<Query> is Some only when a statement was successfully parsed after the last resynchronisation point. A valid statement that appears before a later syntax error does not guarantee Some: the implementation keeps only the successfully parsed suffix after recovery, not any valid prefix.

ยงExample

use decypher::parse_all;

let (query, diagnostics) = parse_all("RETURN;");
assert!(query.is_none());
assert!(!diagnostics.is_empty());