Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
|
Go to the documentation of this file.
36 #include "../library/parserp.h"
59 memset((
void*) &sInput, 0,
sizeof(sInput));
60 memset((
void*) &sState, 0,
sizeof(sState));
61 memset((
void*) &sData, 0,
sizeof(sData));
64 XTHROW(spApi->
spException,
"attempted syntax phase but input grammar not validated");
67 XTHROW(spApi->
spException,
"attempted syntax phase but syntax has already been validated)");
85 if(
sizeof(
achar) >
sizeof(char)){
89 for(; ui < sInput.uiInputLength; ui++){
92 sInput.acpInput = (
const achar*)acpInput;
98 sData.bStrict = bStrict;
100 sInput.vpUserData = (
void*) &sData;
110 if (!sState.uiSuccess) {
The syntax data that gets passed to the syntax parser's callback functions.
abool bApiValidate(void *vpCtx)
Validates an API context pointer.
void * vpParserCtor(exception *spException, void *vpParserInit)
The parser's constructor for file initialization data.
Header file for the semantic translation functions.
Private header file for the APG API suite of functions.
void vExContext()
Handles bad context pointers.
abool bInputValid
APG_TRUE if theer is input and it has been validated, APG_FALSE otherwise.
uint_fast8_t achar
achar is the type for the parser's alphabet characters.
void vApiSyntax(void *vpCtx, abool bStrict)
Parse the SABNF grammar to validate that the grammar structure is valid.
#define XTHROW(ctx, msg)
Exception throw macro.
uint_fast32_t aint
The APG parser's unsigned integer type.
void * vpTraceCtor(void *vpCtx)
The trace object constructor.
Defines the input string and other configuration parameters for the parser,.
The parser's final state.
void * vpVecGrammar
The (achar) input grammar, if sizeof(achar) > sizeof(char).
abool bSyntaxValid
APG_TRUE if the input syntax is valid, APG_FALSE otherwise.
void * vpAst
context handle to the AST object
void * vpVecPushn(void *vpCtx, void *vpElement, aint uiCount)
Adds one or more elements to the end of the array.
void vSabnfGrammarAstCallbacks(void *vpAstCtx)
Set the callback functions for the AST translation of the semantic phase parse to opcodes.
aint uiInputLength
The number of input characters.
void vSabnfGrammarRuleCallbacks(void *vpParserCtx)
Set the parser's rule callback functions for the syntax phase.
Header file for the syntax phase functions.
void * vpAstCtor(void *vpParserCtx)
The AST object constructor.
void * vpSabnfGrammarInit
#define SABNF_GRAMMAR_FILE
uint8_t abool
abool is the APG bool type.
void * vpAltStack
A temporary vector for the AST translator.
void * vpParser
context handle to the SABNF grammar parser object
void vVecClear(void *vpCtx)
Clears all used elements in a vector component.
Public header file for the APG API suite of functions.
void vParserParse(void *vpCtx, parser_config *spConfig, parser_state *spState)
Parse an input string of alphabet characters.
APG Version 7.0 is licensed under the
2-Clause BSD License,
an Open Source Initiative Approved License.