1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 /* A Bison parser, made from grammar.y
22 by GNU Bison version 1.28 */
37 std::list
<Node
*> nodelist
;
39 Node
*mainParse(const char *_code
);
40 void yyerror(const char *);
42 void initFlex( const char *s
);
43 void viewResult(Node
*res
);
49 #define allocValue(x,y) \
50 x = (char *)malloc( strlen(y) +1 ); \
53 #define allocChar(x,y) \
54 x = (char *)malloc(2); \
59 int debug(const char *format
, ...);
82 #define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 66)
84 static const char yytranslate
[] = { 0,
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, 33,
89 37, 2, 2, 2, 2, 2, 2, 2, 2, 2,
90 2, 2, 2, 2, 2, 2, 2, 2, 2, 36,
91 2, 40, 2, 2, 2, 2, 2, 2, 2, 2,
92 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
93 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
94 34, 2, 38, 42, 41, 2, 2, 2, 2, 2,
95 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
96 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
97 2, 2, 35, 32, 39, 2, 2, 2, 2, 2,
98 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
99 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
101 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
102 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
103 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
104 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
105 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
106 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
107 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
108 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
109 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
110 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
111 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
112 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
117 static const short yyprhs
[] = { 0,
118 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
119 20, 22, 24, 26, 28, 30, 32, 34, 36, 39,
120 42, 45, 48, 51, 54, 58, 60, 63, 66, 69,
121 72, 75, 79, 81, 85, 89, 92, 96, 99, 103,
122 106, 110, 114, 120, 124, 130, 132, 135, 137, 140,
123 143, 147, 150, 154, 157, 159, 161, 165, 167, 169,
124 172, 174, 176, 178, 180, 182, 184, 186, 188, 190,
128 static const short yyrhs
[] = { 4,
129 0, 9, 0, 10, 0, 5, 0, 11, 0, 12,
130 0, 20, 0, 21, 0, 7, 0, 6, 0, 23,
131 0, 17, 0, 18, 0, 8, 0, 32, 0, 31,
132 0, 22, 0, 43, 0, 44, 43, 0, 26, 33,
133 0, 26, 34, 0, 26, 35, 0, 26, 36, 0,
134 26, 32, 0, 26, 32, 32, 0, 29, 0, 27,
135 37, 0, 27, 38, 0, 27, 39, 0, 27, 40,
136 0, 27, 32, 0, 27, 32, 32, 0, 30, 0,
137 45, 64, 46, 0, 33, 64, 37, 0, 33, 37,
138 0, 35, 64, 39, 0, 35, 39, 0, 34, 64,
139 38, 0, 34, 38, 0, 65, 41, 65, 0, 65,
140 42, 65, 0, 65, 41, 49, 42, 49, 0, 14,
141 49, 49, 0, 35, 64, 16, 64, 39, 0, 3,
142 0, 54, 49, 0, 19, 0, 56, 49, 0, 13,
143 49, 0, 13, 50, 49, 0, 24, 49, 0, 24,
144 49, 49, 0, 25, 49, 0, 62, 0, 63, 0,
145 62, 28, 63, 0, 64, 0, 65, 0, 64, 65,
146 0, 49, 0, 48, 0, 47, 0, 51, 0, 52,
147 0, 53, 0, 57, 0, 58, 0, 55, 0, 44,
154 static const short yyrline
[] = { 0,
155 59, 61, 62, 63, 64, 65, 66, 67, 68, 69,
156 70, 71, 72, 73, 74, 75, 76, 79, 81, 84,
157 86, 87, 88, 89, 90, 91, 94, 96, 97, 98,
158 99, 100, 101, 104, 108, 110, 113, 115, 118, 120,
159 123, 125, 126, 129, 133, 138, 142, 145, 149, 153,
160 155, 158, 160, 163, 168, 172, 174, 177, 181, 183,
161 186, 188, 189, 190, 191, 192, 193, 194, 195, 196,
167 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
169 static const char * const yytname
[] = { "$","error","$undefined.","ACCENT",
170 "SMALL_GREEK","CAPITAL_GREEK","BINARY_OPERATOR","RELATION_OPERATOR","ARROW",
171 "GENERAL_IDEN","GENERAL_OPER","BIG_SYMBOL","FUNCTION","ROOT","FRACTION","SUBSUP",
172 "EQOVER","DELIMETER","LARGE_DELIM","DECORATION","SPACE_SYMBOL","CHARACTER","STRING",
173 "OPERATOR","EQBEGIN","EQEND","EQLEFT","EQRIGHT","NEWLINE","LEFT_DELIM","RIGHT_DELIM",
174 "DIGIT","'|'","'('","'['","'{'","'<'","')'","']'","'}'","'>'","'_'","'^'","Identifier",
175 "PrimaryExpr","EQLeft","EQRight","Fence","Parenth","Block","Bracket","SubSupExpr",
176 "FractionExpr","OverExpr","Accent","AccentExpr","Decoration","DecorationExpr",
177 "RootExpr","BeginExpr","EndExpr","MathML","Lines","Line","ExprList","Expr", NULL
181 static const short yyr1
[] = { 0,
182 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
183 43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
184 45, 45, 45, 45, 45, 45, 46, 46, 46, 46,
185 46, 46, 46, 47, 48, 48, 49, 49, 50, 50,
186 51, 51, 51, 52, 53, 54, 55, 56, 57, 58,
187 58, 59, 59, 60, 61, 62, 62, 63, 64, 64,
188 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
192 static const short yyr2
[] = { 0,
193 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
194 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
195 2, 2, 2, 2, 3, 1, 2, 2, 2, 2,
196 2, 3, 1, 3, 3, 2, 3, 2, 3, 2,
197 3, 3, 5, 3, 5, 1, 2, 1, 2, 2,
198 3, 2, 3, 2, 1, 1, 3, 1, 1, 2,
199 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
203 static const short yydefact
[] = { 0,
204 46, 1, 4, 10, 9, 14, 2, 3, 5, 6,
205 0, 0, 12, 13, 48, 7, 8, 17, 11, 0,
206 0, 0, 26, 16, 15, 0, 0, 18, 70, 0,
207 63, 62, 61, 64, 65, 66, 0, 69, 0, 67,
208 68, 71, 72, 55, 56, 58, 59, 0, 0, 50,
209 0, 0, 52, 54, 24, 20, 21, 22, 23, 36,
210 0, 38, 0, 19, 0, 47, 49, 0, 60, 0,
211 0, 40, 0, 0, 51, 44, 53, 25, 35, 0,
212 37, 0, 33, 34, 57, 61, 41, 42, 39, 0,
213 31, 27, 28, 29, 30, 0, 45, 32, 43, 0,
217 static const short yydefgoto
[] = { 28,
218 29, 30, 84, 31, 32, 33, 51, 34, 35, 36,
219 37, 38, 39, 40, 41, 42, 43, 100, 44, 45,
223 static const short yypact
[] = { 393,
224 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
225 -30, -19,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -19,
226 -19, -3,-32768,-32768,-32768, 290, 107,-32768, 425, 393,
227 -32768,-32768,-32768,-32768,-32768,-32768, -19,-32768, -19,-32768,
228 -32768,-32768,-32768, -20,-32768, 393, -21, 218, 107,-32768,
229 -19, -19, -19,-32768, -15,-32768,-32768,-32768,-32768,-32768,
230 325,-32768, 70,-32768, 360,-32768,-32768, 393, -21, 393,
231 393,-32768, 254, 144,-32768,-32768,-32768,-32768,-32768, 393,
232 -32768, -25,-32768,-32768,-32768, -31, -21, -21,-32768, 181,
233 -14,-32768,-32768,-32768,-32768, -19,-32768,-32768,-32768, 22,
237 static const short yypgoto
[] = { -2,
238 -32768,-32768,-32768,-32768,-32768, -11,-32768,-32768,-32768,-32768,
239 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -33,
247 static const short yytable
[] = { 50,
248 52, 61, 63, 48, 49, 65, 91, 68, 53, 54,
249 96, 92, 93, 94, 95, 49, 78, 98, 69, 70,
250 71, 101, 102, 73, 74, 66, 64, 67, 55, 56,
251 57, 58, 59, 69, 85, 69, 0, 69, 0, 75,
252 76, 77, 87, 88, 0, 69, 69, 0, 0, 0,
253 0, 0, 0, 0, 0, 90, 0, 0, 86, 0,
254 0, 0, 69, 0, 0, 0, 0, 0, 0, 0,
255 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
256 9, 10, 11, 12, 99, 80, 13, 14, 15, 16,
257 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
258 24, 25, 26, 0, 27, 0, 0, 0, 81, 1,
259 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
260 12, 0, 0, 13, 14, 15, 16, 17, 18, 19,
261 20, 21, 22, 0, 0, 23, 0, 24, 25, 26,
262 0, 27, 0, 0, 0, 62, 1, 2, 3, 4,
263 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
264 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
265 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
266 0, 0, 81, 1, 2, 3, 4, 5, 6, 7,
267 8, 9, 10, 11, 12, 0, 0, 13, 14, 15,
268 16, 17, 18, 19, 20, 21, 22, 0, 0, 23,
269 0, 24, 25, 26, 0, 27, 0, 0, 0, 97,
270 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
271 11, 12, 0, 0, 13, 14, 15, 16, 17, 18,
272 19, 20, 21, 22, 0, 0, 23, 0, 24, 25,
273 26, 0, 27, 0, 0, 72, 1, 2, 3, 4,
274 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
275 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
276 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
277 0, 89, 1, 2, 3, 4, 5, 6, 7, 8,
278 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
279 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
280 24, 25, 26, 0, 27, 0, 60, 1, 2, 3,
281 4, 5, 6, 7, 8, 9, 10, 11, 12, 0,
282 0, 13, 14, 15, 16, 17, 18, 19, 20, 21,
283 22, 0, 0, 23, 0, 24, 25, 26, 0, 27,
284 0, 79, 1, 2, 3, 4, 5, 6, 7, 8,
285 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
286 17, 18, 19, 20, 21, 22, 82, 0, 23, 83,
287 24, 25, 26, 0, 27, 1, 2, 3, 4, 5,
288 6, 7, 8, 9, 10, 11, 12, 0, 0, 13,
289 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
290 0, 23, 0, 24, 25, 26, 0, 27, 2, 3,
291 4, 5, 6, 7, 8, 9, 10, 0, 0, 0,
292 0, 13, 14, 0, 16, 17, 18, 19, 0, 0,
293 0, 0, 0, 0, 0, 24, 25
296 static const short yycheck
[] = { 11,
297 12, 26, 27, 34, 35, 30, 32, 28, 20, 21,
298 42, 37, 38, 39, 40, 35, 32, 32, 46, 41,
299 42, 0, 0, 48, 49, 37, 29, 39, 32, 33,
300 34, 35, 36, 61, 68, 63, -1, 65, -1, 51,
301 52, 53, 70, 71, -1, 73, 74, -1, -1, -1,
302 -1, -1, -1, -1, -1, 80, -1, -1, 70, -1,
303 -1, -1, 90, -1, -1, -1, -1, -1, -1, -1,
304 -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
305 11, 12, 13, 14, 96, 16, 17, 18, 19, 20,
306 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
307 31, 32, 33, -1, 35, -1, -1, -1, 39, 3,
308 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
309 14, -1, -1, 17, 18, 19, 20, 21, 22, 23,
310 24, 25, 26, -1, -1, 29, -1, 31, 32, 33,
311 -1, 35, -1, -1, -1, 39, 3, 4, 5, 6,
312 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
313 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
314 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
315 -1, -1, 39, 3, 4, 5, 6, 7, 8, 9,
316 10, 11, 12, 13, 14, -1, -1, 17, 18, 19,
317 20, 21, 22, 23, 24, 25, 26, -1, -1, 29,
318 -1, 31, 32, 33, -1, 35, -1, -1, -1, 39,
319 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
320 13, 14, -1, -1, 17, 18, 19, 20, 21, 22,
321 23, 24, 25, 26, -1, -1, 29, -1, 31, 32,
322 33, -1, 35, -1, -1, 38, 3, 4, 5, 6,
323 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
324 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
325 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
326 -1, 38, 3, 4, 5, 6, 7, 8, 9, 10,
327 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
328 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
329 31, 32, 33, -1, 35, -1, 37, 3, 4, 5,
330 6, 7, 8, 9, 10, 11, 12, 13, 14, -1,
331 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
332 26, -1, -1, 29, -1, 31, 32, 33, -1, 35,
333 -1, 37, 3, 4, 5, 6, 7, 8, 9, 10,
334 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
335 21, 22, 23, 24, 25, 26, 27, -1, 29, 30,
336 31, 32, 33, -1, 35, 3, 4, 5, 6, 7,
337 8, 9, 10, 11, 12, 13, 14, -1, -1, 17,
338 18, 19, 20, 21, 22, 23, 24, 25, 26, -1,
339 -1, 29, -1, 31, 32, 33, -1, 35, 4, 5,
340 6, 7, 8, 9, 10, 11, 12, -1, -1, -1,
341 -1, 17, 18, -1, 20, 21, 22, 23, -1, -1,
342 -1, -1, -1, -1, -1, 31, 32
344 /* This file comes from bison-1.28. */
346 /* Skeleton output parser for bison,
347 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
349 This program is free software; you can redistribute it and/or modify
350 it under the terms of the GNU General Public License as published by
351 the Free Software Foundation; either version 2, or (at your option)
354 This program is distributed in the hope that it will be useful,
355 but WITHOUT ANY WARRANTY; without even the implied warranty of
356 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
357 GNU General Public License for more details.
359 You should have received a copy of the GNU General Public License
360 along with this program; if not, write to the Free Software
361 Foundation, Inc., 59 Temple Place - Suite 330,
362 Boston, MA 02111-1307, USA. */
364 /* As a special exception, when this file is copied by Bison into a
365 Bison output file, you may use that output file without restriction.
366 This special exception was added by the Free Software Foundation
367 in version 1.24 of Bison. */
369 /* This is the parser code that is written into each bison parser
370 when the %semantic_parser declaration is not specified in the grammar.
371 It was written by Richard Stallman by simplifying the hairy parser
372 used when %semantic_parser is specified. */
374 #ifndef YYSTACK_USE_ALLOCA
376 #define YYSTACK_USE_ALLOCA
377 #else /* alloca not defined */
379 #define YYSTACK_USE_ALLOCA
380 #define alloca __builtin_alloca
381 #else /* not GNU C. */
382 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
383 #define YYSTACK_USE_ALLOCA
384 #include <sal/alloca.h>
385 #else /* not sparc */
388 #define YYSTACK_USE_ALLOCA
389 #endif /* not _AIX */
390 #endif /* not sparc */
391 #endif /* not GNU C */
392 #endif /* alloca not defined */
393 #endif /* YYSTACK_USE_ALLOCA not defined */
395 #ifdef YYSTACK_USE_ALLOCA
396 #define YYSTACK_ALLOC alloca
398 #define YYSTACK_ALLOC malloc
401 /* Note: there must be only one dollar sign in this file.
402 It is replaced by the list of actions, each action
403 as one case of the switch. */
407 #define YYACCEPT goto yyacceptlab
408 #define YYABORT goto yyabortlab
413 #define YYLEX yylex()
419 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
421 #define YYLEX yylex(&yylval, &yylloc)
423 #else /* not YYLSP_NEEDED */
425 #define YYLEX yylex(&yylval, YYLEX_PARAM)
427 #define YYLEX yylex(&yylval)
429 #endif /* not YYLSP_NEEDED */
432 /* If nonreentrant, generate the variables here */
436 int yychar
; /* the lookahead symbol */
437 YYSTYPE yylval
; /* the semantic value of the */
438 /* lookahead symbol */
441 YYLTYPE yylloc
; /* location data for the lookahead */
445 int yynerrs
; /* number of parse errors so far */
446 #endif /* not YYPURE */
449 int yydebug
; /* nonzero means print parse trace */
450 /* Since this is uninitialized, it does not stop multiple parsers
454 /* YYINITDEPTH indicates the initial size of the parser's stacks */
457 #define YYINITDEPTH 200
460 /* YYMAXDEPTH is the maximum size the stacks can grow to
461 (effective only if the built-in stack extension method is used). */
468 #define YYMAXDEPTH 10000
471 /* Define __yy_memcpy. Note that the size argument
472 should be passed with type unsigned int, because that is what the non-GCC
473 definitions require. With GCC, __builtin_memcpy takes an arg
474 of type size_t, but it can handle unsigned int. */
476 #if defined(__GNUC__)
477 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
481 /* This is the most reliable way to avoid incompatibilities
482 in available built-in functions on various systems. */
484 __yy_memcpy (to
, from
, count
)
489 register char *f
= from
;
490 register char *t
= to
;
491 register int i
= count
;
497 #else /* __cplusplus */
499 /* This is the most reliable way to avoid incompatibilities
500 in available built-in functions on various systems. */
502 __yy_memcpy (char *to
, char *from
, unsigned int count
)
504 register char *t
= to
;
505 register char *f
= from
;
506 register int i
= count
;
515 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
516 into yyparse. The argument should have type void *.
517 It should actually point to an object.
518 Grammar actions can access the variable by casting it
519 to the proper pointer type. */
523 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
524 #define YYPARSE_PARAM_DECL
525 #else /* not __cplusplus */
526 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
527 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
528 #endif /* not __cplusplus */
529 #else /* not YYPARSE_PARAM */
530 #define YYPARSE_PARAM_ARG
531 #define YYPARSE_PARAM_DECL
532 #endif /* not YYPARSE_PARAM */
534 /* Prevent warning if -Wstrict-prototypes. */
537 int yyparse (void *);
544 yyparse(YYPARSE_PARAM_ARG
)
547 register int yystate
;
549 register short *yyssp
;
550 register YYSTYPE
*yyvsp
;
551 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
552 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
554 short yyssa
[YYINITDEPTH
]; /* the state stack */
555 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
557 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
558 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
561 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
562 YYLTYPE
*yyls
= yylsa
;
565 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
568 int yystacksize
= YYINITDEPTH
;
569 int yyfree_stacks
= 0;
580 YYSTYPE yyval
; /* the variable used to return */
582 /* semantic values from the action */
589 fprintf(stderr
, "Starting parse\n");
595 yychar
= YYEMPTY
; /* Cause a token to be read. */
597 /* Initialize stack pointers.
598 Waste one element of value and location stack
599 so that they stay on the same level as the state stack.
600 The wasted elements are never initialized. */
608 /* Push a new state, which is found in yystate . */
609 /* In all cases, when you get here, the value and location stacks
610 have just been pushed. so pushing a state here evens the stacks. */
613 *++yyssp
= sal::static_int_cast
<short>(yystate
);
615 if (yyssp
>= yyss
+ yystacksize
- 1)
617 /* Give user a chance to reallocate the stack */
618 /* Use copies of these so that the &'s don't force the real ones into memory. */
619 YYSTYPE
*yyvs1
= yyvs
;
622 YYLTYPE
*yyls1
= yyls
;
625 /* Get the current used size of the three stacks, in elements. */
626 int size
= yyssp
- yyss
+ 1;
629 /* Each stack pointer address is followed by the size of
630 the data in use in that stack, in bytes. */
632 /* This used to be a conditional around just the two extra args,
633 but that might be undefined if yyoverflow is a macro. */
634 yyoverflow("parser stack overflow",
635 &yyss1
, size
* sizeof (*yyssp
),
636 &yyvs1
, size
* sizeof (*yyvsp
),
637 &yyls1
, size
* sizeof (*yylsp
),
640 yyoverflow("parser stack overflow",
641 &yyss1
, size
* sizeof (*yyssp
),
642 &yyvs1
, size
* sizeof (*yyvsp
),
646 yyss
= yyss1
; yyvs
= yyvs1
;
650 #else /* no yyoverflow */
651 /* Extend the stack our own way. */
652 if (yystacksize
>= YYMAXDEPTH
)
654 yyerror("parser stack overflow");
666 if (yystacksize
> YYMAXDEPTH
)
667 yystacksize
= YYMAXDEPTH
;
668 #ifndef YYSTACK_USE_ALLOCA
671 yyss
= (short *) YYSTACK_ALLOC (yystacksize
* sizeof (*yyssp
));
672 __yy_memcpy ((char *)yyss
, (char *)yyss1
,
673 size
* (unsigned int) sizeof (*yyssp
));
674 yyvs
= (YYSTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yyvsp
));
675 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
,
676 size
* (unsigned int) sizeof (*yyvsp
));
678 yyls
= (YYLTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yylsp
));
679 __yy_memcpy ((char *)yyls
, (char *)yyls1
,
680 size
* (unsigned int) sizeof (*yylsp
));
682 #endif /* no yyoverflow */
684 yyssp
= yyss
+ size
- 1;
685 yyvsp
= yyvs
+ size
- 1;
687 yylsp
= yyls
+ size
- 1;
692 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
695 if (yyssp
>= yyss
+ yystacksize
- 1)
701 fprintf(stderr
, "Entering state %d\n", yystate
);
707 /* Do appropriate processing given the current state. */
708 /* Read a lookahead token if we need one and don't already have one. */
711 /* First try to decide what to do without reference to lookahead token. */
713 yyn
= yypact
[yystate
];
717 /* Not known => get a lookahead token if don't already have one. */
719 /* yychar is either YYEMPTY or YYEOF
720 or a valid token in external form. */
722 if (yychar
== YYEMPTY
)
726 fprintf(stderr
, "Reading a token: ");
731 /* Convert token to internal form (in yychar1) for indexing tables with */
733 if (yychar
<= 0) /* This means end of input. */
736 yychar
= YYEOF
; /* Don't call YYLEX any more */
740 fprintf(stderr
, "Now at end of input.\n");
745 yychar1
= YYTRANSLATE(yychar
);
750 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
751 /* Give the individual parser a way to print the precise meaning
752 of a token, for further debugging info. */
754 YYPRINT (stderr
, yychar
, yylval
);
756 fprintf (stderr
, ")\n");
762 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
767 /* yyn is what to do for this token type in this state.
768 Negative => reduce, -yyn is rule number.
769 Positive => shift, yyn is new state.
770 New state is final state => don't bother to shift,
772 0, or most negative number => error. */
787 /* Shift the lookahead token. */
791 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
794 /* Discard the token being shifted unless it is eof. */
803 /* count tokens shifted since error; after three, turn off error status. */
804 if (yyerrstatus
) yyerrstatus
--;
809 /* Do the default action for the current state. */
812 yyn
= yydefact
[yystate
];
816 /* Do a reduction. yyn is the number of a rule to reduce with. */
820 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
827 fprintf (stderr
, "Reducing via rule %d (line %d), ",
830 /* Print the symbols being reduced, and their result. */
831 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
832 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
833 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
841 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
844 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
847 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
850 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
853 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
856 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
859 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
862 { yyval
.ptr
= new Node(ID_CHARACTER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
865 { yyval
.ptr
= new Node(ID_OPERATOR
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
868 { yyval
.ptr
= new Node(ID_OPERATOR
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
871 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
874 { yyval
.ptr
= new Node(ID_DELIMETER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
877 { yyval
.ptr
= new Node(ID_DELIMETER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
880 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
883 { yyval
.ptr
= new Node(ID_CHARACTER
); allocChar(yyval
.ptr
->value
, '|'); debug("Identifier : '|'\n"); nodelist
.push_back(yyval
.ptr
); ;
886 { yyval
.ptr
= new Node(ID_NUMBER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].dval
); debug("Number : %s\n",yyvsp
[0].dval
); nodelist
.push_back(yyval
.ptr
); ;
889 { yyval
.ptr
= new Node(ID_STRING
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("String : %s\n",yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
892 { yyval
.ptr
= new Node(ID_PRIMARYEXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("PrimaryExpr\n"); nodelist
.push_back(yyval
.ptr
); ;
895 { yyval
.ptr
= new Node(ID_PRIMARYEXPR
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; yyval
.ptr
->next
= yyvsp
[0].ptr
; debug("PrimaryExpr : PrimaryExpr Identifier\n"); nodelist
.push_back(yyval
.ptr
); ;
898 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '('); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
901 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '['); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
904 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '{'); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
907 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '<'); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
910 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '|'); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
913 { yyval
.ptr
= new Node(ID_LEFT
); allocValue(yyval
.ptr
->value
, "||"); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
916 { yyval
.ptr
= new Node(ID_LEFT
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
919 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, ')'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
922 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, ']'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
925 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '}'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
928 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '>'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
931 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '|'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
934 { yyval
.ptr
= new Node(ID_RIGHT
); allocValue(yyval
.ptr
->value
, "||"); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
937 { yyval
.ptr
= new Node(ID_RIGHT
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
940 { 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
.push_back(yyval
.ptr
); ;
943 { yyval
.ptr
= new Node(ID_PARENTH
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Parenth: '(' ExprList ')' \n"); nodelist
.push_back(yyval
.ptr
); ;
946 { yyval
.ptr
= new Node(ID_PARENTH
); debug("Parenth: '(' ')' \n"); nodelist
.push_back(yyval
.ptr
); ;
949 { yyval
.ptr
= new Node(ID_BLOCK
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Block: '{' ExprList '}' \n"); nodelist
.push_back(yyval
.ptr
); ;
952 { yyval
.ptr
= new Node(ID_BLOCK
); debug("Block: '{' '}' \n"); nodelist
.push_back(yyval
.ptr
); ;
955 { yyval
.ptr
= new Node(ID_BRACKET
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Bracket \n"); nodelist
.push_back(yyval
.ptr
); ;
958 { yyval
.ptr
= new Node(ID_BRACKET
); debug("Bracket \n"); nodelist
.push_back(yyval
.ptr
); ;
961 { 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
.push_back(yyval
.ptr
); ;
964 { 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
.push_back(yyval
.ptr
); ;
967 { 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
.push_back(yyval
.ptr
); ;
970 { 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
.push_back(yyval
.ptr
); ;
973 { yyval
.ptr
= new Node(ID_OVER
); yyval
.ptr
->child
= yyvsp
[-3].ptr
; yyvsp
[-3].ptr
->next
= yyvsp
[-1].ptr
; debug("OverExpr\n"); nodelist
.push_back(yyval
.ptr
); ;
976 { yyval
.ptr
= new Node(ID_ACCENTEXPR
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Accent : %s\n", yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
979 { yyval
.ptr
= new Node(ID_ACCENTEXPR
); yyval
.ptr
->child
=yyvsp
[-1].ptr
; yyvsp
[-1].ptr
->next
= yyvsp
[0].ptr
; debug("AccentExpr \n"); nodelist
.push_back(yyval
.ptr
); ;
982 { yyval
.ptr
= new Node(ID_DECORATIONEXPR
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Decoration : %s\n", yyvsp
[0].str
); nodelist
.push_back(yyval
.ptr
); ;
985 { yyval
.ptr
= new Node(ID_DECORATIONEXPR
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; yyvsp
[-1].ptr
->next
= yyvsp
[0].ptr
; debug("DecorationExpr \n"); nodelist
.push_back(yyval
.ptr
); ;
988 { yyval
.ptr
= new Node(ID_SQRTEXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("RootExpr : %s\n", yyvsp
[-1].str
); nodelist
.push_back(yyval
.ptr
); ;
991 { 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
.push_back(yyval
.ptr
); ;
994 { yyval
.ptr
= new Node(ID_BEGIN
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("BeginExpr\n"); ;
997 { yyval
.ptr
= new Node(ID_BEGIN
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; yyvsp
[-1].ptr
->next
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("BeginExpr\n"); ;
1000 { yyval
.ptr
= new Node(ID_END
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("EndExpr\n"); ;
1003 { yyval
.ptr
= new Node(ID_MATHML
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); top
= yyval
.ptr
; debug("MathML\n"); ;
1006 { yyval
.ptr
= new Node(ID_LINES
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("Lines\n"); ;
1009 { yyval
.ptr
= new Node(ID_LINES
); yyval
.ptr
->child
= yyvsp
[-2].ptr
; yyvsp
[-2].ptr
->next
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("Lines\n"); ;
1012 { yyval
.ptr
= new Node(ID_LINE
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("Line\n"); ;
1015 { yyval
.ptr
= new Node(ID_EXPRLIST
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("ExprList : Expr\n"); nodelist
.push_back(yyval
.ptr
); ;
1018 { 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
.push_back(yyval
.ptr
); ;
1021 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Block\n"); nodelist
.push_back(yyval
.ptr
);;
1024 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Parenth\n"); nodelist
.push_back(yyval
.ptr
);;
1027 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Fence\n"); nodelist
.push_back(yyval
.ptr
);;
1030 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : SubSupExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1033 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : FractionExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1036 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : OverExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1039 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : DecorationExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1042 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : RootExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1045 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : AccentExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1048 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : PrimaryExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1051 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : BeginExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1054 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : EndExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1057 /* the action file gets copied in in place of this dollarsign */
1068 short *ssp1
= yyss
- 1;
1069 fprintf (stderr
, "state stack now");
1070 while (ssp1
!= yyssp
)
1071 fprintf (stderr
, " %d", *++ssp1
);
1072 fprintf (stderr
, "\n");
1082 yylsp
->first_line
= yylloc
.first_line
;
1083 yylsp
->first_column
= yylloc
.first_column
;
1084 yylsp
->last_line
= (yylsp
-1)->last_line
;
1085 yylsp
->last_column
= (yylsp
-1)->last_column
;
1090 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
1091 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
1095 /* Now "shift" the result of the reduction.
1096 Determine what state that goes to,
1097 based on the state we popped back to
1098 and the rule number reduced by. */
1102 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1103 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1104 yystate
= yytable
[yystate
];
1106 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1110 yyerrlab
: /* here on detecting error */
1113 /* If not already recovering from an error, report this error. */
1117 #ifdef YYERROR_VERBOSE
1118 yyn
= yypact
[yystate
];
1120 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1127 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1128 for (x
= (yyn
< 0 ? -yyn
: 0);
1129 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1130 if (yycheck
[x
+ yyn
] == x
)
1131 size
+= strlen(yytname
[x
]) + 15, count
++;
1132 msg
= (char *) malloc(size
+ 15);
1135 strcpy(msg
, "parse error");
1140 for (x
= (yyn
< 0 ? -yyn
: 0);
1141 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1142 if (yycheck
[x
+ yyn
] == x
)
1144 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
1145 strcat(msg
, yytname
[x
]);
1154 yyerror ("parse error; also virtual memory exceeded");
1157 #endif /* YYERROR_VERBOSE */
1158 yyerror("parse error");
1162 yyerrlab1
: /* here on error raised explicitly by an action */
1164 if (yyerrstatus
== 3)
1166 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1168 /* return failure if at end of input */
1169 if (yychar
== YYEOF
)
1174 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
1180 /* Else will try to reuse lookahead token
1181 after shifting the error token. */
1183 yyerrstatus
= 3; /* Each real token shifted decrements this */
1187 yyerrdefault
: /* current state does not do anything special for the error token. */
1190 /* This is wrong; only states that explicitly want error tokens
1191 should shift them. */
1192 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1193 if (yyn
) goto yydefault
;
1196 yyerrpop
: /* pop the current state because it cannot handle the error token */
1198 if (yyssp
== yyss
) YYABORT
;
1208 short *ssp1
= yyss
- 1;
1209 fprintf (stderr
, "Error: state stack now");
1210 while (ssp1
!= yyssp
)
1211 fprintf (stderr
, " %d", *++ssp1
);
1212 fprintf (stderr
, "\n");
1218 yyn
= yypact
[yystate
];
1223 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1242 fprintf(stderr
, "Shifting error token, ");
1254 /* YYACCEPT comes here. */
1266 /* YYABORT comes here. */
1279 Node
*mainParse(const char *_code
)
1290 void yyerror(const char * /*err*/)
1292 // printf("REALKING ERR[%s]\n",err);
1293 // if error, delete all nodes.
1295 int ncount
= nodelist
.size();
1296 for( int i
= 0 ; i
< ncount
; i
++){
1297 pNode
= nodelist
.front();
1298 nodelist
.pop_front();
1305 int debug(const char * /*format*/, ...)
1311 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */