1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: grammar.cpp,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 /* A Bison parser, made from grammar.y
33 by GNU Bison version 1.28 */
35 #define YYBISON 1 /* Identify Bison output. */
45 #define SMALL_GREEK 258
46 #define CAPITAL_GREEK 259
47 #define BINARY_OPERATOR 260
48 #define RELATION_OPERATOR 261
50 #define GENERAL_IDEN 263
51 #define GENERAL_OPER 264
52 #define BIG_SYMBOL 265
59 #define LARGE_DELIM 272
60 #define DECORATION 273
61 #define SPACE_SYMBOL 274
70 #define LEFT_DELIM 283
71 #define RIGHT_DELIM 284
81 LinkedList
<Node
> nodelist
;
83 Node
*mainParse(const char *_code
);
84 void yyerror(const char *);
86 void initFlex( const char *s
);
87 void viewResult(Node
*res
);
93 #define allocValue(x,y) \
94 x = (char *)malloc( strlen(y) +1 ); \
97 #define allocChar(x,y) \
98 x = (char *)malloc(2); \
103 int debug(const char *format
, ...);
124 #define YYFLAG -32768
127 #define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 66)
129 static const char yytranslate
[] = { 0,
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, 2,
133 2, 2, 2, 2, 2, 2, 2, 2, 2, 33,
134 37, 2, 2, 2, 2, 2, 2, 2, 2, 2,
135 2, 2, 2, 2, 2, 2, 2, 2, 2, 36,
136 2, 40, 2, 2, 2, 2, 2, 2, 2, 2,
137 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
138 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
139 34, 2, 38, 42, 41, 2, 2, 2, 2, 2,
140 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
141 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
142 2, 2, 35, 32, 39, 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, 2, 2, 2, 2, 2,
155 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
156 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
157 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
162 static const short yyprhs
[] = { 0,
163 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
164 20, 22, 24, 26, 28, 30, 32, 34, 36, 39,
165 42, 45, 48, 51, 54, 58, 60, 63, 66, 69,
166 72, 75, 79, 81, 85, 89, 92, 96, 99, 103,
167 106, 110, 114, 120, 124, 130, 132, 135, 137, 140,
168 143, 147, 150, 154, 157, 159, 161, 165, 167, 169,
169 172, 174, 176, 178, 180, 182, 184, 186, 188, 190,
173 static const short yyrhs
[] = { 4,
174 0, 9, 0, 10, 0, 5, 0, 11, 0, 12,
175 0, 20, 0, 21, 0, 7, 0, 6, 0, 23,
176 0, 17, 0, 18, 0, 8, 0, 32, 0, 31,
177 0, 22, 0, 43, 0, 44, 43, 0, 26, 33,
178 0, 26, 34, 0, 26, 35, 0, 26, 36, 0,
179 26, 32, 0, 26, 32, 32, 0, 29, 0, 27,
180 37, 0, 27, 38, 0, 27, 39, 0, 27, 40,
181 0, 27, 32, 0, 27, 32, 32, 0, 30, 0,
182 45, 64, 46, 0, 33, 64, 37, 0, 33, 37,
183 0, 35, 64, 39, 0, 35, 39, 0, 34, 64,
184 38, 0, 34, 38, 0, 65, 41, 65, 0, 65,
185 42, 65, 0, 65, 41, 49, 42, 49, 0, 14,
186 49, 49, 0, 35, 64, 16, 64, 39, 0, 3,
187 0, 54, 49, 0, 19, 0, 56, 49, 0, 13,
188 49, 0, 13, 50, 49, 0, 24, 49, 0, 24,
189 49, 49, 0, 25, 49, 0, 62, 0, 63, 0,
190 62, 28, 63, 0, 64, 0, 65, 0, 64, 65,
191 0, 49, 0, 48, 0, 47, 0, 51, 0, 52,
192 0, 53, 0, 57, 0, 58, 0, 55, 0, 44,
199 static const short yyrline
[] = { 0,
200 59, 61, 62, 63, 64, 65, 66, 67, 68, 69,
201 70, 71, 72, 73, 74, 75, 76, 79, 81, 84,
202 86, 87, 88, 89, 90, 91, 94, 96, 97, 98,
203 99, 100, 101, 104, 108, 110, 113, 115, 118, 120,
204 123, 125, 126, 129, 133, 138, 142, 145, 149, 153,
205 155, 158, 160, 163, 168, 172, 174, 177, 181, 183,
206 186, 188, 189, 190, 191, 192, 193, 194, 195, 196,
212 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
214 static const char * const yytname
[] = { "$","error","$undefined.","ACCENT",
215 "SMALL_GREEK","CAPITAL_GREEK","BINARY_OPERATOR","RELATION_OPERATOR","ARROW",
216 "GENERAL_IDEN","GENERAL_OPER","BIG_SYMBOL","FUNCTION","ROOT","FRACTION","SUBSUP",
217 "EQOVER","DELIMETER","LARGE_DELIM","DECORATION","SPACE_SYMBOL","CHARACTER","STRING",
218 "OPERATOR","EQBEGIN","EQEND","EQLEFT","EQRIGHT","NEWLINE","LEFT_DELIM","RIGHT_DELIM",
219 "DIGIT","'|'","'('","'['","'{'","'<'","')'","']'","'}'","'>'","'_'","'^'","Identifier",
220 "PrimaryExpr","EQLeft","EQRight","Fence","Parenth","Block","Bracket","SubSupExpr",
221 "FractionExpr","OverExpr","Accent","AccentExpr","Decoration","DecorationExpr",
222 "RootExpr","BeginExpr","EndExpr","MathML","Lines","Line","ExprList","Expr", NULL
226 static const short yyr1
[] = { 0,
227 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
228 43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
229 45, 45, 45, 45, 45, 45, 46, 46, 46, 46,
230 46, 46, 46, 47, 48, 48, 49, 49, 50, 50,
231 51, 51, 51, 52, 53, 54, 55, 56, 57, 58,
232 58, 59, 59, 60, 61, 62, 62, 63, 64, 64,
233 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
237 static const short yyr2
[] = { 0,
238 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
239 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
240 2, 2, 2, 2, 3, 1, 2, 2, 2, 2,
241 2, 3, 1, 3, 3, 2, 3, 2, 3, 2,
242 3, 3, 5, 3, 5, 1, 2, 1, 2, 2,
243 3, 2, 3, 2, 1, 1, 3, 1, 1, 2,
244 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
248 static const short yydefact
[] = { 0,
249 46, 1, 4, 10, 9, 14, 2, 3, 5, 6,
250 0, 0, 12, 13, 48, 7, 8, 17, 11, 0,
251 0, 0, 26, 16, 15, 0, 0, 18, 70, 0,
252 63, 62, 61, 64, 65, 66, 0, 69, 0, 67,
253 68, 71, 72, 55, 56, 58, 59, 0, 0, 50,
254 0, 0, 52, 54, 24, 20, 21, 22, 23, 36,
255 0, 38, 0, 19, 0, 47, 49, 0, 60, 0,
256 0, 40, 0, 0, 51, 44, 53, 25, 35, 0,
257 37, 0, 33, 34, 57, 61, 41, 42, 39, 0,
258 31, 27, 28, 29, 30, 0, 45, 32, 43, 0,
262 static const short yydefgoto
[] = { 28,
263 29, 30, 84, 31, 32, 33, 51, 34, 35, 36,
264 37, 38, 39, 40, 41, 42, 43, 100, 44, 45,
268 static const short yypact
[] = { 393,
269 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
270 -30, -19,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -19,
271 -19, -3,-32768,-32768,-32768, 290, 107,-32768, 425, 393,
272 -32768,-32768,-32768,-32768,-32768,-32768, -19,-32768, -19,-32768,
273 -32768,-32768,-32768, -20,-32768, 393, -21, 218, 107,-32768,
274 -19, -19, -19,-32768, -15,-32768,-32768,-32768,-32768,-32768,
275 325,-32768, 70,-32768, 360,-32768,-32768, 393, -21, 393,
276 393,-32768, 254, 144,-32768,-32768,-32768,-32768,-32768, 393,
277 -32768, -25,-32768,-32768,-32768, -31, -21, -21,-32768, 181,
278 -14,-32768,-32768,-32768,-32768, -19,-32768,-32768,-32768, 22,
282 static const short yypgoto
[] = { -2,
283 -32768,-32768,-32768,-32768,-32768, -11,-32768,-32768,-32768,-32768,
284 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -33,
292 static const short yytable
[] = { 50,
293 52, 61, 63, 48, 49, 65, 91, 68, 53, 54,
294 96, 92, 93, 94, 95, 49, 78, 98, 69, 70,
295 71, 101, 102, 73, 74, 66, 64, 67, 55, 56,
296 57, 58, 59, 69, 85, 69, 0, 69, 0, 75,
297 76, 77, 87, 88, 0, 69, 69, 0, 0, 0,
298 0, 0, 0, 0, 0, 90, 0, 0, 86, 0,
299 0, 0, 69, 0, 0, 0, 0, 0, 0, 0,
300 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
301 9, 10, 11, 12, 99, 80, 13, 14, 15, 16,
302 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
303 24, 25, 26, 0, 27, 0, 0, 0, 81, 1,
304 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
305 12, 0, 0, 13, 14, 15, 16, 17, 18, 19,
306 20, 21, 22, 0, 0, 23, 0, 24, 25, 26,
307 0, 27, 0, 0, 0, 62, 1, 2, 3, 4,
308 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
309 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
310 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
311 0, 0, 81, 1, 2, 3, 4, 5, 6, 7,
312 8, 9, 10, 11, 12, 0, 0, 13, 14, 15,
313 16, 17, 18, 19, 20, 21, 22, 0, 0, 23,
314 0, 24, 25, 26, 0, 27, 0, 0, 0, 97,
315 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
316 11, 12, 0, 0, 13, 14, 15, 16, 17, 18,
317 19, 20, 21, 22, 0, 0, 23, 0, 24, 25,
318 26, 0, 27, 0, 0, 72, 1, 2, 3, 4,
319 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
320 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
321 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
322 0, 89, 1, 2, 3, 4, 5, 6, 7, 8,
323 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
324 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
325 24, 25, 26, 0, 27, 0, 60, 1, 2, 3,
326 4, 5, 6, 7, 8, 9, 10, 11, 12, 0,
327 0, 13, 14, 15, 16, 17, 18, 19, 20, 21,
328 22, 0, 0, 23, 0, 24, 25, 26, 0, 27,
329 0, 79, 1, 2, 3, 4, 5, 6, 7, 8,
330 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
331 17, 18, 19, 20, 21, 22, 82, 0, 23, 83,
332 24, 25, 26, 0, 27, 1, 2, 3, 4, 5,
333 6, 7, 8, 9, 10, 11, 12, 0, 0, 13,
334 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
335 0, 23, 0, 24, 25, 26, 0, 27, 2, 3,
336 4, 5, 6, 7, 8, 9, 10, 0, 0, 0,
337 0, 13, 14, 0, 16, 17, 18, 19, 0, 0,
338 0, 0, 0, 0, 0, 24, 25
341 static const short yycheck
[] = { 11,
342 12, 26, 27, 34, 35, 30, 32, 28, 20, 21,
343 42, 37, 38, 39, 40, 35, 32, 32, 46, 41,
344 42, 0, 0, 48, 49, 37, 29, 39, 32, 33,
345 34, 35, 36, 61, 68, 63, -1, 65, -1, 51,
346 52, 53, 70, 71, -1, 73, 74, -1, -1, -1,
347 -1, -1, -1, -1, -1, 80, -1, -1, 70, -1,
348 -1, -1, 90, -1, -1, -1, -1, -1, -1, -1,
349 -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
350 11, 12, 13, 14, 96, 16, 17, 18, 19, 20,
351 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
352 31, 32, 33, -1, 35, -1, -1, -1, 39, 3,
353 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
354 14, -1, -1, 17, 18, 19, 20, 21, 22, 23,
355 24, 25, 26, -1, -1, 29, -1, 31, 32, 33,
356 -1, 35, -1, -1, -1, 39, 3, 4, 5, 6,
357 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
358 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
359 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
360 -1, -1, 39, 3, 4, 5, 6, 7, 8, 9,
361 10, 11, 12, 13, 14, -1, -1, 17, 18, 19,
362 20, 21, 22, 23, 24, 25, 26, -1, -1, 29,
363 -1, 31, 32, 33, -1, 35, -1, -1, -1, 39,
364 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
365 13, 14, -1, -1, 17, 18, 19, 20, 21, 22,
366 23, 24, 25, 26, -1, -1, 29, -1, 31, 32,
367 33, -1, 35, -1, -1, 38, 3, 4, 5, 6,
368 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
369 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
370 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
371 -1, 38, 3, 4, 5, 6, 7, 8, 9, 10,
372 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
373 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
374 31, 32, 33, -1, 35, -1, 37, 3, 4, 5,
375 6, 7, 8, 9, 10, 11, 12, 13, 14, -1,
376 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
377 26, -1, -1, 29, -1, 31, 32, 33, -1, 35,
378 -1, 37, 3, 4, 5, 6, 7, 8, 9, 10,
379 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
380 21, 22, 23, 24, 25, 26, 27, -1, 29, 30,
381 31, 32, 33, -1, 35, 3, 4, 5, 6, 7,
382 8, 9, 10, 11, 12, 13, 14, -1, -1, 17,
383 18, 19, 20, 21, 22, 23, 24, 25, 26, -1,
384 -1, 29, -1, 31, 32, 33, -1, 35, 4, 5,
385 6, 7, 8, 9, 10, 11, 12, -1, -1, -1,
386 -1, 17, 18, -1, 20, 21, 22, 23, -1, -1,
387 -1, -1, -1, -1, -1, 31, 32
389 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
390 #line 3 "/usr/lib/bison.simple"
391 /* This file comes from bison-1.28. */
393 /* Skeleton output parser for bison,
394 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
396 This program is free software; you can redistribute it and/or modify
397 it under the terms of the GNU General Public License as published by
398 the Free Software Foundation; either version 2, or (at your option)
401 This program is distributed in the hope that it will be useful,
402 but WITHOUT ANY WARRANTY; without even the implied warranty of
403 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
404 GNU General Public License for more details.
406 You should have received a copy of the GNU General Public License
407 along with this program; if not, write to the Free Software
408 Foundation, Inc., 59 Temple Place - Suite 330,
409 Boston, MA 02111-1307, USA. */
411 /* As a special exception, when this file is copied by Bison into a
412 Bison output file, you may use that output file without restriction.
413 This special exception was added by the Free Software Foundation
414 in version 1.24 of Bison. */
416 /* This is the parser code that is written into each bison parser
417 when the %semantic_parser declaration is not specified in the grammar.
418 It was written by Richard Stallman by simplifying the hairy parser
419 used when %semantic_parser is specified. */
421 #ifndef YYSTACK_USE_ALLOCA
423 #define YYSTACK_USE_ALLOCA
424 #else /* alloca not defined */
426 #define YYSTACK_USE_ALLOCA
427 #define alloca __builtin_alloca
428 #else /* not GNU C. */
429 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
430 #define YYSTACK_USE_ALLOCA
431 #include <sal/alloca.h>
432 #else /* not sparc */
433 /* We think this test detects Watcom and Microsoft C. */
434 /* This used to test MSDOS, but that is a bad idea
435 since that symbol is in the user namespace. */
436 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
437 #if 0 /* No need for malloc.h, which pollutes the namespace;
438 instead, just don't use alloca. */
441 #else /* not MSDOS, or __TURBOC__ */
443 /* I don't know what this was needed for, but it pollutes the namespace.
444 So I turned it off. rms, 2 May 1997. */
445 /* #include <malloc.h> */
447 #define YYSTACK_USE_ALLOCA
448 #else /* not MSDOS, or __TURBOC__, or _AIX */
450 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
451 and on HPUX 10. Eventually we can turn this on. */
452 #define YYSTACK_USE_ALLOCA
453 #define alloca __builtin_alloca
456 #endif /* not _AIX */
457 #endif /* not MSDOS, or __TURBOC__ */
458 #endif /* not sparc */
459 #endif /* not GNU C */
460 #endif /* alloca not defined */
461 #endif /* YYSTACK_USE_ALLOCA not defined */
463 #ifdef YYSTACK_USE_ALLOCA
464 #define YYSTACK_ALLOC alloca
466 #define YYSTACK_ALLOC malloc
469 /* Note: there must be only one dollar sign in this file.
470 It is replaced by the list of actions, each action
471 as one case of the switch. */
473 #define yyerrok (yyerrstatus = 0)
474 #define yyclearin (yychar = YYEMPTY)
477 #define YYACCEPT goto yyacceptlab
478 #define YYABORT goto yyabortlab
479 #define YYERROR goto yyerrlab1
480 /* Like YYERROR except do call yyerror.
481 This remains here temporarily to ease the
482 transition to the new meaning of YYERROR, for GCC.
483 Once GCC version 2 has supplanted version 1, this can go. */
484 #define YYFAIL goto yyerrlab
485 #define YYRECOVERING() (!!yyerrstatus)
486 #define YYBACKUP(token, value) \
488 if (yychar == YYEMPTY && yylen == 1) \
489 { yychar = (token), yylval = (value); \
490 yychar1 = YYTRANSLATE (yychar); \
495 { yyerror ("syntax error: cannot back up"); YYERROR; } \
499 #define YYERRCODE 256
502 #define YYLEX yylex()
508 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
510 #define YYLEX yylex(&yylval, &yylloc)
512 #else /* not YYLSP_NEEDED */
514 #define YYLEX yylex(&yylval, YYLEX_PARAM)
516 #define YYLEX yylex(&yylval)
518 #endif /* not YYLSP_NEEDED */
521 /* If nonreentrant, generate the variables here */
525 int yychar
; /* the lookahead symbol */
526 YYSTYPE yylval
; /* the semantic value of the */
527 /* lookahead symbol */
530 YYLTYPE yylloc
; /* location data for the lookahead */
534 int yynerrs
; /* number of parse errors so far */
535 #endif /* not YYPURE */
538 int yydebug
; /* nonzero means print parse trace */
539 /* Since this is uninitialized, it does not stop multiple parsers
543 /* YYINITDEPTH indicates the initial size of the parser's stacks */
546 #define YYINITDEPTH 200
549 /* YYMAXDEPTH is the maximum size the stacks can grow to
550 (effective only if the built-in stack extension method is used). */
557 #define YYMAXDEPTH 10000
560 /* Define __yy_memcpy. Note that the size argument
561 should be passed with type unsigned int, because that is what the non-GCC
562 definitions require. With GCC, __builtin_memcpy takes an arg
563 of type size_t, but it can handle unsigned int. */
566 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
567 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
569 #else /* not GNU C or C++ */
572 /* This is the most reliable way to avoid incompatibilities
573 in available built-in functions on various systems. */
575 __yy_memcpy (to
, from
, count
)
580 register char *f
= from
;
581 register char *t
= to
;
582 register int i
= count
;
588 #else /* __cplusplus */
590 /* This is the most reliable way to avoid incompatibilities
591 in available built-in functions on various systems. */
593 __yy_memcpy (char *to
, char *from
, unsigned int count
)
595 register char *t
= to
;
596 register char *f
= from
;
597 register int i
= count
;
606 #line 217 "/usr/lib/bison.simple"
608 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
609 into yyparse. The argument should have type void *.
610 It should actually point to an object.
611 Grammar actions can access the variable by casting it
612 to the proper pointer type. */
616 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
617 #define YYPARSE_PARAM_DECL
618 #else /* not __cplusplus */
619 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
620 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
621 #endif /* not __cplusplus */
622 #else /* not YYPARSE_PARAM */
623 #define YYPARSE_PARAM_ARG
624 #define YYPARSE_PARAM_DECL
625 #endif /* not YYPARSE_PARAM */
627 /* Prevent warning if -Wstrict-prototypes. */
630 int yyparse (void *);
637 yyparse(YYPARSE_PARAM_ARG
)
640 register int yystate
;
642 register short *yyssp
;
643 register YYSTYPE
*yyvsp
;
644 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
645 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
647 short yyssa
[YYINITDEPTH
]; /* the state stack */
648 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
650 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
651 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
654 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
655 YYLTYPE
*yyls
= yylsa
;
658 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
660 #define YYPOPSTACK (yyvsp--, yyssp--)
663 int yystacksize
= YYINITDEPTH
;
664 int yyfree_stacks
= 0;
675 YYSTYPE yyval
; /* the variable used to return */
677 /* semantic values from the action */
684 fprintf(stderr
, "Starting parse\n");
690 yychar
= YYEMPTY
; /* Cause a token to be read. */
692 /* Initialize stack pointers.
693 Waste one element of value and location stack
694 so that they stay on the same level as the state stack.
695 The wasted elements are never initialized. */
703 /* Push a new state, which is found in yystate . */
704 /* In all cases, when you get here, the value and location stacks
705 have just been pushed. so pushing a state here evens the stacks. */
708 *++yyssp
= sal::static_int_cast
<short>(yystate
);
710 if (yyssp
>= yyss
+ yystacksize
- 1)
712 /* Give user a chance to reallocate the stack */
713 /* Use copies of these so that the &'s don't force the real ones into memory. */
714 YYSTYPE
*yyvs1
= yyvs
;
717 YYLTYPE
*yyls1
= yyls
;
720 /* Get the current used size of the three stacks, in elements. */
721 int size
= yyssp
- yyss
+ 1;
724 /* Each stack pointer address is followed by the size of
725 the data in use in that stack, in bytes. */
727 /* This used to be a conditional around just the two extra args,
728 but that might be undefined if yyoverflow is a macro. */
729 yyoverflow("parser stack overflow",
730 &yyss1
, size
* sizeof (*yyssp
),
731 &yyvs1
, size
* sizeof (*yyvsp
),
732 &yyls1
, size
* sizeof (*yylsp
),
735 yyoverflow("parser stack overflow",
736 &yyss1
, size
* sizeof (*yyssp
),
737 &yyvs1
, size
* sizeof (*yyvsp
),
741 yyss
= yyss1
; yyvs
= yyvs1
;
745 #else /* no yyoverflow */
746 /* Extend the stack our own way. */
747 if (yystacksize
>= YYMAXDEPTH
)
749 yyerror("parser stack overflow");
761 if (yystacksize
> YYMAXDEPTH
)
762 yystacksize
= YYMAXDEPTH
;
763 #ifndef YYSTACK_USE_ALLOCA
766 yyss
= (short *) YYSTACK_ALLOC (yystacksize
* sizeof (*yyssp
));
767 __yy_memcpy ((char *)yyss
, (char *)yyss1
,
768 size
* (unsigned int) sizeof (*yyssp
));
769 yyvs
= (YYSTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yyvsp
));
770 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
,
771 size
* (unsigned int) sizeof (*yyvsp
));
773 yyls
= (YYLTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yylsp
));
774 __yy_memcpy ((char *)yyls
, (char *)yyls1
,
775 size
* (unsigned int) sizeof (*yylsp
));
777 #endif /* no yyoverflow */
779 yyssp
= yyss
+ size
- 1;
780 yyvsp
= yyvs
+ size
- 1;
782 yylsp
= yyls
+ size
- 1;
787 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
790 if (yyssp
>= yyss
+ yystacksize
- 1)
796 fprintf(stderr
, "Entering state %d\n", yystate
);
802 /* Do appropriate processing given the current state. */
803 /* Read a lookahead token if we need one and don't already have one. */
806 /* First try to decide what to do without reference to lookahead token. */
808 yyn
= yypact
[yystate
];
812 /* Not known => get a lookahead token if don't already have one. */
814 /* yychar is either YYEMPTY or YYEOF
815 or a valid token in external form. */
817 if (yychar
== YYEMPTY
)
821 fprintf(stderr
, "Reading a token: ");
826 /* Convert token to internal form (in yychar1) for indexing tables with */
828 if (yychar
<= 0) /* This means end of input. */
831 yychar
= YYEOF
; /* Don't call YYLEX any more */
835 fprintf(stderr
, "Now at end of input.\n");
840 yychar1
= YYTRANSLATE(yychar
);
845 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
846 /* Give the individual parser a way to print the precise meaning
847 of a token, for further debugging info. */
849 YYPRINT (stderr
, yychar
, yylval
);
851 fprintf (stderr
, ")\n");
857 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
862 /* yyn is what to do for this token type in this state.
863 Negative => reduce, -yyn is rule number.
864 Positive => shift, yyn is new state.
865 New state is final state => don't bother to shift,
867 0, or most negative number => error. */
882 /* Shift the lookahead token. */
886 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
889 /* Discard the token being shifted unless it is eof. */
898 /* count tokens shifted since error; after three, turn off error status. */
899 if (yyerrstatus
) yyerrstatus
--;
904 /* Do the default action for the current state. */
907 yyn
= yydefact
[yystate
];
911 /* Do a reduction. yyn is the number of a rule to reduce with. */
915 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
922 fprintf (stderr
, "Reducing via rule %d (line %d), ",
925 /* Print the symbols being reduced, and their result. */
926 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
927 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
928 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
937 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
941 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
945 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
949 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
953 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
957 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
961 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
965 { yyval
.ptr
= new Node(ID_CHARACTER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
969 { yyval
.ptr
= new Node(ID_OPERATOR
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
973 { yyval
.ptr
= new Node(ID_OPERATOR
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
977 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
981 { yyval
.ptr
= new Node(ID_DELIMETER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
985 { yyval
.ptr
= new Node(ID_DELIMETER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
989 { yyval
.ptr
= new Node(ID_IDENTIFIER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Identifier : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
993 { yyval
.ptr
= new Node(ID_CHARACTER
); allocChar(yyval
.ptr
->value
, '|'); debug("Identifier : '|'\n"); nodelist
.insert(yyval
.ptr
); ;
997 { yyval
.ptr
= new Node(ID_NUMBER
); allocValue(yyval
.ptr
->value
, yyvsp
[0].dval
); debug("Number : %s\n",yyvsp
[0].dval
); nodelist
.insert(yyval
.ptr
); ;
1000 #line 76 "grammar.y"
1001 { yyval
.ptr
= new Node(ID_STRING
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("String : %s\n",yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
1004 #line 80 "grammar.y"
1005 { yyval
.ptr
= new Node(ID_PRIMARYEXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("PrimaryExpr\n"); nodelist
.insert(yyval
.ptr
); ;
1008 #line 81 "grammar.y"
1009 { yyval
.ptr
= new Node(ID_PRIMARYEXPR
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; yyval
.ptr
->next
= yyvsp
[0].ptr
; debug("PrimaryExpr : PrimaryExpr Identifier\n"); nodelist
.insert(yyval
.ptr
); ;
1012 #line 85 "grammar.y"
1013 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '('); debug("EQLeft \n"); nodelist
.insert(yyval
.ptr
); ;
1016 #line 86 "grammar.y"
1017 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '['); debug("EQLeft \n"); nodelist
.insert(yyval
.ptr
); ;
1020 #line 87 "grammar.y"
1021 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '{'); debug("EQLeft \n"); nodelist
.insert(yyval
.ptr
); ;
1024 #line 88 "grammar.y"
1025 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '<'); debug("EQLeft \n"); nodelist
.insert(yyval
.ptr
); ;
1028 #line 89 "grammar.y"
1029 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '|'); debug("EQLeft \n"); nodelist
.insert(yyval
.ptr
); ;
1032 #line 90 "grammar.y"
1033 { yyval
.ptr
= new Node(ID_LEFT
); allocValue(yyval
.ptr
->value
, "||"); debug("EQLeft \n"); nodelist
.insert(yyval
.ptr
); ;
1036 #line 91 "grammar.y"
1037 { yyval
.ptr
= new Node(ID_LEFT
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("EQLeft \n"); nodelist
.insert(yyval
.ptr
); ;
1040 #line 95 "grammar.y"
1041 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, ')'); debug("EQRight \n"); nodelist
.insert(yyval
.ptr
); ;
1044 #line 96 "grammar.y"
1045 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, ']'); debug("EQRight \n"); nodelist
.insert(yyval
.ptr
); ;
1048 #line 97 "grammar.y"
1049 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '}'); debug("EQRight \n"); nodelist
.insert(yyval
.ptr
); ;
1052 #line 98 "grammar.y"
1053 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '>'); debug("EQRight \n"); nodelist
.insert(yyval
.ptr
); ;
1056 #line 99 "grammar.y"
1057 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '|'); debug("EQRight \n"); nodelist
.insert(yyval
.ptr
); ;
1060 #line 100 "grammar.y"
1061 { yyval
.ptr
= new Node(ID_RIGHT
); allocValue(yyval
.ptr
->value
, "||"); debug("EQRight \n"); nodelist
.insert(yyval
.ptr
); ;
1064 #line 101 "grammar.y"
1065 { yyval
.ptr
= new Node(ID_RIGHT
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("EQRight \n"); nodelist
.insert(yyval
.ptr
); ;
1068 #line 105 "grammar.y"
1069 { 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
.insert(yyval
.ptr
); ;
1072 #line 109 "grammar.y"
1073 { yyval
.ptr
= new Node(ID_PARENTH
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Parenth: '(' ExprList ')' \n"); nodelist
.insert(yyval
.ptr
); ;
1076 #line 110 "grammar.y"
1077 { yyval
.ptr
= new Node(ID_PARENTH
); debug("Parenth: '(' ')' \n"); nodelist
.insert(yyval
.ptr
); ;
1080 #line 114 "grammar.y"
1081 { yyval
.ptr
= new Node(ID_BLOCK
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Block: '{' ExprList '}' \n"); nodelist
.insert(yyval
.ptr
); ;
1084 #line 115 "grammar.y"
1085 { yyval
.ptr
= new Node(ID_BLOCK
); debug("Block: '{' '}' \n"); nodelist
.insert(yyval
.ptr
); ;
1088 #line 119 "grammar.y"
1089 { yyval
.ptr
= new Node(ID_BRACKET
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Bracket \n"); nodelist
.insert(yyval
.ptr
); ;
1092 #line 120 "grammar.y"
1093 { yyval
.ptr
= new Node(ID_BRACKET
); debug("Bracket \n"); nodelist
.insert(yyval
.ptr
); ;
1096 #line 124 "grammar.y"
1097 { 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
.insert(yyval
.ptr
); ;
1100 #line 125 "grammar.y"
1101 { 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
.insert(yyval
.ptr
); ;
1104 #line 126 "grammar.y"
1105 { 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
.insert(yyval
.ptr
); ;
1108 #line 130 "grammar.y"
1109 { 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
.insert(yyval
.ptr
); ;
1112 #line 134 "grammar.y"
1113 { yyval
.ptr
= new Node(ID_OVER
); yyval
.ptr
->child
= yyvsp
[-3].ptr
; yyvsp
[-3].ptr
->next
= yyvsp
[-1].ptr
; debug("OverExpr\n"); nodelist
.insert(yyval
.ptr
); ;
1116 #line 139 "grammar.y"
1117 { yyval
.ptr
= new Node(ID_ACCENTEXPR
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Accent : %s\n", yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
1120 #line 143 "grammar.y"
1121 { yyval
.ptr
= new Node(ID_ACCENTEXPR
); yyval
.ptr
->child
=yyvsp
[-1].ptr
; yyvsp
[-1].ptr
->next
= yyvsp
[0].ptr
; debug("AccentExpr \n"); nodelist
.insert(yyval
.ptr
); ;
1124 #line 146 "grammar.y"
1125 { yyval
.ptr
= new Node(ID_DECORATIONEXPR
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("Decoration : %s\n", yyvsp
[0].str
); nodelist
.insert(yyval
.ptr
); ;
1128 #line 150 "grammar.y"
1129 { yyval
.ptr
= new Node(ID_DECORATIONEXPR
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; yyvsp
[-1].ptr
->next
= yyvsp
[0].ptr
; debug("DecorationExpr \n"); nodelist
.insert(yyval
.ptr
); ;
1132 #line 154 "grammar.y"
1133 { yyval
.ptr
= new Node(ID_SQRTEXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("RootExpr : %s\n", yyvsp
[-1].str
); nodelist
.insert(yyval
.ptr
); ;
1136 #line 155 "grammar.y"
1137 { 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
.insert(yyval
.ptr
); ;
1140 #line 159 "grammar.y"
1141 { yyval
.ptr
= new Node(ID_BEGIN
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.insert(yyval
.ptr
); debug("BeginExpr\n"); ;
1144 #line 160 "grammar.y"
1145 { yyval
.ptr
= new Node(ID_BEGIN
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; yyvsp
[-1].ptr
->next
= yyvsp
[0].ptr
; nodelist
.insert(yyval
.ptr
); debug("BeginExpr\n"); ;
1148 #line 164 "grammar.y"
1149 { yyval
.ptr
= new Node(ID_END
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.insert(yyval
.ptr
); debug("EndExpr\n"); ;
1152 #line 169 "grammar.y"
1153 { yyval
.ptr
= new Node(ID_MATHML
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.insert(yyval
.ptr
); top
= yyval
.ptr
; debug("MathML\n"); ;
1156 #line 173 "grammar.y"
1157 { yyval
.ptr
= new Node(ID_LINES
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.insert(yyval
.ptr
); debug("Lines\n"); ;
1160 #line 174 "grammar.y"
1161 { yyval
.ptr
= new Node(ID_LINES
); yyval
.ptr
->child
= yyvsp
[-2].ptr
; yyvsp
[-2].ptr
->next
= yyvsp
[0].ptr
; nodelist
.insert(yyval
.ptr
); debug("Lines\n"); ;
1164 #line 178 "grammar.y"
1165 { yyval
.ptr
= new Node(ID_LINE
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.insert(yyval
.ptr
); debug("Line\n"); ;
1168 #line 182 "grammar.y"
1169 { yyval
.ptr
= new Node(ID_EXPRLIST
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("ExprList : Expr\n"); nodelist
.insert(yyval
.ptr
); ;
1172 #line 183 "grammar.y"
1173 { 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
.insert(yyval
.ptr
); ;
1176 #line 187 "grammar.y"
1177 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Block\n"); nodelist
.insert(yyval
.ptr
);;
1180 #line 188 "grammar.y"
1181 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Parenth\n"); nodelist
.insert(yyval
.ptr
);;
1184 #line 189 "grammar.y"
1185 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Fence\n"); nodelist
.insert(yyval
.ptr
);;
1188 #line 190 "grammar.y"
1189 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : SubSupExpr\n"); nodelist
.insert(yyval
.ptr
);;
1192 #line 191 "grammar.y"
1193 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : FractionExpr\n"); nodelist
.insert(yyval
.ptr
);;
1196 #line 192 "grammar.y"
1197 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : OverExpr\n"); nodelist
.insert(yyval
.ptr
);;
1200 #line 193 "grammar.y"
1201 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : DecorationExpr\n"); nodelist
.insert(yyval
.ptr
);;
1204 #line 194 "grammar.y"
1205 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : RootExpr\n"); nodelist
.insert(yyval
.ptr
);;
1208 #line 195 "grammar.y"
1209 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : AccentExpr\n"); nodelist
.insert(yyval
.ptr
);;
1212 #line 196 "grammar.y"
1213 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : PrimaryExpr\n"); nodelist
.insert(yyval
.ptr
);;
1216 #line 197 "grammar.y"
1217 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : BeginExpr\n"); nodelist
.insert(yyval
.ptr
);;
1220 #line 198 "grammar.y"
1221 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : EndExpr\n"); nodelist
.insert(yyval
.ptr
);;
1224 /* the action file gets copied in in place of this dollarsign */
1225 #line 543 "/usr/lib/bison.simple"
1236 short *ssp1
= yyss
- 1;
1237 fprintf (stderr
, "state stack now");
1238 while (ssp1
!= yyssp
)
1239 fprintf (stderr
, " %d", *++ssp1
);
1240 fprintf (stderr
, "\n");
1250 yylsp
->first_line
= yylloc
.first_line
;
1251 yylsp
->first_column
= yylloc
.first_column
;
1252 yylsp
->last_line
= (yylsp
-1)->last_line
;
1253 yylsp
->last_column
= (yylsp
-1)->last_column
;
1258 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
1259 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
1263 /* Now "shift" the result of the reduction.
1264 Determine what state that goes to,
1265 based on the state we popped back to
1266 and the rule number reduced by. */
1270 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1271 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1272 yystate
= yytable
[yystate
];
1274 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1278 yyerrlab
: /* here on detecting error */
1281 /* If not already recovering from an error, report this error. */
1285 #ifdef YYERROR_VERBOSE
1286 yyn
= yypact
[yystate
];
1288 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1295 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1296 for (x
= (yyn
< 0 ? -yyn
: 0);
1297 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1298 if (yycheck
[x
+ yyn
] == x
)
1299 size
+= strlen(yytname
[x
]) + 15, count
++;
1300 msg
= (char *) malloc(size
+ 15);
1303 strcpy(msg
, "parse error");
1308 for (x
= (yyn
< 0 ? -yyn
: 0);
1309 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1310 if (yycheck
[x
+ yyn
] == x
)
1312 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
1313 strcat(msg
, yytname
[x
]);
1322 yyerror ("parse error; also virtual memory exceeded");
1325 #endif /* YYERROR_VERBOSE */
1326 yyerror("parse error");
1330 yyerrlab1
: /* here on error raised explicitly by an action */
1332 if (yyerrstatus
== 3)
1334 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1336 /* return failure if at end of input */
1337 if (yychar
== YYEOF
)
1342 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
1348 /* Else will try to reuse lookahead token
1349 after shifting the error token. */
1351 yyerrstatus
= 3; /* Each real token shifted decrements this */
1355 yyerrdefault
: /* current state does not do anything special for the error token. */
1358 /* This is wrong; only states that explicitly want error tokens
1359 should shift them. */
1360 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1361 if (yyn
) goto yydefault
;
1364 yyerrpop
: /* pop the current state because it cannot handle the error token */
1366 if (yyssp
== yyss
) YYABORT
;
1376 short *ssp1
= yyss
- 1;
1377 fprintf (stderr
, "Error: state stack now");
1378 while (ssp1
!= yyssp
)
1379 fprintf (stderr
, " %d", *++ssp1
);
1380 fprintf (stderr
, "\n");
1386 yyn
= yypact
[yystate
];
1391 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1410 fprintf(stderr
, "Shifting error token, ");
1422 /* YYACCEPT comes here. */
1434 /* YYABORT comes here. */
1445 #line 202 "grammar.y"
1448 Node
*mainParse(const char *_code
)
1459 void yyerror(const char * /*err*/)
1461 // printf("REALKING ERR[%s]\n",err);
1462 // if error, delete all nodes.
1464 int ncount
= nodelist
.count();
1465 for( int i
= 0 ; i
< ncount
; i
++){
1466 pNode
= nodelist
.remove(0);
1473 int debug(const char * /*format*/, ...)