MCPcopy Create free account
hub / github.com/AmrDeveloper/GQL / parse_offset_statement

Function parse_offset_statement

crates/gitql-parser/src/parser.rs:1226–1249  ·  view source on GitHub ↗
(
    context: &mut ParserContext,
    env: &mut Environment,
    tokens: &[Token],
    position: &mut usize,
)

Source from the content-addressed store, hash-verified

1224}
1225
1226fn parse_offset_statement(
1227 context: &mut ParserContext,
1228 env: &mut Environment,
1229 tokens: &[Token],
1230 position: &mut usize,
1231) -> Result<Statement, Box<Diagnostic>> {
1232 // Consume `OFFSET` keyword
1233 *position += 1;
1234
1235 if *position >= tokens.len() {
1236 return Err(Diagnostic::error("Expect number after `OFFSET` keyword")
1237 .with_location(calculate_safe_location(tokens, *position - 1))
1238 .as_boxed());
1239 }
1240
1241 let start = parse_expression(context, env, tokens, position)?;
1242 if start.expr_type().is_int() {
1243 return Ok(Statement::Offset(OffsetStatement { start }));
1244 }
1245
1246 Err(Diagnostic::error("Expect int after `OFFSET` keyword")
1247 .with_location(calculate_safe_location(tokens, *position - 1))
1248 .as_boxed())
1249}
1250
1251fn parse_window_named_over_clause(
1252 context: &mut ParserContext,

Callers 1

parse_select_queryFunction · 0.85

Calls 7

calculate_safe_locationFunction · 0.85
parse_expressionFunction · 0.85
as_boxedMethod · 0.80
with_locationMethod · 0.80
expr_typeMethod · 0.80
lenMethod · 0.45
is_intMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…