clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name grammar.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D SYSTEM_ZLIB -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/hwpfilter/source/grammar.cxx
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | #ifndef YYDEBUG |
25 | #define YYDEBUG 0 |
26 | #endif |
27 | #ifndef YYMAXDEPTH |
28 | #define YYMAXDEPTH 0 |
29 | #endif |
30 | |
31 | #include <vector> |
32 | #include <stdlib.h> |
33 | #include <string.h> |
34 | |
35 | #include "grammar.hxx" |
36 | #include "lexer.hxx" |
37 | #include "nodes.h" |
38 | |
39 | extern "C" { |
40 | #include "grammar.h" |
41 | } |
42 | |
43 | std::vector<std::unique_ptr<Node>> nodelist; |
44 | |
45 | static void yyerror(const char *); |
46 | |
47 | static Node *top=nullptr; |
48 | |
49 | int Node::count = 0; |
50 | |
51 | #ifdef PARSE_DEBUG |
52 | #define debug printf |
53 | #else |
54 | static int debug(const char *format, ...); |
55 | #endif |
56 | |
57 | #include <stdio.h> |
58 | |
59 | #define YYFINAL 102 |
60 | #define YYFLAG -32768 |
61 | #define YYNTBASE 43 |
62 | |
63 | #define YYTRANSLATE(x) (static_cast<unsigned>(x) <= 285 ? yytranslate[x] : 66) |
64 | |
65 | const char yytranslate[] = { 0, |
66 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
67 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
68 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
69 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 33, |
70 | 37, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
71 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 36, |
72 | 2, 40, 2, 2, 2, 2, 2, 2, 2, 2, |
73 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
74 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
75 | 34, 2, 38, 42, 41, 2, 2, 2, 2, 2, |
76 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
77 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
78 | 2, 2, 35, 32, 39, 2, 2, 2, 2, 2, |
79 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
80 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
81 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
82 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
83 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
84 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
85 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
86 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
87 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
88 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
89 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
90 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
91 | 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, |
92 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
93 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
94 | 27, 28, 29, 30, 31 |
95 | }; |
96 | |
97 | #if YYDEBUG != 0 |
98 | static const short yyprhs[] = { 0, |
99 | 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, |
100 | 20, 22, 24, 26, 28, 30, 32, 34, 36, 39, |
101 | 42, 45, 48, 51, 54, 58, 60, 63, 66, 69, |
102 | 72, 75, 79, 81, 85, 89, 92, 96, 99, 103, |
103 | 106, 110, 114, 120, 124, 130, 132, 135, 137, 140, |
104 | 143, 147, 150, 154, 157, 159, 161, 165, 167, 169, |
105 | 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, |
106 | 192, 194 |
107 | }; |
108 | |
109 | static const short yyrhs[] = { 4, |
110 | 0, 9, 0, 10, 0, 5, 0, 11, 0, 12, |
111 | 0, 20, 0, 21, 0, 7, 0, 6, 0, 23, |
112 | 0, 17, 0, 18, 0, 8, 0, 32, 0, 31, |
113 | 0, 22, 0, 43, 0, 44, 43, 0, 26, 33, |
114 | 0, 26, 34, 0, 26, 35, 0, 26, 36, 0, |
115 | 26, 32, 0, 26, 32, 32, 0, 29, 0, 27, |
116 | 37, 0, 27, 38, 0, 27, 39, 0, 27, 40, |
117 | 0, 27, 32, 0, 27, 32, 32, 0, 30, 0, |
118 | 45, 64, 46, 0, 33, 64, 37, 0, 33, 37, |
119 | 0, 35, 64, 39, 0, 35, 39, 0, 34, 64, |
120 | 38, 0, 34, 38, 0, 65, 41, 65, 0, 65, |
121 | 42, 65, 0, 65, 41, 49, 42, 49, 0, 14, |
122 | 49, 49, 0, 35, 64, 16, 64, 39, 0, 3, |
123 | 0, 54, 49, 0, 19, 0, 56, 49, 0, 13, |
124 | 49, 0, 13, 50, 49, 0, 24, 49, 0, 24, |
125 | 49, 49, 0, 25, 49, 0, 62, 0, 63, 0, |
126 | 62, 28, 63, 0, 64, 0, 65, 0, 64, 65, |
127 | 0, 49, 0, 48, 0, 47, 0, 51, 0, 52, |
128 | 0, 53, 0, 57, 0, 58, 0, 55, 0, 44, |
129 | 0, 59, 0, 60, 0 |
130 | }; |
131 | |
132 | #endif |
133 | |
134 | #if YYDEBUG != 0 |
135 | static const short yyrline[] = { 0, |
136 | 59, 61, 62, 63, 64, 65, 66, 67, 68, 69, |
137 | 70, 71, 72, 73, 74, 75, 76, 79, 81, 84, |
138 | 86, 87, 88, 89, 90, 91, 94, 96, 97, 98, |
139 | 99, 100, 101, 104, 108, 110, 113, 115, 118, 120, |
140 | 123, 125, 126, 129, 133, 138, 142, 145, 149, 153, |
141 | 155, 158, 160, 163, 168, 172, 174, 177, 181, 183, |
142 | 186, 188, 189, 190, 191, 192, 193, 194, 195, 196, |
143 | 197, 198 |
144 | }; |
145 | #endif |
146 | |
147 | |
148 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) |
149 | |
150 | static const char * const yytname[] = { "$","error","$undefined.","ACCENT", |
151 | "SMALL_GREEK","CAPITAL_GREEK","BINARY_OPERATOR","RELATION_OPERATOR","ARROW", |
152 | "GENERAL_IDEN","GENERAL_OPER","BIG_SYMBOL","FUNCTION","ROOT","FRACTION","SUBSUP", |
153 | "EQOVER","DELIMETER","LARGE_DELIM","DECORATION","SPACE_SYMBOL","CHARACTER","STRING", |
154 | "OPERATOR","EQBEGIN","EQEND","EQLEFT","EQRIGHT","NEWLINE","LEFT_DELIM","RIGHT_DELIM", |
155 | "DIGIT","'|'","'('","'['","'{'","'<'","')'","']'","'}'","'>'","'_'","'^'","Identifier", |
156 | "PrimaryExpr","EQLeft","EQRight","Fence","Parenth","Block","Bracket","SubSupExpr", |
157 | "FractionExpr","OverExpr","Accent","AccentExpr","Decoration","DecorationExpr", |
158 | "RootExpr","BeginExpr","EndExpr","MathML","Lines","Line","ExprList","Expr", NULL |
159 | }; |
160 | #endif |
161 | |
162 | const short yyr1[] = { 0, |
163 | 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, |
164 | 43, 43, 43, 43, 43, 43, 43, 44, 44, 45, |
165 | 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, |
166 | 46, 46, 46, 47, 48, 48, 49, 49, 50, 50, |
167 | 51, 51, 51, 52, 53, 54, 55, 56, 57, 58, |
168 | 58, 59, 59, 60, 61, 62, 62, 63, 64, 64, |
169 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
170 | 65, 65 |
171 | }; |
172 | |
173 | const short yyr2[] = { 0, |
174 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
175 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, |
176 | 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, |
177 | 2, 3, 1, 3, 3, 2, 3, 2, 3, 2, |
178 | 3, 3, 5, 3, 5, 1, 2, 1, 2, 2, |
179 | 3, 2, 3, 2, 1, 1, 3, 1, 1, 2, |
180 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
181 | 1, 1 |
182 | }; |
183 | |
184 | const short yydefact[] = { 0, |
185 | 46, 1, 4, 10, 9, 14, 2, 3, 5, 6, |
186 | 0, 0, 12, 13, 48, 7, 8, 17, 11, 0, |
187 | 0, 0, 26, 16, 15, 0, 0, 18, 70, 0, |
188 | 63, 62, 61, 64, 65, 66, 0, 69, 0, 67, |
189 | 68, 71, 72, 55, 56, 58, 59, 0, 0, 50, |
190 | 0, 0, 52, 54, 24, 20, 21, 22, 23, 36, |
191 | 0, 38, 0, 19, 0, 47, 49, 0, 60, 0, |
192 | 0, 40, 0, 0, 51, 44, 53, 25, 35, 0, |
193 | 37, 0, 33, 34, 57, 61, 41, 42, 39, 0, |
194 | 31, 27, 28, 29, 30, 0, 45, 32, 43, 0, |
195 | 0, 0 |
196 | }; |
197 | |
198 | const short yydefgoto[] = { 28, |
199 | 29, 30, 84, 31, 32, 33, 51, 34, 35, 36, |
200 | 37, 38, 39, 40, 41, 42, 43, 100, 44, 45, |
201 | 46, 47 |
202 | }; |
203 | |
204 | const short yypact[] = { 393, |
205 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
206 | -30, -19,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -19, |
207 | -19, -3,-32768,-32768,-32768, 290, 107,-32768, 425, 393, |
208 | -32768,-32768,-32768,-32768,-32768,-32768, -19,-32768, -19,-32768, |
209 | -32768,-32768,-32768, -20,-32768, 393, -21, 218, 107,-32768, |
210 | -19, -19, -19,-32768, -15,-32768,-32768,-32768,-32768,-32768, |
211 | 325,-32768, 70,-32768, 360,-32768,-32768, 393, -21, 393, |
212 | 393,-32768, 254, 144,-32768,-32768,-32768,-32768,-32768, 393, |
213 | -32768, -25,-32768,-32768,-32768, -31, -21, -21,-32768, 181, |
214 | -14,-32768,-32768,-32768,-32768, -19,-32768,-32768,-32768, 22, |
215 | 23,-32768 |
216 | }; |
217 | |
218 | const short yypgoto[] = { -2, |
219 | -32768,-32768,-32768,-32768,-32768, -11,-32768,-32768,-32768,-32768, |
220 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -33, |
221 | -24, -27 |
222 | }; |
223 | |
224 | |
225 | #define YYLAST 457 |
226 | |
227 | |
228 | const short yytable[] = { 50, |
229 | 52, 61, 63, 48, 49, 65, 91, 68, 53, 54, |
230 | 96, 92, 93, 94, 95, 49, 78, 98, 69, 70, |
231 | 71, 101, 102, 73, 74, 66, 64, 67, 55, 56, |
232 | 57, 58, 59, 69, 85, 69, 0, 69, 0, 75, |
233 | 76, 77, 87, 88, 0, 69, 69, 0, 0, 0, |
234 | 0, 0, 0, 0, 0, 90, 0, 0, 86, 0, |
235 | 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, |
236 | 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, |
237 | 9, 10, 11, 12, 99, 80, 13, 14, 15, 16, |
238 | 17, 18, 19, 20, 21, 22, 0, 0, 23, 0, |
239 | 24, 25, 26, 0, 27, 0, 0, 0, 81, 1, |
240 | 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, |
241 | 12, 0, 0, 13, 14, 15, 16, 17, 18, 19, |
242 | 20, 21, 22, 0, 0, 23, 0, 24, 25, 26, |
243 | 0, 27, 0, 0, 0, 62, 1, 2, 3, 4, |
244 | 5, 6, 7, 8, 9, 10, 11, 12, 0, 0, |
245 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
246 | 0, 0, 23, 0, 24, 25, 26, 0, 27, 0, |
247 | 0, 0, 81, 1, 2, 3, 4, 5, 6, 7, |
248 | 8, 9, 10, 11, 12, 0, 0, 13, 14, 15, |
249 | 16, 17, 18, 19, 20, 21, 22, 0, 0, 23, |
250 | 0, 24, 25, 26, 0, 27, 0, 0, 0, 97, |
251 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
252 | 11, 12, 0, 0, 13, 14, 15, 16, 17, 18, |
253 | 19, 20, 21, 22, 0, 0, 23, 0, 24, 25, |
254 | 26, 0, 27, 0, 0, 72, 1, 2, 3, 4, |
255 | 5, 6, 7, 8, 9, 10, 11, 12, 0, 0, |
256 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
257 | 0, 0, 23, 0, 24, 25, 26, 0, 27, 0, |
258 | 0, 89, 1, 2, 3, 4, 5, 6, 7, 8, |
259 | 9, 10, 11, 12, 0, 0, 13, 14, 15, 16, |
260 | 17, 18, 19, 20, 21, 22, 0, 0, 23, 0, |
261 | 24, 25, 26, 0, 27, 0, 60, 1, 2, 3, |
262 | 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, |
263 | 0, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
264 | 22, 0, 0, 23, 0, 24, 25, 26, 0, 27, |
265 | 0, 79, 1, 2, 3, 4, 5, 6, 7, 8, |
266 | 9, 10, 11, 12, 0, 0, 13, 14, 15, 16, |
267 | 17, 18, 19, 20, 21, 22, 82, 0, 23, 83, |
268 | 24, 25, 26, 0, 27, 1, 2, 3, 4, 5, |
269 | 6, 7, 8, 9, 10, 11, 12, 0, 0, 13, |
270 | 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, |
271 | 0, 23, 0, 24, 25, 26, 0, 27, 2, 3, |
272 | 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, |
273 | 0, 13, 14, 0, 16, 17, 18, 19, 0, 0, |
274 | 0, 0, 0, 0, 0, 24, 25 |
275 | }; |
276 | |
277 | const short yycheck[] = { 11, |
278 | 12, 26, 27, 34, 35, 30, 32, 28, 20, 21, |
279 | 42, 37, 38, 39, 40, 35, 32, 32, 46, 41, |
280 | 42, 0, 0, 48, 49, 37, 29, 39, 32, 33, |
281 | 34, 35, 36, 61, 68, 63, -1, 65, -1, 51, |
282 | 52, 53, 70, 71, -1, 73, 74, -1, -1, -1, |
283 | -1, -1, -1, -1, -1, 80, -1, -1, 70, -1, |
284 | -1, -1, 90, -1, -1, -1, -1, -1, -1, -1, |
285 | -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, |
286 | 11, 12, 13, 14, 96, 16, 17, 18, 19, 20, |
287 | 21, 22, 23, 24, 25, 26, -1, -1, 29, -1, |
288 | 31, 32, 33, -1, 35, -1, -1, -1, 39, 3, |
289 | 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, |
290 | 14, -1, -1, 17, 18, 19, 20, 21, 22, 23, |
291 | 24, 25, 26, -1, -1, 29, -1, 31, 32, 33, |
292 | -1, 35, -1, -1, -1, 39, 3, 4, 5, 6, |
293 | 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, |
294 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
295 | -1, -1, 29, -1, 31, 32, 33, -1, 35, -1, |
296 | -1, -1, 39, 3, 4, 5, 6, 7, 8, 9, |
297 | 10, 11, 12, 13, 14, -1, -1, 17, 18, 19, |
298 | 20, 21, 22, 23, 24, 25, 26, -1, -1, 29, |
299 | -1, 31, 32, 33, -1, 35, -1, -1, -1, 39, |
300 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, |
301 | 13, 14, -1, -1, 17, 18, 19, 20, 21, 22, |
302 | 23, 24, 25, 26, -1, -1, 29, -1, 31, 32, |
303 | 33, -1, 35, -1, -1, 38, 3, 4, 5, 6, |
304 | 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, |
305 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
306 | -1, -1, 29, -1, 31, 32, 33, -1, 35, -1, |
307 | -1, 38, 3, 4, 5, 6, 7, 8, 9, 10, |
308 | 11, 12, 13, 14, -1, -1, 17, 18, 19, 20, |
309 | 21, 22, 23, 24, 25, 26, -1, -1, 29, -1, |
310 | 31, 32, 33, -1, 35, -1, 37, 3, 4, 5, |
311 | 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, |
312 | -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, |
313 | 26, -1, -1, 29, -1, 31, 32, 33, -1, 35, |
314 | -1, 37, 3, 4, 5, 6, 7, 8, 9, 10, |
315 | 11, 12, 13, 14, -1, -1, 17, 18, 19, 20, |
316 | 21, 22, 23, 24, 25, 26, 27, -1, 29, 30, |
317 | 31, 32, 33, -1, 35, 3, 4, 5, 6, 7, |
318 | 8, 9, 10, 11, 12, 13, 14, -1, -1, 17, |
319 | 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, |
320 | -1, 29, -1, 31, 32, 33, -1, 35, 4, 5, |
321 | 6, 7, 8, 9, 10, 11, 12, -1, -1, -1, |
322 | -1, 17, 18, -1, 20, 21, 22, 23, -1, -1, |
323 | -1, -1, -1, -1, -1, 31, 32 |
324 | }; |
325 | |
326 | |
327 | |
328 | |
329 | |
330 | |
331 | |
332 | |
333 | |
334 | |
335 | |
336 | |
337 | |
338 | |
339 | |
340 | |
341 | |
342 | |
343 | |
344 | |
345 | |
346 | |
347 | |
348 | |
349 | |
350 | |
351 | |
352 | |
353 | |
354 | |
355 | |
356 | |
357 | |
358 | |
359 | #define YYEMPTY -2 |
360 | #define YYEOF 0 |
361 | #define YYACCEPT goto yyacceptlab |
362 | #define YYABORT goto yyabortlab |
363 | |
364 | #define YYTERROR 1 |
365 | |
366 | #ifndef YYPURE |
367 | #define YYLEX yylex() |
368 | #endif |
369 | |
370 | #ifdef YYPURE |
371 | #ifdef YYLSP_NEEDED |
372 | #ifdef YYLEX_PARAM |
373 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) |
374 | #else |
375 | #define YYLEX yylex(&yylval, &yylloc) |
376 | #endif |
377 | #else /* not YYLSP_NEEDED */ |
378 | #ifdef YYLEX_PARAM |
379 | #define YYLEX yylex(&yylval, YYLEX_PARAM) |
380 | #else |
381 | #define YYLEX yylex(&yylval) |
382 | #endif |
383 | #endif /* not YYLSP_NEEDED */ |
384 | #endif |
385 | |
386 | |
387 | |
388 | #ifndef YYPURE |
389 | |
390 | static int yychar; |
391 | YYSTYPE yylval; |
392 | |
393 | |
394 | #ifdef YYLSP_NEEDED |
395 | YYLTYPE yylloc; |
396 | |
397 | #endif |
398 | |
399 | static int yynerrs; |
400 | #endif /* not YYPURE */ |
401 | |
402 | #if YYDEBUG != 0 |
403 | int yydebug; |
404 | |
405 | |
406 | #endif |
407 | |
408 | |
409 | |
410 | #ifndef YYINITDEPTH |
411 | #define YYINITDEPTH 200 |
412 | #endif |
413 | |
414 | |
415 | |
416 | |
417 | #if YYMAXDEPTH == 0 |
418 | #undef YYMAXDEPTH |
419 | #endif |
420 | |
421 | #ifndef YYMAXDEPTH |
422 | #define YYMAXDEPTH 10000 |
423 | #endif |
424 | |
425 | |
426 | |
427 | |
428 | |
429 | |
430 | |
431 | #ifdef YYPARSE_PARAM |
432 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM |
433 | #define YYPARSE_PARAM_DECL |
434 | #else /* not YYPARSE_PARAM */ |
435 | #define YYPARSE_PARAM_ARG |
436 | #define YYPARSE_PARAM_DECL |
437 | #endif /* not YYPARSE_PARAM */ |
438 | |
439 | |
440 | #ifdef __GNUC__ |
441 | #ifdef YYPARSE_PARAM |
442 | int yyparse (void *); |
443 | #else |
444 | static int yyparse(); |
445 | #endif |
446 | #endif |
447 | |
448 | static int |
449 | yyparse(YYPARSE_PARAM_ARG) |
450 | YYPARSE_PARAM_DECL |
451 | { |
452 | int yystate; |
453 | int yyn; |
454 | short *yyssp; |
455 | YYSTYPE *yyvsp; |
456 | int yyerrstatus; |
457 | int yychar1 = 0; |
458 | |
459 | short yyssa[YYINITDEPTH]; |
460 | YYSTYPE yyvsa[YYINITDEPTH]; |
461 | |
462 | short *yyss = yyssa; |
463 | YYSTYPE *yyvs = yyvsa; |
464 | |
465 | #ifdef YYLSP_NEEDED |
466 | YYLTYPE yylsa[YYINITDEPTH]; |
467 | YYLTYPE *yyls = yylsa; |
468 | YYLTYPE *yylsp; |
469 | |
470 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
471 | #endif |
472 | |
473 | int yystacksize = YYINITDEPTH; |
474 | int yyfree_stacks = 0; |
475 | |
476 | #ifdef YYPURE |
477 | int yychar; |
478 | YYSTYPE yylval; |
479 | int yynerrs; |
480 | #ifdef YYLSP_NEEDED |
481 | YYLTYPE yylloc; |
482 | #endif |
483 | #endif |
484 | |
485 | YYSTYPE yyval; |
486 | yyval.dval = nullptr; |
487 | |
488 | |
489 | |
490 | int yylen; |
491 | |
492 | #if YYDEBUG != 0 |
493 | if (yydebug) |
494 | fprintf(stderr, "Starting parse\n"); |
495 | #endif |
496 | |
497 | yystate = 0; |
498 | yyerrstatus = 0; |
499 | yynerrs = 0; |
500 | yychar = YYEMPTY; |
501 | |
502 | |
503 | |
504 | |
505 | |
506 | |
507 | yyssp = yyss - 1; |
508 | yyvsp = yyvs; |
509 | #ifdef YYLSP_NEEDED |
510 | yylsp = yyls; |
511 | #endif |
512 | |
513 | |
514 | |
515 | |
516 | yynewstate: |
517 | |
518 | *++yyssp = sal::static_int_cast<short>(yystate); |
519 | |
520 | if (yyssp >= yyss + yystacksize - 1) |
| |
| 23 | | Assuming the condition is true | |
|
| |
| 49 | | Assuming the condition is true | |
|
| |
521 | { |
522 | |
523 | |
524 | YYSTYPE *yyvs1 = yyvs; |
525 | short *yyss1 = yyss; |
526 | #ifdef YYLSP_NEEDED |
527 | YYLTYPE *yyls1 = yyls; |
528 | #endif |
529 | |
530 | |
531 | int size = yyssp - yyss + 1; |
532 | |
533 | #ifdef yyoverflow |
534 | |
535 | |
536 | #ifdef YYLSP_NEEDED |
537 | |
538 | |
539 | yyoverflow("parser stack overflow", |
540 | &yyss1, size * sizeof (*yyssp), |
541 | &yyvs1, size * sizeof (*yyvsp), |
542 | &yyls1, size * sizeof (*yylsp), |
543 | &yystacksize); |
544 | #else |
545 | yyoverflow("parser stack overflow", |
546 | &yyss1, size * sizeof (*yyssp), |
547 | &yyvs1, size * sizeof (*yyvsp), |
548 | &yystacksize); |
549 | #endif |
550 | |
551 | yyss = yyss1; yyvs = yyvs1; |
552 | #ifdef YYLSP_NEEDED |
553 | yyls = yyls1; |
554 | #endif |
555 | #else /* no yyoverflow */ |
556 | |
557 | if (yystacksize >= YYMAXDEPTH) |
| |
| |
558 | { |
559 | yyerror("parser stack overflow"); |
560 | if (yyfree_stacks) |
561 | { |
562 | free (yyss); |
563 | free (yyvs); |
564 | #ifdef YYLSP_NEEDED |
565 | free (yyls); |
566 | #endif |
567 | } |
568 | return 2; |
569 | } |
570 | yystacksize *= 2; |
571 | if (yystacksize > YYMAXDEPTH) |
| |
| |
572 | yystacksize = YYMAXDEPTH; |
573 | yyfree_stacks = 1; |
574 | yyss = static_cast<short *>(malloc (yystacksize * sizeof (*yyssp))); |
575 | memcpy (yyss, yyss1, size * sizeof (*yyssp)); |
576 | yyvs = static_cast<YYSTYPE *>(malloc (yystacksize * sizeof (*yyvsp))); |
| |
577 | memcpy (yyvs, yyvs1, size * sizeof (*yyvsp)); |
578 | #ifdef YYLSP_NEEDED |
579 | yyls = (YYLTYPE *) malloc (yystacksize * sizeof (*yylsp)); |
580 | memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); |
581 | #endif |
582 | #endif /* no yyoverflow */ |
583 | |
584 | yyssp = yyss + size - 1; |
585 | yyvsp = yyvs + size - 1; |
586 | #ifdef YYLSP_NEEDED |
587 | yylsp = yyls + size - 1; |
588 | #endif |
589 | |
590 | #if YYDEBUG != 0 |
591 | if (yydebug) |
592 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); |
593 | #endif |
594 | |
595 | if (yyssp >= yyss + yystacksize - 1) |
| 28 | | Assuming the condition is false | |
|
| |
| |
596 | YYABORT; |
597 | } |
598 | |
599 | #if YYDEBUG != 0 |
600 | if (yydebug) |
601 | fprintf(stderr, "Entering state %d\n", yystate); |
602 | #endif |
603 | |
604 | goto yybackup; |
| 2 | | Control jumps to line 613 | |
|
| 30 | | Control jumps to line 613 | |
|
| 54 | | Control jumps to line 613 | |
|
605 | yybackup: |
606 | |
607 | |
608 | |
609 | |
610 | |
611 | |
612 | |
613 | yyn = yypact[yystate]; |
| 55 | | Potential leak of memory pointed to by 'yyvs1' |
|
614 | if (yyn == YYFLAG) |
| |
| 31 | | Assuming the condition is false | |
|
| |
615 | goto yydefault; |
616 | |
617 | |
618 | |
619 | |
620 | |
621 | |
622 | if (yychar == YYEMPTY) |
| |
| |
623 | { |
624 | #if YYDEBUG != 0 |
625 | if (yydebug) |
626 | fprintf(stderr, "Reading a token: "); |
627 | #endif |
628 | yychar = YYLEX; |
629 | } |
630 | |
631 | |
632 | |
633 | if (yychar <= 0) |
| 5 | | Assuming 'yychar' is > 0 | |
|
| |
| |
634 | { |
635 | yychar1 = 0; |
636 | yychar = YYEOF; |
637 | |
638 | #if YYDEBUG != 0 |
639 | if (yydebug) |
640 | fprintf(stderr, "Now at end of input.\n"); |
641 | #endif |
642 | } |
643 | else |
644 | { |
645 | yychar1 = YYTRANSLATE(yychar); |
| 7 | | Assuming 'yychar' is <= 285 | |
|
| |
| |
646 | |
647 | #if YYDEBUG != 0 |
648 | if (yydebug) |
649 | { |
650 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); |
651 | |
652 | |
653 | #ifdef YYPRINT |
654 | YYPRINT (stderr, yychar, yylval); |
655 | #endif |
656 | fprintf (stderr, ")\n"); |
657 | } |
658 | #endif |
659 | } |
660 | |
661 | yyn += yychar1; |
662 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) |
| |
| 10 | | Assuming 'yyn' is <= YYLAST | |
|
| 11 | | Assuming the condition is false | |
|
| |
| |
| 37 | | Assuming 'yyn' is <= YYLAST | |
|
| 38 | | Assuming the condition is false | |
|
| |
663 | goto yydefault; |
664 | |
665 | yyn = yytable[yyn]; |
666 | |
667 | |
668 | |
669 | |
670 | |
671 | |
672 | |
673 | |
674 | if (yyn < 0) |
| |
| |
| |
| |
675 | { |
676 | if (yyn == YYFLAG) |
| 15 | | Assuming the condition is false | |
|
| |
677 | goto yyerrlab; |
678 | yyn = -yyn; |
679 | goto yyreduce; |
| 17 | | Control jumps to line 718 | |
|
680 | } |
681 | else if (yyn == 0) |
| 42 | | Assuming 'yyn' is not equal to 0 | |
|
| |
682 | goto yyerrlab; |
683 | |
684 | if (yyn == YYFINAL) |
| 44 | | Assuming 'yyn' is not equal to YYFINAL | |
|
| |
685 | YYACCEPT; |
686 | |
687 | |
688 | |
689 | #if YYDEBUG != 0 |
690 | if (yydebug) |
691 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); |
692 | #endif |
693 | |
694 | |
695 | if (yychar != YYEOF) |
| |
696 | yychar = YYEMPTY; |
697 | |
698 | *++yyvsp = yylval; |
699 | #ifdef YYLSP_NEEDED |
700 | *++yylsp = yylloc; |
701 | #endif |
702 | |
703 | |
704 | if (yyerrstatus) yyerrstatus--; |
| |
705 | |
706 | yystate = yyn; |
707 | goto yynewstate; |
| 48 | | Control jumps to line 518 | |
|
708 | |
709 | |
710 | yydefault: |
711 | |
712 | yyn = yydefact[yystate]; |
713 | if (yyn == 0) |
714 | goto yyerrlab; |
715 | |
716 | |
717 | yyreduce: |
718 | yylen = yyr2[yyn]; |
719 | if (yylen > 0) |
| 18 | | Assuming 'yylen' is <= 0 | |
|
| |
720 | yyval = yyvsp[1-yylen]; |
721 | |
722 | #if YYDEBUG != 0 |
723 | if (yydebug) |
724 | { |
725 | int i; |
726 | |
727 | fprintf (stderr, "Reducing via rule %d (line %d), ", |
728 | yyn, yyrline[yyn]); |
729 | |
730 | |
731 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) |
732 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); |
733 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); |
734 | } |
735 | #endif |
736 | |
737 | |
738 | switch (yyn) { |
| 20 | | 'Default' branch taken. Execution continues on line 959 | |
|
739 | |
740 | case 1: |
741 | { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
742 | break;} |
743 | case 2: |
744 | { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
745 | break;} |
746 | case 3: |
747 | { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
748 | break;} |
749 | case 4: |
750 | { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
751 | break;} |
752 | case 5: |
753 | { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
754 | break;} |
755 | case 6: |
756 | { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
757 | break;} |
758 | case 7: |
759 | { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
760 | break;} |
761 | case 8: |
762 | { yyval.ptr = new Node(ID_CHARACTER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
763 | break;} |
764 | case 9: |
765 | { yyval.ptr = new Node(ID_OPERATOR); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
766 | break;} |
767 | case 10: |
768 | { yyval.ptr = new Node(ID_OPERATOR); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
769 | break;} |
770 | case 11: |
771 | { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
772 | break;} |
773 | case 12: |
774 | { yyval.ptr = new Node(ID_DELIMITER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
775 | break;} |
776 | case 13: |
777 | { yyval.ptr = new Node(ID_DELIMITER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
778 | break;} |
779 | case 14: |
780 | { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
781 | break;} |
782 | case 15: |
783 | { yyval.ptr = new Node(ID_CHARACTER); yyval.ptr->value = strdup("|"); debug("Identifier : '|'\n"); nodelist.emplace_back(yyval.ptr); |
784 | break;} |
785 | case 16: |
786 | { yyval.ptr = new Node(ID_NUMBER); yyval.ptr->value = strdup(yyvsp[0].dval); debug("Number : %s\n",yyvsp[0].dval); nodelist.emplace_back(yyval.ptr); |
787 | break;} |
788 | case 17: |
789 | { yyval.ptr = new Node(ID_STRING); yyval.ptr->value = strdup(yyvsp[0].str); debug("String : %s\n",yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
790 | break;} |
791 | case 18: |
792 | { yyval.ptr = new Node(ID_PRIMARYEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("PrimaryExpr\n"); nodelist.emplace_back(yyval.ptr); |
793 | break;} |
794 | case 19: |
795 | { yyval.ptr = new Node(ID_PRIMARYEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyval.ptr->next = yyvsp[0].ptr; debug("PrimaryExpr : PrimaryExpr Identifier\n"); nodelist.emplace_back(yyval.ptr); |
796 | break;} |
797 | case 20: |
798 | { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("("); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr); |
799 | break;} |
800 | case 21: |
801 | { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("["); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr); |
802 | break;} |
803 | case 22: |
804 | { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("{"); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr); |
805 | break;} |
806 | case 23: |
807 | { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("<"); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr); |
808 | break;} |
809 | case 24: |
810 | { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("|"); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr); |
811 | break;} |
812 | case 25: |
813 | { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value =strdup("||"); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr); |
814 | break;} |
815 | case 26: |
816 | { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup(yyvsp[0].str); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr); |
817 | break;} |
818 | case 27: |
819 | { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup(")"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr); |
820 | break;} |
821 | case 28: |
822 | { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("]"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr); |
823 | break;} |
824 | case 29: |
825 | { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("}"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr); |
826 | break;} |
827 | case 30: |
828 | { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup(">"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr); |
829 | break;} |
830 | case 31: |
831 | { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("|"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr); |
832 | break;} |
833 | case 32: |
834 | { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("||"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr); |
835 | break;} |
836 | case 33: |
837 | { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup(yyvsp[0].str); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr); |
838 | break;} |
839 | case 34: |
840 | { yyval.ptr = new Node(ID_FENCE); yyval.ptr->child=yyvsp[-2].ptr; yyvsp[-2].ptr->next=yyvsp[-1].ptr; yyvsp[-1].ptr->next=yyvsp[0].ptr; debug("Fence \n"); nodelist.emplace_back(yyval.ptr); |
841 | break;} |
842 | case 35: |
843 | { yyval.ptr = new Node(ID_PARENTH); yyval.ptr->child = yyvsp[-1].ptr; debug("Parenth: '(' ExprList ')' \n"); nodelist.emplace_back(yyval.ptr); |
844 | break;} |
845 | case 36: |
846 | { yyval.ptr = new Node(ID_PARENTH); debug("Parenth: '(' ')' \n"); nodelist.emplace_back(yyval.ptr); |
847 | break;} |
848 | case 37: |
849 | { yyval.ptr = new Node(ID_BLOCK); yyval.ptr->child = yyvsp[-1].ptr; debug("Block: '{' ExprList '}' \n"); nodelist.emplace_back(yyval.ptr); |
850 | break;} |
851 | case 38: |
852 | { yyval.ptr = new Node(ID_BLOCK); debug("Block: '{' '}' \n"); nodelist.emplace_back(yyval.ptr); |
853 | break;} |
854 | case 39: |
855 | { yyval.ptr = new Node(ID_BRACKET); yyval.ptr->child = yyvsp[-1].ptr; debug("Bracket \n"); nodelist.emplace_back(yyval.ptr); |
856 | break;} |
857 | case 40: |
858 | { yyval.ptr = new Node(ID_BRACKET); debug("Bracket \n"); nodelist.emplace_back(yyval.ptr); |
859 | break;} |
860 | case 41: |
861 | { yyval.ptr = new Node(ID_SUBEXPR); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; debug("SubSupExpr : ID_SUBEXPR\n"); nodelist.emplace_back(yyval.ptr); |
862 | break;} |
863 | case 42: |
864 | { yyval.ptr = new Node(ID_SUPEXPR); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; debug("SubSupExpr : ID_SUPEXPR\n"); nodelist.emplace_back(yyval.ptr); |
865 | break;} |
866 | case 43: |
867 | { yyval.ptr = new Node(ID_SUBSUPEXPR); yyval.ptr->child=yyvsp[-4].ptr; yyvsp[-4].ptr->next=yyvsp[-2].ptr; yyvsp[-2].ptr->next=yyvsp[0].ptr; debug("SubSupExpr : ID_SUBSUPEXPR\n"); nodelist.emplace_back(yyval.ptr); |
868 | break;} |
869 | case 44: |
870 | { yyval.ptr = new Node(ID_FRACTIONEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("FractionExpr : %s\n",yyvsp[-2].str); nodelist.emplace_back(yyval.ptr); |
871 | break;} |
872 | case 45: |
873 | { yyval.ptr = new Node(ID_OVER); yyval.ptr->child = yyvsp[-3].ptr; yyvsp[-3].ptr->next = yyvsp[-1].ptr; debug("OverExpr\n"); nodelist.emplace_back(yyval.ptr); |
874 | break;} |
875 | case 46: |
876 | { yyval.ptr = new Node(ID_ACCENTEXPR); yyval.ptr->value = strdup(yyvsp[0].str); debug("Accent : %s\n", yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
877 | break;} |
878 | case 47: |
879 | { yyval.ptr = new Node(ID_ACCENTEXPR); yyval.ptr->child=yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("AccentExpr \n"); nodelist.emplace_back(yyval.ptr); |
880 | break;} |
881 | case 48: |
882 | { yyval.ptr = new Node(ID_DECORATIONEXPR); yyval.ptr->value = strdup(yyvsp[0].str); debug("Decoration : %s\n", yyvsp[0].str); nodelist.emplace_back(yyval.ptr); |
883 | break;} |
884 | case 49: |
885 | { yyval.ptr = new Node(ID_DECORATIONEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("DecorationExpr \n"); nodelist.emplace_back(yyval.ptr); |
886 | break;} |
887 | case 50: |
888 | { yyval.ptr = new Node(ID_SQRTEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("RootExpr : %s\n", yyvsp[-1].str); nodelist.emplace_back(yyval.ptr); |
889 | break;} |
890 | case 51: |
891 | { yyval.ptr = new Node(ID_ROOTEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next= yyvsp[0].ptr; debug("RootExpr : %s\n", yyvsp[-2].str); nodelist.emplace_back(yyval.ptr); |
892 | break;} |
893 | case 52: |
894 | { yyval.ptr = new Node(ID_BEGIN); yyval.ptr->child = yyvsp[0].ptr; nodelist.emplace_back(yyval.ptr); debug("BeginExpr\n"); |
895 | break;} |
896 | case 53: |
897 | { yyval.ptr = new Node(ID_BEGIN); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next= yyvsp[0].ptr; nodelist.emplace_back(yyval.ptr); debug("BeginExpr\n"); |
898 | break;} |
899 | case 54: |
900 | { yyval.ptr = new Node(ID_END); yyval.ptr->child = yyvsp[0].ptr; nodelist.emplace_back(yyval.ptr); debug("EndExpr\n"); |
901 | break;} |
902 | case 55: |
903 | { yyval.ptr = new Node(ID_MATHML); yyval.ptr->child = yyvsp[0].ptr; nodelist.emplace_back(yyval.ptr); top = yyval.ptr; debug("MathML\n"); |
904 | break;} |
905 | case 56: |
906 | { yyval.ptr = new Node(ID_LINES); yyval.ptr->child = yyvsp[0].ptr; nodelist.emplace_back(yyval.ptr); debug("Lines\n"); |
907 | break;} |
908 | case 57: |
909 | { yyval.ptr = new Node(ID_LINES); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; nodelist.emplace_back(yyval.ptr); debug("Lines\n"); |
910 | break;} |
911 | case 58: |
912 | { yyval.ptr = new Node(ID_LINE); yyval.ptr->child = yyvsp[0].ptr; nodelist.emplace_back(yyval.ptr); debug("Line\n"); |
913 | break;} |
914 | case 59: |
915 | { yyval.ptr = new Node(ID_EXPRLIST); yyval.ptr->child = yyvsp[0].ptr; debug("ExprList : Expr\n"); nodelist.emplace_back(yyval.ptr); |
916 | break;} |
917 | case 60: |
918 | { yyval.ptr = new Node(ID_EXPRLIST); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("ExprList : ExprList Expr\n"); nodelist.emplace_back(yyval.ptr); |
919 | break;} |
920 | case 61: |
921 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Block\n"); nodelist.emplace_back(yyval.ptr); |
922 | break;} |
923 | case 62: |
924 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Parenth\n"); nodelist.emplace_back(yyval.ptr); |
925 | break;} |
926 | case 63: |
927 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Fence\n"); nodelist.emplace_back(yyval.ptr); |
928 | break;} |
929 | case 64: |
930 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : SubSupExpr\n"); nodelist.emplace_back(yyval.ptr); |
931 | break;} |
932 | case 65: |
933 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : FractionExpr\n"); nodelist.emplace_back(yyval.ptr); |
934 | break;} |
935 | case 66: |
936 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : OverExpr\n"); nodelist.emplace_back(yyval.ptr); |
937 | break;} |
938 | case 67: |
939 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : DecorationExpr\n"); nodelist.emplace_back(yyval.ptr); |
940 | break;} |
941 | case 68: |
942 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : RootExpr\n"); nodelist.emplace_back(yyval.ptr); |
943 | break;} |
944 | case 69: |
945 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : AccentExpr\n"); nodelist.emplace_back(yyval.ptr); |
946 | break;} |
947 | case 70: |
948 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : PrimaryExpr\n"); nodelist.emplace_back(yyval.ptr); |
949 | break;} |
950 | case 71: |
951 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : BeginExpr\n"); nodelist.emplace_back(yyval.ptr); |
952 | break;} |
953 | case 72: |
954 | { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : EndExpr\n"); nodelist.emplace_back(yyval.ptr); |
955 | break;} |
956 | } |
957 | |
958 | |
959 | yyvsp -= yylen; |
960 | yyssp -= yylen; |
961 | #ifdef YYLSP_NEEDED |
962 | yylsp -= yylen; |
963 | #endif |
964 | |
965 | #if YYDEBUG != 0 |
966 | if (yydebug) |
967 | { |
968 | short *ssp1 = yyss - 1; |
969 | fprintf (stderr, "state stack now"); |
970 | while (ssp1 != yyssp) |
971 | fprintf (stderr, " %d", *++ssp1); |
972 | fprintf (stderr, "\n"); |
973 | } |
974 | #endif |
975 | |
976 | *++yyvsp = yyval; |
977 | |
978 | #ifdef YYLSP_NEEDED |
979 | yylsp++; |
980 | if (yylen == 0) |
981 | { |
982 | yylsp->first_line = yylloc.first_line; |
983 | yylsp->first_column = yylloc.first_column; |
984 | yylsp->last_line = (yylsp-1)->last_line; |
985 | yylsp->last_column = (yylsp-1)->last_column; |
986 | yylsp->text = 0; |
987 | } |
988 | else |
989 | { |
990 | yylsp->last_line = (yylsp+yylen-1)->last_line; |
991 | yylsp->last_column = (yylsp+yylen-1)->last_column; |
992 | } |
993 | #endif |
994 | |
995 | |
996 | |
997 | |
998 | |
999 | |
1000 | yyn = yyr1[yyn]; |
1001 | |
1002 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; |
1003 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
| 21 | | Assuming 'yystate' is < 0 | |
|
1004 | yystate = yytable[yystate]; |
1005 | else |
1006 | yystate = yydefgoto[yyn - YYNTBASE]; |
1007 | |
1008 | goto yynewstate; |
| 22 | | Control jumps to line 518 | |
|
1009 | |
1010 | yyerrlab: |
1011 | |
1012 | if (! yyerrstatus) |
1013 | |
1014 | { |
1015 | ++yynerrs; |
1016 | |
1017 | #ifdef YYERROR_VERBOSE |
1018 | yyn = yypact[yystate]; |
1019 | |
1020 | if (yyn > YYFLAG && yyn < YYLAST) |
1021 | { |
1022 | int size = 0; |
1023 | char *msg; |
1024 | int x, count; |
1025 | |
1026 | count = 0; |
1027 | |
1028 | for (x = ((yyn < 0) ? -yyn : 0); |
1029 | x < (sizeof(yytname) / sizeof(char *)); x++) |
1030 | if (yycheck[x + yyn] == x) |
1031 | size += strlen(yytname[x]) + 15, count++; |
1032 | msg = (char *) malloc(size + 15); |
1033 | if (msg != 0) |
1034 | { |
1035 | strcpy(msg, "parse error"); |
1036 | |
1037 | if (count < 5) |
1038 | { |
1039 | count = 0; |
1040 | for (x = ((yyn < 0) ? -yyn : 0); |
1041 | x < (sizeof(yytname) / sizeof(char *)); x++) |
1042 | if (yycheck[x + yyn] == x) |
1043 | { |
1044 | strcat(msg, count == 0 ? ", expecting `" : " or `"); |
1045 | strcat(msg, yytname[x]); |
1046 | strcat(msg, "'"); |
1047 | count++; |
1048 | } |
1049 | } |
1050 | yyerror(msg); |
1051 | free(msg); |
1052 | } |
1053 | else |
1054 | yyerror ("parse error; also virtual memory exceeded"); |
1055 | } |
1056 | else |
1057 | #endif /* YYERROR_VERBOSE */ |
1058 | yyerror("parse error"); |
1059 | } |
1060 | |
1061 | goto yyerrlab1; |
1062 | yyerrlab1: |
1063 | |
1064 | if (yyerrstatus == 3) |
1065 | { |
1066 | |
1067 | |
1068 | |
1069 | if (yychar == YYEOF) |
1070 | YYABORT; |
1071 | |
1072 | #if YYDEBUG != 0 |
1073 | if (yydebug) |
1074 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); |
1075 | #endif |
1076 | |
1077 | yychar = YYEMPTY; |
1078 | } |
1079 | |
1080 | |
1081 | |
1082 | |
1083 | yyerrstatus = 3; |
1084 | |
1085 | goto yyerrhandle; |
1086 | |
1087 | yyerrdefault: |
1088 | |
1089 | #if 0 |
1090 | |
1091 | |
1092 | yyn = yydefact[yystate]; |
1093 | if (yyn) goto yydefault; |
1094 | #endif |
1095 | |
1096 | yyerrpop: |
1097 | |
1098 | if (yyssp == yyss) YYABORT; |
1099 | yyvsp--; |
1100 | yystate = *--yyssp; |
1101 | #ifdef YYLSP_NEEDED |
1102 | yylsp--; |
1103 | #endif |
1104 | |
1105 | #if YYDEBUG != 0 |
1106 | if (yydebug) |
1107 | { |
1108 | short *ssp1 = yyss - 1; |
1109 | fprintf (stderr, "Error: state stack now"); |
1110 | while (ssp1 != yyssp) |
1111 | fprintf (stderr, " %d", *++ssp1); |
1112 | fprintf (stderr, "\n"); |
1113 | } |
1114 | #endif |
1115 | |
1116 | yyerrhandle: |
1117 | |
1118 | yyn = yypact[yystate]; |
1119 | if (yyn == YYFLAG) |
1120 | goto yyerrdefault; |
1121 | |
1122 | yyn += YYTERROR; |
1123 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) |
1124 | goto yyerrdefault; |
1125 | |
1126 | yyn = yytable[yyn]; |
1127 | if (yyn < 0) |
1128 | { |
1129 | if (yyn == YYFLAG) |
1130 | goto yyerrpop; |
1131 | yyn = -yyn; |
1132 | goto yyreduce; |
1133 | } |
1134 | else if (yyn == 0) |
1135 | goto yyerrpop; |
1136 | |
1137 | if (yyn == YYFINAL) |
1138 | YYACCEPT; |
1139 | |
1140 | #if YYDEBUG != 0 |
1141 | if (yydebug) |
1142 | fprintf(stderr, "Shifting error token, "); |
1143 | #endif |
1144 | |
1145 | *++yyvsp = yylval; |
1146 | #ifdef YYLSP_NEEDED |
1147 | *++yylsp = yylloc; |
1148 | #endif |
1149 | |
1150 | yystate = yyn; |
1151 | goto yynewstate; |
1152 | |
1153 | yyacceptlab: |
1154 | |
1155 | if (yyfree_stacks) |
1156 | { |
1157 | free (yyss); |
1158 | free (yyvs); |
1159 | #ifdef YYLSP_NEEDED |
1160 | free (yyls); |
1161 | #endif |
1162 | } |
1163 | return 0; |
1164 | |
1165 | yyabortlab: |
1166 | |
1167 | if (yyfree_stacks) |
1168 | { |
1169 | free (yyss); |
1170 | free (yyvs); |
1171 | #ifdef YYLSP_NEEDED |
1172 | free (yyls); |
1173 | #endif |
1174 | } |
1175 | return 1; |
1176 | } |
1177 | |
1178 | |
1179 | Node *mainParse(const char *_code) |
1180 | { |
1181 | initFlex( _code ); |
1182 | top = nullptr; |
1183 | yyparse(); |
1184 | if( top ) |
1185 | return top; |
1186 | else |
1187 | return nullptr; |
1188 | } |
1189 | |
1190 | void yyerror(const char * ) |
1191 | { |
1192 | |
1193 | |
1194 | nodelist.clear(); |
1195 | top = nullptr; |
1196 | } |
1197 | |
1198 | #ifndef PARSE_DEBUG |
1199 | int debug(const char * , ...) |
1200 | { |
1201 | return 0; |
1202 | } |
1203 | #endif |
1204 | |
1205 | |