MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / parse

Function parse

nodedb/src/control/promql/parser.rs:14–24  ·  view source on GitHub ↗

Parse a PromQL expression from a token stream.

(tokens: &[Token])

Source from the content-addressed store, hash-verified

12
13/// Parse a PromQL expression from a token stream.
14pub fn parse(tokens: &[Token]) -> Result<Expr, PromqlError> {
15 let mut p = Parser::new(tokens);
16 let expr = p.parse_expr(0)?;
17 if !p.at_eof() {
18 return Err(PromqlError::UnexpectedToken {
19 expected: "end of expression".to_string(),
20 found: format!("{:?}", p.peek()),
21 });
22 }
23 Ok(expr)
24}
25
26struct Parser<'a> {
27 tokens: &'a [Token],

Callers 15

parse_durationMethod · 0.70
pFunction · 0.70
parse_exception_handlersFunction · 0.50
expect_tokenFunction · 0.50
expect_identFunction · 0.50
collect_sql_untilFunction · 0.50
parse_statementFunction · 0.50
parse_rollbackFunction · 0.50
parse_savepointFunction · 0.50
parse_releaseFunction · 0.50
load_rsa_public_key_pemFunction · 0.50

Calls 3

parse_exprMethod · 0.80
at_eofMethod · 0.80
to_stringMethod · 0.80

Tested by 15

single_ip_matchFunction · 0.40
cidr_range_matchFunction · 0.40
cidr_24_matchFunction · 0.40
cidr_contains_basicFunction · 0.40
range_queryFunction · 0.40
parse_get_commandFunction · 0.40
parse_set_with_exFunction · 0.40