APG
… an ABNF Parser Generator
|
Some basic functions of the APG Application Programming Interface. More...
Go to the source code of this file.
Functions | |
void * | vpApiCtor (exception *spEx) |
Construct an API component context (object). More... | |
void | vApiDtor (void *vpCtx) |
The API component destructor. More... | |
abool | bApiValidate (void *vpCtx) |
Validates an API context pointer. More... | |
void * | vpApiGetErrorLog (void *vpCtx) |
Get the internal message log. More... | |
void | vApiRulesToHtml (void *vpCtx, const char *cpFileName) |
Display the grammar rules in human-readable, HTML format. More... | |
void | vApiRulesToAscii (void *vpCtx, const char *cpMode, const char *cpFileName) |
Display rules and UDTs in human-readable format in ASCII format. More... | |
void | vApiOpcodesToAscii (void *vpCtx, const char *cpFileName) |
Display all opcodes in human-readable format. More... | |
void | vApiFile (void *vpCtx, const char *cpFileName, abool bStrict, abool bPppt) |
Quicky way to generate a parser from a grammar file. More... | |
void | vApiString (void *vpCtx, const char *cpString, abool bStrict, abool bPppt) |
Quicky way to generate a parser from a grammar string. More... | |
void | vHtmlHeader (FILE *spFile, const char *cpTitle) |
Prints an HTML header to an open file. More... | |
void | vHtmlFooter (FILE *spFile) |
Prints an HTML footer to an open file. More... | |
Some basic functions of the APG Application Programming Interface.
NOTE: The macro APG_AST must be defined for compliation of the APG A{I; The Abstract Syntax Tree (AST) is used for syntax translation. APG_AST must be defined to allow its use.
Definition in file api.c.
abool bApiValidate | ( | void * | vpCtx | ) |
Validates an API context pointer.
vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |
void vApiDtor | ( | void * | vpCtx | ) |
The API component destructor.
vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |
Quicky way to generate a parser from a grammar file.
Calls all of the intermediate steps in one function. Input is limited to a single file.
vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |
cpFileName | - Name of the grammar file. |
bStrict | If true, only strictly ABNF (RFC 5234 & RFC7405) grammars allowed. |
bPppt | If true, Partially-Predictive Parsing Tables (PPPTs) are generated. Note that in this single, collective call to generate a parser there is no opportunity to protect any rules from PPPT replacement. If any rules need protecting it will be necessary to do the full sequence of API calls. |
void vApiOpcodesToAscii | ( | void * | vpCtx, |
const char * | cpFileName | ||
) |
Display all opcodes in human-readable format.
vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |
cpFileName | - Name of the file to display on. Any directories in the path name must exist. If NULL, stdout is used. |
void vApiRulesToAscii | ( | void * | vpCtx, |
const char * | cpMode, | ||
const char * | cpFileName | ||
) |
Display rules and UDTs in human-readable format in ASCII format.
vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |
cpMode | (note: the first character (case-insensitive) of the following options is all that is needed)
|
cpFileName | - Name of the file to display on. Any directories in the path name must exist. If NULL, stdout is used. |
void vApiRulesToHtml | ( | void * | vpCtx, |
const char * | cpFileName | ||
) |
Display the grammar rules in human-readable, HTML format.
vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |
cpFileName | - Name of the file to display on. Any directories in the path name must exist. If NULL, stdout is used. |
Quicky way to generate a parser from a grammar string.
Calls all of the intermediate steps in one function. Input is limited to a single file.
vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |
cpString | - Pointer to a string which contains the entire grammar. |
bStrict | If true, only strictly ABNF (RFC 5234 & RFC7405) grammars allowed. |
bPppt | If true, Partially-Predictive Parsing Tables (PPPTs) are generated. Note that in this single, collective call to generate a parser there is no opportunity to protect any rules from PPPT replacement. If any rules need protecting it will be necessary to do the full sequence of API calls. |
void vHtmlFooter | ( | FILE * | spFile | ) |
void vHtmlHeader | ( | FILE * | spFile, |
const char * | cpTitle | ||
) |
void* vpApiCtor | ( | exception * | spEx | ) |
Construct an API component context (object).
spEx | Pointer to a valid exception object. See XCTOR(). If invalid, the application will silently exit with a BAD_CONTEXT exit code. |
void* vpApiGetErrorLog | ( | void * | vpCtx | ) |
Get the internal message log.
User may want to display or otherwise use the list of messages.
vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |