Operator Precedence

Release 1.0 - ...

This table lists the operator precedence as applied by the expression evaluator.

Operators in the same cell of the table have equal precedence and are evaluated in the given order in an expression unless explicitly forced by parentheses.

Operator Alias Meaning Example
()
$
  Function call (vipermethod)
Get buffer value, alias for buffer.get()
string.toupper("you") => YOU
$varname is equivalent to buffer.get(varname)
~
!

+
  One's complement
Logical not
Unary minus
Unary plus
~10 => -11
!true => false
-1 => -1
+1 => 1
*
/
%
  Multiplication
Division
Modulus
2 * 3 => 6
6 / 3 => 2
6 % 4 => 2
+
  Addition
Subtraction
1 + 2 => 3
3 - 2 => 1
<<
>>
  Left shift
Right shift

1 << 2 => 4

8 >> 3 => 1

<
>
<=
>=
LT
GT
LTE
GTE
Less than
Greater than
Less than or equal to
Greater than or equal to
 
==
!=
EQ
NEQ
Equality
Inequality
 
&   Bitwise AND 3 & 6 => 2
^   Bitwise exclusive OR 3 ^ 6 => 5
|   Bitwise inclusive OR 3 | 6 => 7
&& AND Logical AND 1 && 2 => true
|| OR Logical OR 1 || 0 => true
;   Statement separator buffer.set(a,2); buffer.get(a) * 2 => 4

The associativity of the operators is right to left for the unary operator and left to right for all other operators.