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

Function parse_path

libs/@local/hashql/syntax-jexpr/src/parser/string/path.rs:48–69  ·  view source on GitHub ↗
(
    input: &mut Input<'heap, 'span, 'source>,
)

Source from the content-addressed store, hash-verified

46}
47
48pub(crate) fn parse_path<'heap, 'span, 'source, E>(
49 input: &mut Input<'heap, 'span, 'source>,
50) -> ModalResult<Path<'heap>, E>
51where
52 E: ParserError<Input<'heap, 'span, 'source>>
53 + AddContext<Input<'heap, 'span, 'source>, StrContext>,
54{
55 let root = opt(ws("::")).map(|value| value.is_some());
56 let segments = separated_alloc1(input.state.heap, parse_path_segment, ws("::"));
57
58 let ((rooted, segments), span) = (root, segments)
59 .with_span()
60 .context(StrContext::Label("path"))
61 .parse_next(input)?;
62
63 Ok(Path {
64 id: NodeId::PLACEHOLDER,
65 span: input.state.span(span),
66 rooted,
67 segments,
68 })
69}
70
71#[cfg(test)]
72mod tests {

Callers

nothing calls this directly

Calls 7

wsFunction · 0.85
separated_alloc1Function · 0.85
OkInterface · 0.85
LabelClass · 0.50
mapMethod · 0.45
contextMethod · 0.45
spanMethod · 0.45

Tested by

no test coverage detected