Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
Data Structures | Functions
backrefu.c File Reference

The universal-mode back reference object. More...

#include "./apg.h"
#include "./lib.h"
#include "./parserp.h"
#include "./backref.h"
#include "./backrefu.h"
Include dependency graph for backrefu.c:

Go to the source code of this file.

Data Structures

struct  bkru_frame
 
struct  bkru_input
 

Functions

void * vpBkruCtor (parser *spParserCtx)
 
void vBkruRuleOpen (void *vpCtx, aint uiIndex)
 
void vBkruRuleClose (void *vpCtx, aint uiIndex, aint uiState, aint uiPhraseOffset, aint uiPhraseLength)
 
void vBkruUdtClose (void *vpCtx, aint uiIndex, aint uiState, aint uiPhraseOffset, aint uiPhraseLength)
 
void vBkruOpOpen (void *vpCtx)
 
void vBkruOpClose (void *vpCtx, aint uiState)
 
bkr_phrase sBkruFetch (void *vpCtx, aint uiIndex)
 

Detailed Description

The universal-mode back reference object.

This component will maintain a list of frame stacks, one for each rule that is universal-mode back referenced. It will have a map, that maps each rule index to the proper frame stack index. It also needs a stack of check points. RNM, ALT, CAT and REP operators need to checkpoint the frame stacks going down the tree, and restore the checkpoint coming up the tree if the node does not find a phrase match.

Each rule's Single-Expansion Syntax Tree(SEST) will be scanned for any references to any of the back referenced rules. If a rule does not reference any back referenced rules (which is anticipated to be most rules) it will set a "don't backref" flag that will prevent any back reference code in the tree below the rule's RNM node, saving a lot of check point work.

Definition in file backrefu.c.

Function Documentation

◆ sBkruFetch()

bkr_phrase sBkruFetch ( void *  vpCtx,
aint  uiIndex 
)

Definition at line 358 of file backrefu.c.

◆ vBkruOpClose()

void vBkruOpClose ( void *  vpCtx,
aint  uiState 
)

Definition at line 340 of file backrefu.c.

◆ vBkruOpOpen()

void vBkruOpOpen ( void *  vpCtx)

Definition at line 327 of file backrefu.c.

◆ vBkruRuleClose()

void vBkruRuleClose ( void *  vpCtx,
aint  uiIndex,
aint  uiState,
aint  uiPhraseOffset,
aint  uiPhraseLength 
)

Definition at line 295 of file backrefu.c.

◆ vBkruRuleOpen()

void vBkruRuleOpen ( void *  vpCtx,
aint  uiIndex 
)

Definition at line 282 of file backrefu.c.

◆ vBkruUdtClose()

void vBkruUdtClose ( void *  vpCtx,
aint  uiIndex,
aint  uiState,
aint  uiPhraseOffset,
aint  uiPhraseLength 
)

Definition at line 320 of file backrefu.c.

◆ vpBkruCtor()

void* vpBkruCtor ( parser *  spParserCtx)

Definition at line 100 of file backrefu.c.

APG Version 7.0 is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.