MCPcopy Create free account
hub / github.com/hashintel/hash / parse_expr

Method parse_expr

libs/@local/hashql/syntax-jexpr/src/lib.rs:51–64  ·  view source on GitHub ↗

Parse an expression from a byte slice. # Errors - Lexer errors if the input contains invalid tokens - Parser errors if the tokens don't form a valid expression - Unexpected EOF if the input is incomplete

(&mut self, source: &[u8])

Source from the content-addressed store, hash-verified

49 /// - Parser errors if the tokens don't form a valid expression
50 /// - Unexpected EOF if the input is incomplete
51 pub fn parse_expr(&mut self, source: &[u8]) -> Result<Expr<'heap>, JExprDiagnostic> {
52 let lexer = lexer::Lexer::new(source);
53
54 let mut state = ParserState::new(self.heap, lexer, self.spans);
55
56 let expr = parser::expr::parse_expr(&mut state)
57 .change_category(JExprDiagnosticCategory::Parser)?;
58
59 state
60 .finish()
61 .change_category(JExprDiagnosticCategory::Parser)?;
62
63 Ok(expr)
64 }
65}
66
67#[cfg(test)]

Callers 3

parseMethod · 0.80
parse_sourceFunction · 0.80
parse_inputFunction · 0.80

Calls 4

OkInterface · 0.85
change_categoryMethod · 0.80
parse_exprFunction · 0.50
finishMethod · 0.45

Tested by

no test coverage detected