1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 /* A Bison parser, made from grammar.y
31 by GNU Bison version 1.28 */
33 #define YYBISON 1 /* Identify Bison output. */
43 #define SMALL_GREEK 258
44 #define CAPITAL_GREEK 259
45 #define BINARY_OPERATOR 260
46 #define RELATION_OPERATOR 261
48 #define GENERAL_IDEN 263
49 #define GENERAL_OPER 264
50 #define BIG_SYMBOL 265
57 #define LARGE_DELIM 272
58 #define DECORATION 273
59 #define SPACE_SYMBOL 274
68 #define LEFT_DELIM 283
69 #define RIGHT_DELIM 284
80 std::list
<Node
*> nodelist
;
82 Node
*mainParse(const char *_code
);
83 void yyerror(const char *);
85 void initFlex( const char *s
);
86 void viewResult(Node
*res
);
92 #define allocValue(x,y) \
93 x = (char *)malloc( strlen(y) +1 ); \
96 #define allocChar(x,y) \
97 x = (char *)malloc(2); \
102 int debug(const char *format
, ...);
123 #define YYFLAG -32768
126 #define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 66)
128 static const char yytranslate
[] = { 0,
129 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
130 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
131 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
132 2, 2, 2, 2, 2, 2, 2, 2, 2, 33,
133 37, 2, 2, 2, 2, 2, 2, 2, 2, 2,
134 2, 2, 2, 2, 2, 2, 2, 2, 2, 36,
135 2, 40, 2, 2, 2, 2, 2, 2, 2, 2,
136 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
137 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
138 34, 2, 38, 42, 41, 2, 2, 2, 2, 2,
139 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
140 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
141 2, 2, 35, 32, 39, 2, 2, 2, 2, 2,
142 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
143 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
144 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
145 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
146 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
147 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
148 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
149 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
150 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
151 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
152 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
153 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
154 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
155 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
156 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
161 static const short yyprhs
[] = { 0,
162 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
163 20, 22, 24, 26, 28, 30, 32, 34, 36, 39,
164 42, 45, 48, 51, 54, 58, 60, 63, 66, 69,
165 72, 75, 79, 81, 85, 89, 92, 96, 99, 103,
166 106, 110, 114, 120, 124, 130, 132, 135, 137, 140,
167 143, 147, 150, 154, 157, 159, 161, 165, 167, 169,
168 172, 174, 176, 178, 180, 182, 184, 186, 188, 190,
172 static const short yyrhs
[] = { 4,
173 0, 9, 0, 10, 0, 5, 0, 11, 0, 12,
174 0, 20, 0, 21, 0, 7, 0, 6, 0, 23,
175 0, 17, 0, 18, 0, 8, 0, 32, 0, 31,
176 0, 22, 0, 43, 0, 44, 43, 0, 26, 33,
177 0, 26, 34, 0, 26, 35, 0, 26, 36, 0,
178 26, 32, 0, 26, 32, 32, 0, 29, 0, 27,
179 37, 0, 27, 38, 0, 27, 39, 0, 27, 40,
180 0, 27, 32, 0, 27, 32, 32, 0, 30, 0,
181 45, 64, 46, 0, 33, 64, 37, 0, 33, 37,
182 0, 35, 64, 39, 0, 35, 39, 0, 34, 64,
183 38, 0, 34, 38, 0, 65, 41, 65, 0, 65,
184 42, 65, 0, 65, 41, 49, 42, 49, 0, 14,
185 49, 49, 0, 35, 64, 16, 64, 39, 0, 3,
186 0, 54, 49, 0, 19, 0, 56, 49, 0, 13,
187 49, 0, 13, 50, 49, 0, 24, 49, 0, 24,
188 49, 49, 0, 25, 49, 0, 62, 0, 63, 0,
189 62, 28, 63, 0, 64, 0, 65, 0, 64, 65,
190 0, 49, 0, 48, 0, 47, 0, 51, 0, 52,
191 0, 53, 0, 57, 0, 58, 0, 55, 0, 44,
198 static const short yyrline
[] = { 0,
199 59, 61, 62, 63, 64, 65, 66, 67, 68, 69,
200 70, 71, 72, 73, 74, 75, 76, 79, 81, 84,
201 86, 87, 88, 89, 90, 91, 94, 96, 97, 98,
202 99, 100, 101, 104, 108, 110, 113, 115, 118, 120,
203 123, 125, 126, 129, 133, 138, 142, 145, 149, 153,
204 155, 158, 160, 163, 168, 172, 174, 177, 181, 183,
205 186, 188, 189, 190, 191, 192, 193, 194, 195, 196,
211 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
213 static const char * const yytname
[] = { "$","error","$undefined.","ACCENT",
214 "SMALL_GREEK","CAPITAL_GREEK","BINARY_OPERATOR","RELATION_OPERATOR","ARROW",
215 "GENERAL_IDEN","GENERAL_OPER","BIG_SYMBOL","FUNCTION","ROOT","FRACTION","SUBSUP",
216 "EQOVER","DELIMETER","LARGE_DELIM","DECORATION","SPACE_SYMBOL","CHARACTER","STRING",
217 "OPERATOR","EQBEGIN","EQEND","EQLEFT","EQRIGHT","NEWLINE","LEFT_DELIM","RIGHT_DELIM",
218 "DIGIT","'|'","'('","'['","'{'","'<'","')'","']'","'}'","'>'","'_'","'^'","Identifier",
219 "PrimaryExpr","EQLeft","EQRight","Fence","Parenth","Block","Bracket","SubSupExpr",
220 "FractionExpr","OverExpr","Accent","AccentExpr","Decoration","DecorationExpr",
221 "RootExpr","BeginExpr","EndExpr","MathML","Lines","Line","ExprList","Expr", NULL
225 static const short yyr1
[] = { 0,
226 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
227 43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
228 45, 45, 45, 45, 45, 45, 46, 46, 46, 46,
229 46, 46, 46, 47, 48, 48, 49, 49, 50, 50,
230 51, 51, 51, 52, 53, 54, 55, 56, 57, 58,
231 58, 59, 59, 60, 61, 62, 62, 63, 64, 64,
232 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
236 static const short yyr2
[] = { 0,
237 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
238 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
239 2, 2, 2, 2, 3, 1, 2, 2, 2, 2,
240 2, 3, 1, 3, 3, 2, 3, 2, 3, 2,
241 3, 3, 5, 3, 5, 1, 2, 1, 2, 2,
242 3, 2, 3, 2, 1, 1, 3, 1, 1, 2,
243 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
247 static const short yydefact
[] = { 0,
248 46, 1, 4, 10, 9, 14, 2, 3, 5, 6,
249 0, 0, 12, 13, 48, 7, 8, 17, 11, 0,
250 0, 0, 26, 16, 15, 0, 0, 18, 70, 0,
251 63, 62, 61, 64, 65, 66, 0, 69, 0, 67,
252 68, 71, 72, 55, 56, 58, 59, 0, 0, 50,
253 0, 0, 52, 54, 24, 20, 21, 22, 23, 36,
254 0, 38, 0, 19, 0, 47, 49, 0, 60, 0,
255 0, 40, 0, 0, 51, 44, 53, 25, 35, 0,
256 37, 0, 33, 34, 57, 61, 41, 42, 39, 0,
257 31, 27, 28, 29, 30, 0, 45, 32, 43, 0,
261 static const short yydefgoto
[] = { 28,
262 29, 30, 84, 31, 32, 33, 51, 34, 35, 36,
263 37, 38, 39, 40, 41, 42, 43, 100, 44, 45,
267 static const short yypact
[] = { 393,
268 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
269 -30, -19,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -19,
270 -19, -3,-32768,-32768,-32768, 290, 107,-32768, 425, 393,
271 -32768,-32768,-32768,-32768,-32768,-32768, -19,-32768, -19,-32768,
272 -32768,-32768,-32768, -20,-32768, 393, -21, 218, 107,-32768,
273 -19, -19, -19,-32768, -15,-32768,-32768,-32768,-32768,-32768,
274 325,-32768, 70,-32768, 360,-32768,-32768, 393, -21, 393,
275 393,-32768, 254, 144,-32768,-32768,-32768,-32768,-32768, 393,
276 -32768, -25,-32768,-32768,-32768, -31, -21, -21,-32768, 181,
277 -14,-32768,-32768,-32768,-32768, -19,-32768,-32768,-32768, 22,
281 static const short yypgoto
[] = { -2,
282 -32768,-32768,-32768,-32768,-32768, -11,-32768,-32768,-32768,-32768,
283 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -33,
291 static const short yytable
[] = { 50,
292 52, 61, 63, 48, 49, 65, 91, 68, 53, 54,
293 96, 92, 93, 94, 95, 49, 78, 98, 69, 70,
294 71, 101, 102, 73, 74, 66, 64, 67, 55, 56,
295 57, 58, 59, 69, 85, 69, 0, 69, 0, 75,
296 76, 77, 87, 88, 0, 69, 69, 0, 0, 0,
297 0, 0, 0, 0, 0, 90, 0, 0, 86, 0,
298 0, 0, 69, 0, 0, 0, 0, 0, 0, 0,
299 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
300 9, 10, 11, 12, 99, 80, 13, 14, 15, 16,
301 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
302 24, 25, 26, 0, 27, 0, 0, 0, 81, 1,
303 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
304 12, 0, 0, 13, 14, 15, 16, 17, 18, 19,
305 20, 21, 22, 0, 0, 23, 0, 24, 25, 26,
306 0, 27, 0, 0, 0, 62, 1, 2, 3, 4,
307 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
308 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
309 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
310 0, 0, 81, 1, 2, 3, 4, 5, 6, 7,
311 8, 9, 10, 11, 12, 0, 0, 13, 14, 15,
312 16, 17, 18, 19, 20, 21, 22, 0, 0, 23,
313 0, 24, 25, 26, 0, 27, 0, 0, 0, 97,
314 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
315 11, 12, 0, 0, 13, 14, 15, 16, 17, 18,
316 19, 20, 21, 22, 0, 0, 23, 0, 24, 25,
317 26, 0, 27, 0, 0, 72, 1, 2, 3, 4,
318 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
319 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
320 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
321 0, 89, 1, 2, 3, 4, 5, 6, 7, 8,
322 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
323 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
324 24, 25, 26, 0, 27, 0, 60, 1, 2, 3,
325 4, 5, 6, 7, 8, 9, 10, 11, 12, 0,
326 0, 13, 14, 15, 16, 17, 18, 19, 20, 21,
327 22, 0, 0, 23, 0, 24, 25, 26, 0, 27,
328 0, 79, 1, 2, 3, 4, 5, 6, 7, 8,
329 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
330 17, 18, 19, 20, 21, 22, 82, 0, 23, 83,
331 24, 25, 26, 0, 27, 1, 2, 3, 4, 5,
332 6, 7, 8, 9, 10, 11, 12, 0, 0, 13,
333 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
334 0, 23, 0, 24, 25, 26, 0, 27, 2, 3,
335 4, 5, 6, 7, 8, 9, 10, 0, 0, 0,
336 0, 13, 14, 0, 16, 17, 18, 19, 0, 0,
337 0, 0, 0, 0, 0, 24, 25
340 static const short yycheck
[] = { 11,
341 12, 26, 27, 34, 35, 30, 32, 28, 20, 21,
342 42, 37, 38, 39, 40, 35, 32, 32, 46, 41,
343 42, 0, 0, 48, 49, 37, 29, 39, 32, 33,
344 34, 35, 36, 61, 68, 63, -1, 65, -1, 51,
345 52, 53, 70, 71, -1, 73, 74, -1, -1, -1,
346 -1, -1, -1, -1, -1, 80, -1, -1, 70, -1,
347 -1, -1, 90, -1, -1, -1, -1, -1, -1, -1,
348 -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
349 11, 12, 13, 14, 96, 16, 17, 18, 19, 20,
350 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
351 31, 32, 33, -1, 35, -1, -1, -1, 39, 3,
352 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
353 14, -1, -1, 17, 18, 19, 20, 21, 22, 23,
354 24, 25, 26, -1, -1, 29, -1, 31, 32, 33,
355 -1, 35, -1, -1, -1, 39, 3, 4, 5, 6,
356 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
357 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
358 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
359 -1, -1, 39, 3, 4, 5, 6, 7, 8, 9,
360 10, 11, 12, 13, 14, -1, -1, 17, 18, 19,
361 20, 21, 22, 23, 24, 25, 26, -1, -1, 29,
362 -1, 31, 32, 33, -1, 35, -1, -1, -1, 39,
363 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
364 13, 14, -1, -1, 17, 18, 19, 20, 21, 22,
365 23, 24, 25, 26, -1, -1, 29, -1, 31, 32,
366 33, -1, 35, -1, -1, 38, 3, 4, 5, 6,
367 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
368 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
369 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
370 -1, 38, 3, 4, 5, 6, 7, 8, 9, 10,
371 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
372 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
373 31, 32, 33, -1, 35, -1, 37, 3, 4, 5,
374 6, 7, 8, 9, 10, 11, 12, 13, 14, -1,
375 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
376 26, -1, -1, 29, -1, 31, 32, 33, -1, 35,
377 -1, 37, 3, 4, 5, 6, 7, 8, 9, 10,
378 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
379 21, 22, 23, 24, 25, 26, 27, -1, 29, 30,
380 31, 32, 33, -1, 35, 3, 4, 5, 6, 7,
381 8, 9, 10, 11, 12, 13, 14, -1, -1, 17,
382 18, 19, 20, 21, 22, 23, 24, 25, 26, -1,
383 -1, 29, -1, 31, 32, 33, -1, 35, 4, 5,
384 6, 7, 8, 9, 10, 11, 12, -1, -1, -1,
385 -1, 17, 18, -1, 20, 21, 22, 23, -1, -1,
386 -1, -1, -1, -1, -1, 31, 32
388 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
389 #line 3 "/usr/lib/bison.simple"
390 /* This file comes from bison-1.28. */
392 /* Skeleton output parser for bison,
393 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
395 This program is free software; you can redistribute it and/or modify
396 it under the terms of the GNU General Public License as published by
397 the Free Software Foundation; either version 2, or (at your option)
400 This program is distributed in the hope that it will be useful,
401 but WITHOUT ANY WARRANTY; without even the implied warranty of
402 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
403 GNU General Public License for more details.
405 You should have received a copy of the GNU General Public License
406 along with this program; if not, write to the Free Software
407 Foundation, Inc., 59 Temple Place - Suite 330,
408 Boston, MA 02111-1307, USA. */
410 /* As a special exception, when this file is copied by Bison into a
411 Bison output file, you may use that output file without restriction.
412 This special exception was added by the Free Software Foundation
413 in version 1.24 of Bison. */
415 /* This is the parser code that is written into each bison parser
416 when the %semantic_parser declaration is not specified in the grammar.
417 It was written by Richard Stallman by simplifying the hairy parser
418 used when %semantic_parser is specified. */
420 #ifndef YYSTACK_USE_ALLOCA
422 #define YYSTACK_USE_ALLOCA
423 #else /* alloca not defined */
425 #define YYSTACK_USE_ALLOCA
426 #define alloca __builtin_alloca
427 #else /* not GNU C. */
428 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
429 #define YYSTACK_USE_ALLOCA
430 #include <sal/alloca.h>
431 #else /* not sparc */
434 #define YYSTACK_USE_ALLOCA
435 #endif /* not _AIX */
436 #endif /* not sparc */
437 #endif /* not GNU C */
438 #endif /* alloca not defined */
439 #endif /* YYSTACK_USE_ALLOCA not defined */
441 #ifdef YYSTACK_USE_ALLOCA
442 #define YYSTACK_ALLOC alloca
444 #define YYSTACK_ALLOC malloc
447 /* Note: there must be only one dollar sign in this file.
448 It is replaced by the list of actions, each action
449 as one case of the switch. */
451 #define yyerrok (yyerrstatus = 0)
452 #define yyclearin (yychar = YYEMPTY)
455 #define YYACCEPT goto yyacceptlab
456 #define YYABORT goto yyabortlab
457 #define YYERROR goto yyerrlab1
458 /* Like YYERROR except do call yyerror.
459 This remains here temporarily to ease the
460 transition to the new meaning of YYERROR, for GCC.
461 Once GCC version 2 has supplanted version 1, this can go. */
462 #define YYFAIL goto yyerrlab
463 #define YYRECOVERING() (!!yyerrstatus)
464 #define YYBACKUP(token, value) \
466 if (yychar == YYEMPTY && yylen == 1) \
467 { yychar = (token), yylval = (value); \
468 yychar1 = YYTRANSLATE (yychar); \
473 { yyerror ("syntax error: cannot back up"); YYERROR; } \
477 #define YYERRCODE 256
480 #define YYLEX yylex()
486 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
488 #define YYLEX yylex(&yylval, &yylloc)
490 #else /* not YYLSP_NEEDED */
492 #define YYLEX yylex(&yylval, YYLEX_PARAM)
494 #define YYLEX yylex(&yylval)
496 #endif /* not YYLSP_NEEDED */
499 /* If nonreentrant, generate the variables here */
503 int yychar
; /* the lookahead symbol */
504 YYSTYPE yylval
; /* the semantic value of the */
505 /* lookahead symbol */
508 YYLTYPE yylloc
; /* location data for the lookahead */
512 int yynerrs
; /* number of parse errors so far */
513 #endif /* not YYPURE */
516 int yydebug
; /* nonzero means print parse trace */
517 /* Since this is uninitialized, it does not stop multiple parsers
521 /* YYINITDEPTH indicates the initial size of the parser's stacks */
524 #define YYINITDEPTH 200
527 /* YYMAXDEPTH is the maximum size the stacks can grow to
528 (effective only if the built-in stack extension method is used). */
535 #define YYMAXDEPTH 10000
538 /* Define __yy_memcpy. Note that the size argument
539 should be passed with type unsigned int, because that is what the non-GCC
540 definitions require. With GCC, __builtin_memcpy takes an arg
541 of type size_t, but it can handle unsigned int. */
543 #if defined(__GNUC__)
544 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
548 /* This is the most reliable way to avoid incompatibilities
549 in available built-in functions on various systems. */
551 __yy_memcpy (to
, from
, count
)
556 register char *f
= from
;
557 register char *t
= to
;
558 register int i
= count
;
564 #else /* __cplusplus */
566 /* This is the most reliable way to avoid incompatibilities
567 in available built-in functions on various systems. */
569 __yy_memcpy (char *to
, char *from
, unsigned int count
)
571 register char *t
= to
;
572 register char *f
= from
;
573 register int i
= count
;
582 #line 217 "/usr/lib/bison.simple"
584 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
585 into yyparse. The argument should have type void *.
586 It should actually point to an object.
587 Grammar actions can access the variable by casting it
588 to the proper pointer type. */
592 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
593 #define YYPARSE_PARAM_DECL
594 #else /* not __cplusplus */
595 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
596 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
597 #endif /* not __cplusplus */
598 #else /* not YYPARSE_PARAM */
599 #define YYPARSE_PARAM_ARG
600 #define YYPARSE_PARAM_DECL
601 #endif /* not YYPARSE_PARAM */
603 /* Prevent warning if -Wstrict-prototypes. */
606 int yyparse (void *);
613 yyparse(YYPARSE_PARAM_ARG
)
616 register int yystate
;
618 register short *yyssp
;
619 register YYSTYPE
*yyvsp
;
620 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
621 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
623 short yyssa
[YYINITDEPTH
]; /* the state stack */
624 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
626 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
627 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
630 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
631 YYLTYPE
*yyls
= yylsa
;
634 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
636 #define YYPOPSTACK (yyvsp--, yyssp--)
639 int yystacksize
= YYINITDEPTH
;
640 int yyfree_stacks
= 0;
651 YYSTYPE yyval
; /* the variable used to return */
653 /* semantic values from the action */
660 fprintf(stderr
, "Starting parse\n");
666 yychar
= YYEMPTY
; /* Cause a token to be read. */
668 /* Initialize stack pointers.
669 Waste one element of value and location stack
670 so that they stay on the same level as the state stack.
671 The wasted elements are never initialized. */
679 /* Push a new state, which is found in yystate . */
680 /* In all cases, when you get here, the value and location stacks
681 have just been pushed. so pushing a state here evens the stacks. */
684 *++yyssp
= sal::static_int_cast
<short>(yystate
);
686 if (yyssp
>= yyss
+ yystacksize
- 1)
688 /* Give user a chance to reallocate the stack */
689 /* Use copies of these so that the &'s don't force the real ones into memory. */
690 YYSTYPE
*yyvs1
= yyvs
;
693 YYLTYPE
*yyls1
= yyls
;
696 /* Get the current used size of the three stacks, in elements. */
697 int size
= yyssp
- yyss
+ 1;
700 /* Each stack pointer address is followed by the size of
701 the data in use in that stack, in bytes. */
703 /* This used to be a conditional around just the two extra args,
704 but that might be undefined if yyoverflow is a macro. */
705 yyoverflow("parser stack overflow",
706 &yyss1
, size
* sizeof (*yyssp
),
707 &yyvs1
, size
* sizeof (*yyvsp
),
708 &yyls1
, size
* sizeof (*yylsp
),
711 yyoverflow("parser stack overflow",
712 &yyss1
, size
* sizeof (*yyssp
),
713 &yyvs1
, size
* sizeof (*yyvsp
),
717 yyss
= yyss1
; yyvs
= yyvs1
;
721 #else /* no yyoverflow */
722 /* Extend the stack our own way. */
723 if (yystacksize
>= YYMAXDEPTH
)
725 yyerror("parser stack overflow");
737 if (yystacksize
> YYMAXDEPTH
)
738 yystacksize
= YYMAXDEPTH
;
739 #ifndef YYSTACK_USE_ALLOCA
742 yyss
= (short *) YYSTACK_ALLOC (yystacksize
* sizeof (*yyssp
));
743 __yy_memcpy ((char *)yyss
, (char *)yyss1
,
744 size
* (unsigned int) sizeof (*yyssp
));
745 yyvs
= (YYSTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yyvsp
));
746 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
,
747 size
* (unsigned int) sizeof (*yyvsp
));
749 yyls
= (YYLTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yylsp
));
750 __yy_memcpy ((char *)yyls
, (char *)yyls1
,
751 size
* (unsigned int) sizeof (*yylsp
));
753 #endif /* no yyoverflow */
755 yyssp
= yyss
+ size
- 1;
756 yyvsp
= yyvs
+ size
- 1;
758 yylsp
= yyls
+ size
- 1;
763 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
766 if (yyssp
>= yyss
+ yystacksize
- 1)
772 fprintf(stderr
, "Entering state %d\n", yystate
);
778 /* Do appropriate processing given the current state. */
779 /* Read a lookahead token if we need one and don't already have one. */
782 /* First try to decide what to do without reference to lookahead token. */
784 yyn
= yypact
[yystate
];
788 /* Not known => get a lookahead token if don't already have one. */
790 /* yychar is either YYEMPTY or YYEOF
791 or a valid token in external form. */
793 if (yychar
== YYEMPTY
)
797 fprintf(stderr
, "Reading a token: ");
802 /* Convert token to internal form (in yychar1) for indexing tables with */
804 if (yychar
<= 0) /* This means end of input. */
807 yychar
= YYEOF
; /* Don't call YYLEX any more */
811 fprintf(stderr
, "Now at end of input.\n");
816 yychar1
= YYTRANSLATE(yychar
);
821 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
822 /* Give the individual parser a way to print the precise meaning
823 of a token, for further debugging info. */
825 YYPRINT (stderr
, yychar
, yylval
);
827 fprintf (stderr
, ")\n");
833 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
838 /* yyn is what to do for this token type in this state.
839 Negative => reduce, -yyn is rule number.
840 Positive => shift, yyn is new state.
841 New state is final state => don't bother to shift,
843 0, or most negative number => error. */
858 /* Shift the lookahead token. */
862 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
865 /* Discard the token being shifted unless it is eof. */
874 /* count tokens shifted since error; after three, turn off error status. */
875 if (yyerrstatus
) yyerrstatus
--;
880 /* Do the default action for the current state. */
883 yyn
= yydefact
[yystate
];
887 /* Do a reduction. yyn is the number of a rule to reduce with. */
891 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
898 fprintf (stderr
, "Reducing via rule %d (line %d), ",
901 /* Print the symbols being reduced, and their result. */
902 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
903 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
904 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
913 { 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
); ;
917 { 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
); ;
921 { 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
); ;
925 { 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
); ;
929 { 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
); ;
933 { 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
); ;
937 { 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
); ;
941 { 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
); ;
945 { 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
); ;
949 { 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
); ;
953 { 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
); ;
957 { 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
); ;
961 { 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
); ;
965 { 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
); ;
969 { yyval
.ptr
= new Node(ID_CHARACTER
); allocChar(yyval
.ptr
->value
, '|'); debug("Identifier : '|'\n"); nodelist
.push_back(yyval
.ptr
); ;
973 { 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
); ;
977 { 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
); ;
981 { yyval
.ptr
= new Node(ID_PRIMARYEXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("PrimaryExpr\n"); nodelist
.push_back(yyval
.ptr
); ;
985 { 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
); ;
989 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '('); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
993 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '['); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
997 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '{'); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
1000 #line 88 "grammar.y"
1001 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '<'); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
1004 #line 89 "grammar.y"
1005 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '|'); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
1008 #line 90 "grammar.y"
1009 { yyval
.ptr
= new Node(ID_LEFT
); allocValue(yyval
.ptr
->value
, "||"); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
1012 #line 91 "grammar.y"
1013 { yyval
.ptr
= new Node(ID_LEFT
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
1016 #line 95 "grammar.y"
1017 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, ')'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1020 #line 96 "grammar.y"
1021 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, ']'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1024 #line 97 "grammar.y"
1025 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '}'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1028 #line 98 "grammar.y"
1029 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '>'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1032 #line 99 "grammar.y"
1033 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '|'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1036 #line 100 "grammar.y"
1037 { yyval
.ptr
= new Node(ID_RIGHT
); allocValue(yyval
.ptr
->value
, "||"); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1040 #line 101 "grammar.y"
1041 { yyval
.ptr
= new Node(ID_RIGHT
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1044 #line 105 "grammar.y"
1045 { 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
); ;
1048 #line 109 "grammar.y"
1049 { yyval
.ptr
= new Node(ID_PARENTH
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Parenth: '(' ExprList ')' \n"); nodelist
.push_back(yyval
.ptr
); ;
1052 #line 110 "grammar.y"
1053 { yyval
.ptr
= new Node(ID_PARENTH
); debug("Parenth: '(' ')' \n"); nodelist
.push_back(yyval
.ptr
); ;
1056 #line 114 "grammar.y"
1057 { yyval
.ptr
= new Node(ID_BLOCK
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Block: '{' ExprList '}' \n"); nodelist
.push_back(yyval
.ptr
); ;
1060 #line 115 "grammar.y"
1061 { yyval
.ptr
= new Node(ID_BLOCK
); debug("Block: '{' '}' \n"); nodelist
.push_back(yyval
.ptr
); ;
1064 #line 119 "grammar.y"
1065 { yyval
.ptr
= new Node(ID_BRACKET
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Bracket \n"); nodelist
.push_back(yyval
.ptr
); ;
1068 #line 120 "grammar.y"
1069 { yyval
.ptr
= new Node(ID_BRACKET
); debug("Bracket \n"); nodelist
.push_back(yyval
.ptr
); ;
1072 #line 124 "grammar.y"
1073 { 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
); ;
1076 #line 125 "grammar.y"
1077 { 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
); ;
1080 #line 126 "grammar.y"
1081 { 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
); ;
1084 #line 130 "grammar.y"
1085 { 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
); ;
1088 #line 134 "grammar.y"
1089 { 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
); ;
1092 #line 139 "grammar.y"
1093 { 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
); ;
1096 #line 143 "grammar.y"
1097 { 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
); ;
1100 #line 146 "grammar.y"
1101 { 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
); ;
1104 #line 150 "grammar.y"
1105 { 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
); ;
1108 #line 154 "grammar.y"
1109 { yyval
.ptr
= new Node(ID_SQRTEXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("RootExpr : %s\n", yyvsp
[-1].str
); nodelist
.push_back(yyval
.ptr
); ;
1112 #line 155 "grammar.y"
1113 { 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
); ;
1116 #line 159 "grammar.y"
1117 { yyval
.ptr
= new Node(ID_BEGIN
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("BeginExpr\n"); ;
1120 #line 160 "grammar.y"
1121 { 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"); ;
1124 #line 164 "grammar.y"
1125 { yyval
.ptr
= new Node(ID_END
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("EndExpr\n"); ;
1128 #line 169 "grammar.y"
1129 { yyval
.ptr
= new Node(ID_MATHML
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); top
= yyval
.ptr
; debug("MathML\n"); ;
1132 #line 173 "grammar.y"
1133 { yyval
.ptr
= new Node(ID_LINES
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("Lines\n"); ;
1136 #line 174 "grammar.y"
1137 { 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"); ;
1140 #line 178 "grammar.y"
1141 { yyval
.ptr
= new Node(ID_LINE
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("Line\n"); ;
1144 #line 182 "grammar.y"
1145 { yyval
.ptr
= new Node(ID_EXPRLIST
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("ExprList : Expr\n"); nodelist
.push_back(yyval
.ptr
); ;
1148 #line 183 "grammar.y"
1149 { 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
); ;
1152 #line 187 "grammar.y"
1153 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Block\n"); nodelist
.push_back(yyval
.ptr
);;
1156 #line 188 "grammar.y"
1157 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Parenth\n"); nodelist
.push_back(yyval
.ptr
);;
1160 #line 189 "grammar.y"
1161 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Fence\n"); nodelist
.push_back(yyval
.ptr
);;
1164 #line 190 "grammar.y"
1165 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : SubSupExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1168 #line 191 "grammar.y"
1169 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : FractionExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1172 #line 192 "grammar.y"
1173 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : OverExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1176 #line 193 "grammar.y"
1177 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : DecorationExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1180 #line 194 "grammar.y"
1181 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : RootExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1184 #line 195 "grammar.y"
1185 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : AccentExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1188 #line 196 "grammar.y"
1189 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : PrimaryExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1192 #line 197 "grammar.y"
1193 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : BeginExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1196 #line 198 "grammar.y"
1197 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : EndExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1200 /* the action file gets copied in in place of this dollarsign */
1201 #line 543 "/usr/lib/bison.simple"
1212 short *ssp1
= yyss
- 1;
1213 fprintf (stderr
, "state stack now");
1214 while (ssp1
!= yyssp
)
1215 fprintf (stderr
, " %d", *++ssp1
);
1216 fprintf (stderr
, "\n");
1226 yylsp
->first_line
= yylloc
.first_line
;
1227 yylsp
->first_column
= yylloc
.first_column
;
1228 yylsp
->last_line
= (yylsp
-1)->last_line
;
1229 yylsp
->last_column
= (yylsp
-1)->last_column
;
1234 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
1235 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
1239 /* Now "shift" the result of the reduction.
1240 Determine what state that goes to,
1241 based on the state we popped back to
1242 and the rule number reduced by. */
1246 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1247 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1248 yystate
= yytable
[yystate
];
1250 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1254 yyerrlab
: /* here on detecting error */
1257 /* If not already recovering from an error, report this error. */
1261 #ifdef YYERROR_VERBOSE
1262 yyn
= yypact
[yystate
];
1264 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1271 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1272 for (x
= (yyn
< 0 ? -yyn
: 0);
1273 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1274 if (yycheck
[x
+ yyn
] == x
)
1275 size
+= strlen(yytname
[x
]) + 15, count
++;
1276 msg
= (char *) malloc(size
+ 15);
1279 strcpy(msg
, "parse error");
1284 for (x
= (yyn
< 0 ? -yyn
: 0);
1285 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1286 if (yycheck
[x
+ yyn
] == x
)
1288 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
1289 strcat(msg
, yytname
[x
]);
1298 yyerror ("parse error; also virtual memory exceeded");
1301 #endif /* YYERROR_VERBOSE */
1302 yyerror("parse error");
1306 yyerrlab1
: /* here on error raised explicitly by an action */
1308 if (yyerrstatus
== 3)
1310 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1312 /* return failure if at end of input */
1313 if (yychar
== YYEOF
)
1318 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
1324 /* Else will try to reuse lookahead token
1325 after shifting the error token. */
1327 yyerrstatus
= 3; /* Each real token shifted decrements this */
1331 yyerrdefault
: /* current state does not do anything special for the error token. */
1334 /* This is wrong; only states that explicitly want error tokens
1335 should shift them. */
1336 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1337 if (yyn
) goto yydefault
;
1340 yyerrpop
: /* pop the current state because it cannot handle the error token */
1342 if (yyssp
== yyss
) YYABORT
;
1352 short *ssp1
= yyss
- 1;
1353 fprintf (stderr
, "Error: state stack now");
1354 while (ssp1
!= yyssp
)
1355 fprintf (stderr
, " %d", *++ssp1
);
1356 fprintf (stderr
, "\n");
1362 yyn
= yypact
[yystate
];
1367 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1386 fprintf(stderr
, "Shifting error token, ");
1398 /* YYACCEPT comes here. */
1410 /* YYABORT comes here. */
1421 #line 202 "grammar.y"
1424 Node
*mainParse(const char *_code
)
1435 void yyerror(const char * /*err*/)
1437 // printf("REALKING ERR[%s]\n",err);
1438 // if error, delete all nodes.
1440 int ncount
= nodelist
.size();
1441 for( int i
= 0 ; i
< ncount
; i
++){
1442 pNode
= nodelist
.front();
1443 nodelist
.pop_front();
1450 int debug(const char * /*format*/, ...)
1456 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */