Mathematical Expressions

Template files can also contain mathematical expressions.

For example, to translate a model during output, apply a formula to the x-coordinate of a node:
*nodes()
    *format()
        *string("node,")
        *field(integer,id,10)
        *string(",")
        *field(real,[x+100.0],10) 
        *string(",")
        *field(real,y,10)
        *string(",")
        *field(real,z,10)
    *end()
*output()

100.0 is added to the x-coordinate of the nodes and is sent to the formatter, where it is written to the file. The square brackets, [], around the formula tell the parser that the enclosed text is a formula and not to interpret the asterisk, *, as a new command.

The following operators are available for mathematical expressions:
Addition +
Subtraction -
Multiplication *
Division /
Modulus %