Operators¶
ISO 10303-11 keeps operator reserved words in a separate table (clause 7.2,
table 2) from the statement keywords, and ExpressLexer honours that split by
emitting Operator.Word for them. The symbolic operators are emitted as plain
Operator.
Word operators (table 2)¶
word operators
IF a AND b THEN
a := a OR b; -- OR
a := a XOR b; -- XOR
a := a ANDOR b; -- ANDOR
a := a MOD b; -- MOD
a := a DIV b; -- DIV
IF a NOT IN b AND a LIKE b AND NOT c THEN
a := TRUE;
END_IF;
END_IF;
Each word operator on its own, so the family is easy to read at a glance:
Symbolic operators¶
symbolic operators
-- assignment and instance-comparison operators
a := b; -- :=
a :=: b; -- :=: (instance equal, rel_op)
a :<>: b; -- :<>: (instance not equal, rel_op)
-- relational operators
p < q; -- <
p <= q; -- <=
p > q; -- >
p >= q; -- >=
p <> q; -- <>
-- arithmetic operators
r + s; -- +
r - s; -- -
r * s; -- *
r / s; -- /
r ** 2; -- **
-- remaining symbols recognised as operators
a || b; -- ||
\ -- \
The :=: and :<>: forms are matched before the bare :=, so a relational
comparison is never split into an assignment operator and a stray colon (see
test_express_instance_comparison_operators).
@ is a special character of the EXPRESS character set (clause 7.1.3), so it
can appear inside a string literal, but it is not one of the symbols in clause
7.3 (table 6) and no operator is spelled with it. Outside a string it lexes as
an error.