Parse Library: 3.2 Coding with the Parse Library: Evaluating a Token Sequence

Up: GEOS SDK TechDocs | Up | Prev: 3.1 Parsing a String | Next: 3.3 Formatting a Token Sequence
ParserEvalExpression()

To format an expression, call ParserEvalExpression() . This routine is passed a token sequence; it evaluates it and writes the resulting token sequence to a passed buffer. It calls a supplied callback routine to perform the following tasks:

The evaluator produces a sequence two tokens long, including the "end-of-expression" token. The first token might be an error token. Two errors are so serious that if they occur, the evaluation is immediately halted and the error is returned:

PSEE_OUT_OF_STACK_SPACE
The evaluator ran out of stack space. Evaluation was halted when this occurred.
PSEE_NESTING_TOO_DEEP
The nesting grew too deep for the evaluator. Evaluation was halted when this occurred.

The following errors may be propagated; that is, if an expression returns an error, that error would be passed, as a value, to outer expressions. For example, if the evaluator were evaluating "SUM(1, (PROD(1, 2, "F. T. Poomm"))", PROD would return PSEE_WRONG_TYPE, since it expects numeric arguments. SUM, in turn, would be passed two arguments: the number 1 and the error PSEE_WRONG_TYPE. That function might, in turn, propagate the error upward, return a different error, or return a non-error value. (SUM, as it happens, would propagate the error; that is, it would return PSEE_WRONG_TYPE.)

PSEE_ROW_OUT_OF_RANGE
A cell's row index was out of range.
PSEE_COLUMN_OUT_OF_RANGE
A cell's column index was out of range.
PSEE_FUNCTION_NO_LONGER_EXISTS
The callback routine did not recognize the function ID for an external function.
PSEE_BAD_ARG_COUNT
A function was passed the wrong number of arguments.
PSEE_WRONG_TYPE
A function was passed an argument of the wrong type.
PSEE_DIVIDE_BY_ZERO
A division by zero was attempted.
PSEE_UNDEFINED_NAME
The callback would not provide a value for an identifier ID.
PSEE_CIRCULAR_REF
A circular reference occurred. This error will only occur if it is returned by the callback routine.
PSEE_CIRCULAR_DEP
The value is dependant on a cell whose value is PSEE_CIRCULAR_REF.
PSEE_CIRC_NAME_REF
The expression uses a name which is defined circularly.
PSEE_NUMBER_OUT_OF_RANGE
The result was a number which could not be expressed as a float.
PSEE_GEN_ERR
General error; this is returned when no other error code is appropriate.
PSEE_NA
The value for a cell was not available.
PSEE_FLOAT_POS_INFINITY
A float routine returned the error FLOAT_POS_INFINITY.
PSEE_FLOAT_NEG_INFINITY
A float routine returned the error FLOAT_NEG_INFINITY.
PSEE_FLOAT_GEN_ERR
A float routine returned the error FLOAT_GEN_ERR.
PSEE_TOO_MANY_DEPENDENCIES
The formula contained too many levels of dependency. This is generally returned by the callback routine; the Parse library routines do not return this error, they merely propagate it.

The application may also define its own error codes, beginning with the constant PSEE_FIRST_APPLICATION_ERROR. All internal functions, and all operators, always propagate application-defined errors.


Up: GEOS SDK TechDocs | Up | Prev: 3.1 Parsing a String | Next: 3.3 Formatting a Token Sequence