gtpc2mjvC/C++ Language Support User's Guide

Appendix G. IPRSE - A Parser Utility for TPF Systems

IPRSE is a C utility that is used for matching parameter lists with grammars and returning the values of the parameters if they match. You code a function that defines a grammar to IPRSE for string parsing. The strings can be input commands or other similar application strings that need parsing. The parameters in the input string must follow the grammar rules for the parser.

To use the parser:

  1. Define a grammar in a function; see Defining a Grammar that follows.
  2. Call the following functions to activate the parser:
    1. IPRSE_parse-Parse a Text String against a Grammar

      Matches the parameter list with the grammar and returns the values of the parameters and a return code as output.

    2. A function that processes the parsed output.

    For a complete, coded example showing the grammar, the parsing, and the call to a function to process the parsed output, see Examples.

  3. Understand the errors that can result from an incorrect grammar or an input string.

    When an input string does not match the grammar, the parser issues online messages, which are controlled by an option specified on the IPRSE_parse function. When an invalid grammar is detected, the system issues an OPR dump. For more information, see Error Return.