Inquisitor

Expressions

In Inquisitor brackets delineate all expressions (....). They may be either in a unary form (that is, an optional operator followed by atom), or in a binary form (that is,. two atoms separated by an operator). The atoms can be simple literal values, data variables, record fields, or other expressions. In binary form expressions both atoms must be of the same data type.

Having all expressions delineated by brackets simplifies the parsing process. It means that no precedence has to be defined for any of the operators, and ensures that the Inquisitor script writers explicitly set exactly the operation they expect.

The three expression types used in Inquisitor scripts are:

  • Logical Expressions
  • Arithmetic Expressions
  • String Expressions

These expressions are described in detail below.

Logical Expressions
Logical expressions are expressions which evaluate to give a LOGICAL value.

Literal values:.
.TRUE. or.FALSE.

Table 6 - Operators

Form Type Action
.NOT. or ! UNARY Logical NOT; inverts the logical value of a logical atom.
.AND. or && BINARY Logical AND; evaluates as.TRUE. only if both atoms are evaluate as.TRUE.
.OR. or || BINARY Logical OR; evaluates as.TRUE. if either or both atoms evaluate as.TRUE.
.LT. or < BINARY Evaluates as.TRUE. if the left hand atom is less than the right hand atom.
.GT. or > BINARY Evaluates as.TRUE. if the left hand atom is greater than the right hand atom.
.EQ. or == BINARY Evaluates as.TRUE. If the left hand atom is equal to the right hand atom.
.GE. Or >= BINARY Evaluates as.TRUE. If the left hand atom is greater than or equal to the right hand atom.
.LE. Or <= BINARY Evaluates as.TRUE. If the left hand atom is less than or equal to the right hand atom.
.NE. or != BINARY Evaluates as.TRUE. If the left hand atom is not equal to the right hand atom.

Numerical comparisons using the comparison operators (.LT. to.NE.) are obvious in their function. The string comparisons use lexicographic differences as the means of comparison.

You can use wildcards when performing string comparisons. The standard shell character matching is used; * for any number of wild characters (0..n), ? for any single wild character, [SET] any single character from the set in the square brackets, and [!SET] for any single character not in the set. The SET is specified in the form A-Z or ABCF (or a mixture of both). To match for these special characters in a string literally, they may be protected by a \; for example, to see if a string is just an * character, the comparison would be #STR == '\*'. For this reason, protect *?-[]!\ with the \ character if they are used literally (that is, specify literal \ as \\).

Arithmetic Expressions
Expressions that evaluate to give a numeric value. The value can be either INTEGER or FLOAT.

Literal values:
INTEGER numbers (in the range INT_MIN to INT_MAX)
FLOAT numbers (in the range +/- DBL_MIN to DBL_MAX)

(See /usr/include/limits.h for the values of these constants on your system)

Table 7 - Operators

Form Type Action
+ UNARY Will not change numeric value.
- UNARY Negates the numeric value of an arithmetic atom.
.INT UNARY Converts FLOAT atom to nearest INTEGER (will cause error if FLOAT value outside INTEGER range).
+ BINARY Arithmetic addition.
- BINARY Arithmetic subtraction.
* BINARY Arithmetic multiplication.
/ BINARY Arithmetic division.
.MAX BINARY Evaluates to the larger of the two atoms.
.MIN BINARY Evaluates to the smaller of the two atoms.

All of the operators will take either INTEGER or FLOAT arguments, and will return values of the same type. If mixed types are used with the binary operators, then the return value type will be FLOAT.

String Expressions
Expressions that evaluate to give a character string. Can be single character or any length, and can contain any extended ASCII set character (0..255).

Literal values:
STRING characters (printable characters)
CHAR characters (any ASCII characters)

Table 8 - Operators

Form Type Action
.UPC. UNARY Evaluates to uppercase characters in atom (not implemented)
.LOC. UNARY Evaluates to lowercase characters in atom (not implemented)
+ BINARY String concatenation.

There are no unary string operators defined for Inquisitor as yet, however, the two outlined above are planned as extensions in the near future.

String expressions using the operators are limited to using STRING type atoms (not CHAR).