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 */
24 #define YYBISON 1 /* Identify Bison output. */
34 #define SMALL_GREEK 258
35 #define CAPITAL_GREEK 259
36 #define BINARY_OPERATOR 260
37 #define RELATION_OPERATOR 261
39 #define GENERAL_IDEN 263
40 #define GENERAL_OPER 264
41 #define BIG_SYMBOL 265
48 #define LARGE_DELIM 272
49 #define DECORATION 273
50 #define SPACE_SYMBOL 274
59 #define LEFT_DELIM 283
60 #define RIGHT_DELIM 284
71 std::list
<Node
*> nodelist
;
73 Node
*mainParse(const char *_code
);
74 void yyerror(const char *);
76 void initFlex( const char *s
);
77 void viewResult(Node
*res
);
83 #define allocValue(x,y) \
84 x = (char *)malloc( strlen(y) +1 ); \
87 #define allocChar(x,y) \
88 x = (char *)malloc(2); \
93 int debug(const char *format
, ...);
114 #define YYFLAG -32768
117 #define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 66)
119 static const char yytranslate
[] = { 0,
120 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
121 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
122 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
123 2, 2, 2, 2, 2, 2, 2, 2, 2, 33,
124 37, 2, 2, 2, 2, 2, 2, 2, 2, 2,
125 2, 2, 2, 2, 2, 2, 2, 2, 2, 36,
126 2, 40, 2, 2, 2, 2, 2, 2, 2, 2,
127 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
128 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
129 34, 2, 38, 42, 41, 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, 35, 32, 39, 2, 2, 2, 2, 2,
133 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
134 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
135 2, 2, 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 2, 2, 2, 2, 2, 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, 2, 2, 2, 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, 1, 3, 4, 5, 6,
146 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
147 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
152 static const short yyprhs
[] = { 0,
153 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
154 20, 22, 24, 26, 28, 30, 32, 34, 36, 39,
155 42, 45, 48, 51, 54, 58, 60, 63, 66, 69,
156 72, 75, 79, 81, 85, 89, 92, 96, 99, 103,
157 106, 110, 114, 120, 124, 130, 132, 135, 137, 140,
158 143, 147, 150, 154, 157, 159, 161, 165, 167, 169,
159 172, 174, 176, 178, 180, 182, 184, 186, 188, 190,
163 static const short yyrhs
[] = { 4,
164 0, 9, 0, 10, 0, 5, 0, 11, 0, 12,
165 0, 20, 0, 21, 0, 7, 0, 6, 0, 23,
166 0, 17, 0, 18, 0, 8, 0, 32, 0, 31,
167 0, 22, 0, 43, 0, 44, 43, 0, 26, 33,
168 0, 26, 34, 0, 26, 35, 0, 26, 36, 0,
169 26, 32, 0, 26, 32, 32, 0, 29, 0, 27,
170 37, 0, 27, 38, 0, 27, 39, 0, 27, 40,
171 0, 27, 32, 0, 27, 32, 32, 0, 30, 0,
172 45, 64, 46, 0, 33, 64, 37, 0, 33, 37,
173 0, 35, 64, 39, 0, 35, 39, 0, 34, 64,
174 38, 0, 34, 38, 0, 65, 41, 65, 0, 65,
175 42, 65, 0, 65, 41, 49, 42, 49, 0, 14,
176 49, 49, 0, 35, 64, 16, 64, 39, 0, 3,
177 0, 54, 49, 0, 19, 0, 56, 49, 0, 13,
178 49, 0, 13, 50, 49, 0, 24, 49, 0, 24,
179 49, 49, 0, 25, 49, 0, 62, 0, 63, 0,
180 62, 28, 63, 0, 64, 0, 65, 0, 64, 65,
181 0, 49, 0, 48, 0, 47, 0, 51, 0, 52,
182 0, 53, 0, 57, 0, 58, 0, 55, 0, 44,
189 static const short yyrline
[] = { 0,
190 59, 61, 62, 63, 64, 65, 66, 67, 68, 69,
191 70, 71, 72, 73, 74, 75, 76, 79, 81, 84,
192 86, 87, 88, 89, 90, 91, 94, 96, 97, 98,
193 99, 100, 101, 104, 108, 110, 113, 115, 118, 120,
194 123, 125, 126, 129, 133, 138, 142, 145, 149, 153,
195 155, 158, 160, 163, 168, 172, 174, 177, 181, 183,
196 186, 188, 189, 190, 191, 192, 193, 194, 195, 196,
202 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
204 static const char * const yytname
[] = { "$","error","$undefined.","ACCENT",
205 "SMALL_GREEK","CAPITAL_GREEK","BINARY_OPERATOR","RELATION_OPERATOR","ARROW",
206 "GENERAL_IDEN","GENERAL_OPER","BIG_SYMBOL","FUNCTION","ROOT","FRACTION","SUBSUP",
207 "EQOVER","DELIMETER","LARGE_DELIM","DECORATION","SPACE_SYMBOL","CHARACTER","STRING",
208 "OPERATOR","EQBEGIN","EQEND","EQLEFT","EQRIGHT","NEWLINE","LEFT_DELIM","RIGHT_DELIM",
209 "DIGIT","'|'","'('","'['","'{'","'<'","')'","']'","'}'","'>'","'_'","'^'","Identifier",
210 "PrimaryExpr","EQLeft","EQRight","Fence","Parenth","Block","Bracket","SubSupExpr",
211 "FractionExpr","OverExpr","Accent","AccentExpr","Decoration","DecorationExpr",
212 "RootExpr","BeginExpr","EndExpr","MathML","Lines","Line","ExprList","Expr", NULL
216 static const short yyr1
[] = { 0,
217 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
218 43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
219 45, 45, 45, 45, 45, 45, 46, 46, 46, 46,
220 46, 46, 46, 47, 48, 48, 49, 49, 50, 50,
221 51, 51, 51, 52, 53, 54, 55, 56, 57, 58,
222 58, 59, 59, 60, 61, 62, 62, 63, 64, 64,
223 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
227 static const short yyr2
[] = { 0,
228 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
229 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
230 2, 2, 2, 2, 3, 1, 2, 2, 2, 2,
231 2, 3, 1, 3, 3, 2, 3, 2, 3, 2,
232 3, 3, 5, 3, 5, 1, 2, 1, 2, 2,
233 3, 2, 3, 2, 1, 1, 3, 1, 1, 2,
234 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
238 static const short yydefact
[] = { 0,
239 46, 1, 4, 10, 9, 14, 2, 3, 5, 6,
240 0, 0, 12, 13, 48, 7, 8, 17, 11, 0,
241 0, 0, 26, 16, 15, 0, 0, 18, 70, 0,
242 63, 62, 61, 64, 65, 66, 0, 69, 0, 67,
243 68, 71, 72, 55, 56, 58, 59, 0, 0, 50,
244 0, 0, 52, 54, 24, 20, 21, 22, 23, 36,
245 0, 38, 0, 19, 0, 47, 49, 0, 60, 0,
246 0, 40, 0, 0, 51, 44, 53, 25, 35, 0,
247 37, 0, 33, 34, 57, 61, 41, 42, 39, 0,
248 31, 27, 28, 29, 30, 0, 45, 32, 43, 0,
252 static const short yydefgoto
[] = { 28,
253 29, 30, 84, 31, 32, 33, 51, 34, 35, 36,
254 37, 38, 39, 40, 41, 42, 43, 100, 44, 45,
258 static const short yypact
[] = { 393,
259 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
260 -30, -19,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -19,
261 -19, -3,-32768,-32768,-32768, 290, 107,-32768, 425, 393,
262 -32768,-32768,-32768,-32768,-32768,-32768, -19,-32768, -19,-32768,
263 -32768,-32768,-32768, -20,-32768, 393, -21, 218, 107,-32768,
264 -19, -19, -19,-32768, -15,-32768,-32768,-32768,-32768,-32768,
265 325,-32768, 70,-32768, 360,-32768,-32768, 393, -21, 393,
266 393,-32768, 254, 144,-32768,-32768,-32768,-32768,-32768, 393,
267 -32768, -25,-32768,-32768,-32768, -31, -21, -21,-32768, 181,
268 -14,-32768,-32768,-32768,-32768, -19,-32768,-32768,-32768, 22,
272 static const short yypgoto
[] = { -2,
273 -32768,-32768,-32768,-32768,-32768, -11,-32768,-32768,-32768,-32768,
274 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -33,
282 static const short yytable
[] = { 50,
283 52, 61, 63, 48, 49, 65, 91, 68, 53, 54,
284 96, 92, 93, 94, 95, 49, 78, 98, 69, 70,
285 71, 101, 102, 73, 74, 66, 64, 67, 55, 56,
286 57, 58, 59, 69, 85, 69, 0, 69, 0, 75,
287 76, 77, 87, 88, 0, 69, 69, 0, 0, 0,
288 0, 0, 0, 0, 0, 90, 0, 0, 86, 0,
289 0, 0, 69, 0, 0, 0, 0, 0, 0, 0,
290 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
291 9, 10, 11, 12, 99, 80, 13, 14, 15, 16,
292 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
293 24, 25, 26, 0, 27, 0, 0, 0, 81, 1,
294 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
295 12, 0, 0, 13, 14, 15, 16, 17, 18, 19,
296 20, 21, 22, 0, 0, 23, 0, 24, 25, 26,
297 0, 27, 0, 0, 0, 62, 1, 2, 3, 4,
298 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
299 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
300 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
301 0, 0, 81, 1, 2, 3, 4, 5, 6, 7,
302 8, 9, 10, 11, 12, 0, 0, 13, 14, 15,
303 16, 17, 18, 19, 20, 21, 22, 0, 0, 23,
304 0, 24, 25, 26, 0, 27, 0, 0, 0, 97,
305 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
306 11, 12, 0, 0, 13, 14, 15, 16, 17, 18,
307 19, 20, 21, 22, 0, 0, 23, 0, 24, 25,
308 26, 0, 27, 0, 0, 72, 1, 2, 3, 4,
309 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
310 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
311 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
312 0, 89, 1, 2, 3, 4, 5, 6, 7, 8,
313 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
314 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
315 24, 25, 26, 0, 27, 0, 60, 1, 2, 3,
316 4, 5, 6, 7, 8, 9, 10, 11, 12, 0,
317 0, 13, 14, 15, 16, 17, 18, 19, 20, 21,
318 22, 0, 0, 23, 0, 24, 25, 26, 0, 27,
319 0, 79, 1, 2, 3, 4, 5, 6, 7, 8,
320 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
321 17, 18, 19, 20, 21, 22, 82, 0, 23, 83,
322 24, 25, 26, 0, 27, 1, 2, 3, 4, 5,
323 6, 7, 8, 9, 10, 11, 12, 0, 0, 13,
324 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
325 0, 23, 0, 24, 25, 26, 0, 27, 2, 3,
326 4, 5, 6, 7, 8, 9, 10, 0, 0, 0,
327 0, 13, 14, 0, 16, 17, 18, 19, 0, 0,
328 0, 0, 0, 0, 0, 24, 25
331 static const short yycheck
[] = { 11,
332 12, 26, 27, 34, 35, 30, 32, 28, 20, 21,
333 42, 37, 38, 39, 40, 35, 32, 32, 46, 41,
334 42, 0, 0, 48, 49, 37, 29, 39, 32, 33,
335 34, 35, 36, 61, 68, 63, -1, 65, -1, 51,
336 52, 53, 70, 71, -1, 73, 74, -1, -1, -1,
337 -1, -1, -1, -1, -1, 80, -1, -1, 70, -1,
338 -1, -1, 90, -1, -1, -1, -1, -1, -1, -1,
339 -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
340 11, 12, 13, 14, 96, 16, 17, 18, 19, 20,
341 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
342 31, 32, 33, -1, 35, -1, -1, -1, 39, 3,
343 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
344 14, -1, -1, 17, 18, 19, 20, 21, 22, 23,
345 24, 25, 26, -1, -1, 29, -1, 31, 32, 33,
346 -1, 35, -1, -1, -1, 39, 3, 4, 5, 6,
347 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
348 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
349 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
350 -1, -1, 39, 3, 4, 5, 6, 7, 8, 9,
351 10, 11, 12, 13, 14, -1, -1, 17, 18, 19,
352 20, 21, 22, 23, 24, 25, 26, -1, -1, 29,
353 -1, 31, 32, 33, -1, 35, -1, -1, -1, 39,
354 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
355 13, 14, -1, -1, 17, 18, 19, 20, 21, 22,
356 23, 24, 25, 26, -1, -1, 29, -1, 31, 32,
357 33, -1, 35, -1, -1, 38, 3, 4, 5, 6,
358 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
359 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
360 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
361 -1, 38, 3, 4, 5, 6, 7, 8, 9, 10,
362 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
363 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
364 31, 32, 33, -1, 35, -1, 37, 3, 4, 5,
365 6, 7, 8, 9, 10, 11, 12, 13, 14, -1,
366 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
367 26, -1, -1, 29, -1, 31, 32, 33, -1, 35,
368 -1, 37, 3, 4, 5, 6, 7, 8, 9, 10,
369 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
370 21, 22, 23, 24, 25, 26, 27, -1, 29, 30,
371 31, 32, 33, -1, 35, 3, 4, 5, 6, 7,
372 8, 9, 10, 11, 12, 13, 14, -1, -1, 17,
373 18, 19, 20, 21, 22, 23, 24, 25, 26, -1,
374 -1, 29, -1, 31, 32, 33, -1, 35, 4, 5,
375 6, 7, 8, 9, 10, 11, 12, -1, -1, -1,
376 -1, 17, 18, -1, 20, 21, 22, 23, -1, -1,
377 -1, -1, -1, -1, -1, 31, 32
379 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
380 #line 3 "/usr/lib/bison.simple"
381 /* This file comes from bison-1.28. */
383 /* Skeleton output parser for bison,
384 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
386 This program is free software; you can redistribute it and/or modify
387 it under the terms of the GNU General Public License as published by
388 the Free Software Foundation; either version 2, or (at your option)
391 This program is distributed in the hope that it will be useful,
392 but WITHOUT ANY WARRANTY; without even the implied warranty of
393 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
394 GNU General Public License for more details.
396 You should have received a copy of the GNU General Public License
397 along with this program; if not, write to the Free Software
398 Foundation, Inc., 59 Temple Place - Suite 330,
399 Boston, MA 02111-1307, USA. */
401 /* As a special exception, when this file is copied by Bison into a
402 Bison output file, you may use that output file without restriction.
403 This special exception was added by the Free Software Foundation
404 in version 1.24 of Bison. */
406 /* This is the parser code that is written into each bison parser
407 when the %semantic_parser declaration is not specified in the grammar.
408 It was written by Richard Stallman by simplifying the hairy parser
409 used when %semantic_parser is specified. */
411 #ifndef YYSTACK_USE_ALLOCA
413 #define YYSTACK_USE_ALLOCA
414 #else /* alloca not defined */
416 #define YYSTACK_USE_ALLOCA
417 #define alloca __builtin_alloca
418 #else /* not GNU C. */
419 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
420 #define YYSTACK_USE_ALLOCA
421 #include <sal/alloca.h>
422 #else /* not sparc */
425 #define YYSTACK_USE_ALLOCA
426 #endif /* not _AIX */
427 #endif /* not sparc */
428 #endif /* not GNU C */
429 #endif /* alloca not defined */
430 #endif /* YYSTACK_USE_ALLOCA not defined */
432 #ifdef YYSTACK_USE_ALLOCA
433 #define YYSTACK_ALLOC alloca
435 #define YYSTACK_ALLOC malloc
438 /* Note: there must be only one dollar sign in this file.
439 It is replaced by the list of actions, each action
440 as one case of the switch. */
442 #define yyerrok (yyerrstatus = 0)
443 #define yyclearin (yychar = YYEMPTY)
446 #define YYACCEPT goto yyacceptlab
447 #define YYABORT goto yyabortlab
448 #define YYERROR goto yyerrlab1
449 /* Like YYERROR except do call yyerror.
450 This remains here temporarily to ease the
451 transition to the new meaning of YYERROR, for GCC.
452 Once GCC version 2 has supplanted version 1, this can go. */
453 #define YYFAIL goto yyerrlab
454 #define YYRECOVERING() (!!yyerrstatus)
455 #define YYBACKUP(token, value) \
457 if (yychar == YYEMPTY && yylen == 1) \
458 { yychar = (token), yylval = (value); \
459 yychar1 = YYTRANSLATE (yychar); \
464 { yyerror ("syntax error: cannot back up"); YYERROR; } \
468 #define YYERRCODE 256
471 #define YYLEX yylex()
477 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
479 #define YYLEX yylex(&yylval, &yylloc)
481 #else /* not YYLSP_NEEDED */
483 #define YYLEX yylex(&yylval, YYLEX_PARAM)
485 #define YYLEX yylex(&yylval)
487 #endif /* not YYLSP_NEEDED */
490 /* If nonreentrant, generate the variables here */
494 int yychar
; /* the lookahead symbol */
495 YYSTYPE yylval
; /* the semantic value of the */
496 /* lookahead symbol */
499 YYLTYPE yylloc
; /* location data for the lookahead */
503 int yynerrs
; /* number of parse errors so far */
504 #endif /* not YYPURE */
507 int yydebug
; /* nonzero means print parse trace */
508 /* Since this is uninitialized, it does not stop multiple parsers
512 /* YYINITDEPTH indicates the initial size of the parser's stacks */
515 #define YYINITDEPTH 200
518 /* YYMAXDEPTH is the maximum size the stacks can grow to
519 (effective only if the built-in stack extension method is used). */
526 #define YYMAXDEPTH 10000
529 /* Define __yy_memcpy. Note that the size argument
530 should be passed with type unsigned int, because that is what the non-GCC
531 definitions require. With GCC, __builtin_memcpy takes an arg
532 of type size_t, but it can handle unsigned int. */
534 #if defined(__GNUC__)
535 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
539 /* This is the most reliable way to avoid incompatibilities
540 in available built-in functions on various systems. */
542 __yy_memcpy (to
, from
, count
)
547 register char *f
= from
;
548 register char *t
= to
;
549 register int i
= count
;
555 #else /* __cplusplus */
557 /* This is the most reliable way to avoid incompatibilities
558 in available built-in functions on various systems. */
560 __yy_memcpy (char *to
, char *from
, unsigned int count
)
562 register char *t
= to
;
563 register char *f
= from
;
564 register int i
= count
;
573 #line 217 "/usr/lib/bison.simple"
575 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
576 into yyparse. The argument should have type void *.
577 It should actually point to an object.
578 Grammar actions can access the variable by casting it
579 to the proper pointer type. */
583 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
584 #define YYPARSE_PARAM_DECL
585 #else /* not __cplusplus */
586 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
587 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
588 #endif /* not __cplusplus */
589 #else /* not YYPARSE_PARAM */
590 #define YYPARSE_PARAM_ARG
591 #define YYPARSE_PARAM_DECL
592 #endif /* not YYPARSE_PARAM */
594 /* Prevent warning if -Wstrict-prototypes. */
597 int yyparse (void *);
604 yyparse(YYPARSE_PARAM_ARG
)
607 register int yystate
;
609 register short *yyssp
;
610 register YYSTYPE
*yyvsp
;
611 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
612 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
614 short yyssa
[YYINITDEPTH
]; /* the state stack */
615 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
617 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
618 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
621 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
622 YYLTYPE
*yyls
= yylsa
;
625 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
627 #define YYPOPSTACK (yyvsp--, yyssp--)
630 int yystacksize
= YYINITDEPTH
;
631 int yyfree_stacks
= 0;
642 YYSTYPE yyval
; /* the variable used to return */
644 /* semantic values from the action */
651 fprintf(stderr
, "Starting parse\n");
657 yychar
= YYEMPTY
; /* Cause a token to be read. */
659 /* Initialize stack pointers.
660 Waste one element of value and location stack
661 so that they stay on the same level as the state stack.
662 The wasted elements are never initialized. */
670 /* Push a new state, which is found in yystate . */
671 /* In all cases, when you get here, the value and location stacks
672 have just been pushed. so pushing a state here evens the stacks. */
675 *++yyssp
= sal::static_int_cast
<short>(yystate
);
677 if (yyssp
>= yyss
+ yystacksize
- 1)
679 /* Give user a chance to reallocate the stack */
680 /* Use copies of these so that the &'s don't force the real ones into memory. */
681 YYSTYPE
*yyvs1
= yyvs
;
684 YYLTYPE
*yyls1
= yyls
;
687 /* Get the current used size of the three stacks, in elements. */
688 int size
= yyssp
- yyss
+ 1;
691 /* Each stack pointer address is followed by the size of
692 the data in use in that stack, in bytes. */
694 /* This used to be a conditional around just the two extra args,
695 but that might be undefined if yyoverflow is a macro. */
696 yyoverflow("parser stack overflow",
697 &yyss1
, size
* sizeof (*yyssp
),
698 &yyvs1
, size
* sizeof (*yyvsp
),
699 &yyls1
, size
* sizeof (*yylsp
),
702 yyoverflow("parser stack overflow",
703 &yyss1
, size
* sizeof (*yyssp
),
704 &yyvs1
, size
* sizeof (*yyvsp
),
708 yyss
= yyss1
; yyvs
= yyvs1
;
712 #else /* no yyoverflow */
713 /* Extend the stack our own way. */
714 if (yystacksize
>= YYMAXDEPTH
)
716 yyerror("parser stack overflow");
728 if (yystacksize
> YYMAXDEPTH
)
729 yystacksize
= YYMAXDEPTH
;
730 #ifndef YYSTACK_USE_ALLOCA
733 yyss
= (short *) YYSTACK_ALLOC (yystacksize
* sizeof (*yyssp
));
734 __yy_memcpy ((char *)yyss
, (char *)yyss1
,
735 size
* (unsigned int) sizeof (*yyssp
));
736 yyvs
= (YYSTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yyvsp
));
737 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
,
738 size
* (unsigned int) sizeof (*yyvsp
));
740 yyls
= (YYLTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yylsp
));
741 __yy_memcpy ((char *)yyls
, (char *)yyls1
,
742 size
* (unsigned int) sizeof (*yylsp
));
744 #endif /* no yyoverflow */
746 yyssp
= yyss
+ size
- 1;
747 yyvsp
= yyvs
+ size
- 1;
749 yylsp
= yyls
+ size
- 1;
754 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
757 if (yyssp
>= yyss
+ yystacksize
- 1)
763 fprintf(stderr
, "Entering state %d\n", yystate
);
769 /* Do appropriate processing given the current state. */
770 /* Read a lookahead token if we need one and don't already have one. */
773 /* First try to decide what to do without reference to lookahead token. */
775 yyn
= yypact
[yystate
];
779 /* Not known => get a lookahead token if don't already have one. */
781 /* yychar is either YYEMPTY or YYEOF
782 or a valid token in external form. */
784 if (yychar
== YYEMPTY
)
788 fprintf(stderr
, "Reading a token: ");
793 /* Convert token to internal form (in yychar1) for indexing tables with */
795 if (yychar
<= 0) /* This means end of input. */
798 yychar
= YYEOF
; /* Don't call YYLEX any more */
802 fprintf(stderr
, "Now at end of input.\n");
807 yychar1
= YYTRANSLATE(yychar
);
812 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
813 /* Give the individual parser a way to print the precise meaning
814 of a token, for further debugging info. */
816 YYPRINT (stderr
, yychar
, yylval
);
818 fprintf (stderr
, ")\n");
824 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
829 /* yyn is what to do for this token type in this state.
830 Negative => reduce, -yyn is rule number.
831 Positive => shift, yyn is new state.
832 New state is final state => don't bother to shift,
834 0, or most negative number => error. */
849 /* Shift the lookahead token. */
853 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
856 /* Discard the token being shifted unless it is eof. */
865 /* count tokens shifted since error; after three, turn off error status. */
866 if (yyerrstatus
) yyerrstatus
--;
871 /* Do the default action for the current state. */
874 yyn
= yydefact
[yystate
];
878 /* Do a reduction. yyn is the number of a rule to reduce with. */
882 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
889 fprintf (stderr
, "Reducing via rule %d (line %d), ",
892 /* Print the symbols being reduced, and their result. */
893 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
894 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
895 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
904 { 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
); ;
908 { 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
); ;
912 { 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
); ;
916 { 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
); ;
920 { 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
); ;
924 { 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
); ;
928 { 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
); ;
932 { 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
); ;
936 { 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
); ;
940 { 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
); ;
944 { 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
); ;
948 { 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
); ;
952 { 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
); ;
956 { 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
); ;
960 { yyval
.ptr
= new Node(ID_CHARACTER
); allocChar(yyval
.ptr
->value
, '|'); debug("Identifier : '|'\n"); nodelist
.push_back(yyval
.ptr
); ;
964 { 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
); ;
968 { 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
); ;
972 { yyval
.ptr
= new Node(ID_PRIMARYEXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("PrimaryExpr\n"); nodelist
.push_back(yyval
.ptr
); ;
976 { 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
); ;
980 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '('); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
984 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '['); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
988 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '{'); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
992 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '<'); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
996 { yyval
.ptr
= new Node(ID_LEFT
); allocChar(yyval
.ptr
->value
, '|'); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
1000 { yyval
.ptr
= new Node(ID_LEFT
); allocValue(yyval
.ptr
->value
, "||"); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
1003 #line 91 "grammar.y"
1004 { yyval
.ptr
= new Node(ID_LEFT
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("EQLeft \n"); nodelist
.push_back(yyval
.ptr
); ;
1007 #line 95 "grammar.y"
1008 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, ')'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1011 #line 96 "grammar.y"
1012 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, ']'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1015 #line 97 "grammar.y"
1016 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '}'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1019 #line 98 "grammar.y"
1020 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '>'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1023 #line 99 "grammar.y"
1024 { yyval
.ptr
= new Node(ID_RIGHT
); allocChar(yyval
.ptr
->value
, '|'); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1027 #line 100 "grammar.y"
1028 { yyval
.ptr
= new Node(ID_RIGHT
); allocValue(yyval
.ptr
->value
, "||"); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1031 #line 101 "grammar.y"
1032 { yyval
.ptr
= new Node(ID_RIGHT
); allocValue(yyval
.ptr
->value
, yyvsp
[0].str
); debug("EQRight \n"); nodelist
.push_back(yyval
.ptr
); ;
1035 #line 105 "grammar.y"
1036 { 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
); ;
1039 #line 109 "grammar.y"
1040 { yyval
.ptr
= new Node(ID_PARENTH
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Parenth: '(' ExprList ')' \n"); nodelist
.push_back(yyval
.ptr
); ;
1043 #line 110 "grammar.y"
1044 { yyval
.ptr
= new Node(ID_PARENTH
); debug("Parenth: '(' ')' \n"); nodelist
.push_back(yyval
.ptr
); ;
1047 #line 114 "grammar.y"
1048 { yyval
.ptr
= new Node(ID_BLOCK
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Block: '{' ExprList '}' \n"); nodelist
.push_back(yyval
.ptr
); ;
1051 #line 115 "grammar.y"
1052 { yyval
.ptr
= new Node(ID_BLOCK
); debug("Block: '{' '}' \n"); nodelist
.push_back(yyval
.ptr
); ;
1055 #line 119 "grammar.y"
1056 { yyval
.ptr
= new Node(ID_BRACKET
); yyval
.ptr
->child
= yyvsp
[-1].ptr
; debug("Bracket \n"); nodelist
.push_back(yyval
.ptr
); ;
1059 #line 120 "grammar.y"
1060 { yyval
.ptr
= new Node(ID_BRACKET
); debug("Bracket \n"); nodelist
.push_back(yyval
.ptr
); ;
1063 #line 124 "grammar.y"
1064 { 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
); ;
1067 #line 125 "grammar.y"
1068 { 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
); ;
1071 #line 126 "grammar.y"
1072 { 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
); ;
1075 #line 130 "grammar.y"
1076 { 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
); ;
1079 #line 134 "grammar.y"
1080 { 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
); ;
1083 #line 139 "grammar.y"
1084 { 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
); ;
1087 #line 143 "grammar.y"
1088 { 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
); ;
1091 #line 146 "grammar.y"
1092 { 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
); ;
1095 #line 150 "grammar.y"
1096 { 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
); ;
1099 #line 154 "grammar.y"
1100 { yyval
.ptr
= new Node(ID_SQRTEXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("RootExpr : %s\n", yyvsp
[-1].str
); nodelist
.push_back(yyval
.ptr
); ;
1103 #line 155 "grammar.y"
1104 { 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
); ;
1107 #line 159 "grammar.y"
1108 { yyval
.ptr
= new Node(ID_BEGIN
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("BeginExpr\n"); ;
1111 #line 160 "grammar.y"
1112 { 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"); ;
1115 #line 164 "grammar.y"
1116 { yyval
.ptr
= new Node(ID_END
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("EndExpr\n"); ;
1119 #line 169 "grammar.y"
1120 { yyval
.ptr
= new Node(ID_MATHML
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); top
= yyval
.ptr
; debug("MathML\n"); ;
1123 #line 173 "grammar.y"
1124 { yyval
.ptr
= new Node(ID_LINES
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("Lines\n"); ;
1127 #line 174 "grammar.y"
1128 { 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"); ;
1131 #line 178 "grammar.y"
1132 { yyval
.ptr
= new Node(ID_LINE
); yyval
.ptr
->child
= yyvsp
[0].ptr
; nodelist
.push_back(yyval
.ptr
); debug("Line\n"); ;
1135 #line 182 "grammar.y"
1136 { yyval
.ptr
= new Node(ID_EXPRLIST
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("ExprList : Expr\n"); nodelist
.push_back(yyval
.ptr
); ;
1139 #line 183 "grammar.y"
1140 { 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
); ;
1143 #line 187 "grammar.y"
1144 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Block\n"); nodelist
.push_back(yyval
.ptr
);;
1147 #line 188 "grammar.y"
1148 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Parenth\n"); nodelist
.push_back(yyval
.ptr
);;
1151 #line 189 "grammar.y"
1152 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : Fence\n"); nodelist
.push_back(yyval
.ptr
);;
1155 #line 190 "grammar.y"
1156 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : SubSupExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1159 #line 191 "grammar.y"
1160 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : FractionExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1163 #line 192 "grammar.y"
1164 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : OverExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1167 #line 193 "grammar.y"
1168 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : DecorationExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1171 #line 194 "grammar.y"
1172 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : RootExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1175 #line 195 "grammar.y"
1176 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : AccentExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1179 #line 196 "grammar.y"
1180 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : PrimaryExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1183 #line 197 "grammar.y"
1184 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : BeginExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1187 #line 198 "grammar.y"
1188 { yyval
.ptr
= new Node(ID_EXPR
); yyval
.ptr
->child
= yyvsp
[0].ptr
; debug("Expr : EndExpr\n"); nodelist
.push_back(yyval
.ptr
);;
1191 /* the action file gets copied in in place of this dollarsign */
1192 #line 543 "/usr/lib/bison.simple"
1203 short *ssp1
= yyss
- 1;
1204 fprintf (stderr
, "state stack now");
1205 while (ssp1
!= yyssp
)
1206 fprintf (stderr
, " %d", *++ssp1
);
1207 fprintf (stderr
, "\n");
1217 yylsp
->first_line
= yylloc
.first_line
;
1218 yylsp
->first_column
= yylloc
.first_column
;
1219 yylsp
->last_line
= (yylsp
-1)->last_line
;
1220 yylsp
->last_column
= (yylsp
-1)->last_column
;
1225 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
1226 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
1230 /* Now "shift" the result of the reduction.
1231 Determine what state that goes to,
1232 based on the state we popped back to
1233 and the rule number reduced by. */
1237 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1238 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1239 yystate
= yytable
[yystate
];
1241 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1245 yyerrlab
: /* here on detecting error */
1248 /* If not already recovering from an error, report this error. */
1252 #ifdef YYERROR_VERBOSE
1253 yyn
= yypact
[yystate
];
1255 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1262 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1263 for (x
= (yyn
< 0 ? -yyn
: 0);
1264 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1265 if (yycheck
[x
+ yyn
] == x
)
1266 size
+= strlen(yytname
[x
]) + 15, count
++;
1267 msg
= (char *) malloc(size
+ 15);
1270 strcpy(msg
, "parse error");
1275 for (x
= (yyn
< 0 ? -yyn
: 0);
1276 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1277 if (yycheck
[x
+ yyn
] == x
)
1279 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
1280 strcat(msg
, yytname
[x
]);
1289 yyerror ("parse error; also virtual memory exceeded");
1292 #endif /* YYERROR_VERBOSE */
1293 yyerror("parse error");
1297 yyerrlab1
: /* here on error raised explicitly by an action */
1299 if (yyerrstatus
== 3)
1301 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1303 /* return failure if at end of input */
1304 if (yychar
== YYEOF
)
1309 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
1315 /* Else will try to reuse lookahead token
1316 after shifting the error token. */
1318 yyerrstatus
= 3; /* Each real token shifted decrements this */
1322 yyerrdefault
: /* current state does not do anything special for the error token. */
1325 /* This is wrong; only states that explicitly want error tokens
1326 should shift them. */
1327 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1328 if (yyn
) goto yydefault
;
1331 yyerrpop
: /* pop the current state because it cannot handle the error token */
1333 if (yyssp
== yyss
) YYABORT
;
1343 short *ssp1
= yyss
- 1;
1344 fprintf (stderr
, "Error: state stack now");
1345 while (ssp1
!= yyssp
)
1346 fprintf (stderr
, " %d", *++ssp1
);
1347 fprintf (stderr
, "\n");
1353 yyn
= yypact
[yystate
];
1358 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1377 fprintf(stderr
, "Shifting error token, ");
1389 /* YYACCEPT comes here. */
1401 /* YYABORT comes here. */
1412 #line 202 "grammar.y"
1415 Node
*mainParse(const char *_code
)
1426 void yyerror(const char * /*err*/)
1428 // printf("REALKING ERR[%s]\n",err);
1429 // if error, delete all nodes.
1431 int ncount
= nodelist
.size();
1432 for( int i
= 0 ; i
< ncount
; i
++){
1433 pNode
= nodelist
.front();
1434 nodelist
.pop_front();
1441 int debug(const char * /*format*/, ...)
1447 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */