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

Function parse_interval_expression

crates/gitql-parser/src/parse_interval.rs:14–38  ·  view source on GitHub ↗
(
    tokens: &[Token],
    position: &mut usize,
)

Source from the content-addressed store, hash-verified

12const INTERVAL_MAX_VALUE: i64 = 170_000_000;
13
14pub(crate) fn parse_interval_expression(
15 tokens: &[Token],
16 position: &mut usize,
17) -> Result<Box<dyn Expr>, Box<Diagnostic>> {
18 consume_token_or_error(
19 tokens,
20 position,
21 TokenKind::Interval,
22 "Expect 'Interval' Keyword",
23 )?;
24
25 let interval_value_token = consume_conditional_token_or_errors(
26 tokens,
27 position,
28 |t| matches!(t.kind, TokenKind::String(_)),
29 "Expect String after 'Interval' Keyword as interval value",
30 )?;
31
32 let interval = parse_interval_literal(
33 &interval_value_token.to_string(),
34 interval_value_token.location,
35 )?;
36
37 Ok(Box::new(IntervalExpr::new(interval)))
38}
39
40/// Parse string into Interval expression.
41///

Callers 1

parse_primary_expressionFunction · 0.85

Calls 3

consume_token_or_errorFunction · 0.85
parse_interval_literalFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…