Werecat supports the following syntax in expressions.
Operator | Description |
!x | Boolean not |
+x, -x | Numerical +/- |
a*b, a/b, a%b | Multiply, divide, integer mod |
a+b, a-b | Numeric add, substract |
a<b, a <= b, a > b, a >= b | Numeric comparison |
a=b, a == b, a != b | Equality checks (numeric if possible, string otherwise) |
a =~ b | b must be a regexpr of form /pattern/. Evaluates to index of first match, or false |
a !~ b | b must be a regexpr of form /pattern/. True if a does not match b |
a && b, a and b | Boolean and |
a || b, a or b | Boolean or |
a.identifier | Field deference |
a[b] | Array index, Map lookup, or Set contains. B must be a valid type for the operation. |
a(b,c,...) | Function calls, method must be public. |
Werecat supports the following literals.
Literal | Examples |
Numbers | 1, 3, .02, 0.2 |
Characters | 'a' |
Strings | "foo" |
Regexp | /pattern/ |
Constants | true, false, null |