next up previous
Next: 8. Buffers and Windows Up: Ved Text Editor Reference Previous: 6. Attributes

7. Expressions and Values

Ved has a full-function expression evaluator which can assist you in a number of areas. Whenever a numeric value is needed by Ved this evaluator is used. The following operators are recognized by the evaluator:

+
addition

-
subtraction or unary negate

*
multiplication

/
division

%
modulus

The following operands are recognized:

Decimal Numbers
An optional minus sign followed by a series of decimal digits. Valid decimal numbers include: 123, 0, and -34.

Hexadecimal Numbers
A dollar sign ($) or a ``0x'' followed by a series of hexadecimal characters (0-9, A-F or a-f). Valid hexadecimal numbers include: $123, $e0F and $A20 and 0x4f.

Octal Numbers
A ``0'' followed by a series of valid octal digits (0-7). Valid octal numbers include: 033 and 0128.

Character Constants
A single character surrounded by single quotes represents the ASCII value of the character. For example, a 'c' would be evaluated as 99 or $63. Common ``C-like'' escapes can also be used:

'\\'
a single backslash,

'\a'
an alert ($07) character,

'\b'
a backspace ($08) character,

'\f'
a formfeed ($0c) character,

'\n'
a new line ($0a) character,

'\r'
a carriage return ($0d) character,

'\t'
a tab ($09) character,

'\v'
a vertical tab ($0b) character.

Valid character constants include: 'c', '3' and '\n'.

Control Value
A ``^'' followed by a single alphanumeric character. This is converted to the value of the character less $40. For example, ^A is identical to 'A'-0x40 and $41-$40 and 1.

Expressions are evaluated from left to right using the algebraic order of operations (multiplication and division are performed before addition and subtraction). Parentheses can be used to alter the normal order of evaluation.

No spaces or other characters other than those specified above are permitted in an expression. No variables are supported in expressions at this time.

Whenever this manual refers to a ``value'' or ``expression'' we are referring to a valid expression as detailed above. Valid expressions include ``12'', ``12+$44'', ``'c'-(55%'A')'', etc. Expressions are evaluated internally with native (usually 32 bit) signed integer math routines.

At times, in this manual, you will see a reference made to the value ``MAXINT''. This represents the maximum value of a signed integer (on 32 bit machines this is 4,294,967,295). We find typing MAXINT a lot easier!


next up previous
Next: 8. Buffers and Windows Up: Ved Text Editor Reference Previous: 6. Attributes
2004-05-02