(
env: &mut Environment,
tokens: &[Token],
position: &mut usize,
)
| 85 | } |
| 86 | |
| 87 | fn parse_do_query( |
| 88 | env: &mut Environment, |
| 89 | tokens: &[Token], |
| 90 | position: &mut usize, |
| 91 | ) -> Result<Query, Box<Diagnostic>> { |
| 92 | // Consume Do keyword |
| 93 | *position += 1; |
| 94 | |
| 95 | if *position >= tokens.len() { |
| 96 | return Err( |
| 97 | Diagnostic::error("Expect expression after Do Statement keyword") |
| 98 | .with_location(calculate_safe_location(tokens, *position - 1)) |
| 99 | .as_boxed(), |
| 100 | ); |
| 101 | } |
| 102 | |
| 103 | let mut context = ParserContext::default(); |
| 104 | let mut exprs = vec![]; |
| 105 | |
| 106 | loop { |
| 107 | let expression = parse_expression(&mut context, env, tokens, position)?; |
| 108 | exprs.push(expression); |
| 109 | |
| 110 | if !is_current_token(tokens, position, TokenKind::Comma) { |
| 111 | break; |
| 112 | } |
| 113 | |
| 114 | // Consume `,` |
| 115 | *position += 1; |
| 116 | } |
| 117 | |
| 118 | Ok(Query::Do(DoQuery { exprs })) |
| 119 | } |
| 120 | |
| 121 | fn parse_set_query( |
| 122 | env: &mut Environment, |
no test coverage detected
searching dependent graphs…