MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / label_factor

Function label_factor

graphlite/src/ast/parser.rs:3053–3074  ·  view source on GitHub ↗

Parse label factor: identifier | :identifier | % | (label_expression) Supports ISO GQL delimited identifiers: `My-Label`, :`Special-Label`

(tokens: &[Token])

Source from the content-addressed store, hash-verified

3051/// Parse label factor: identifier | :identifier | % | (label_expression)
3052/// Supports ISO GQL delimited identifiers: `My-Label`, :`Special-Label`
3053fn label_factor(tokens: &[Token]) -> IResult<&[Token], LabelFactor> {
3054 alt((
3055 // Colon-prefixed identifier: :LABEL_NAME or :`Special-Label`
3056 map(
3057 tuple((expect_token(Token::Colon), identifier_or_quoted)),
3058 |(_, name)| LabelFactor::Identifier(name),
3059 ),
3060 // Regular identifier: LABEL_NAME or `Special-Label`
3061 map(identifier_or_quoted, LabelFactor::Identifier),
3062 // Wildcard: %
3063 value(LabelFactor::Wildcard, expect_token(Token::Percent)),
3064 // Parenthesized expression: (label_expression)
3065 map(
3066 delimited(
3067 expect_token(Token::LeftParen),
3068 label_expression,
3069 expect_token(Token::RightParen),
3070 ),
3071 |expr| LabelFactor::Parenthesized(Box::new(expr)),
3072 ),
3073 ))(tokens)
3074}
3075
3076/// Convert LabelExpression to Vec<String> for backward compatibility
3077/// This extracts all identifier labels from a label expression like "Transaction|Purchase" -> ["Transaction", "Purchase"]

Callers

nothing calls this directly

Calls 1

expect_tokenFunction · 0.85

Tested by

no test coverage detected