cpiParseLastChild

Purpose

Parses the last child of a specified syntax element. It is invoked by the broker when the last child element of the current syntax element is required.
Defined In Type Member
CPI_VFT Mandatory iFpParseLastChild

Syntax

void cpiParseLastChild(
  CciParser*   parser,
  CciContext*  context,
  CciElement*  currentElement);

Parameters

parser
The address of the parser object (input).
context
The address of the context owned by the parser object (input).
currentElement
The address of the current syntax element (input).

Return values

None.

Sample

This example is taken from the sample parser file BipSampPluginParser.c (lines 515 to 544):

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.

Related concepts
User-defined parsers
User-defined extensions
Related tasks
Creating a parser in C
Related reference
cpiParseFirstChild
C parser implementation functions