Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
backref.h
Go to the documentation of this file.
1 /* *************************************************************************************
2  Copyright (c) 2021, Lowell D. Thomas
3  All rights reserved.
4 
5  This file is part of APG Version 7.0.
6  APG Version 7.0 may be used under the terms of the BSD 2-Clause License.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  1. Redistributions of source code must retain the above copyright notice, this
12  list of conditions and the following disclaimer.
13 
14  2. Redistributions in binary form must reproduce the above copyright notice,
15  this list of conditions and the following disclaimer in the documentation
16  and/or other materials provided with the distribution.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 
29 * *************************************************************************************/
30 #ifndef LIB_BACKREF_H_
31 #define LIB_BACKREF_H_
32 #ifdef APG_BKR
33 
43 typedef struct {
48 } bkr_rule;
49 
53 typedef struct {
57 } bkr_udt;
58 
63 typedef struct {
66 } bkr_phrase;
67 
71 typedef struct {
72  const void* vpValidate;
74  parser* spParserCtx;
77  void** vppPhraseStacks;
79  void* vpCheckPoints;
80  void* vpOpenRules;
84 } backref;
85 
86 #endif /* APG_BKR */
87 #endif /* LIB_BACKREF_H_ */
bkr_udt::uiBackRefIndex
aint uiBackRefIndex
If this UDT is back referenced, this is the UDT's index in the bkr map.
Definition: backref.h:56
backref::vpCheckPoints
void * vpCheckPoints
A stack of check points (a check point is the current record count in each of the frame stacks).
Definition: backref.h:79
backref::spException
exception * spException
Pointer to the exception structure for reporting fatal errors.
Definition: backref.h:73
bkr_udt::uiIsBackRef
aint uiIsBackRef
APG_TRUE if this UDT has been back referenced in, APG_FALSE otherwise.
Definition: backref.h:55
bkr_phrase::uiPhraseOffset
aint uiPhraseOffset
The offset to the matched phrase.
Definition: backref.h:64
backref::uiBkrCount
aint uiBkrCount
Number of back referenced rules/UDTS.
Definition: backref.h:81
backref::spParserCtx
parser * spParserCtx
Pointer to the parser context that created this object.
Definition: backref.h:74
aint
uint_fast32_t aint
The APG parser's unsigned integer type.
Definition: apg.h:79
bkr_udt
Back referencing information for each UDT.
Definition: backref.h:53
bkr_phrase::uiPhraseLength
aint uiPhraseLength
The matched phrase length.
Definition: backref.h:65
backref::spUdts
bkr_udt * spUdts
Pointer to the back reference UDT information.
Definition: backref.h:76
exception
A structure to describe the type and location of a caught exception.
Definition: exception.h:47
bkr_rule::spRule
rule * spRule
Definition: backref.h:44
backref
The back reference object's context.
Definition: backref.h:71
backref::vppPhraseStacks
void ** vppPhraseStacks
An array of frame structs, vector context if rule/UDT index is universally back referenced....
Definition: backref.h:77
bkr_rule::uiIsBackRef
aint uiIsBackRef
APG_TRUE if this rule has been back referenced, APG_FALSE otherwise.
Definition: backref.h:46
backref::vpValidate
const void * vpValidate
"magic" number to validate that the context is valid
Definition: backref.h:72
rule
Data structure for a single rule.
Definition: parserp.h:119
bkr_phrase
Defines one frame on the back reference stack.
Definition: backref.h:63
backref::uiBkrRulesOpen
aint uiBkrRulesOpen
Counter for the number of open rules that have BKR nodes in the rule SEST. (Single-Expansion Syntax T...
Definition: backref.h:82
bkr_udt::spUdt
udt * spUdt
Definition: backref.h:54
bkr_rule::uiBackRefIndex
aint uiBackRefIndex
If this rule is back referenced, this is the rule's index in the bkr map.
Definition: backref.h:47
bkr_rule::uiHasBackRef
aint uiHasBackRef
APG_TRUE if this rule refers to a referenced rule in it syntax tree, APG_FALSE otherwise.
Definition: backref.h:45
bkr_rule
Back referencing information for each rule.
Definition: backref.h:43
backref::spRules
bkr_rule * spRules
Pointer to the back reference rule information.
Definition: backref.h:75
backref::vpOpenRules
void * vpOpenRules
A stack indicating if the top rule has a BKR in its syntax tree.
Definition: backref.h:80
udt
Data structure for a single UDT.
Definition: parserp.h:133
APG Version 7.0 is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.