Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
astp.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_ASTP_H_
31 #define LIB_ASTP_H_
32 
33 #ifdef APG_AST
34 
46 typedef struct{
47  const void* vpValidate;
49  parser* spParser;
51  void* vpVecRecords;
56 // achar* acpInput; ///< \brief Pointer to the input string.
57 // aint uiLength; ///< \brief Number of alphabet characters in the input string.
58 } ast;
59 
64 void vAstClear(void* vpCtx);
66 void vAstRuleOpen(void* vpCtx, aint uiRuleIndex, aint uiPhraseOffset);
67 void vAstRuleClose(void* vpCtx, aint uiRuleIndex, aint uiState, aint uiPhraseOffset, aint uiPhraseLength);
68 void vAstOpOpen(void* vpCtx);
69 void vAstOpClose(void* vpCtx, aint uiState);
71 
72 #endif /* APG_AST */
73 #endif /* LIB_ASTP_H_ */
ast::vpVecThatStack
void * vpVecThatStack
Pointer to the vector holding a LIFO stack to match up and down node records.
Definition: astp.h:52
ast::vpVecOpenStack
void * vpVecOpenStack
Pointer to a vector LIFO stack of open rule nodes.
Definition: astp.h:53
ast::pfnRuleCallbacks
ast_callback * pfnRuleCallbacks
An array of rule name call back functions.
Definition: astp.h:54
vAstOpOpen
void vAstOpOpen(void *vpCtx)
Called in preparation for a downward traversal of an RNM or UDT node.
Definition: ast.c:392
vAstRuleClose
void vAstRuleClose(void *vpCtx, aint uiRuleIndex, aint uiState, aint uiPhraseOffset, aint uiPhraseLength)
Called by parser's RNM operator after upward traversal.
Definition: ast.c:329
aint
uint_fast32_t aint
The APG parser's unsigned integer type.
Definition: apg.h:79
ast
The AST object context. Holds the object's state.
Definition: astp.h:46
exception
A structure to describe the type and location of a caught exception.
Definition: exception.h:47
ast::spException
exception * spException
Pointer to an exception structure for reporting fatal errors back to the parser's catch block scope.
Definition: astp.h:48
ast::vpVecRecords
void * vpVecRecords
Pointer to the vector holding the AST records (two for each saved node).
Definition: astp.h:51
ast_callback
aint(* ast_callback)(ast_data *spData)
The prototype for AST translation callback functions.
Definition: ast.h:91
ast::pfnUdtCallbacks
ast_callback * pfnUdtCallbacks
An array of UDT call back functions.
Definition: astp.h:55
vAstClear
void vAstClear(void *vpCtx)
Clear the AST records for reuse of the AST object.
Definition: ast.c:118
ast::vpValidate
const void * vpValidate
A "magic number" indicating a valid, initialized AST object.
Definition: astp.h:47
vAstRuleOpen
void vAstRuleOpen(void *vpCtx, aint uiRuleIndex, aint uiPhraseOffset)
Called by parser's RNM operator before downward traversal.
Definition: ast.c:286
vAstOpClose
void vAstOpClose(void *vpCtx, aint uiState)
Called to finish up after an upward traversal of an RNM or UDT node.
Definition: ast.c:403
APG Version 7.0 is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.