Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
Data Fields
callback_data Struct Reference

The data struct passed to each callback function. More...

#include <parser.h>

Collaboration diagram for callback_data:
Collaboration graph
[legend]

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 acharacpString
 [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...
 
exceptionspException
 [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...
 

Detailed Description

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.

Definition at line 134 of file parser.h.

Field Documentation

◆ acpString

const achar* callback_data::acpString

[read only] Pointer to the input sub-string,

Definition at line 156 of file parser.h.

◆ spException

exception* callback_data::spException

[read only] Use to throw exceptions back to the parser's catch block scope: e.g. XTHROW(spException, "my message")

Definition at line 165 of file parser.h.

◆ uiCallbackPhraseLength

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_).

Definition at line 145 of file parser.h.

◆ uiCallbackState

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.

Definition at line 139 of file parser.h.

◆ uiParserOffset

aint callback_data::uiParserOffset

[read only] Offset from acpString to the first character to match

Definition at line 160 of file parser.h.

◆ uiParserPhraseLength

aint callback_data::uiParserPhraseLength

[read only] The parser's matched phrase length if uiParserState is ID_MATCH or ID_NOMATCH. 0 otherwise.

Definition at line 161 of file parser.h.

◆ uiParserState

aint callback_data::uiParserState

[read only] ID_ACTIVE if the parser is going down the tree. ID_MATCH or ID_NOMATCH if coming up the tree.

Definition at line 158 of file parser.h.

◆ uiRuleIndex

aint callback_data::uiRuleIndex

[read only] The rule index of this rule's callback. APG_UNDEFINED if this is a UDT callback.

Definition at line 163 of file parser.h.

◆ uiStringLength

aint callback_data::uiStringLength

[read only] The input string length.

Definition at line 157 of file parser.h.

◆ uiUDTIndex

aint callback_data::uiUDTIndex

[read only] The UDT index of this UDT's callback. APG_UNDEFINED if this is a rule callback.

Definition at line 164 of file parser.h.

◆ vpCtx

void* callback_data::vpCtx

[read only] Do not use. For system use only.

Definition at line 169 of file parser.h.

◆ vpMem

void* callback_data::vpMem

[read only] Do not use. For system use only.

Definition at line 170 of file parser.h.

◆ vpUserData

void* callback_data::vpUserData

[input/output] User-defined data passed to to the parser in parser_config.

Ignored by Parser.

Definition at line 136 of file parser.h.


The documentation for this struct was generated from the following file:
APG Version 7.0 is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.