APG
… an ABNF Parser Generator
|
The data struct passed to each callback function. More...
#include <parser.h>
Data Fields | |
void * | vpUserData |
[input/output] User-defined data passed to to the parser in parser_config. More... | |
aint | uiCallbackState |
[input/output] Rule name (RNM) callback functions: If ID_ACTIVE, the parser takes no action. Otherwise the parser accepts this result and skips the sub-tree below the RNM operator. More... | |
aint | uiCallbackPhraseLength |
[input/output] The phrase length of the matched phrase if the callback function returns ID_MATCH. More... | |
const achar * | acpString |
[read only] Pointer to the input sub-string, More... | |
aint | uiStringLength |
[read only] The input string length. More... | |
aint | uiParserState |
[read only] ID_ACTIVE if the parser is going down the tree. ID_MATCH or ID_NOMATCH if coming up the tree. More... | |
aint | uiParserOffset |
[read only] Offset from acpString to the first character to match More... | |
aint | uiParserPhraseLength |
[read only] The parser's matched phrase length if uiParserState is ID_MATCH or ID_NOMATCH. 0 otherwise. More... | |
aint | uiRuleIndex |
[read only] The rule index of this rule's callback. APG_UNDEFINED if this is a UDT callback. More... | |
aint | uiUDTIndex |
[read only] The UDT index of this UDT's callback. APG_UNDEFINED if this is a rule callback. More... | |
exception * | spException |
[read only] Use to throw exceptions back to the parser's catch block scope: e.g. XTHROW(spException, "my message") More... | |
void * | vpCtx |
[read only] Do not use. For system use only. More... | |
void * | vpMem |
[read only] Do not use. For system use only. More... | |
The data struct passed to each callback function.
It is the same for rule name (RNM) and user-defined (UDT) callback functions. Note that the callback function only sees the sub-string being parsed, not the entire string, if different.
Only the variables designated [input/output] should be modified. All other variables are read only. The parser will fail or produce unpredictable results if any read-only variables are changed.
const achar* callback_data::acpString |
exception* callback_data::spException |
aint callback_data::uiCallbackPhraseLength |
[input/output] The phrase length of the matched phrase if the callback function returns ID_MATCH.
If the callback function returns ID_ACTIVE, ID_EMPTY or ID_NOMATCH, this value is ignored and assumed to be 0. The parser will throw an exception if this value extends beyond the end of the string being parsed.
For UDT callback functions, the parser will throw an exception if the phrase length is 0 and the UDT is designated as non-empty (UDT name begins with u_
).
aint callback_data::uiCallbackState |
[input/output] Rule name (RNM) callback functions: If ID_ACTIVE, the parser takes no action. Otherwise the parser accepts this result and skips the sub-tree below the RNM operator.
User-defined (UDT) callback functions: Must be not be ID_ACTIVE. The parser will throw an exception if the user returns ID_ACTIVE.
aint callback_data::uiParserOffset |
aint callback_data::uiParserPhraseLength |
aint callback_data::uiParserState |
aint callback_data::uiRuleIndex |
aint callback_data::uiStringLength |
aint callback_data::uiUDTIndex |
void* callback_data::vpCtx |
void* callback_data::vpMem |
void* callback_data::vpUserData |
[input/output] User-defined data passed to to the parser in parser_config.
Ignored by Parser.