Expressions And Conditionals

Top  Previous  Next

The EXPL editor can do complex editing tasks using expressions and conditional operations. In other words, you can create small programs that do very complex editing tasks. The syntax is relatively simple.


Expressions. Expressions are a series of mathematical or Boolean operations that, when evaluated, result in a single numeric value. The editor uses expressions to test for special situations, like a unique combination of characters. Expressions also can be used to create such things as an incrementing column of numbers.


Expressions are always enclosed in parentheses “()”. Expressions consist of two kinds of items: factors and operators. Factors are something that has a value, such as the number 2. Operators operate on factors, like the plus sign operates on 2 + 2.


For a complete list of Factors and Operators click here.


Note that all these factors and operators can only be used in an expression. In other words, they can only be used inside parentheses. Some of these characters have different meanings outside expressions. For example, “_” means “return the character before cursor” inside an expression and "insert global variable value" outside an expression.


When the editor evaluates an expression, it reduces all the operators and factors to a single numeric value. For instance, the expression: (1+2+3) reduces to the value 6. Sometimes an expression is used as a Boolean value. In other words, sometimes the expression is reduced to a single true or false value. For example:




In this expression, if the character under the cursor is “A”, then the expression evaluates to true. In the editor, “true” is the value $FFFFFFFF (or any non-zero value) and “false” is 0.