Expression syntax

how to configure

Expressions can be configured in two ways:

advised syntax

The advised syntax is to configure an expression after the combination of a colon and an equals sign (:=). Expressions are not quoted in this syntax.

See the following examples:

attribute<NrHa>   ForestAndNature (rdc_100l) := LandUseClass/Forest + LandUseClass/Nature;
unit<float32>     meter                      := BaseUnit('m', float32);
parameter<string> capitol                    := 'Amsterdam';
parameter<meter>  marathon                   := 42195[meter];

syntax with the expr property

The other syntax configures an expression with the “expr” Property. In this syntax an expression is always configured between double quotes (“”).

See the following examples:

attribute<NrHa>   ForestAndNature (rdc_100l) : expr = "LandUseClass/Forest + LandUseClass/Nature";
unit<float32>     m                          : expr = "BaseUnit('m', float32)";
parameter<string> capitol                    : expr = "'Amsterdam'";
parameter<meter>  marathon                   : expr = "42195[meter]";

This syntax is valid, but the := syntax is advised, as:

  1. It is shorter.
  2. It is better understood by grammar configuration files, for example in Notepad++ or Crimson Editor.
  3. Double quotes in strings can be used without indirections.

components

Expressions consist of one or a combination of the following components:

  1. references to other tree items, such as data items and units, see example 1
  2. Operators and functions, see example 1,2,4
  3. literals, see example 3 and 4

Each of these is described on Expression elements.