Skip to content

module

expr

Expressions: what attribute values, {…} in strings, if conditions and for … in can compute. Pure: an expression reads its scope and returns a value.

expr    := lambda | coalesce
lambda  := (IDENT | '(' IDENT (',' IDENT)* ')') '->' expr      (call arguments only)
coalesce:= or ('??' or)*
or      := and ('||' and)*
and     := cmp ('&&' cmp)*
cmp     := pipe (('=='|'!='|'<'|'<='|'>'|'>=') pipe)?
pipe    := sum ('|>' IDENT ('(' args ')')?)*     (as Elixir: `xs |> len > 2` compares the length)
sum     := product (('+'|'-') product)*
product := unary (('*'|'/'|'%') unary)*
unary   := ('!'|'-') unary | postfix
postfix := primary ('.' IDENT)*
primary := NUM | STRING | 'true' | 'false' | 'null' | path | IDENT '(' args ')'
         | '[' items ']' | '{' fields '}' | '(' expr ')'
         | 'if' expr 'then' expr 'else' expr

Enums

  • BinOp

    A binary operator.

  • Expr

    An expression.

  • Qualifier

    One part of a comprehension, after the |.

  • UnOp

    A unary operator.

Constants

PIPE_PRECEDENCE

pub const PIPE_PRECEDENCE: u8 = 6;

How tightly |> binds: under arithmetic, over comparisons.