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

Function parse_object

libs/@local/hashql/syntax-jexpr/src/parser/object/mod.rs:90–106  ·  view source on GitHub ↗
(
    state: &mut ParserState<'heap, 'source, '_>,
    token: Token<'source>,
)

Source from the content-addressed store, hash-verified

88}
89
90pub(crate) fn parse_object<'heap, 'source>(
91 state: &mut ParserState<'heap, 'source, '_>,
92 token: Token<'source>,
93) -> Result<Expr<'heap>, ParserDiagnostic> {
94 let mut current = ObjectState::Initial(Initial);
95
96 let range = visit_object(state, token, |state, key| {
97 let scoped = mem::replace(&mut current, ObjectState::Initial(Initial));
98 current = scoped.handle(state, key)?;
99
100 Ok(())
101 })?;
102
103 let expr = current.build(state, range)?;
104
105 Ok(expr)
106}
107
108#[cfg(test)]
109mod tests {

Callers 1

parse_exprFunction · 0.85

Calls 5

InitialClass · 0.85
visit_objectFunction · 0.85
OkInterface · 0.85
handleMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected