Parse label term: factor1 ! factor2 ! ... or :label1:label2:...
(tokens: &[Token])
| 3024 | |
| 3025 | /// Parse label term: factor1 ! factor2 ! ... or :label1:label2:... |
| 3026 | fn label_term(tokens: &[Token]) -> IResult<&[Token], LabelTerm> { |
| 3027 | map( |
| 3028 | tuple(( |
| 3029 | label_factor, |
| 3030 | many0(alt(( |
| 3031 | // Traditional NOT-separated factors |
| 3032 | tuple((expect_token(Token::Not), label_factor)), |
| 3033 | // Consecutive colon-separated labels (for syntax like :Manager:TeamLead or :`Special-Label`) |
| 3034 | map( |
| 3035 | tuple((expect_token(Token::Colon), identifier_or_quoted)), |
| 3036 | |(_, name)| (Token::Not, LabelFactor::Identifier(name)), // Dummy token, we only use the factor |
| 3037 | ), |
| 3038 | ))), |
| 3039 | )), |
| 3040 | |(first_factor, additional_factors)| { |
| 3041 | let mut factors = vec![first_factor]; |
| 3042 | factors.extend(additional_factors.into_iter().map(|(_, factor)| factor)); |
| 3043 | LabelTerm { |
| 3044 | factors, |
| 3045 | location: Location::default(), |
| 3046 | } |
| 3047 | }, |
| 3048 | )(tokens) |
| 3049 | } |
| 3050 | |
| 3051 | /// Parse label factor: identifier | :identifier | % | (label_expression) |
| 3052 | /// Supports ISO GQL delimited identifiers: `My-Label`, :`Special-Label` |
nothing calls this directly
no test coverage detected