fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / hwpfilter / source / grammar.cxx
blob77984b97c9fab4208c432fc8d36fd15ed2dc7d20
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #ifndef YYDEBUG
25 #define YYDEBUG 0
26 #endif
27 #ifndef YYMAXDEPTH
28 #define YYMAXDEPTH 0
29 #endif
31 #include <list>
32 #include <stdlib.h>
33 #include <string.h>
35 #include "grammar.hxx"
36 #include "lexer.hxx"
37 #include "nodes.h"
39 std::list<Node*> nodelist;
41 void yyerror(const char *);
43 Node *top=0L;
45 int Node::count = 0;
47 #ifdef PARSE_DEBUG
48 #define debug printf
49 #else
50 int debug(const char *format, ...);
51 #endif
54 typedef union {
55 char *dval;
56 char *str;
57 Node *ptr;
58 } YYSTYPE;
59 #include <stdio.h>
61 #ifndef __cplusplus
62 #ifndef __STDC__
63 #define const
64 #endif
65 #endif
69 #define YYFINAL 102
70 #define YYFLAG -32768
71 #define YYNTBASE 43
73 #define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 66)
75 static const char yytranslate[] = { 0,
76 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
77 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
78 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
79 2, 2, 2, 2, 2, 2, 2, 2, 2, 33,
80 37, 2, 2, 2, 2, 2, 2, 2, 2, 2,
81 2, 2, 2, 2, 2, 2, 2, 2, 2, 36,
82 2, 40, 2, 2, 2, 2, 2, 2, 2, 2,
83 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
84 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
85 34, 2, 38, 42, 41, 2, 2, 2, 2, 2,
86 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
87 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
88 2, 2, 35, 32, 39, 2, 2, 2, 2, 2,
89 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
90 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
91 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
92 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
93 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
94 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
95 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
96 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
97 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
98 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
99 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
101 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
102 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
103 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
104 27, 28, 29, 30, 31
107 #if YYDEBUG != 0
108 static const short yyprhs[] = { 0,
109 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
110 20, 22, 24, 26, 28, 30, 32, 34, 36, 39,
111 42, 45, 48, 51, 54, 58, 60, 63, 66, 69,
112 72, 75, 79, 81, 85, 89, 92, 96, 99, 103,
113 106, 110, 114, 120, 124, 130, 132, 135, 137, 140,
114 143, 147, 150, 154, 157, 159, 161, 165, 167, 169,
115 172, 174, 176, 178, 180, 182, 184, 186, 188, 190,
116 192, 194
119 static const short yyrhs[] = { 4,
120 0, 9, 0, 10, 0, 5, 0, 11, 0, 12,
121 0, 20, 0, 21, 0, 7, 0, 6, 0, 23,
122 0, 17, 0, 18, 0, 8, 0, 32, 0, 31,
123 0, 22, 0, 43, 0, 44, 43, 0, 26, 33,
124 0, 26, 34, 0, 26, 35, 0, 26, 36, 0,
125 26, 32, 0, 26, 32, 32, 0, 29, 0, 27,
126 37, 0, 27, 38, 0, 27, 39, 0, 27, 40,
127 0, 27, 32, 0, 27, 32, 32, 0, 30, 0,
128 45, 64, 46, 0, 33, 64, 37, 0, 33, 37,
129 0, 35, 64, 39, 0, 35, 39, 0, 34, 64,
130 38, 0, 34, 38, 0, 65, 41, 65, 0, 65,
131 42, 65, 0, 65, 41, 49, 42, 49, 0, 14,
132 49, 49, 0, 35, 64, 16, 64, 39, 0, 3,
133 0, 54, 49, 0, 19, 0, 56, 49, 0, 13,
134 49, 0, 13, 50, 49, 0, 24, 49, 0, 24,
135 49, 49, 0, 25, 49, 0, 62, 0, 63, 0,
136 62, 28, 63, 0, 64, 0, 65, 0, 64, 65,
137 0, 49, 0, 48, 0, 47, 0, 51, 0, 52,
138 0, 53, 0, 57, 0, 58, 0, 55, 0, 44,
139 0, 59, 0, 60, 0
142 #endif
144 #if YYDEBUG != 0
145 static const short yyrline[] = { 0,
146 59, 61, 62, 63, 64, 65, 66, 67, 68, 69,
147 70, 71, 72, 73, 74, 75, 76, 79, 81, 84,
148 86, 87, 88, 89, 90, 91, 94, 96, 97, 98,
149 99, 100, 101, 104, 108, 110, 113, 115, 118, 120,
150 123, 125, 126, 129, 133, 138, 142, 145, 149, 153,
151 155, 158, 160, 163, 168, 172, 174, 177, 181, 183,
152 186, 188, 189, 190, 191, 192, 193, 194, 195, 196,
153 197, 198
155 #endif
158 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
160 static const char * const yytname[] = { "$","error","$undefined.","ACCENT",
161 "SMALL_GREEK","CAPITAL_GREEK","BINARY_OPERATOR","RELATION_OPERATOR","ARROW",
162 "GENERAL_IDEN","GENERAL_OPER","BIG_SYMBOL","FUNCTION","ROOT","FRACTION","SUBSUP",
163 "EQOVER","DELIMETER","LARGE_DELIM","DECORATION","SPACE_SYMBOL","CHARACTER","STRING",
164 "OPERATOR","EQBEGIN","EQEND","EQLEFT","EQRIGHT","NEWLINE","LEFT_DELIM","RIGHT_DELIM",
165 "DIGIT","'|'","'('","'['","'{'","'<'","')'","']'","'}'","'>'","'_'","'^'","Identifier",
166 "PrimaryExpr","EQLeft","EQRight","Fence","Parenth","Block","Bracket","SubSupExpr",
167 "FractionExpr","OverExpr","Accent","AccentExpr","Decoration","DecorationExpr",
168 "RootExpr","BeginExpr","EndExpr","MathML","Lines","Line","ExprList","Expr", NULL
170 #endif
172 static const short yyr1[] = { 0,
173 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
174 43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
175 45, 45, 45, 45, 45, 45, 46, 46, 46, 46,
176 46, 46, 46, 47, 48, 48, 49, 49, 50, 50,
177 51, 51, 51, 52, 53, 54, 55, 56, 57, 58,
178 58, 59, 59, 60, 61, 62, 62, 63, 64, 64,
179 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
180 65, 65
183 static const short yyr2[] = { 0,
184 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
185 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
186 2, 2, 2, 2, 3, 1, 2, 2, 2, 2,
187 2, 3, 1, 3, 3, 2, 3, 2, 3, 2,
188 3, 3, 5, 3, 5, 1, 2, 1, 2, 2,
189 3, 2, 3, 2, 1, 1, 3, 1, 1, 2,
190 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
191 1, 1
194 static const short yydefact[] = { 0,
195 46, 1, 4, 10, 9, 14, 2, 3, 5, 6,
196 0, 0, 12, 13, 48, 7, 8, 17, 11, 0,
197 0, 0, 26, 16, 15, 0, 0, 18, 70, 0,
198 63, 62, 61, 64, 65, 66, 0, 69, 0, 67,
199 68, 71, 72, 55, 56, 58, 59, 0, 0, 50,
200 0, 0, 52, 54, 24, 20, 21, 22, 23, 36,
201 0, 38, 0, 19, 0, 47, 49, 0, 60, 0,
202 0, 40, 0, 0, 51, 44, 53, 25, 35, 0,
203 37, 0, 33, 34, 57, 61, 41, 42, 39, 0,
204 31, 27, 28, 29, 30, 0, 45, 32, 43, 0,
205 0, 0
208 static const short yydefgoto[] = { 28,
209 29, 30, 84, 31, 32, 33, 51, 34, 35, 36,
210 37, 38, 39, 40, 41, 42, 43, 100, 44, 45,
211 46, 47
214 static const short yypact[] = { 393,
215 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
216 -30, -19,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -19,
217 -19, -3,-32768,-32768,-32768, 290, 107,-32768, 425, 393,
218 -32768,-32768,-32768,-32768,-32768,-32768, -19,-32768, -19,-32768,
219 -32768,-32768,-32768, -20,-32768, 393, -21, 218, 107,-32768,
220 -19, -19, -19,-32768, -15,-32768,-32768,-32768,-32768,-32768,
221 325,-32768, 70,-32768, 360,-32768,-32768, 393, -21, 393,
222 393,-32768, 254, 144,-32768,-32768,-32768,-32768,-32768, 393,
223 -32768, -25,-32768,-32768,-32768, -31, -21, -21,-32768, 181,
224 -14,-32768,-32768,-32768,-32768, -19,-32768,-32768,-32768, 22,
225 23,-32768
228 static const short yypgoto[] = { -2,
229 -32768,-32768,-32768,-32768,-32768, -11,-32768,-32768,-32768,-32768,
230 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -33,
231 -24, -27
235 #define YYLAST 457
238 static const short yytable[] = { 50,
239 52, 61, 63, 48, 49, 65, 91, 68, 53, 54,
240 96, 92, 93, 94, 95, 49, 78, 98, 69, 70,
241 71, 101, 102, 73, 74, 66, 64, 67, 55, 56,
242 57, 58, 59, 69, 85, 69, 0, 69, 0, 75,
243 76, 77, 87, 88, 0, 69, 69, 0, 0, 0,
244 0, 0, 0, 0, 0, 90, 0, 0, 86, 0,
245 0, 0, 69, 0, 0, 0, 0, 0, 0, 0,
246 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
247 9, 10, 11, 12, 99, 80, 13, 14, 15, 16,
248 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
249 24, 25, 26, 0, 27, 0, 0, 0, 81, 1,
250 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
251 12, 0, 0, 13, 14, 15, 16, 17, 18, 19,
252 20, 21, 22, 0, 0, 23, 0, 24, 25, 26,
253 0, 27, 0, 0, 0, 62, 1, 2, 3, 4,
254 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
255 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
256 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
257 0, 0, 81, 1, 2, 3, 4, 5, 6, 7,
258 8, 9, 10, 11, 12, 0, 0, 13, 14, 15,
259 16, 17, 18, 19, 20, 21, 22, 0, 0, 23,
260 0, 24, 25, 26, 0, 27, 0, 0, 0, 97,
261 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
262 11, 12, 0, 0, 13, 14, 15, 16, 17, 18,
263 19, 20, 21, 22, 0, 0, 23, 0, 24, 25,
264 26, 0, 27, 0, 0, 72, 1, 2, 3, 4,
265 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
266 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
267 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
268 0, 89, 1, 2, 3, 4, 5, 6, 7, 8,
269 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
270 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
271 24, 25, 26, 0, 27, 0, 60, 1, 2, 3,
272 4, 5, 6, 7, 8, 9, 10, 11, 12, 0,
273 0, 13, 14, 15, 16, 17, 18, 19, 20, 21,
274 22, 0, 0, 23, 0, 24, 25, 26, 0, 27,
275 0, 79, 1, 2, 3, 4, 5, 6, 7, 8,
276 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
277 17, 18, 19, 20, 21, 22, 82, 0, 23, 83,
278 24, 25, 26, 0, 27, 1, 2, 3, 4, 5,
279 6, 7, 8, 9, 10, 11, 12, 0, 0, 13,
280 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
281 0, 23, 0, 24, 25, 26, 0, 27, 2, 3,
282 4, 5, 6, 7, 8, 9, 10, 0, 0, 0,
283 0, 13, 14, 0, 16, 17, 18, 19, 0, 0,
284 0, 0, 0, 0, 0, 24, 25
287 static const short yycheck[] = { 11,
288 12, 26, 27, 34, 35, 30, 32, 28, 20, 21,
289 42, 37, 38, 39, 40, 35, 32, 32, 46, 41,
290 42, 0, 0, 48, 49, 37, 29, 39, 32, 33,
291 34, 35, 36, 61, 68, 63, -1, 65, -1, 51,
292 52, 53, 70, 71, -1, 73, 74, -1, -1, -1,
293 -1, -1, -1, -1, -1, 80, -1, -1, 70, -1,
294 -1, -1, 90, -1, -1, -1, -1, -1, -1, -1,
295 -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
296 11, 12, 13, 14, 96, 16, 17, 18, 19, 20,
297 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
298 31, 32, 33, -1, 35, -1, -1, -1, 39, 3,
299 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
300 14, -1, -1, 17, 18, 19, 20, 21, 22, 23,
301 24, 25, 26, -1, -1, 29, -1, 31, 32, 33,
302 -1, 35, -1, -1, -1, 39, 3, 4, 5, 6,
303 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
304 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
305 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
306 -1, -1, 39, 3, 4, 5, 6, 7, 8, 9,
307 10, 11, 12, 13, 14, -1, -1, 17, 18, 19,
308 20, 21, 22, 23, 24, 25, 26, -1, -1, 29,
309 -1, 31, 32, 33, -1, 35, -1, -1, -1, 39,
310 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
311 13, 14, -1, -1, 17, 18, 19, 20, 21, 22,
312 23, 24, 25, 26, -1, -1, 29, -1, 31, 32,
313 33, -1, 35, -1, -1, 38, 3, 4, 5, 6,
314 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
315 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
316 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
317 -1, 38, 3, 4, 5, 6, 7, 8, 9, 10,
318 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
319 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
320 31, 32, 33, -1, 35, -1, 37, 3, 4, 5,
321 6, 7, 8, 9, 10, 11, 12, 13, 14, -1,
322 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
323 26, -1, -1, 29, -1, 31, 32, 33, -1, 35,
324 -1, 37, 3, 4, 5, 6, 7, 8, 9, 10,
325 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
326 21, 22, 23, 24, 25, 26, 27, -1, 29, 30,
327 31, 32, 33, -1, 35, 3, 4, 5, 6, 7,
328 8, 9, 10, 11, 12, 13, 14, -1, -1, 17,
329 18, 19, 20, 21, 22, 23, 24, 25, 26, -1,
330 -1, 29, -1, 31, 32, 33, -1, 35, 4, 5,
331 6, 7, 8, 9, 10, 11, 12, -1, -1, -1,
332 -1, 17, 18, -1, 20, 21, 22, 23, -1, -1,
333 -1, -1, -1, -1, -1, 31, 32
335 /* This file comes from bison-1.28. */
337 /* Skeleton output parser for bison,
338 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
340 This program is free software; you can redistribute it and/or modify
341 it under the terms of the GNU General Public License as published by
342 the Free Software Foundation; either version 2, or (at your option)
343 any later version.
345 This program is distributed in the hope that it will be useful,
346 but WITHOUT ANY WARRANTY; without even the implied warranty of
347 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
348 GNU General Public License for more details.
350 You should have received a copy of the GNU General Public License
351 along with this program; if not, write to the Free Software
352 Foundation, Inc., 59 Temple Place - Suite 330,
353 Boston, MA 02111-1307, USA. */
355 /* As a special exception, when this file is copied by Bison into a
356 Bison output file, you may use that output file without restriction.
357 This special exception was added by the Free Software Foundation
358 in version 1.24 of Bison. */
360 /* This is the parser code that is written into each bison parser
361 when the %semantic_parser declaration is not specified in the grammar.
362 It was written by Richard Stallman by simplifying the hairy parser
363 used when %semantic_parser is specified. */
365 #ifndef YYSTACK_USE_ALLOCA
366 #ifdef alloca
367 #define YYSTACK_USE_ALLOCA
368 #else /* alloca not defined */
369 #ifdef __GNUC__
370 #define YYSTACK_USE_ALLOCA
371 #define alloca __builtin_alloca
372 #else /* not GNU C. */
373 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || (defined (__sun) && defined (__i386))
374 #define YYSTACK_USE_ALLOCA
375 #include <sal/alloca.h>
376 #else /* not sparc */
377 #if defined(_AIX)
378 #pragma alloca
379 #define YYSTACK_USE_ALLOCA
380 #endif /* not _AIX */
381 #endif /* not sparc */
382 #endif /* not GNU C */
383 #endif /* alloca not defined */
384 #endif /* YYSTACK_USE_ALLOCA not defined */
386 #ifdef YYSTACK_USE_ALLOCA
387 #define YYSTACK_ALLOC alloca
388 #else
389 #define YYSTACK_ALLOC malloc
390 #endif
392 /* Note: there must be only one dollar sign in this file.
393 It is replaced by the list of actions, each action
394 as one case of the switch. */
396 #define YYEMPTY -2
397 #define YYEOF 0
398 #define YYACCEPT goto yyacceptlab
399 #define YYABORT goto yyabortlab
401 #define YYTERROR 1
403 #ifndef YYPURE
404 #define YYLEX yylex()
405 #endif
407 #ifdef YYPURE
408 #ifdef YYLSP_NEEDED
409 #ifdef YYLEX_PARAM
410 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
411 #else
412 #define YYLEX yylex(&yylval, &yylloc)
413 #endif
414 #else /* not YYLSP_NEEDED */
415 #ifdef YYLEX_PARAM
416 #define YYLEX yylex(&yylval, YYLEX_PARAM)
417 #else
418 #define YYLEX yylex(&yylval)
419 #endif
420 #endif /* not YYLSP_NEEDED */
421 #endif
423 /* If nonreentrant, generate the variables here */
425 #ifndef YYPURE
427 int yychar; /* the lookahead symbol */
428 YYSTYPE yylval; /* the semantic value of the */
429 /* lookahead symbol */
431 #ifdef YYLSP_NEEDED
432 YYLTYPE yylloc; /* location data for the lookahead */
433 /* symbol */
434 #endif
436 int yynerrs; /* number of parse errors so far */
437 #endif /* not YYPURE */
439 #if YYDEBUG != 0
440 int yydebug; /* nonzero means print parse trace */
441 /* Since this is uninitialized, it does not stop multiple parsers
442 from coexisting. */
443 #endif
445 /* YYINITDEPTH indicates the initial size of the parser's stacks */
447 #ifndef YYINITDEPTH
448 #define YYINITDEPTH 200
449 #endif
451 /* YYMAXDEPTH is the maximum size the stacks can grow to
452 (effective only if the built-in stack extension method is used). */
454 #if YYMAXDEPTH == 0
455 #undef YYMAXDEPTH
456 #endif
458 #ifndef YYMAXDEPTH
459 #define YYMAXDEPTH 10000
460 #endif
462 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
463 into yyparse. The argument should have type void *.
464 It should actually point to an object.
465 Grammar actions can access the variable by casting it
466 to the proper pointer type. */
468 #ifdef YYPARSE_PARAM
469 #ifdef __cplusplus
470 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
471 #define YYPARSE_PARAM_DECL
472 #else /* not __cplusplus */
473 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
474 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
475 #endif /* not __cplusplus */
476 #else /* not YYPARSE_PARAM */
477 #define YYPARSE_PARAM_ARG
478 #define YYPARSE_PARAM_DECL
479 #endif /* not YYPARSE_PARAM */
481 /* Prevent warning if -Wstrict-prototypes. */
482 #ifdef __GNUC__
483 #ifdef YYPARSE_PARAM
484 int yyparse (void *);
485 #else
486 int yyparse();
487 #endif
488 #endif
491 yyparse(YYPARSE_PARAM_ARG)
492 YYPARSE_PARAM_DECL
494 int yystate;
495 int yyn;
496 short *yyssp;
497 YYSTYPE *yyvsp;
498 int yyerrstatus; /* number of tokens to shift before error messages enabled */
499 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
501 short yyssa[YYINITDEPTH]; /* the state stack */
502 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
504 short *yyss = yyssa; /* refer to the stacks through separate pointers */
505 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
507 #ifdef YYLSP_NEEDED
508 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
509 YYLTYPE *yyls = yylsa;
510 YYLTYPE *yylsp;
512 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
513 #endif
515 int yystacksize = YYINITDEPTH;
516 int yyfree_stacks = 0;
518 #ifdef YYPURE
519 int yychar;
520 YYSTYPE yylval;
521 int yynerrs;
522 #ifdef YYLSP_NEEDED
523 YYLTYPE yylloc;
524 #endif
525 #endif
527 YYSTYPE yyval; /* the variable used to return */
528 yyval.dval = 0;
529 /* semantic values from the action */
530 /* routines */
532 int yylen;
534 #if YYDEBUG != 0
535 if (yydebug)
536 fprintf(stderr, "Starting parse\n");
537 #endif
539 yystate = 0;
540 yyerrstatus = 0;
541 yynerrs = 0;
542 yychar = YYEMPTY; /* Cause a token to be read. */
544 /* Initialize stack pointers.
545 Waste one element of value and location stack
546 so that they stay on the same level as the state stack.
547 The wasted elements are never initialized. */
549 yyssp = yyss - 1;
550 yyvsp = yyvs;
551 #ifdef YYLSP_NEEDED
552 yylsp = yyls;
553 #endif
555 /* Push a new state, which is found in yystate . */
556 /* In all cases, when you get here, the value and location stacks
557 have just been pushed. so pushing a state here evens the stacks. */
558 yynewstate:
560 *++yyssp = sal::static_int_cast<short>(yystate);
562 if (yyssp >= yyss + yystacksize - 1)
564 /* Give user a chance to reallocate the stack */
565 /* Use copies of these so that the &'s don't force the real ones into memory. */
566 YYSTYPE *yyvs1 = yyvs;
567 short *yyss1 = yyss;
568 #ifdef YYLSP_NEEDED
569 YYLTYPE *yyls1 = yyls;
570 #endif
572 /* Get the current used size of the three stacks, in elements. */
573 int size = yyssp - yyss + 1;
575 #ifdef yyoverflow
576 /* Each stack pointer address is followed by the size of
577 the data in use in that stack, in bytes. */
578 #ifdef YYLSP_NEEDED
579 /* This used to be a conditional around just the two extra args,
580 but that might be undefined if yyoverflow is a macro. */
581 yyoverflow("parser stack overflow",
582 &yyss1, size * sizeof (*yyssp),
583 &yyvs1, size * sizeof (*yyvsp),
584 &yyls1, size * sizeof (*yylsp),
585 &yystacksize);
586 #else
587 yyoverflow("parser stack overflow",
588 &yyss1, size * sizeof (*yyssp),
589 &yyvs1, size * sizeof (*yyvsp),
590 &yystacksize);
591 #endif
593 yyss = yyss1; yyvs = yyvs1;
594 #ifdef YYLSP_NEEDED
595 yyls = yyls1;
596 #endif
597 #else /* no yyoverflow */
598 /* Extend the stack our own way. */
599 if (yystacksize >= YYMAXDEPTH)
601 yyerror("parser stack overflow");
602 if (yyfree_stacks)
604 free (yyss);
605 free (yyvs);
606 #ifdef YYLSP_NEEDED
607 free (yyls);
608 #endif
610 return 2;
612 yystacksize *= 2;
613 if (yystacksize > YYMAXDEPTH)
614 yystacksize = YYMAXDEPTH;
615 #ifndef YYSTACK_USE_ALLOCA
616 yyfree_stacks = 1;
617 #endif
618 yyss = static_cast<short *>(YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)));
619 memcpy (yyss, yyss1,
620 size * (unsigned int) sizeof (*yyssp));
621 yyvs = static_cast<YYSTYPE *>(YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)));
622 memcpy (yyvs, yyvs1,
623 size * (unsigned int) sizeof (*yyvsp));
624 #ifdef YYLSP_NEEDED
625 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
626 memcpy ((char *)yyls, (char *)yyls1,
627 size * (unsigned int) sizeof (*yylsp));
628 #endif
629 #endif /* no yyoverflow */
631 yyssp = yyss + size - 1;
632 yyvsp = yyvs + size - 1;
633 #ifdef YYLSP_NEEDED
634 yylsp = yyls + size - 1;
635 #endif
637 #if YYDEBUG != 0
638 if (yydebug)
639 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
640 #endif
642 if (yyssp >= yyss + yystacksize - 1)
643 YYABORT;
646 #if YYDEBUG != 0
647 if (yydebug)
648 fprintf(stderr, "Entering state %d\n", yystate);
649 #endif
651 goto yybackup;
652 yybackup:
654 /* Do appropriate processing given the current state. */
655 /* Read a lookahead token if we need one and don't already have one. */
656 /* yyresume: */
658 /* First try to decide what to do without reference to lookahead token. */
660 yyn = yypact[yystate];
661 if (yyn == YYFLAG)
662 goto yydefault;
664 /* Not known => get a lookahead token if don't already have one. */
666 /* yychar is either YYEMPTY or YYEOF
667 or a valid token in external form. */
669 if (yychar == YYEMPTY)
671 #if YYDEBUG != 0
672 if (yydebug)
673 fprintf(stderr, "Reading a token: ");
674 #endif
675 yychar = YYLEX;
678 /* Convert token to internal form (in yychar1) for indexing tables with */
680 if (yychar <= 0) /* This means end of input. */
682 yychar1 = 0;
683 yychar = YYEOF; /* Don't call YYLEX any more */
685 #if YYDEBUG != 0
686 if (yydebug)
687 fprintf(stderr, "Now at end of input.\n");
688 #endif
690 else
692 yychar1 = YYTRANSLATE(yychar);
694 #if YYDEBUG != 0
695 if (yydebug)
697 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
698 /* Give the individual parser a way to print the precise meaning
699 of a token, for further debugging info. */
700 #ifdef YYPRINT
701 YYPRINT (stderr, yychar, yylval);
702 #endif
703 fprintf (stderr, ")\n");
705 #endif
708 yyn += yychar1;
709 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
710 goto yydefault;
712 yyn = yytable[yyn];
714 /* yyn is what to do for this token type in this state.
715 Negative => reduce, -yyn is rule number.
716 Positive => shift, yyn is new state.
717 New state is final state => don't bother to shift,
718 just return success.
719 0, or most negative number => error. */
721 if (yyn < 0)
723 if (yyn == YYFLAG)
724 goto yyerrlab;
725 yyn = -yyn;
726 goto yyreduce;
728 else if (yyn == 0)
729 goto yyerrlab;
731 if (yyn == YYFINAL)
732 YYACCEPT;
734 /* Shift the lookahead token. */
736 #if YYDEBUG != 0
737 if (yydebug)
738 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
739 #endif
741 /* Discard the token being shifted unless it is eof. */
742 if (yychar != YYEOF)
743 yychar = YYEMPTY;
745 *++yyvsp = yylval;
746 #ifdef YYLSP_NEEDED
747 *++yylsp = yylloc;
748 #endif
750 /* count tokens shifted since error; after three, turn off error status. */
751 if (yyerrstatus) yyerrstatus--;
753 yystate = yyn;
754 goto yynewstate;
756 /* Do the default action for the current state. */
757 yydefault:
759 yyn = yydefact[yystate];
760 if (yyn == 0)
761 goto yyerrlab;
763 /* Do a reduction. yyn is the number of a rule to reduce with. */
764 yyreduce:
765 yylen = yyr2[yyn];
766 if (yylen > 0)
767 yyval = yyvsp[1-yylen]; /* implement default value of the action */
769 #if YYDEBUG != 0
770 if (yydebug)
772 int i;
774 fprintf (stderr, "Reducing via rule %d (line %d), ",
775 yyn, yyrline[yyn]);
777 /* Print the symbols being reduced, and their result. */
778 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
779 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
780 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
782 #endif
785 switch (yyn) {
787 case 1:
788 { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
789 break;}
790 case 2:
791 { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
792 break;}
793 case 3:
794 { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
795 break;}
796 case 4:
797 { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
798 break;}
799 case 5:
800 { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
801 break;}
802 case 6:
803 { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
804 break;}
805 case 7:
806 { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
807 break;}
808 case 8:
809 { yyval.ptr = new Node(ID_CHARACTER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
810 break;}
811 case 9:
812 { yyval.ptr = new Node(ID_OPERATOR); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
813 break;}
814 case 10:
815 { yyval.ptr = new Node(ID_OPERATOR); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
816 break;}
817 case 11:
818 { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
819 break;}
820 case 12:
821 { yyval.ptr = new Node(ID_DELIMETER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
822 break;}
823 case 13:
824 { yyval.ptr = new Node(ID_DELIMETER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
825 break;}
826 case 14:
827 { yyval.ptr = new Node(ID_IDENTIFIER); yyval.ptr->value = strdup(yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
828 break;}
829 case 15:
830 { yyval.ptr = new Node(ID_CHARACTER); yyval.ptr->value = strdup("|"); debug("Identifier : '|'\n"); nodelist.push_back(yyval.ptr); ;
831 break;}
832 case 16:
833 { yyval.ptr = new Node(ID_NUMBER); yyval.ptr->value = strdup(yyvsp[0].dval); debug("Number : %s\n",yyvsp[0].dval); nodelist.push_back(yyval.ptr); ;
834 break;}
835 case 17:
836 { yyval.ptr = new Node(ID_STRING); yyval.ptr->value = strdup(yyvsp[0].str); debug("String : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
837 break;}
838 case 18:
839 { yyval.ptr = new Node(ID_PRIMARYEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("PrimaryExpr\n"); nodelist.push_back(yyval.ptr); ;
840 break;}
841 case 19:
842 { 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); ;
843 break;}
844 case 20:
845 { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("("); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
846 break;}
847 case 21:
848 { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("["); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
849 break;}
850 case 22:
851 { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("{"); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
852 break;}
853 case 23:
854 { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("<"); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
855 break;}
856 case 24:
857 { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup("|"); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
858 break;}
859 case 25:
860 { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value =strdup("||"); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
861 break;}
862 case 26:
863 { yyval.ptr = new Node(ID_LEFT); yyval.ptr->value = strdup(yyvsp[0].str); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
864 break;}
865 case 27:
866 { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup(")"); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
867 break;}
868 case 28:
869 { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("]"); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
870 break;}
871 case 29:
872 { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("}"); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
873 break;}
874 case 30:
875 { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup(">"); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
876 break;}
877 case 31:
878 { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("|"); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
879 break;}
880 case 32:
881 { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup("||"); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
882 break;}
883 case 33:
884 { yyval.ptr = new Node(ID_RIGHT); yyval.ptr->value = strdup(yyvsp[0].str); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
885 break;}
886 case 34:
887 { 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); ;
888 break;}
889 case 35:
890 { yyval.ptr = new Node(ID_PARENTH); yyval.ptr->child = yyvsp[-1].ptr; debug("Parenth: '(' ExprList ')' \n"); nodelist.push_back(yyval.ptr); ;
891 break;}
892 case 36:
893 { yyval.ptr = new Node(ID_PARENTH); debug("Parenth: '(' ')' \n"); nodelist.push_back(yyval.ptr); ;
894 break;}
895 case 37:
896 { yyval.ptr = new Node(ID_BLOCK); yyval.ptr->child = yyvsp[-1].ptr; debug("Block: '{' ExprList '}' \n"); nodelist.push_back(yyval.ptr); ;
897 break;}
898 case 38:
899 { yyval.ptr = new Node(ID_BLOCK); debug("Block: '{' '}' \n"); nodelist.push_back(yyval.ptr); ;
900 break;}
901 case 39:
902 { yyval.ptr = new Node(ID_BRACKET); yyval.ptr->child = yyvsp[-1].ptr; debug("Bracket \n"); nodelist.push_back(yyval.ptr); ;
903 break;}
904 case 40:
905 { yyval.ptr = new Node(ID_BRACKET); debug("Bracket \n"); nodelist.push_back(yyval.ptr); ;
906 break;}
907 case 41:
908 { 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); ;
909 break;}
910 case 42:
911 { 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); ;
912 break;}
913 case 43:
914 { 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); ;
915 break;}
916 case 44:
917 { 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); ;
918 break;}
919 case 45:
920 { 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); ;
921 break;}
922 case 46:
923 { yyval.ptr = new Node(ID_ACCENTEXPR); yyval.ptr->value = strdup(yyvsp[0].str); debug("Accent : %s\n", yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
924 break;}
925 case 47:
926 { 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); ;
927 break;}
928 case 48:
929 { yyval.ptr = new Node(ID_DECORATIONEXPR); yyval.ptr->value = strdup(yyvsp[0].str); debug("Decoration : %s\n", yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
930 break;}
931 case 49:
932 { 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); ;
933 break;}
934 case 50:
935 { yyval.ptr = new Node(ID_SQRTEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("RootExpr : %s\n", yyvsp[-1].str); nodelist.push_back(yyval.ptr); ;
936 break;}
937 case 51:
938 { 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); ;
939 break;}
940 case 52:
941 { yyval.ptr = new Node(ID_BEGIN); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("BeginExpr\n"); ;
942 break;}
943 case 53:
944 { 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"); ;
945 break;}
946 case 54:
947 { yyval.ptr = new Node(ID_END); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("EndExpr\n"); ;
948 break;}
949 case 55:
950 { yyval.ptr = new Node(ID_MATHML); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); top = yyval.ptr; debug("MathML\n"); ;
951 break;}
952 case 56:
953 { yyval.ptr = new Node(ID_LINES); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("Lines\n"); ;
954 break;}
955 case 57:
956 { 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"); ;
957 break;}
958 case 58:
959 { yyval.ptr = new Node(ID_LINE); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("Line\n"); ;
960 break;}
961 case 59:
962 { yyval.ptr = new Node(ID_EXPRLIST); yyval.ptr->child = yyvsp[0].ptr; debug("ExprList : Expr\n"); nodelist.push_back(yyval.ptr); ;
963 break;}
964 case 60:
965 { 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); ;
966 break;}
967 case 61:
968 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Block\n"); nodelist.push_back(yyval.ptr);;
969 break;}
970 case 62:
971 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Parenth\n"); nodelist.push_back(yyval.ptr);;
972 break;}
973 case 63:
974 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Fence\n"); nodelist.push_back(yyval.ptr);;
975 break;}
976 case 64:
977 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : SubSupExpr\n"); nodelist.push_back(yyval.ptr);;
978 break;}
979 case 65:
980 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : FractionExpr\n"); nodelist.push_back(yyval.ptr);;
981 break;}
982 case 66:
983 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : OverExpr\n"); nodelist.push_back(yyval.ptr);;
984 break;}
985 case 67:
986 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : DecorationExpr\n"); nodelist.push_back(yyval.ptr);;
987 break;}
988 case 68:
989 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : RootExpr\n"); nodelist.push_back(yyval.ptr);;
990 break;}
991 case 69:
992 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : AccentExpr\n"); nodelist.push_back(yyval.ptr);;
993 break;}
994 case 70:
995 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : PrimaryExpr\n"); nodelist.push_back(yyval.ptr);;
996 break;}
997 case 71:
998 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : BeginExpr\n"); nodelist.push_back(yyval.ptr);;
999 break;}
1000 case 72:
1001 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : EndExpr\n"); nodelist.push_back(yyval.ptr);;
1002 break;}
1004 /* the action file gets copied in place of this dollarsign */
1006 yyvsp -= yylen;
1007 yyssp -= yylen;
1008 #ifdef YYLSP_NEEDED
1009 yylsp -= yylen;
1010 #endif
1012 #if YYDEBUG != 0
1013 if (yydebug)
1015 short *ssp1 = yyss - 1;
1016 fprintf (stderr, "state stack now");
1017 while (ssp1 != yyssp)
1018 fprintf (stderr, " %d", *++ssp1);
1019 fprintf (stderr, "\n");
1021 #endif
1023 *++yyvsp = yyval;
1025 #ifdef YYLSP_NEEDED
1026 yylsp++;
1027 if (yylen == 0)
1029 yylsp->first_line = yylloc.first_line;
1030 yylsp->first_column = yylloc.first_column;
1031 yylsp->last_line = (yylsp-1)->last_line;
1032 yylsp->last_column = (yylsp-1)->last_column;
1033 yylsp->text = 0;
1035 else
1037 yylsp->last_line = (yylsp+yylen-1)->last_line;
1038 yylsp->last_column = (yylsp+yylen-1)->last_column;
1040 #endif
1042 /* Now "shift" the result of the reduction.
1043 Determine what state that goes to,
1044 based on the state we popped back to
1045 and the rule number reduced by. */
1047 yyn = yyr1[yyn];
1049 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1050 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1051 yystate = yytable[yystate];
1052 else
1053 yystate = yydefgoto[yyn - YYNTBASE];
1055 goto yynewstate;
1057 yyerrlab: /* here on detecting error */
1059 if (! yyerrstatus)
1060 /* If not already recovering from an error, report this error. */
1062 ++yynerrs;
1064 #ifdef YYERROR_VERBOSE
1065 yyn = yypact[yystate];
1067 if (yyn > YYFLAG && yyn < YYLAST)
1069 int size = 0;
1070 char *msg;
1071 int x, count;
1073 count = 0;
1074 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1075 for (x = ((yyn < 0) ? -yyn : 0);
1076 x < (sizeof(yytname) / sizeof(char *)); x++)
1077 if (yycheck[x + yyn] == x)
1078 size += strlen(yytname[x]) + 15, count++;
1079 msg = (char *) malloc(size + 15);
1080 if (msg != 0)
1082 strcpy(msg, "parse error");
1084 if (count < 5)
1086 count = 0;
1087 for (x = ((yyn < 0) ? -yyn : 0);
1088 x < (sizeof(yytname) / sizeof(char *)); x++)
1089 if (yycheck[x + yyn] == x)
1091 strcat(msg, count == 0 ? ", expecting `" : " or `");
1092 strcat(msg, yytname[x]);
1093 strcat(msg, "'");
1094 count++;
1097 yyerror(msg);
1098 free(msg);
1100 else
1101 yyerror ("parse error; also virtual memory exceeded");
1103 else
1104 #endif /* YYERROR_VERBOSE */
1105 yyerror("parse error");
1108 goto yyerrlab1;
1109 yyerrlab1: /* here on error raised explicitly by an action */
1111 if (yyerrstatus == 3)
1113 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1115 /* return failure if at end of input */
1116 if (yychar == YYEOF)
1117 YYABORT;
1119 #if YYDEBUG != 0
1120 if (yydebug)
1121 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1122 #endif
1124 yychar = YYEMPTY;
1127 /* Else will try to reuse lookahead token
1128 after shifting the error token. */
1130 yyerrstatus = 3; /* Each real token shifted decrements this */
1132 goto yyerrhandle;
1134 yyerrdefault: /* current state does not do anything special for the error token. */
1136 #if 0
1137 /* This is wrong; only states that explicitly want error tokens
1138 should shift them. */
1139 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1140 if (yyn) goto yydefault;
1141 #endif
1143 yyerrpop: /* pop the current state because it cannot handle the error token */
1145 if (yyssp == yyss) YYABORT;
1146 yyvsp--;
1147 yystate = *--yyssp;
1148 #ifdef YYLSP_NEEDED
1149 yylsp--;
1150 #endif
1152 #if YYDEBUG != 0
1153 if (yydebug)
1155 short *ssp1 = yyss - 1;
1156 fprintf (stderr, "Error: state stack now");
1157 while (ssp1 != yyssp)
1158 fprintf (stderr, " %d", *++ssp1);
1159 fprintf (stderr, "\n");
1161 #endif
1163 yyerrhandle:
1165 yyn = yypact[yystate];
1166 if (yyn == YYFLAG)
1167 goto yyerrdefault;
1169 yyn += YYTERROR;
1170 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1171 goto yyerrdefault;
1173 yyn = yytable[yyn];
1174 if (yyn < 0)
1176 if (yyn == YYFLAG)
1177 goto yyerrpop;
1178 yyn = -yyn;
1179 goto yyreduce;
1181 else if (yyn == 0)
1182 goto yyerrpop;
1184 if (yyn == YYFINAL)
1185 YYACCEPT;
1187 #if YYDEBUG != 0
1188 if (yydebug)
1189 fprintf(stderr, "Shifting error token, ");
1190 #endif
1192 *++yyvsp = yylval;
1193 #ifdef YYLSP_NEEDED
1194 *++yylsp = yylloc;
1195 #endif
1197 yystate = yyn;
1198 goto yynewstate;
1200 yyacceptlab:
1201 /* YYACCEPT comes here. */
1202 if (yyfree_stacks)
1204 free (yyss);
1205 free (yyvs);
1206 #ifdef YYLSP_NEEDED
1207 free (yyls);
1208 #endif
1210 return 0;
1212 yyabortlab:
1213 /* YYABORT comes here. */
1214 if (yyfree_stacks)
1216 free (yyss);
1217 free (yyvs);
1218 #ifdef YYLSP_NEEDED
1219 free (yyls);
1220 #endif
1222 return 1;
1226 Node *mainParse(const char *_code)
1228 initFlex( _code );
1229 top = 0L;
1230 yyparse();
1231 if( top )
1232 return top;
1233 else
1234 return 0L;
1237 void yyerror(const char * /*err*/)
1239 // printf("REALKING ERR[%s]\n",err);
1240 // if error, delete all nodes.
1241 Node *pNode = 0L;
1242 int ncount = nodelist.size();
1243 for( int i = 0 ; i < ncount ; i++){
1244 pNode = nodelist.front();
1245 nodelist.pop_front();
1246 delete pNode;
1248 top = 0L;
1251 #ifndef PARSE_DEBUG
1252 int debug(const char * /*format*/, ...)
1254 return 0;
1256 #endif
1258 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */