-
Notifications
You must be signed in to change notification settings - Fork 0
Expression
expression ::=
<number> | false | true | <string> | <tuple> | <array> | <map>
| <braces> | <if> | self | super | nil
| <unary_operation> | <binary_operation> | <set>
| <dot> | <null_safe_dot> | <call> | <index>
| <lambda> | <val> | <throw>
| <do> | <while> | <break> | <return>
| <case> | <synchronized> | <\weak> | <\try>
if ::= if(<expression>) <expression> else <expression>
braces ::= {
<expression>
<expression>
...
}
The return value is the return value of the last expression.
unary_operation ::= (! | -) <expression> | <expression> (++ | --)
if(!bar) foo++ else -foo
binary_operation ::= <expression> <\operation_type> <expression>
operation_type ::= + | - | * | / | && | || | == | === | != | !== | > | < | >= | <=
=== and !== - compare objects by pointer whereas == and != call isEqual function
dot ::= <expression>.<call>
null_safe_dot ::= <expression>?.<call>
call ::= name[(<call_parameter> [, <call_parameter> ...]) [<post_lambda>] ]
call_parameter ::= [parameter_name = ] <expression>
foo.f(a = 3, 4)
foo.functionWithoutArguments