This function parses the last child of a specified syntax element. It is called by the integration node when the last child element of the current syntax element is required.
Defined In | Type | Member |
---|---|---|
CPI_VFT | Mandatory | iFpParseLastChild |
void cpiParseLastChild(
CciParser* parser,
CciContext* context,
CciElement* currentElement);
None.
This example is taken from the sample parser file BipSampPluginParser.c:
void cpiParseLastChild(
CciParser* parser,
CciContext* context,
CciElement* element
){
PARSER_CONTEXT_ST* pc = (PARSER_CONTEXT_ST *)context ;
int rc;
if ((cpiElementType(&rc, element) == CCI_ELEMENT_TYPE_NAME)) {
while ((!cpiElementCompleteNext(&rc, element)) &&
(pc->iCurrentElement))
{
pc->iCurrentElement = parseNextItem(parser, context, pc->iCurrentElement);
}
}
if (pc->trace) {
fprintf(pc->tracefile, "PLUGIN: <- cpiParseLastChild()\n");
fflush(pc->tracefile);
}
return;
}
The purpose of this code is to parse children of an element until the last child is reached. You can use this kind of structure in a parser that does not already know the exact offset in the bit stream of the last child of an element.