MCPcopy Create free account
hub / github.com/PRQL/prql / aliased

Function aliased

prqlc/prqlc-parser/src/parser/expr.rs:373–390  ·  view source on GitHub ↗
(expr: E)

Source from the content-addressed store, hash-verified

371#[allow(dead_code)]
372#[cfg(not(coverage))]
373fn aliased<'a, I, E>(expr: E) -> impl Parser<'a, I, Expr, ParserError<'a>> + Clone + 'a
374where
375 I: Input<'a, Token = lr::Token, Span = Span> + BorrowInput<'a>,
376 E: Parser<'a, I, Expr, ParserError<'a>> + Clone + 'a,
377{
378 let aliased = ident_part()
379 .then_ignore(ctrl('='))
380 .then(expr)
381 .map(|(alias, mut expr)| {
382 expr.alias = Some(alias);
383 expr
384 });
385 // Because `expr` accounts for parentheses, and aliased is `x=$expr`, we
386 // need to allow another layer of parentheses here.
387 aliased
388 .clone()
389 .or(aliased.delimited_by(ctrl('('), ctrl(')')))
390}
391
392fn maybe_aliased<'a, I, E>(expr: E) -> impl Parser<'a, I, Expr, ParserError<'a>> + Clone + 'a
393where

Callers

nothing calls this directly

Calls 3

ctrlFunction · 0.85
mapMethod · 0.80
ident_partFunction · 0.70

Tested by

no test coverage detected