Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
json
json-grammar.h
Go to the documentation of this file.
1
//
2
// This C-language parser header was generated by APG Version 7.0.
3
// User modifications invalidate the license agreement and may cause unpredictable results.
4
//
5
/* *************************************************************************************
6
Copyright (c) 2021, Lowell D. Thomas
7
All rights reserved.
8
9
This file is part of APG Version 7.0.
10
APG Version 7.0 may be used under the terms of the BSD 2-Clause License.
11
12
Redistribution and use in source and binary forms, with or without
13
modification, are permitted provided that the following conditions are met:
14
15
1. Redistributions of source code must retain the above copyright notice, this
16
list of conditions and the following disclaimer.
17
18
2. Redistributions in binary form must reproduce the above copyright notice,
19
this list of conditions and the following disclaimer in the documentation
20
and/or other materials provided with the distribution.
21
22
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33
* *************************************************************************************/
34
35
#ifndef _JSON_GRAMMAR_H_
36
#define _JSON_GRAMMAR_H_
37
38
// rule ids
39
#define JSON_GRAMMAR_ARRAY 18
40
#define JSON_GRAMMAR_ASCII 46
41
#define JSON_GRAMMAR_BACKSPACE 41
42
#define JSON_GRAMMAR_BEGIN_ARRAY 1
43
#define JSON_GRAMMAR_BEGIN_OBJECT 2
44
#define JSON_GRAMMAR_CHAR 37
45
#define JSON_GRAMMAR_CR 44
46
#define JSON_GRAMMAR_DECIMAL_POINT 21
47
#define JSON_GRAMMAR_DIGIT 56
48
#define JSON_GRAMMAR_DIGIT1_9 22
49
#define JSON_GRAMMAR_E 23
50
#define JSON_GRAMMAR_EMINUS 29
51
#define JSON_GRAMMAR_END_ARRAY 3
52
#define JSON_GRAMMAR_END_MEMBER_SEPARATOR 7
53
#define JSON_GRAMMAR_END_OBJECT 4
54
#define JSON_GRAMMAR_END_VALUE_SEPARATOR 8
55
#define JSON_GRAMMAR_EPLUS 31
56
#define JSON_GRAMMAR_EXP 24
57
#define JSON_GRAMMAR_FALSE 11
58
#define JSON_GRAMMAR_FORM_FEED 42
59
#define JSON_GRAMMAR_FRAC 25
60
#define JSON_GRAMMAR_FRAC_DIGITS 26
61
#define JSON_GRAMMAR_FRAC_ONLY 20
62
#define JSON_GRAMMAR_HEXDIG 57
63
#define JSON_GRAMMAR_INT 27
64
#define JSON_GRAMMAR_JSON_TEXT 0
65
#define JSON_GRAMMAR_KEY 16
66
#define JSON_GRAMMAR_KEY_BEGIN 17
67
#define JSON_GRAMMAR_LINE_FEED 43
68
#define JSON_GRAMMAR_MEMBER 15
69
#define JSON_GRAMMAR_MINUS 28
70
#define JSON_GRAMMAR_NAME_SEPARATOR 5
71
#define JSON_GRAMMAR_NULL 12
72
#define JSON_GRAMMAR_NUMBER 19
73
#define JSON_GRAMMAR_OBJECT 14
74
#define JSON_GRAMMAR_PLUS 30
75
#define JSON_GRAMMAR_QUOTE 38
76
#define JSON_GRAMMAR_R_SOLIDUS 39
77
#define JSON_GRAMMAR_SOLIDUS 40
78
#define JSON_GRAMMAR_STRING 33
79
#define JSON_GRAMMAR_STRING_BEGIN 34
80
#define JSON_GRAMMAR_STRING_CONTENT 35
81
#define JSON_GRAMMAR_STRING_END 36
82
#define JSON_GRAMMAR_TAB 45
83
#define JSON_GRAMMAR_TRUE 13
84
#define JSON_GRAMMAR_UTF16 47
85
#define JSON_GRAMMAR_UTF16_1 49
86
#define JSON_GRAMMAR_UTF16_2 48
87
#define JSON_GRAMMAR_UTF16_TAIL 50
88
#define JSON_GRAMMAR_UTF8 51
89
#define JSON_GRAMMAR_UTF8_2 52
90
#define JSON_GRAMMAR_UTF8_3 53
91
#define JSON_GRAMMAR_UTF8_4 54
92
#define JSON_GRAMMAR_UTF8_TAIL 55
93
#define JSON_GRAMMAR_VALUE 10
94
#define JSON_GRAMMAR_VALUE_SEPARATOR 6
95
#define JSON_GRAMMAR_WS 9
96
#define JSON_GRAMMAR_ZERO 32
97
#define RULE_COUNT_JSON_GRAMMAR 58
98
99
// pointer to parser initialization data
100
extern
void
*
vpJsonGrammarInit
;
101
102
// Helper function(s) for setting rule/UDT name callbacks.
103
// Un-comment and replace named NULL with pointer to the appropriate callback function.
104
// NOTE: This can easily be modified for setting AST callback functions:
105
// Replace parser_callback with ast_callback and
106
// vParserSetRuleCallback(vpParserCtx) with vAstSetRuleCallback(vpAstCtx) and
107
// vParserSetUdtCallback(vpParserCtx) with vAstSetUdtCallback(vpAstCtx).
108
/****************************************************************
109
void vJsonGrammarRuleCallbacks(void* vpParserCtx){
110
aint ui;
111
parser_callback cb[RULE_COUNT_JSON_GRAMMAR];
112
cb[JSON_GRAMMAR_ARRAY] = NULL;
113
cb[JSON_GRAMMAR_ASCII] = NULL;
114
cb[JSON_GRAMMAR_BACKSPACE] = NULL;
115
cb[JSON_GRAMMAR_BEGIN_ARRAY] = NULL;
116
cb[JSON_GRAMMAR_BEGIN_OBJECT] = NULL;
117
cb[JSON_GRAMMAR_CHAR] = NULL;
118
cb[JSON_GRAMMAR_CR] = NULL;
119
cb[JSON_GRAMMAR_DECIMAL_POINT] = NULL;
120
cb[JSON_GRAMMAR_DIGIT] = NULL;
121
cb[JSON_GRAMMAR_DIGIT1_9] = NULL;
122
cb[JSON_GRAMMAR_E] = NULL;
123
cb[JSON_GRAMMAR_EMINUS] = NULL;
124
cb[JSON_GRAMMAR_END_ARRAY] = NULL;
125
cb[JSON_GRAMMAR_END_MEMBER_SEPARATOR] = NULL;
126
cb[JSON_GRAMMAR_END_OBJECT] = NULL;
127
cb[JSON_GRAMMAR_END_VALUE_SEPARATOR] = NULL;
128
cb[JSON_GRAMMAR_EPLUS] = NULL;
129
cb[JSON_GRAMMAR_EXP] = NULL;
130
cb[JSON_GRAMMAR_FALSE] = NULL;
131
cb[JSON_GRAMMAR_FORM_FEED] = NULL;
132
cb[JSON_GRAMMAR_FRAC] = NULL;
133
cb[JSON_GRAMMAR_FRAC_DIGITS] = NULL;
134
cb[JSON_GRAMMAR_FRAC_ONLY] = NULL;
135
cb[JSON_GRAMMAR_HEXDIG] = NULL;
136
cb[JSON_GRAMMAR_INT] = NULL;
137
cb[JSON_GRAMMAR_JSON_TEXT] = NULL;
138
cb[JSON_GRAMMAR_KEY] = NULL;
139
cb[JSON_GRAMMAR_KEY_BEGIN] = NULL;
140
cb[JSON_GRAMMAR_LINE_FEED] = NULL;
141
cb[JSON_GRAMMAR_MEMBER] = NULL;
142
cb[JSON_GRAMMAR_MINUS] = NULL;
143
cb[JSON_GRAMMAR_NAME_SEPARATOR] = NULL;
144
cb[JSON_GRAMMAR_NULL] = NULL;
145
cb[JSON_GRAMMAR_NUMBER] = NULL;
146
cb[JSON_GRAMMAR_OBJECT] = NULL;
147
cb[JSON_GRAMMAR_PLUS] = NULL;
148
cb[JSON_GRAMMAR_QUOTE] = NULL;
149
cb[JSON_GRAMMAR_R_SOLIDUS] = NULL;
150
cb[JSON_GRAMMAR_SOLIDUS] = NULL;
151
cb[JSON_GRAMMAR_STRING] = NULL;
152
cb[JSON_GRAMMAR_STRING_BEGIN] = NULL;
153
cb[JSON_GRAMMAR_STRING_CONTENT] = NULL;
154
cb[JSON_GRAMMAR_STRING_END] = NULL;
155
cb[JSON_GRAMMAR_TAB] = NULL;
156
cb[JSON_GRAMMAR_TRUE] = NULL;
157
cb[JSON_GRAMMAR_UTF16] = NULL;
158
cb[JSON_GRAMMAR_UTF16_1] = NULL;
159
cb[JSON_GRAMMAR_UTF16_2] = NULL;
160
cb[JSON_GRAMMAR_UTF16_TAIL] = NULL;
161
cb[JSON_GRAMMAR_UTF8] = NULL;
162
cb[JSON_GRAMMAR_UTF8_2] = NULL;
163
cb[JSON_GRAMMAR_UTF8_3] = NULL;
164
cb[JSON_GRAMMAR_UTF8_4] = NULL;
165
cb[JSON_GRAMMAR_UTF8_TAIL] = NULL;
166
cb[JSON_GRAMMAR_VALUE] = NULL;
167
cb[JSON_GRAMMAR_VALUE_SEPARATOR] = NULL;
168
cb[JSON_GRAMMAR_WS] = NULL;
169
cb[JSON_GRAMMAR_ZERO] = NULL;
170
for(ui = 0; ui < (aint)RULE_COUNT_JSON_GRAMMAR; ui++){
171
vParserSetRuleCallback(vpParserCtx, ui, cb[ui]);
172
}
173
}
174
****************************************************************/
175
176
#endif
/* _JSON_GRAMMAR_H_ */
vpJsonGrammarInit
void * vpJsonGrammarInit
Definition:
json-grammar.c:1631
Generated on Sun Jun 13 2021 14:32:59 for APG by
1.8.17
APG Version 7.0 is licensed under the
2-Clause BSD License
,
an Open Source Initiative Approved License.