|
GEOS SDK TechDocs
|
|
3 Coding with the Parse Library
|
3.2 Evaluating a Token Sequence
ParserParseString()
To parse a string, call
ParserParseString()
. This routine takes four arguments:
-
a pointer to a null-terminated string
-
a pointer to a buffer
-
a pointer to a
CParserStruct
(This structure contains a pointer to a callback routine.)
-
a
pointer to a
CParserReturnStruct
ParserParseString()
parses a string into a sequence of tokens and writes the tokens to the buffer. Whenever the parser encounters an identifier, it calls the callback routine and requests an ID number for the identifier. Similarly, when the parser encounters a function whose name it does not recognize, it calls the callback routine to get a function ID number. The ID numbers are stored in the token sequence. Note: it is best to parse strings that contain
known
function names and identifiers.
The Parser can return the following errors:
-
PSEE_BAD_NUMBER
-
The string contained a badly-formatted number.
-
PSEE_BAD_CELL_REFERENCE
-
The string contained a badly-formatted cell reference.
-
PSEE_NO_CLOSE_QUOTE
-
The string contained an opening quote with no matching closing quote.
-
PSEE_COLUMN_TOO_LARGE
-
The string contained a cell whose column index was out of bounds (greater than 255).
-
PSEE_ROW_TOO_LARGE
-
The string contained a cell whose row index was out of bounds.
-
PSEE_ILLEGAL_TOKEN
-
The string contained a character sequence which was not a legal token.
-
PSEE_TOO_MANY_TOKENS
-
The expression was too complex.
-
PSEE_EXPECTED_OPEN_PAREN
-
A function call lacked an open-parenthesis.
-
PSEE_EXPECTED_CLOSE_PAREN
-
A function call lacked a close-parenthesis.
-
PSEE_BAD_EXPRESSION
-
The string contained a badly-formed expression.
-
PSEE_EXPECTED_END_OF_EXPRESSION
-
An expression ended improperly.
-
PSEE_MISSING_CLOSE_PAREN
-
Parentheses were mismatched.
-
PSEE_UNKNOWN_IDENTIFIER
-
An identifier or external function name was encountered, and the callback routine would not provide an ID for it.
-
PSEE_GENERAL
-
General parser error.
|
GEOS SDK TechDocs
|
|
3 Coding with the Parse Library
|
3.2 Evaluating a Token Sequence