Bug Summary

File:home/maarten/src/libreoffice/core/hwpfilter/source/grammar.cxx
Warning:line 585, column 13
Potential leak of memory pointed to by 'yyss1'

Annotated Source Code

Press '?' to see keyboard shortcuts

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/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21/* A Bison parser, made from grammar.y
22 by GNU Bison version 1.28 */
23
24#ifndef YYDEBUG0
25#define YYDEBUG0 0
26#endif
27#ifndef YYMAXDEPTH10000
28#define YYMAXDEPTH10000 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
39extern "C" {
40#include "grammar.h"
41}
42
43std::vector<std::unique_ptr<Node>> nodelist;
44
45static void yyerror(const char *);
46
47static Node *top=nullptr;
48
49int Node::count = 0;
50
51#ifdef PARSE_DEBUG
52#define debug printf
53#else
54static int debug(const char *format, ...);
55#endif
56
57#include <stdio.h>
58
59#define YYFINAL102 102
60#define YYFLAG-32768 -32768
61#define YYNTBASE43 43
62
63#define YYTRANSLATE(x)(static_cast<unsigned>(x) <= 285 ? yytranslate[x] : 66
)
(static_cast<unsigned>(x) <= 285 ? yytranslate[x] : 66)
64
65const 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 YYDEBUG0 != 0
98static 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
109static 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 YYDEBUG0 != 0
135static 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 YYDEBUG0 != 0 || defined (YYERROR_VERBOSE)
149
150static 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__null
159};
160#endif
161
162const 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
173const 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
184const 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
198const 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
204const 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
218const 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 YYLAST457 457
226
227
228const 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
277const 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/* This file comes from bison-1.28. */
326
327/* Skeleton output parser for bison,
328 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
329
330 This program is free software; you can redistribute it and/or modify
331 it under the terms of the GNU General Public License as published by
332 the Free Software Foundation; either version 2, or (at your option)
333 any later version.
334
335 This program is distributed in the hope that it will be useful,
336 but WITHOUT ANY WARRANTY; without even the implied warranty of
337 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
338 GNU General Public License for more details.
339
340 You should have received a copy of the GNU General Public License
341 along with this program; if not, write to the Free Software
342 Foundation, Inc., 59 Temple Place - Suite 330,
343 Boston, MA 02111-1307, USA. */
344
345/* As a special exception, when this file is copied by Bison into a
346 Bison output file, you may use that output file without restriction.
347 This special exception was added by the Free Software Foundation
348 in version 1.24 of Bison. */
349
350/* This is the parser code that is written into each bison parser
351 when the %semantic_parser declaration is not specified in the grammar.
352 It was written by Richard Stallman by simplifying the hairy parser
353 used when %semantic_parser is specified. */
354
355/* Note: there must be only one dollar sign in this file.
356 It is replaced by the list of actions, each action
357 as one case of the switch. */
358
359#define YYEMPTY-2 -2
360#define YYEOF0 0
361#define YYACCEPTgoto yyacceptlab goto yyacceptlab
362#define YYABORTgoto yyabortlab goto yyabortlab
363
364#define YYTERROR1 1
365
366#ifndef YYPURE
367#define YYLEXyylex() yylex()
368#endif
369
370#ifdef YYPURE
371#ifdef YYLSP_NEEDED
372#ifdef YYLEX_PARAM
373#define YYLEXyylex() yylex(&yylval, &yylloc, YYLEX_PARAM)
374#else
375#define YYLEXyylex() yylex(&yylval, &yylloc)
376#endif
377#else /* not YYLSP_NEEDED */
378#ifdef YYLEX_PARAM
379#define YYLEXyylex() yylex(&yylval, YYLEX_PARAM)
380#else
381#define YYLEXyylex() yylex(&yylval)
382#endif
383#endif /* not YYLSP_NEEDED */
384#endif
385
386/* If nonreentrant, generate the variables here */
387
388#ifndef YYPURE
389
390static int yychar; /* the lookahead symbol */
391YYSTYPE yylval; /* the semantic value of the */
392 /* lookahead symbol */
393
394#ifdef YYLSP_NEEDED
395YYLTYPE yylloc; /* location data for the lookahead */
396 /* symbol */
397#endif
398
399static int yynerrs; /* number of parse errors so far */
400#endif /* not YYPURE */
401
402#if YYDEBUG0 != 0
403int yydebug; /* nonzero means print parse trace */
404/* Since this is uninitialized, it does not stop multiple parsers
405 from coexisting. */
406#endif
407
408/* YYINITDEPTH indicates the initial size of the parser's stacks */
409
410#ifndef YYINITDEPTH200
411#define YYINITDEPTH200 200
412#endif
413
414/* YYMAXDEPTH is the maximum size the stacks can grow to
415 (effective only if the built-in stack extension method is used). */
416
417#if YYMAXDEPTH10000 == 0
418#undef YYMAXDEPTH10000
419#endif
420
421#ifndef YYMAXDEPTH10000
422#define YYMAXDEPTH10000 10000
423#endif
424
425/* The user can define YYPARSE_PARAM as the name of an argument to be passed
426 into yyparse. The argument should have type void *.
427 It should actually point to an object.
428 Grammar actions can access the variable by casting it
429 to the proper pointer type. */
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/* Prevent warning if -Wstrict-prototypes. */
440#ifdef __GNUC__4
441#ifdef YYPARSE_PARAM
442int yyparse (void *);
443#else
444static int yyparse();
445#endif
446#endif
447
448static int
449yyparse(YYPARSE_PARAM_ARG)
450 YYPARSE_PARAM_DECL
451{
452 int yystate;
453 int yyn;
454 short *yyssp;
455 YYSTYPE *yyvsp;
456 int yyerrstatus; /* number of tokens to shift before error messages enabled */
457 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
458
459 short yyssa[YYINITDEPTH200]; /* the state stack */
460 YYSTYPE yyvsa[YYINITDEPTH200]; /* the semantic value stack */
461
462 short *yyss = yyssa; /* refer to the stacks through separate pointers */
463 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
464
465#ifdef YYLSP_NEEDED
466 YYLTYPE yylsa[YYINITDEPTH200]; /* the location stack */
467 YYLTYPE *yyls = yylsa;
468 YYLTYPE *yylsp;
469
470#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
471#endif
472
473 int yystacksize = YYINITDEPTH200;
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; /* the variable used to return */
486 yyval.dval = nullptr;
487 /* semantic values from the action */
488 /* routines */
489
490 int yylen;
491
492#if YYDEBUG0 != 0
493 if (yydebug)
494 fprintf(stderrstderr, "Starting parse\n");
495#endif
496
497 yystate = 0;
498 yyerrstatus = 0;
499 yynerrs = 0;
500 yychar = YYEMPTY-2; /* Cause a token to be read. */
501
502 /* Initialize stack pointers.
503 Waste one element of value and location stack
504 so that they stay on the same level as the state stack.
505 The wasted elements are never initialized. */
506
507 yyssp = yyss - 1;
508 yyvsp = yyvs;
509#ifdef YYLSP_NEEDED
510 yylsp = yyls;
511#endif
512
513/* Push a new state, which is found in yystate . */
514/* In all cases, when you get here, the value and location stacks
515 have just been pushed. So pushing a state here events the stacks. */
516yynewstate:
517
518 *++yyssp = sal::static_int_cast<short>(yystate);
519
520 if (yyssp >= yyss + yystacksize - 1)
1
Taking false branch
23
Assuming the condition is true
24
Taking true branch
49
Assuming the condition is true
50
Taking true branch
521 {
522 /* Give user a chance to reallocate the stack */
523 /* Use copies of these so that the &'s don't force the real ones into memory. */
524 YYSTYPE *yyvs1 = yyvs;
525 short *yyss1 = yyss;
526#ifdef YYLSP_NEEDED
527 YYLTYPE *yyls1 = yyls;
528#endif
529
530 /* Get the current used size of the three stacks, in elements. */
531 int size = yyssp - yyss + 1;
532
533#ifdef yyoverflow
534 /* Each stack pointer address is followed by the size of
535 the data in use in that stack, in bytes. */
536#ifdef YYLSP_NEEDED
537 /* This used to be a conditional around just the two extra args,
538 but that might be undefined if yyoverflow is a macro. */
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 /* Extend the stack our own way. */
557 if (yystacksize
24.1
'yystacksize' is < YYMAXDEPTH
50.1
'yystacksize' is < YYMAXDEPTH
>= YYMAXDEPTH10000)
25
Taking false branch
51
Taking false branch
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
25.1
'yystacksize' is <= YYMAXDEPTH
51.1
'yystacksize' is <= YYMAXDEPTH
> YYMAXDEPTH10000)
26
Taking false branch
52
Taking false branch
572 yystacksize = YYMAXDEPTH10000;
573 yyfree_stacks = 1;
574 yyss = static_cast<short *>(malloc (yystacksize * sizeof (*yyssp)));
27
Memory is allocated
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;
53
Potential leak of memory pointed to by 'yyss1'
586#ifdef YYLSP_NEEDED
587 yylsp = yyls + size - 1;
588#endif
589
590#if YYDEBUG0 != 0
591 if (yydebug)
592 fprintf(stderrstderr, "Stack size increased to %d\n", yystacksize);
593#endif
594
595 if (yyssp >= yyss + yystacksize - 1)
28
Assuming the condition is false
29
Taking false branch
596 YYABORTgoto yyabortlab;
597 }
598
599#if YYDEBUG0 != 0
600 if (yydebug)
601 fprintf(stderrstderr, "Entering state %d\n", yystate);
602#endif
603
604 goto yybackup;
2
Control jumps to line 613
30
Control jumps to line 613
605 yybackup:
606
607/* Do appropriate processing given the current state. */
608/* Read a lookahead token if we need one and don't already have one. */
609/* yyresume: */
610
611 /* First try to decide what to do without reference to lookahead token. */
612
613 yyn = yypact[yystate];
614 if (yyn == YYFLAG-32768)
3
Taking false branch
31
Assuming the condition is false
32
Taking false branch
615 goto yydefault;
616
617 /* Not known => get a lookahead token if don't already have one. */
618
619 /* yychar is either YYEMPTY or YYEOF
620 or a valid token in external form. */
621
622 if (yychar == YYEMPTY-2)
4
Taking true branch
33
Taking false branch
623 {
624#if YYDEBUG0 != 0
625 if (yydebug)
626 fprintf(stderrstderr, "Reading a token: ");
627#endif
628 yychar = YYLEXyylex();
629 }
630
631 /* Convert token to internal form (in yychar1) for indexing tables with */
632
633 if (yychar
33.1
'yychar' is > 0
<= 0
) /* This means end of input. */
5
Assuming 'yychar' is > 0
6
Taking false branch
34
Taking false branch
634 {
635 yychar1 = 0;
636 yychar = YYEOF0; /* Don't call YYLEX any more */
637
638#if YYDEBUG0 != 0
639 if (yydebug)
640 fprintf(stderrstderr, "Now at end of input.\n");
641#endif
642 }
643 else
644 {
645 yychar1 = YYTRANSLATE(yychar)(static_cast<unsigned>(yychar) <= 285 ? yytranslate[
yychar] : 66)
;
7
Assuming 'yychar' is <= 285
8
'?' condition is true
35
'?' condition is true
646
647#if YYDEBUG0 != 0
648 if (yydebug)
649 {
650 fprintf (stderrstderr, "Next token is %d (%s", yychar, yytname[yychar1]);
651 /* Give the individual parser a way to print the precise meaning
652 of a token, for further debugging info. */
653#ifdef YYPRINT
654 YYPRINT (stderrstderr, yychar, yylval);
655#endif
656 fprintf (stderrstderr, ")\n");
657 }
658#endif
659 }
660
661 yyn += yychar1;
662 if (yyn < 0 || yyn > YYLAST457 || yycheck[yyn] != yychar1)
9
Assuming 'yyn' is >= 0
10
Assuming 'yyn' is <= YYLAST
11
Assuming the condition is false
12
Taking false branch
36
Assuming 'yyn' is >= 0
37
Assuming 'yyn' is <= YYLAST
38
Assuming the condition is false
39
Taking false branch
663 goto yydefault;
664
665 yyn = yytable[yyn];
666
667 /* yyn is what to do for this token type in this state.
668 Negative => reduce, -yyn is rule number.
669 Positive => shift, yyn is new state.
670 New state is final state => don't bother to shift,
671 just return success.
672 0, or most negative number => error. */
673
674 if (yyn < 0)
13
Assuming 'yyn' is < 0
14
Taking true branch
40
Assuming 'yyn' is >= 0
41
Taking false branch
675 {
676 if (yyn == YYFLAG-32768)
15
Assuming the condition is false
16
Taking false branch
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
43
Taking false branch
682 goto yyerrlab;
683
684 if (yyn == YYFINAL102)
44
Assuming 'yyn' is not equal to YYFINAL
45
Taking false branch
685 YYACCEPTgoto yyacceptlab;
686
687 /* Shift the lookahead token. */
688
689#if YYDEBUG0 != 0
690 if (yydebug)
691 fprintf(stderrstderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
692#endif
693
694 /* Discard the token being shifted unless it is eof. */
695 if (yychar
45.1
'yychar' is not equal to YYEOF
!= YYEOF0)
46
Taking true branch
696 yychar = YYEMPTY-2;
697
698 *++yyvsp = yylval;
699#ifdef YYLSP_NEEDED
700 *++yylsp = yylloc;
701#endif
702
703 /* count tokens shifted since error; after three, turn off error status. */
704 if (yyerrstatus
46.1
'yyerrstatus' is 0
) yyerrstatus--;
47
Taking false branch
705
706 yystate = yyn;
707 goto yynewstate;
48
Control jumps to line 518
708
709/* Do the default action for the current state. */
710yydefault:
711
712 yyn = yydefact[yystate];
713 if (yyn == 0)
714 goto yyerrlab;
715
716/* Do a reduction. yyn is the number of a rule to reduce with. */
717yyreduce:
718 yylen = yyr2[yyn];
719 if (yylen > 0)
18
Assuming 'yylen' is <= 0
19
Taking false branch
720 yyval = yyvsp[1-yylen]; /* implement default value of the action */
721
722#if YYDEBUG0 != 0
723 if (yydebug)
724 {
725 int i;
726
727 fprintf (stderrstderr, "Reducing via rule %d (line %d), ",
728 yyn, yyrline[yyn]);
729
730 /* Print the symbols being reduced, and their result. */
731 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
732 fprintf (stderrstderr, "%s ", yytname[yyrhs[i]]);
733 fprintf (stderrstderr, " -> %s\n", yytname[yyr1[yyn]]);
734 }
735#endif
736
737
738 switch (yyn) {
20
'Default' branch taken. Execution continues on line 959
739
740case 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;}
743case 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;}
746case 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;}
749case 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;}
752case 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;}
755case 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;}
758case 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;}
761case 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;}
764case 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;}
767case 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;}
770case 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;}
773case 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;}
776case 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;}
779case 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;}
782case 15:
783{ yyval.ptr = new Node(ID_CHARACTER); yyval.ptr->value = strdup("|"); debug("Identifier : '|'\n"); nodelist.emplace_back(yyval.ptr);
784 break;}
785case 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;}
788case 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;}
791case 18:
792{ yyval.ptr = new Node(ID_PRIMARYEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("PrimaryExpr\n"); nodelist.emplace_back(yyval.ptr);
793 break;}
794case 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;}
797case 20:
798{ yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("("); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr);
799 break;}
800case 21:
801{ yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("["); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr);
802 break;}
803case 22:
804{ yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("{"); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr);
805 break;}
806case 23:
807{ yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("<"); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr);
808 break;}
809case 24:
810{ yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("|"); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr);
811 break;}
812case 25:
813{ yyval.ptr = new Node(ID_LEFT); yyval.ptr->value =strdup("||"); debug("EQLeft \n"); nodelist.emplace_back(yyval.ptr);
814 break;}
815case 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;}
818case 27:
819{ yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup(")"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr);
820 break;}
821case 28:
822{ yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("]"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr);
823 break;}
824case 29:
825{ yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("}"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr);
826 break;}
827case 30:
828{ yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup(">"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr);
829 break;}
830case 31:
831{ yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("|"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr);
832 break;}
833case 32:
834{ yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("||"); debug("EQRight \n"); nodelist.emplace_back(yyval.ptr);
835 break;}
836case 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;}
839case 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;}
842case 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;}
845case 36:
846{ yyval.ptr = new Node(ID_PARENTH); debug("Parenth: '(' ')' \n"); nodelist.emplace_back(yyval.ptr);
847 break;}
848case 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;}
851case 38:
852{ yyval.ptr = new Node(ID_BLOCK); debug("Block: '{' '}' \n"); nodelist.emplace_back(yyval.ptr);
853 break;}
854case 39:
855{ yyval.ptr = new Node(ID_BRACKET); yyval.ptr->child = yyvsp[-1].ptr; debug("Bracket \n"); nodelist.emplace_back(yyval.ptr);
856 break;}
857case 40:
858{ yyval.ptr = new Node(ID_BRACKET); debug("Bracket \n"); nodelist.emplace_back(yyval.ptr);
859 break;}
860case 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;}
863case 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;}
866case 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;}
869case 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;}
872case 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;}
875case 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;}
878case 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;}
881case 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;}
884case 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;}
887case 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;}
890case 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;}
893case 52:
894{ yyval.ptr = new Node(ID_BEGIN); yyval.ptr->child = yyvsp[0].ptr; nodelist.emplace_back(yyval.ptr); debug("BeginExpr\n");
895 break;}
896case 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;}
899case 54:
900{ yyval.ptr = new Node(ID_END); yyval.ptr->child = yyvsp[0].ptr; nodelist.emplace_back(yyval.ptr); debug("EndExpr\n");
901 break;}
902case 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;}
905case 56:
906{ yyval.ptr = new Node(ID_LINES); yyval.ptr->child = yyvsp[0].ptr; nodelist.emplace_back(yyval.ptr); debug("Lines\n");
907 break;}
908case 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;}
911case 58:
912{ yyval.ptr = new Node(ID_LINE); yyval.ptr->child = yyvsp[0].ptr; nodelist.emplace_back(yyval.ptr); debug("Line\n");
913 break;}
914case 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;}
917case 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;}
920case 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;}
923case 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;}
926case 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;}
929case 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;}
932case 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;}
935case 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;}
938case 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;}
941case 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;}
944case 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;}
947case 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;}
950case 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;}
953case 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 /* the action file gets copied in place of this dollarsign */
958
959 yyvsp -= yylen;
960 yyssp -= yylen;
961#ifdef YYLSP_NEEDED
962 yylsp -= yylen;
963#endif
964
965#if YYDEBUG0 != 0
966 if (yydebug)
967 {
968 short *ssp1 = yyss - 1;
969 fprintf (stderrstderr, "state stack now");
970 while (ssp1 != yyssp)
971 fprintf (stderrstderr, " %d", *++ssp1);
972 fprintf (stderrstderr, "\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 /* Now "shift" the result of the reduction.
996 Determine what state that goes to,
997 based on the state we popped back to
998 and the rule number reduced by. */
999
1000 yyn = yyr1[yyn];
1001
1002 yystate = yypgoto[yyn - YYNTBASE43] + *yyssp;
1003 if (yystate >= 0 && yystate <= YYLAST457 && yycheck[yystate] == *yyssp)
21
Assuming 'yystate' is < 0
1004 yystate = yytable[yystate];
1005 else
1006 yystate = yydefgoto[yyn - YYNTBASE43];
1007
1008 goto yynewstate;
22
Control jumps to line 518
1009
1010yyerrlab: /* here on detecting error */
1011
1012 if (! yyerrstatus)
1013 /* If not already recovering from an error, report this error. */
1014 {
1015 ++yynerrs;
1016
1017#ifdef YYERROR_VERBOSE
1018 yyn = yypact[yystate];
1019
1020 if (yyn > YYFLAG-32768 && yyn < YYLAST457)
1021 {
1022 int size = 0;
1023 char *msg;
1024 int x, count;
1025
1026 count = 0;
1027 /* Start X at -yyn if negative to avoid negative indexes in yycheck. */
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;
1062yyerrlab1: /* here on error raised explicitly by an action */
1063
1064 if (yyerrstatus == 3)
1065 {
1066 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1067
1068 /* return failure if at end of input */
1069 if (yychar == YYEOF0)
1070 YYABORTgoto yyabortlab;
1071
1072#if YYDEBUG0 != 0
1073 if (yydebug)
1074 fprintf(stderrstderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1075#endif
1076
1077 yychar = YYEMPTY-2;
1078 }
1079
1080 /* Else will try to reuse lookahead token
1081 after shifting the error token. */
1082
1083 yyerrstatus = 3; /* Each real token shifted decrements this */
1084
1085 goto yyerrhandle;
1086
1087yyerrdefault: /* current state does not do anything special for the error token. */
1088
1089#if 0
1090 /* This is wrong; only states that explicitly want error tokens
1091 should shift them. */
1092 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1093 if (yyn) goto yydefault;
1094#endif
1095
1096yyerrpop: /* pop the current state because it cannot handle the error token */
1097
1098 if (yyssp == yyss) YYABORTgoto yyabortlab;
1099 yyvsp--;
1100 yystate = *--yyssp;
1101#ifdef YYLSP_NEEDED
1102 yylsp--;
1103#endif
1104
1105#if YYDEBUG0 != 0
1106 if (yydebug)
1107 {
1108 short *ssp1 = yyss - 1;
1109 fprintf (stderrstderr, "Error: state stack now");
1110 while (ssp1 != yyssp)
1111 fprintf (stderrstderr, " %d", *++ssp1);
1112 fprintf (stderrstderr, "\n");
1113 }
1114#endif
1115
1116yyerrhandle:
1117
1118 yyn = yypact[yystate];
1119 if (yyn == YYFLAG-32768)
1120 goto yyerrdefault;
1121
1122 yyn += YYTERROR1;
1123 if (yyn < 0 || yyn > YYLAST457 || yycheck[yyn] != YYTERROR1)
1124 goto yyerrdefault;
1125
1126 yyn = yytable[yyn];
1127 if (yyn < 0)
1128 {
1129 if (yyn == YYFLAG-32768)
1130 goto yyerrpop;
1131 yyn = -yyn;
1132 goto yyreduce;
1133 }
1134 else if (yyn == 0)
1135 goto yyerrpop;
1136
1137 if (yyn == YYFINAL102)
1138 YYACCEPTgoto yyacceptlab;
1139
1140#if YYDEBUG0 != 0
1141 if (yydebug)
1142 fprintf(stderrstderr, "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 /* YYACCEPT comes here. */
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 /* YYABORT comes here. */
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
1179Node *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
1190void yyerror(const char * /*err*/)
1191{
1192// printf("REALKING ERR[%s]\n",err);
1193 // if error, delete all nodes.
1194 nodelist.clear();
1195 top = nullptr;
1196}
1197
1198#ifndef PARSE_DEBUG
1199int debug(const char * /*format*/, ...)
1200{
1201 return 0;
1202}
1203#endif
1204
1205/* vim:set shiftwidth=4 softtabstop=4 expandtab: */