Skip to main content

parse_repl

Function parse_repl 

Source
pub fn parse_repl(path: &str, source: &str) -> ReplParse
Expand description

Parse a REPL snippet. Unlike [parse], the top level does not require a closing wow, so a clean parse to end-of-input is ReplParse::Complete. A parse that fails at end-of-input — the snippet was cut off mid-construct — is ReplParse::Incomplete so the caller can read another line; any failure at a real token is ReplParse::Error. A leading top-level wow ends the snippet, so the statements before it parse as complete.