Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
|
Go to the documentation of this file.
40 #include "../api/api.h"
134 void vApgexPattern(
void* vpCtx,
const char* cpPattern,
const char* cpFlags);
136 void vApgexPatternFile(
void* vpCtx,
const char* cpFileName,
const char* cpFlags);
aint uiNodeHits
The number of parser node hits.
void vApgexDisplayResult(void *vpCtx, apgex_result *spResult, const char *cpFileName)
Display the complete results from a pattern match.
apgex_phrase * spPhrases
The list of matched phrases. Any given rule or UDT may have multiple matched sub-phrases.
apg_phrase * spApgexSplit(void *vpCtx, apg_phrase *spSource, aint uiLimit, aint *uipCount)
Split a phrase into an array of sub-phrases.
void vApgexPatternParser(void *vpCtx, void *vpParser, const char *cpFlags)
Define the SABNF pattern with a user-created parser.
aint uiPhraseCount
The number of matched sub-phrases for this rule/UDT.
void * vpApgexCtor(exception *spEx)
The phrase-matching engine object constructor.
abool bTraceMode
True if the t flag is set in the cpFlags string.
Detailed information about the apgex object after vApgexPattern() has been called.
apgex_phrase sRightContext
The right context of the last match - that is the phrase suffix to the matched phrase.
abool bStickyMode
True if the y flag is set prior to any occurrence of g in the cpFlags string.
void vApgexDisplayProperties(void *vpCtx, apgex_properties *spProperties, const char *cpFileName)
Display the object's properties.
aint uiTreeDepth
The maximum parsing tree depth.
The phrase matching results.
void * vpParser
Pointer to the parser object context.
aint uiIndex
The rule or UDT grammar index.
abool bDefaultMode
True if the cpFlags parameter in vApgexPattern() is NULL or empty.
abool bApgexTest(void *vpCtx, apg_phrase *spSource)
Report only success or failure on a pattern match.
const char * cpFlags
The original string of flags from vApgexPattern().
void vApgexSetLastIndex(void *vpCtx, aint uiLastIndex)
Sets the index of the character in the source where the pattern-match search is to begin.
void(* parser_callback)(callback_data *spData)
User-written callback function prototype.
apgex_phrase * spLeftContext
The phrase prefix.
void vApgexDtor(void *vpCtx)
The phrase-matching engine object destructor.
apgex_result sApgexExec(void *vpCtx, apg_phrase *spSource)
Attempt a pattern match on the source array of APG alphabet characters.
aint uiRuleCount
The number of combined rules and UDTs in the pattern.
uint_fast32_t aint
The APG parser's unsigned integer type.
void vApgexBkrCheck(exception *spEx)
Back referencing check.
apgex_properties sApgexProperties(void *vpCtx)
Get a copy of the object's properties.
apgex_phrase * spResult
The matched phrase. NULL if no match.
aint uiLastIndex
The index of the character in the input string where the attempted pattern match begins....
apg_phrase sApgexReplaceFunc(void *vpCtx, apg_phrase *spSource, pfn_replace pfnFunc, void *vpUser)
Replace the matched phrase with a user-generated phrase.
apg_phrase(* pfn_replace)(apgex_result *spResult, apgex_properties *spProperties, void *vpUser)
Prototype for the replacement function used by sApgexReplaceFunc().
void * vpApgexGetAst(void *vpCtx)
Get a pointer to the AST object's context.
A structure to describe the type and location of a caught exception.
aint uiLastIndex
The last index following the last pattern match attempt.
Defines a pointer to an achar array plus its length. That is, a phrase as is often used by APG.
const char * cpRuleName
The rule or UDT name.
abool bTraceHtmlMode
True if the th flags ar set for HTML trace output in the cpFlags string.
void vApgexDisplayPatternErrors(void *vpCtx, const char *cpFileName)
apg_phrase sLastSource
The last source or input string as a phrase - may be different from original if sApgexReplace() or sA...
void vApgexEnableRules(void *vpCtx, const char *cpNames, abool bEnable)
Enable or disable specified rule and/or UDT names for phrase capture.
const char * cpPattern
Internally preserve copy of the SABNF grammar defining the string to match. NULL if the pattern is de...
void vApgexDefineUDT(void *vpCtx, const char *cpName, parser_callback pfnUdt)
Define the callback function for a User-Defined Terminal (UDT).
apg_phrase sOriginalSource
The original source or input string as a phrase.
abool bGlobalMode
True if the g flag is set prior to any occurrence of y in the cpFlags string.
apgex_phrase * spRightContext
The phrase suffix.
void * vpApgexGetParser(void *vpCtx)
Get a pointer to the parser object's context.
void * vpTrace
Pointer to the trace object context. NULL unless the t flag is used.
uint8_t abool
abool is the APG bool type.
void * vpApgexGetTrace(void *vpCtx)
Get a pointer to the trace object's context.
Information about each rule or UDT in the SABNF pattern.
void vApgexDisplayPhrase(void *vpCtx, apgex_phrase *spPhrase, const char *cpFileName)
Display the object's properties.
apg_phrase sApgexReplace(void *vpCtx, apg_phrase *spSource, apg_phrase *spReplacement)
Replace the matched phrase with a specified phrase.
void vApgexPattern(void *vpCtx, const char *cpPattern, const char *cpFlags)
Prepare a phrase-matching parser for the given pattern.
apgex_phrase sLeftContext
The left context of the last match - that is the phrase prefix to the matched phrase.
apg_phrase sPhrase
The matched phrase.
void vApgexPatternFile(void *vpCtx, const char *cpFileName, const char *cpFlags)
Reads the SABNF grammar defining the pattern from a file.
void * vpAst
Pointer to the AST object context. NULL unless the a flag is used.
abool bPpptMode
True if the p flag is set. The parser will use Partially-Predictive Parsing Tables.
The representation of a matched phrase.
apgex_rule * spRules
The phrases matched by all enabled rules and/or UDTs. NULL if no match.
aint uiPhraseOffset
Offset into the source string where the matched phrase begins.
APG Version 7.0 is licensed under the
2-Clause BSD License,
an Open Source Initiative Approved License.