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

Function maybe_aliased

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

Source from the content-addressed store, hash-verified

390}
391
392fn maybe_aliased<'a, I, E>(expr: E) -> impl Parser<'a, I, Expr, ParserError<'a>> + Clone + 'a
393where
394 I: Input<'a, Token = lr::Token, Span = Span> + BorrowInput<'a>,
395 E: Parser<'a, I, Expr, ParserError<'a>> + Clone + 'a,
396{
397 let aliased = ident_part()
398 .then_ignore(ctrl('='))
399 // This is added for `maybe_aliased`; possibly we should integrate
400 // the funcs
401 .or_not()
402 .then(expr)
403 .map(|(alias, mut expr)| {
404 expr.alias = alias.or(expr.alias);
405 expr
406 });
407 // Because `expr` accounts for parentheses, and aliased is `x=$expr`, we
408 // need to allow another layer of parentheses here.
409 aliased
410 .clone()
411 .or(aliased.delimited_by(ctrl('('), ctrl(')')))
412}
413
414fn func_call<'a, I, E>(expr: E) -> impl Parser<'a, I, Expr, ParserError<'a>> + Clone + 'a
415where

Callers 3

tupleFunction · 0.85
pipelineFunction · 0.85
func_callFunction · 0.85

Calls 3

ctrlFunction · 0.85
mapMethod · 0.80
ident_partFunction · 0.70

Tested by

no test coverage detected