Expressions must be enclosed in ${} to be evaluated.
The expression parser supports four primary datatypes that
are known from these languages:
integer (4 byte signed integer), double (double precision
floating point value), string (arbitrary length text string,
terminated by '0') and void (empty dummy type).
Moreover, arrays and structs are supported, as well as calling
a series of functions.
Operations include:
addition (+), subtraction (-), multiplication (*), division (/),
remainder (%), pre- und postincrement/-decrement ($i++, --$i, etc.)
bitwise operations (&, |, ^, ~ as in C), unary operations
(-$i, ~0x32, !$j), logical operations (&&, ||),
assignment expressions ($i=5), C-Style combined assignment
expressions (+=, -=, *=, /=, %=, &=, |=, ^=), equality and
relational expressions (==, !=, >=, <=, <, >), conditional
expressions ( $i>15 ? 23 : 42 ), typecasts, brackets (())
to specify precedence, Array access ([]), struct member
access (.), calling functions ($root.func.whatever(parm,...))
Please read up the concept of the variables, if you have not
already done so, as it differs slightly from traditional
approaches.
Important differences to the above languages:
- strings can be used easily. The are usually typecasted
automatically as appropriate (PHP-like behaviour)
- string concatenation works with the intuitive "+" notation.
- Arrays are like PHP or Perl hashes. That is they don't use
a fixed numbering scheme, but rather a string as the array
index ($root.view[current]...).
- Expressions are not shortcut-evaluated like the conditional
and logical operators in C are.
- Access to nonexistent variables yields a result of type void
which can be used to check for variable existance
( IF ${$argv[2]==(void)0} ...)
- void values can be compared. This is only true, if both values
are of type void.