Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / hwpfilter / source / grammar.cxx
blob1b76cbbf509be8cde313b8c90b7787e9bfa49ce6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 /* A Bison parser, made from grammar.y
31 by GNU Bison version 1.28 */
33 #define YYBISON 1 /* Identify Bison output. */
35 #ifndef YYDEBUG
36 #define YYDEBUG 0
37 #endif
38 #ifndef YYMAXDEPTH
39 #define YYMAXDEPTH 0
40 #endif
42 #define ACCENT 257
43 #define SMALL_GREEK 258
44 #define CAPITAL_GREEK 259
45 #define BINARY_OPERATOR 260
46 #define RELATION_OPERATOR 261
47 #define ARROW 262
48 #define GENERAL_IDEN 263
49 #define GENERAL_OPER 264
50 #define BIG_SYMBOL 265
51 #define FUNCTION 266
52 #define ROOT 267
53 #define FRACTION 268
54 #define SUBSUP 269
55 #define EQOVER 270
56 #define DELIMETER 271
57 #define LARGE_DELIM 272
58 #define DECORATION 273
59 #define SPACE_SYMBOL 274
60 #define CHARACTER 275
61 #define STRING 276
62 #define OPERATOR 277
63 #define EQBEGIN 278
64 #define EQEND 279
65 #define EQLEFT 280
66 #define EQRIGHT 281
67 #define NEWLINE 282
68 #define LEFT_DELIM 283
69 #define RIGHT_DELIM 284
70 #define DIGIT 285
72 #line 1 "grammar.y"
74 #include <list>
75 #include <stdlib.h>
76 #include <string.h>
78 #include "nodes.h"
80 std::list<Node*> nodelist;
82 Node *mainParse(const char *_code);
83 void yyerror(const char *);
84 int yylex();
85 void initFlex( const char *s );
86 void viewResult(Node *res);
88 Node *top=0L;
90 int Node::count = 0;
92 #define allocValue(x,y) \
93 x = (char *)malloc( strlen(y) +1 ); \
94 strcpy(x,y)
96 #define allocChar(x,y) \
97 x = (char *)malloc(2); \
98 sprintf(x,"%c",y)
99 #ifdef PARSE_DEBUG
100 #define debug printf
101 #else
102 int debug(const char *format, ...);
103 #endif
106 #line 35 "grammar.y"
107 typedef union {
108 char *dval;
109 char *str;
110 Node *ptr;
111 } YYSTYPE;
112 #include <stdio.h>
114 #ifndef __cplusplus
115 #ifndef __STDC__
116 #define const
117 #endif
118 #endif
122 #define YYFINAL 102
123 #define YYFLAG -32768
124 #define YYNTBASE 43
126 #define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 66)
128 static const char yytranslate[] = { 0,
129 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
130 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
131 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
132 2, 2, 2, 2, 2, 2, 2, 2, 2, 33,
133 37, 2, 2, 2, 2, 2, 2, 2, 2, 2,
134 2, 2, 2, 2, 2, 2, 2, 2, 2, 36,
135 2, 40, 2, 2, 2, 2, 2, 2, 2, 2,
136 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
137 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
138 34, 2, 38, 42, 41, 2, 2, 2, 2, 2,
139 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
140 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
141 2, 2, 35, 32, 39, 2, 2, 2, 2, 2,
142 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
143 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
144 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
145 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
146 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
147 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
148 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
149 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
150 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
151 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
152 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
153 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
154 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
155 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
156 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
157 27, 28, 29, 30, 31
160 #if YYDEBUG != 0
161 static const short yyprhs[] = { 0,
162 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
163 20, 22, 24, 26, 28, 30, 32, 34, 36, 39,
164 42, 45, 48, 51, 54, 58, 60, 63, 66, 69,
165 72, 75, 79, 81, 85, 89, 92, 96, 99, 103,
166 106, 110, 114, 120, 124, 130, 132, 135, 137, 140,
167 143, 147, 150, 154, 157, 159, 161, 165, 167, 169,
168 172, 174, 176, 178, 180, 182, 184, 186, 188, 190,
169 192, 194
172 static const short yyrhs[] = { 4,
173 0, 9, 0, 10, 0, 5, 0, 11, 0, 12,
174 0, 20, 0, 21, 0, 7, 0, 6, 0, 23,
175 0, 17, 0, 18, 0, 8, 0, 32, 0, 31,
176 0, 22, 0, 43, 0, 44, 43, 0, 26, 33,
177 0, 26, 34, 0, 26, 35, 0, 26, 36, 0,
178 26, 32, 0, 26, 32, 32, 0, 29, 0, 27,
179 37, 0, 27, 38, 0, 27, 39, 0, 27, 40,
180 0, 27, 32, 0, 27, 32, 32, 0, 30, 0,
181 45, 64, 46, 0, 33, 64, 37, 0, 33, 37,
182 0, 35, 64, 39, 0, 35, 39, 0, 34, 64,
183 38, 0, 34, 38, 0, 65, 41, 65, 0, 65,
184 42, 65, 0, 65, 41, 49, 42, 49, 0, 14,
185 49, 49, 0, 35, 64, 16, 64, 39, 0, 3,
186 0, 54, 49, 0, 19, 0, 56, 49, 0, 13,
187 49, 0, 13, 50, 49, 0, 24, 49, 0, 24,
188 49, 49, 0, 25, 49, 0, 62, 0, 63, 0,
189 62, 28, 63, 0, 64, 0, 65, 0, 64, 65,
190 0, 49, 0, 48, 0, 47, 0, 51, 0, 52,
191 0, 53, 0, 57, 0, 58, 0, 55, 0, 44,
192 0, 59, 0, 60, 0
195 #endif
197 #if YYDEBUG != 0
198 static const short yyrline[] = { 0,
199 59, 61, 62, 63, 64, 65, 66, 67, 68, 69,
200 70, 71, 72, 73, 74, 75, 76, 79, 81, 84,
201 86, 87, 88, 89, 90, 91, 94, 96, 97, 98,
202 99, 100, 101, 104, 108, 110, 113, 115, 118, 120,
203 123, 125, 126, 129, 133, 138, 142, 145, 149, 153,
204 155, 158, 160, 163, 168, 172, 174, 177, 181, 183,
205 186, 188, 189, 190, 191, 192, 193, 194, 195, 196,
206 197, 198
208 #endif
211 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
213 static const char * const yytname[] = { "$","error","$undefined.","ACCENT",
214 "SMALL_GREEK","CAPITAL_GREEK","BINARY_OPERATOR","RELATION_OPERATOR","ARROW",
215 "GENERAL_IDEN","GENERAL_OPER","BIG_SYMBOL","FUNCTION","ROOT","FRACTION","SUBSUP",
216 "EQOVER","DELIMETER","LARGE_DELIM","DECORATION","SPACE_SYMBOL","CHARACTER","STRING",
217 "OPERATOR","EQBEGIN","EQEND","EQLEFT","EQRIGHT","NEWLINE","LEFT_DELIM","RIGHT_DELIM",
218 "DIGIT","'|'","'('","'['","'{'","'<'","')'","']'","'}'","'>'","'_'","'^'","Identifier",
219 "PrimaryExpr","EQLeft","EQRight","Fence","Parenth","Block","Bracket","SubSupExpr",
220 "FractionExpr","OverExpr","Accent","AccentExpr","Decoration","DecorationExpr",
221 "RootExpr","BeginExpr","EndExpr","MathML","Lines","Line","ExprList","Expr", NULL
223 #endif
225 static const short yyr1[] = { 0,
226 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
227 43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
228 45, 45, 45, 45, 45, 45, 46, 46, 46, 46,
229 46, 46, 46, 47, 48, 48, 49, 49, 50, 50,
230 51, 51, 51, 52, 53, 54, 55, 56, 57, 58,
231 58, 59, 59, 60, 61, 62, 62, 63, 64, 64,
232 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
233 65, 65
236 static const short yyr2[] = { 0,
237 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
238 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
239 2, 2, 2, 2, 3, 1, 2, 2, 2, 2,
240 2, 3, 1, 3, 3, 2, 3, 2, 3, 2,
241 3, 3, 5, 3, 5, 1, 2, 1, 2, 2,
242 3, 2, 3, 2, 1, 1, 3, 1, 1, 2,
243 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
244 1, 1
247 static const short yydefact[] = { 0,
248 46, 1, 4, 10, 9, 14, 2, 3, 5, 6,
249 0, 0, 12, 13, 48, 7, 8, 17, 11, 0,
250 0, 0, 26, 16, 15, 0, 0, 18, 70, 0,
251 63, 62, 61, 64, 65, 66, 0, 69, 0, 67,
252 68, 71, 72, 55, 56, 58, 59, 0, 0, 50,
253 0, 0, 52, 54, 24, 20, 21, 22, 23, 36,
254 0, 38, 0, 19, 0, 47, 49, 0, 60, 0,
255 0, 40, 0, 0, 51, 44, 53, 25, 35, 0,
256 37, 0, 33, 34, 57, 61, 41, 42, 39, 0,
257 31, 27, 28, 29, 30, 0, 45, 32, 43, 0,
258 0, 0
261 static const short yydefgoto[] = { 28,
262 29, 30, 84, 31, 32, 33, 51, 34, 35, 36,
263 37, 38, 39, 40, 41, 42, 43, 100, 44, 45,
264 46, 47
267 static const short yypact[] = { 393,
268 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
269 -30, -19,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -19,
270 -19, -3,-32768,-32768,-32768, 290, 107,-32768, 425, 393,
271 -32768,-32768,-32768,-32768,-32768,-32768, -19,-32768, -19,-32768,
272 -32768,-32768,-32768, -20,-32768, 393, -21, 218, 107,-32768,
273 -19, -19, -19,-32768, -15,-32768,-32768,-32768,-32768,-32768,
274 325,-32768, 70,-32768, 360,-32768,-32768, 393, -21, 393,
275 393,-32768, 254, 144,-32768,-32768,-32768,-32768,-32768, 393,
276 -32768, -25,-32768,-32768,-32768, -31, -21, -21,-32768, 181,
277 -14,-32768,-32768,-32768,-32768, -19,-32768,-32768,-32768, 22,
278 23,-32768
281 static const short yypgoto[] = { -2,
282 -32768,-32768,-32768,-32768,-32768, -11,-32768,-32768,-32768,-32768,
283 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -33,
284 -24, -27
288 #define YYLAST 457
291 static const short yytable[] = { 50,
292 52, 61, 63, 48, 49, 65, 91, 68, 53, 54,
293 96, 92, 93, 94, 95, 49, 78, 98, 69, 70,
294 71, 101, 102, 73, 74, 66, 64, 67, 55, 56,
295 57, 58, 59, 69, 85, 69, 0, 69, 0, 75,
296 76, 77, 87, 88, 0, 69, 69, 0, 0, 0,
297 0, 0, 0, 0, 0, 90, 0, 0, 86, 0,
298 0, 0, 69, 0, 0, 0, 0, 0, 0, 0,
299 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
300 9, 10, 11, 12, 99, 80, 13, 14, 15, 16,
301 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
302 24, 25, 26, 0, 27, 0, 0, 0, 81, 1,
303 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
304 12, 0, 0, 13, 14, 15, 16, 17, 18, 19,
305 20, 21, 22, 0, 0, 23, 0, 24, 25, 26,
306 0, 27, 0, 0, 0, 62, 1, 2, 3, 4,
307 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
308 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
309 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
310 0, 0, 81, 1, 2, 3, 4, 5, 6, 7,
311 8, 9, 10, 11, 12, 0, 0, 13, 14, 15,
312 16, 17, 18, 19, 20, 21, 22, 0, 0, 23,
313 0, 24, 25, 26, 0, 27, 0, 0, 0, 97,
314 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
315 11, 12, 0, 0, 13, 14, 15, 16, 17, 18,
316 19, 20, 21, 22, 0, 0, 23, 0, 24, 25,
317 26, 0, 27, 0, 0, 72, 1, 2, 3, 4,
318 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
319 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
320 0, 0, 23, 0, 24, 25, 26, 0, 27, 0,
321 0, 89, 1, 2, 3, 4, 5, 6, 7, 8,
322 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
323 17, 18, 19, 20, 21, 22, 0, 0, 23, 0,
324 24, 25, 26, 0, 27, 0, 60, 1, 2, 3,
325 4, 5, 6, 7, 8, 9, 10, 11, 12, 0,
326 0, 13, 14, 15, 16, 17, 18, 19, 20, 21,
327 22, 0, 0, 23, 0, 24, 25, 26, 0, 27,
328 0, 79, 1, 2, 3, 4, 5, 6, 7, 8,
329 9, 10, 11, 12, 0, 0, 13, 14, 15, 16,
330 17, 18, 19, 20, 21, 22, 82, 0, 23, 83,
331 24, 25, 26, 0, 27, 1, 2, 3, 4, 5,
332 6, 7, 8, 9, 10, 11, 12, 0, 0, 13,
333 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
334 0, 23, 0, 24, 25, 26, 0, 27, 2, 3,
335 4, 5, 6, 7, 8, 9, 10, 0, 0, 0,
336 0, 13, 14, 0, 16, 17, 18, 19, 0, 0,
337 0, 0, 0, 0, 0, 24, 25
340 static const short yycheck[] = { 11,
341 12, 26, 27, 34, 35, 30, 32, 28, 20, 21,
342 42, 37, 38, 39, 40, 35, 32, 32, 46, 41,
343 42, 0, 0, 48, 49, 37, 29, 39, 32, 33,
344 34, 35, 36, 61, 68, 63, -1, 65, -1, 51,
345 52, 53, 70, 71, -1, 73, 74, -1, -1, -1,
346 -1, -1, -1, -1, -1, 80, -1, -1, 70, -1,
347 -1, -1, 90, -1, -1, -1, -1, -1, -1, -1,
348 -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
349 11, 12, 13, 14, 96, 16, 17, 18, 19, 20,
350 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
351 31, 32, 33, -1, 35, -1, -1, -1, 39, 3,
352 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
353 14, -1, -1, 17, 18, 19, 20, 21, 22, 23,
354 24, 25, 26, -1, -1, 29, -1, 31, 32, 33,
355 -1, 35, -1, -1, -1, 39, 3, 4, 5, 6,
356 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
357 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
358 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
359 -1, -1, 39, 3, 4, 5, 6, 7, 8, 9,
360 10, 11, 12, 13, 14, -1, -1, 17, 18, 19,
361 20, 21, 22, 23, 24, 25, 26, -1, -1, 29,
362 -1, 31, 32, 33, -1, 35, -1, -1, -1, 39,
363 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
364 13, 14, -1, -1, 17, 18, 19, 20, 21, 22,
365 23, 24, 25, 26, -1, -1, 29, -1, 31, 32,
366 33, -1, 35, -1, -1, 38, 3, 4, 5, 6,
367 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
368 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
369 -1, -1, 29, -1, 31, 32, 33, -1, 35, -1,
370 -1, 38, 3, 4, 5, 6, 7, 8, 9, 10,
371 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
372 21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
373 31, 32, 33, -1, 35, -1, 37, 3, 4, 5,
374 6, 7, 8, 9, 10, 11, 12, 13, 14, -1,
375 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
376 26, -1, -1, 29, -1, 31, 32, 33, -1, 35,
377 -1, 37, 3, 4, 5, 6, 7, 8, 9, 10,
378 11, 12, 13, 14, -1, -1, 17, 18, 19, 20,
379 21, 22, 23, 24, 25, 26, 27, -1, 29, 30,
380 31, 32, 33, -1, 35, 3, 4, 5, 6, 7,
381 8, 9, 10, 11, 12, 13, 14, -1, -1, 17,
382 18, 19, 20, 21, 22, 23, 24, 25, 26, -1,
383 -1, 29, -1, 31, 32, 33, -1, 35, 4, 5,
384 6, 7, 8, 9, 10, 11, 12, -1, -1, -1,
385 -1, 17, 18, -1, 20, 21, 22, 23, -1, -1,
386 -1, -1, -1, -1, -1, 31, 32
388 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
389 #line 3 "/usr/lib/bison.simple"
390 /* This file comes from bison-1.28. */
392 /* Skeleton output parser for bison,
393 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
395 This program is free software; you can redistribute it and/or modify
396 it under the terms of the GNU General Public License as published by
397 the Free Software Foundation; either version 2, or (at your option)
398 any later version.
400 This program is distributed in the hope that it will be useful,
401 but WITHOUT ANY WARRANTY; without even the implied warranty of
402 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
403 GNU General Public License for more details.
405 You should have received a copy of the GNU General Public License
406 along with this program; if not, write to the Free Software
407 Foundation, Inc., 59 Temple Place - Suite 330,
408 Boston, MA 02111-1307, USA. */
410 /* As a special exception, when this file is copied by Bison into a
411 Bison output file, you may use that output file without restriction.
412 This special exception was added by the Free Software Foundation
413 in version 1.24 of Bison. */
415 /* This is the parser code that is written into each bison parser
416 when the %semantic_parser declaration is not specified in the grammar.
417 It was written by Richard Stallman by simplifying the hairy parser
418 used when %semantic_parser is specified. */
420 #ifndef YYSTACK_USE_ALLOCA
421 #ifdef alloca
422 #define YYSTACK_USE_ALLOCA
423 #else /* alloca not defined */
424 #ifdef __GNUC__
425 #define YYSTACK_USE_ALLOCA
426 #define alloca __builtin_alloca
427 #else /* not GNU C. */
428 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
429 #define YYSTACK_USE_ALLOCA
430 #include <sal/alloca.h>
431 #else /* not sparc */
432 #if defined(_AIX)
433 #pragma alloca
434 #define YYSTACK_USE_ALLOCA
435 #endif /* not _AIX */
436 #endif /* not sparc */
437 #endif /* not GNU C */
438 #endif /* alloca not defined */
439 #endif /* YYSTACK_USE_ALLOCA not defined */
441 #ifdef YYSTACK_USE_ALLOCA
442 #define YYSTACK_ALLOC alloca
443 #else
444 #define YYSTACK_ALLOC malloc
445 #endif
447 /* Note: there must be only one dollar sign in this file.
448 It is replaced by the list of actions, each action
449 as one case of the switch. */
451 #define yyerrok (yyerrstatus = 0)
452 #define yyclearin (yychar = YYEMPTY)
453 #define YYEMPTY -2
454 #define YYEOF 0
455 #define YYACCEPT goto yyacceptlab
456 #define YYABORT goto yyabortlab
457 #define YYERROR goto yyerrlab1
458 /* Like YYERROR except do call yyerror.
459 This remains here temporarily to ease the
460 transition to the new meaning of YYERROR, for GCC.
461 Once GCC version 2 has supplanted version 1, this can go. */
462 #define YYFAIL goto yyerrlab
463 #define YYRECOVERING() (!!yyerrstatus)
464 #define YYBACKUP(token, value) \
465 do \
466 if (yychar == YYEMPTY && yylen == 1) \
467 { yychar = (token), yylval = (value); \
468 yychar1 = YYTRANSLATE (yychar); \
469 YYPOPSTACK; \
470 goto yybackup; \
472 else \
473 { yyerror ("syntax error: cannot back up"); YYERROR; } \
474 while (0)
476 #define YYTERROR 1
477 #define YYERRCODE 256
479 #ifndef YYPURE
480 #define YYLEX yylex()
481 #endif
483 #ifdef YYPURE
484 #ifdef YYLSP_NEEDED
485 #ifdef YYLEX_PARAM
486 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
487 #else
488 #define YYLEX yylex(&yylval, &yylloc)
489 #endif
490 #else /* not YYLSP_NEEDED */
491 #ifdef YYLEX_PARAM
492 #define YYLEX yylex(&yylval, YYLEX_PARAM)
493 #else
494 #define YYLEX yylex(&yylval)
495 #endif
496 #endif /* not YYLSP_NEEDED */
497 #endif
499 /* If nonreentrant, generate the variables here */
501 #ifndef YYPURE
503 int yychar; /* the lookahead symbol */
504 YYSTYPE yylval; /* the semantic value of the */
505 /* lookahead symbol */
507 #ifdef YYLSP_NEEDED
508 YYLTYPE yylloc; /* location data for the lookahead */
509 /* symbol */
510 #endif
512 int yynerrs; /* number of parse errors so far */
513 #endif /* not YYPURE */
515 #if YYDEBUG != 0
516 int yydebug; /* nonzero means print parse trace */
517 /* Since this is uninitialized, it does not stop multiple parsers
518 from coexisting. */
519 #endif
521 /* YYINITDEPTH indicates the initial size of the parser's stacks */
523 #ifndef YYINITDEPTH
524 #define YYINITDEPTH 200
525 #endif
527 /* YYMAXDEPTH is the maximum size the stacks can grow to
528 (effective only if the built-in stack extension method is used). */
530 #if YYMAXDEPTH == 0
531 #undef YYMAXDEPTH
532 #endif
534 #ifndef YYMAXDEPTH
535 #define YYMAXDEPTH 10000
536 #endif
538 /* Define __yy_memcpy. Note that the size argument
539 should be passed with type unsigned int, because that is what the non-GCC
540 definitions require. With GCC, __builtin_memcpy takes an arg
541 of type size_t, but it can handle unsigned int. */
543 #if defined(__GNUC__)
544 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
545 #else
546 #ifndef __cplusplus
548 /* This is the most reliable way to avoid incompatibilities
549 in available built-in functions on various systems. */
550 static void
551 __yy_memcpy (to, from, count)
552 char *to;
553 char *from;
554 unsigned int count;
556 register char *f = from;
557 register char *t = to;
558 register int i = count;
560 while (i-- > 0)
561 *t++ = *f++;
564 #else /* __cplusplus */
566 /* This is the most reliable way to avoid incompatibilities
567 in available built-in functions on various systems. */
568 static void
569 __yy_memcpy (char *to, char *from, unsigned int count)
571 register char *t = to;
572 register char *f = from;
573 register int i = count;
575 while (i-- > 0)
576 *t++ = *f++;
579 #endif
580 #endif
582 #line 217 "/usr/lib/bison.simple"
584 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
585 into yyparse. The argument should have type void *.
586 It should actually point to an object.
587 Grammar actions can access the variable by casting it
588 to the proper pointer type. */
590 #ifdef YYPARSE_PARAM
591 #ifdef __cplusplus
592 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
593 #define YYPARSE_PARAM_DECL
594 #else /* not __cplusplus */
595 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
596 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
597 #endif /* not __cplusplus */
598 #else /* not YYPARSE_PARAM */
599 #define YYPARSE_PARAM_ARG
600 #define YYPARSE_PARAM_DECL
601 #endif /* not YYPARSE_PARAM */
603 /* Prevent warning if -Wstrict-prototypes. */
604 #ifdef __GNUC__
605 #ifdef YYPARSE_PARAM
606 int yyparse (void *);
607 #else
608 int yyparse (void);
609 #endif
610 #endif
613 yyparse(YYPARSE_PARAM_ARG)
614 YYPARSE_PARAM_DECL
616 register int yystate;
617 register int yyn;
618 register short *yyssp;
619 register YYSTYPE *yyvsp;
620 int yyerrstatus; /* number of tokens to shift before error messages enabled */
621 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
623 short yyssa[YYINITDEPTH]; /* the state stack */
624 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
626 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
627 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
629 #ifdef YYLSP_NEEDED
630 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
631 YYLTYPE *yyls = yylsa;
632 YYLTYPE *yylsp;
634 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
635 #else
636 #define YYPOPSTACK (yyvsp--, yyssp--)
637 #endif
639 int yystacksize = YYINITDEPTH;
640 int yyfree_stacks = 0;
642 #ifdef YYPURE
643 int yychar;
644 YYSTYPE yylval;
645 int yynerrs;
646 #ifdef YYLSP_NEEDED
647 YYLTYPE yylloc;
648 #endif
649 #endif
651 YYSTYPE yyval; /* the variable used to return */
652 yyval.dval = 0;
653 /* semantic values from the action */
654 /* routines */
656 int yylen;
658 #if YYDEBUG != 0
659 if (yydebug)
660 fprintf(stderr, "Starting parse\n");
661 #endif
663 yystate = 0;
664 yyerrstatus = 0;
665 yynerrs = 0;
666 yychar = YYEMPTY; /* Cause a token to be read. */
668 /* Initialize stack pointers.
669 Waste one element of value and location stack
670 so that they stay on the same level as the state stack.
671 The wasted elements are never initialized. */
673 yyssp = yyss - 1;
674 yyvsp = yyvs;
675 #ifdef YYLSP_NEEDED
676 yylsp = yyls;
677 #endif
679 /* Push a new state, which is found in yystate . */
680 /* In all cases, when you get here, the value and location stacks
681 have just been pushed. so pushing a state here evens the stacks. */
682 yynewstate:
684 *++yyssp = sal::static_int_cast<short>(yystate);
686 if (yyssp >= yyss + yystacksize - 1)
688 /* Give user a chance to reallocate the stack */
689 /* Use copies of these so that the &'s don't force the real ones into memory. */
690 YYSTYPE *yyvs1 = yyvs;
691 short *yyss1 = yyss;
692 #ifdef YYLSP_NEEDED
693 YYLTYPE *yyls1 = yyls;
694 #endif
696 /* Get the current used size of the three stacks, in elements. */
697 int size = yyssp - yyss + 1;
699 #ifdef yyoverflow
700 /* Each stack pointer address is followed by the size of
701 the data in use in that stack, in bytes. */
702 #ifdef YYLSP_NEEDED
703 /* This used to be a conditional around just the two extra args,
704 but that might be undefined if yyoverflow is a macro. */
705 yyoverflow("parser stack overflow",
706 &yyss1, size * sizeof (*yyssp),
707 &yyvs1, size * sizeof (*yyvsp),
708 &yyls1, size * sizeof (*yylsp),
709 &yystacksize);
710 #else
711 yyoverflow("parser stack overflow",
712 &yyss1, size * sizeof (*yyssp),
713 &yyvs1, size * sizeof (*yyvsp),
714 &yystacksize);
715 #endif
717 yyss = yyss1; yyvs = yyvs1;
718 #ifdef YYLSP_NEEDED
719 yyls = yyls1;
720 #endif
721 #else /* no yyoverflow */
722 /* Extend the stack our own way. */
723 if (yystacksize >= YYMAXDEPTH)
725 yyerror("parser stack overflow");
726 if (yyfree_stacks)
728 free (yyss);
729 free (yyvs);
730 #ifdef YYLSP_NEEDED
731 free (yyls);
732 #endif
734 return 2;
736 yystacksize *= 2;
737 if (yystacksize > YYMAXDEPTH)
738 yystacksize = YYMAXDEPTH;
739 #ifndef YYSTACK_USE_ALLOCA
740 yyfree_stacks = 1;
741 #endif
742 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
743 __yy_memcpy ((char *)yyss, (char *)yyss1,
744 size * (unsigned int) sizeof (*yyssp));
745 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
746 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
747 size * (unsigned int) sizeof (*yyvsp));
748 #ifdef YYLSP_NEEDED
749 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
750 __yy_memcpy ((char *)yyls, (char *)yyls1,
751 size * (unsigned int) sizeof (*yylsp));
752 #endif
753 #endif /* no yyoverflow */
755 yyssp = yyss + size - 1;
756 yyvsp = yyvs + size - 1;
757 #ifdef YYLSP_NEEDED
758 yylsp = yyls + size - 1;
759 #endif
761 #if YYDEBUG != 0
762 if (yydebug)
763 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
764 #endif
766 if (yyssp >= yyss + yystacksize - 1)
767 YYABORT;
770 #if YYDEBUG != 0
771 if (yydebug)
772 fprintf(stderr, "Entering state %d\n", yystate);
773 #endif
775 goto yybackup;
776 yybackup:
778 /* Do appropriate processing given the current state. */
779 /* Read a lookahead token if we need one and don't already have one. */
780 /* yyresume: */
782 /* First try to decide what to do without reference to lookahead token. */
784 yyn = yypact[yystate];
785 if (yyn == YYFLAG)
786 goto yydefault;
788 /* Not known => get a lookahead token if don't already have one. */
790 /* yychar is either YYEMPTY or YYEOF
791 or a valid token in external form. */
793 if (yychar == YYEMPTY)
795 #if YYDEBUG != 0
796 if (yydebug)
797 fprintf(stderr, "Reading a token: ");
798 #endif
799 yychar = YYLEX;
802 /* Convert token to internal form (in yychar1) for indexing tables with */
804 if (yychar <= 0) /* This means end of input. */
806 yychar1 = 0;
807 yychar = YYEOF; /* Don't call YYLEX any more */
809 #if YYDEBUG != 0
810 if (yydebug)
811 fprintf(stderr, "Now at end of input.\n");
812 #endif
814 else
816 yychar1 = YYTRANSLATE(yychar);
818 #if YYDEBUG != 0
819 if (yydebug)
821 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
822 /* Give the individual parser a way to print the precise meaning
823 of a token, for further debugging info. */
824 #ifdef YYPRINT
825 YYPRINT (stderr, yychar, yylval);
826 #endif
827 fprintf (stderr, ")\n");
829 #endif
832 yyn += yychar1;
833 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
834 goto yydefault;
836 yyn = yytable[yyn];
838 /* yyn is what to do for this token type in this state.
839 Negative => reduce, -yyn is rule number.
840 Positive => shift, yyn is new state.
841 New state is final state => don't bother to shift,
842 just return success.
843 0, or most negative number => error. */
845 if (yyn < 0)
847 if (yyn == YYFLAG)
848 goto yyerrlab;
849 yyn = -yyn;
850 goto yyreduce;
852 else if (yyn == 0)
853 goto yyerrlab;
855 if (yyn == YYFINAL)
856 YYACCEPT;
858 /* Shift the lookahead token. */
860 #if YYDEBUG != 0
861 if (yydebug)
862 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
863 #endif
865 /* Discard the token being shifted unless it is eof. */
866 if (yychar != YYEOF)
867 yychar = YYEMPTY;
869 *++yyvsp = yylval;
870 #ifdef YYLSP_NEEDED
871 *++yylsp = yylloc;
872 #endif
874 /* count tokens shifted since error; after three, turn off error status. */
875 if (yyerrstatus) yyerrstatus--;
877 yystate = yyn;
878 goto yynewstate;
880 /* Do the default action for the current state. */
881 yydefault:
883 yyn = yydefact[yystate];
884 if (yyn == 0)
885 goto yyerrlab;
887 /* Do a reduction. yyn is the number of a rule to reduce with. */
888 yyreduce:
889 yylen = yyr2[yyn];
890 if (yylen > 0)
891 yyval = yyvsp[1-yylen]; /* implement default value of the action */
893 #if YYDEBUG != 0
894 if (yydebug)
896 int i;
898 fprintf (stderr, "Reducing via rule %d (line %d), ",
899 yyn, yyrline[yyn]);
901 /* Print the symbols being reduced, and their result. */
902 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
903 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
904 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
906 #endif
909 switch (yyn) {
911 case 1:
912 #line 60 "grammar.y"
913 { yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
914 break;}
915 case 2:
916 #line 61 "grammar.y"
917 { yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
918 break;}
919 case 3:
920 #line 62 "grammar.y"
921 { yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
922 break;}
923 case 4:
924 #line 63 "grammar.y"
925 { yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
926 break;}
927 case 5:
928 #line 64 "grammar.y"
929 { yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
930 break;}
931 case 6:
932 #line 65 "grammar.y"
933 { yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
934 break;}
935 case 7:
936 #line 66 "grammar.y"
937 { yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
938 break;}
939 case 8:
940 #line 67 "grammar.y"
941 { yyval.ptr = new Node(ID_CHARACTER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
942 break;}
943 case 9:
944 #line 68 "grammar.y"
945 { yyval.ptr = new Node(ID_OPERATOR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
946 break;}
947 case 10:
948 #line 69 "grammar.y"
949 { yyval.ptr = new Node(ID_OPERATOR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
950 break;}
951 case 11:
952 #line 70 "grammar.y"
953 { yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
954 break;}
955 case 12:
956 #line 71 "grammar.y"
957 { yyval.ptr = new Node(ID_DELIMETER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
958 break;}
959 case 13:
960 #line 72 "grammar.y"
961 { yyval.ptr = new Node(ID_DELIMETER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
962 break;}
963 case 14:
964 #line 73 "grammar.y"
965 { yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
966 break;}
967 case 15:
968 #line 74 "grammar.y"
969 { yyval.ptr = new Node(ID_CHARACTER); allocChar(yyval.ptr->value , '|'); debug("Identifier : '|'\n"); nodelist.push_back(yyval.ptr); ;
970 break;}
971 case 16:
972 #line 75 "grammar.y"
973 { yyval.ptr = new Node(ID_NUMBER); allocValue(yyval.ptr->value , yyvsp[0].dval); debug("Number : %s\n",yyvsp[0].dval); nodelist.push_back(yyval.ptr); ;
974 break;}
975 case 17:
976 #line 76 "grammar.y"
977 { yyval.ptr = new Node(ID_STRING); allocValue(yyval.ptr->value , yyvsp[0].str); debug("String : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
978 break;}
979 case 18:
980 #line 80 "grammar.y"
981 { yyval.ptr = new Node(ID_PRIMARYEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("PrimaryExpr\n"); nodelist.push_back(yyval.ptr); ;
982 break;}
983 case 19:
984 #line 81 "grammar.y"
985 { yyval.ptr = new Node(ID_PRIMARYEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyval.ptr->next = yyvsp[0].ptr; debug("PrimaryExpr : PrimaryExpr Identifier\n"); nodelist.push_back(yyval.ptr); ;
986 break;}
987 case 20:
988 #line 85 "grammar.y"
989 { yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '('); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
990 break;}
991 case 21:
992 #line 86 "grammar.y"
993 { yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '['); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
994 break;}
995 case 22:
996 #line 87 "grammar.y"
997 { yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '{'); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
998 break;}
999 case 23:
1000 #line 88 "grammar.y"
1001 { yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '<'); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
1002 break;}
1003 case 24:
1004 #line 89 "grammar.y"
1005 { yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '|'); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
1006 break;}
1007 case 25:
1008 #line 90 "grammar.y"
1009 { yyval.ptr = new Node(ID_LEFT); allocValue(yyval.ptr->value , "||"); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
1010 break;}
1011 case 26:
1012 #line 91 "grammar.y"
1013 { yyval.ptr = new Node(ID_LEFT); allocValue(yyval.ptr->value , yyvsp[0].str); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
1014 break;}
1015 case 27:
1016 #line 95 "grammar.y"
1017 { yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , ')'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1018 break;}
1019 case 28:
1020 #line 96 "grammar.y"
1021 { yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , ']'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1022 break;}
1023 case 29:
1024 #line 97 "grammar.y"
1025 { yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '}'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1026 break;}
1027 case 30:
1028 #line 98 "grammar.y"
1029 { yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '>'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1030 break;}
1031 case 31:
1032 #line 99 "grammar.y"
1033 { yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '|'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1034 break;}
1035 case 32:
1036 #line 100 "grammar.y"
1037 { yyval.ptr = new Node(ID_RIGHT); allocValue(yyval.ptr->value , "||"); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1038 break;}
1039 case 33:
1040 #line 101 "grammar.y"
1041 { yyval.ptr = new Node(ID_RIGHT); allocValue(yyval.ptr->value , yyvsp[0].str); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1042 break;}
1043 case 34:
1044 #line 105 "grammar.y"
1045 { yyval.ptr = new Node(ID_FENCE); yyval.ptr->child=yyvsp[-2].ptr; yyvsp[-2].ptr->next=yyvsp[-1].ptr; yyvsp[-1].ptr->next=yyvsp[0].ptr; debug("Fence \n"); nodelist.push_back(yyval.ptr); ;
1046 break;}
1047 case 35:
1048 #line 109 "grammar.y"
1049 { yyval.ptr = new Node(ID_PARENTH); yyval.ptr->child = yyvsp[-1].ptr; debug("Parenth: '(' ExprList ')' \n"); nodelist.push_back(yyval.ptr); ;
1050 break;}
1051 case 36:
1052 #line 110 "grammar.y"
1053 { yyval.ptr = new Node(ID_PARENTH); debug("Parenth: '(' ')' \n"); nodelist.push_back(yyval.ptr); ;
1054 break;}
1055 case 37:
1056 #line 114 "grammar.y"
1057 { yyval.ptr = new Node(ID_BLOCK); yyval.ptr->child = yyvsp[-1].ptr; debug("Block: '{' ExprList '}' \n"); nodelist.push_back(yyval.ptr); ;
1058 break;}
1059 case 38:
1060 #line 115 "grammar.y"
1061 { yyval.ptr = new Node(ID_BLOCK); debug("Block: '{' '}' \n"); nodelist.push_back(yyval.ptr); ;
1062 break;}
1063 case 39:
1064 #line 119 "grammar.y"
1065 { yyval.ptr = new Node(ID_BRACKET); yyval.ptr->child = yyvsp[-1].ptr; debug("Bracket \n"); nodelist.push_back(yyval.ptr); ;
1066 break;}
1067 case 40:
1068 #line 120 "grammar.y"
1069 { yyval.ptr = new Node(ID_BRACKET); debug("Bracket \n"); nodelist.push_back(yyval.ptr); ;
1070 break;}
1071 case 41:
1072 #line 124 "grammar.y"
1073 { yyval.ptr = new Node(ID_SUBEXPR); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; debug("SubSupExpr : ID_SUBEXPR\n"); nodelist.push_back(yyval.ptr); ;
1074 break;}
1075 case 42:
1076 #line 125 "grammar.y"
1077 { yyval.ptr = new Node(ID_SUPEXPR); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; debug("SubSupExpr : ID_SUPEXPR\n"); nodelist.push_back(yyval.ptr); ;
1078 break;}
1079 case 43:
1080 #line 126 "grammar.y"
1081 { yyval.ptr = new Node(ID_SUBSUPEXPR); yyval.ptr->child=yyvsp[-4].ptr; yyvsp[-4].ptr->next=yyvsp[-2].ptr; yyvsp[-2].ptr->next=yyvsp[0].ptr; debug("SubSupExpr : ID_SUBSUPEXPR\n"); nodelist.push_back(yyval.ptr); ;
1082 break;}
1083 case 44:
1084 #line 130 "grammar.y"
1085 { yyval.ptr = new Node(ID_FRACTIONEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("FractionExpr : %s\n",yyvsp[-2].str); nodelist.push_back(yyval.ptr); ;
1086 break;}
1087 case 45:
1088 #line 134 "grammar.y"
1089 { yyval.ptr = new Node(ID_OVER); yyval.ptr->child = yyvsp[-3].ptr; yyvsp[-3].ptr->next = yyvsp[-1].ptr; debug("OverExpr\n"); nodelist.push_back(yyval.ptr); ;
1090 break;}
1091 case 46:
1092 #line 139 "grammar.y"
1093 { yyval.ptr = new Node(ID_ACCENTEXPR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Accent : %s\n", yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
1094 break;}
1095 case 47:
1096 #line 143 "grammar.y"
1097 { yyval.ptr = new Node(ID_ACCENTEXPR); yyval.ptr->child=yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("AccentExpr \n"); nodelist.push_back(yyval.ptr); ;
1098 break;}
1099 case 48:
1100 #line 146 "grammar.y"
1101 { yyval.ptr = new Node(ID_DECORATIONEXPR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Decoration : %s\n", yyvsp[0].str); nodelist.push_back(yyval.ptr); ;
1102 break;}
1103 case 49:
1104 #line 150 "grammar.y"
1105 { yyval.ptr = new Node(ID_DECORATIONEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("DecorationExpr \n"); nodelist.push_back(yyval.ptr); ;
1106 break;}
1107 case 50:
1108 #line 154 "grammar.y"
1109 { yyval.ptr = new Node(ID_SQRTEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("RootExpr : %s\n", yyvsp[-1].str); nodelist.push_back(yyval.ptr); ;
1110 break;}
1111 case 51:
1112 #line 155 "grammar.y"
1113 { yyval.ptr = new Node(ID_ROOTEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next= yyvsp[0].ptr; debug("RootExpr : %s\n", yyvsp[-2].str); nodelist.push_back(yyval.ptr); ;
1114 break;}
1115 case 52:
1116 #line 159 "grammar.y"
1117 { yyval.ptr = new Node(ID_BEGIN); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("BeginExpr\n"); ;
1118 break;}
1119 case 53:
1120 #line 160 "grammar.y"
1121 { yyval.ptr = new Node(ID_BEGIN); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next= yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("BeginExpr\n"); ;
1122 break;}
1123 case 54:
1124 #line 164 "grammar.y"
1125 { yyval.ptr = new Node(ID_END); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("EndExpr\n"); ;
1126 break;}
1127 case 55:
1128 #line 169 "grammar.y"
1129 { yyval.ptr = new Node(ID_MATHML); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); top = yyval.ptr; debug("MathML\n"); ;
1130 break;}
1131 case 56:
1132 #line 173 "grammar.y"
1133 { yyval.ptr = new Node(ID_LINES); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("Lines\n"); ;
1134 break;}
1135 case 57:
1136 #line 174 "grammar.y"
1137 { yyval.ptr = new Node(ID_LINES); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("Lines\n"); ;
1138 break;}
1139 case 58:
1140 #line 178 "grammar.y"
1141 { yyval.ptr = new Node(ID_LINE); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("Line\n"); ;
1142 break;}
1143 case 59:
1144 #line 182 "grammar.y"
1145 { yyval.ptr = new Node(ID_EXPRLIST); yyval.ptr->child = yyvsp[0].ptr; debug("ExprList : Expr\n"); nodelist.push_back(yyval.ptr); ;
1146 break;}
1147 case 60:
1148 #line 183 "grammar.y"
1149 { yyval.ptr = new Node(ID_EXPRLIST); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("ExprList : ExprList Expr\n"); nodelist.push_back(yyval.ptr); ;
1150 break;}
1151 case 61:
1152 #line 187 "grammar.y"
1153 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Block\n"); nodelist.push_back(yyval.ptr);;
1154 break;}
1155 case 62:
1156 #line 188 "grammar.y"
1157 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Parenth\n"); nodelist.push_back(yyval.ptr);;
1158 break;}
1159 case 63:
1160 #line 189 "grammar.y"
1161 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Fence\n"); nodelist.push_back(yyval.ptr);;
1162 break;}
1163 case 64:
1164 #line 190 "grammar.y"
1165 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : SubSupExpr\n"); nodelist.push_back(yyval.ptr);;
1166 break;}
1167 case 65:
1168 #line 191 "grammar.y"
1169 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : FractionExpr\n"); nodelist.push_back(yyval.ptr);;
1170 break;}
1171 case 66:
1172 #line 192 "grammar.y"
1173 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : OverExpr\n"); nodelist.push_back(yyval.ptr);;
1174 break;}
1175 case 67:
1176 #line 193 "grammar.y"
1177 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : DecorationExpr\n"); nodelist.push_back(yyval.ptr);;
1178 break;}
1179 case 68:
1180 #line 194 "grammar.y"
1181 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : RootExpr\n"); nodelist.push_back(yyval.ptr);;
1182 break;}
1183 case 69:
1184 #line 195 "grammar.y"
1185 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : AccentExpr\n"); nodelist.push_back(yyval.ptr);;
1186 break;}
1187 case 70:
1188 #line 196 "grammar.y"
1189 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : PrimaryExpr\n"); nodelist.push_back(yyval.ptr);;
1190 break;}
1191 case 71:
1192 #line 197 "grammar.y"
1193 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : BeginExpr\n"); nodelist.push_back(yyval.ptr);;
1194 break;}
1195 case 72:
1196 #line 198 "grammar.y"
1197 { yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : EndExpr\n"); nodelist.push_back(yyval.ptr);;
1198 break;}
1200 /* the action file gets copied in in place of this dollarsign */
1201 #line 543 "/usr/lib/bison.simple"
1203 yyvsp -= yylen;
1204 yyssp -= yylen;
1205 #ifdef YYLSP_NEEDED
1206 yylsp -= yylen;
1207 #endif
1209 #if YYDEBUG != 0
1210 if (yydebug)
1212 short *ssp1 = yyss - 1;
1213 fprintf (stderr, "state stack now");
1214 while (ssp1 != yyssp)
1215 fprintf (stderr, " %d", *++ssp1);
1216 fprintf (stderr, "\n");
1218 #endif
1220 *++yyvsp = yyval;
1222 #ifdef YYLSP_NEEDED
1223 yylsp++;
1224 if (yylen == 0)
1226 yylsp->first_line = yylloc.first_line;
1227 yylsp->first_column = yylloc.first_column;
1228 yylsp->last_line = (yylsp-1)->last_line;
1229 yylsp->last_column = (yylsp-1)->last_column;
1230 yylsp->text = 0;
1232 else
1234 yylsp->last_line = (yylsp+yylen-1)->last_line;
1235 yylsp->last_column = (yylsp+yylen-1)->last_column;
1237 #endif
1239 /* Now "shift" the result of the reduction.
1240 Determine what state that goes to,
1241 based on the state we popped back to
1242 and the rule number reduced by. */
1244 yyn = yyr1[yyn];
1246 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1247 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1248 yystate = yytable[yystate];
1249 else
1250 yystate = yydefgoto[yyn - YYNTBASE];
1252 goto yynewstate;
1254 yyerrlab: /* here on detecting error */
1256 if (! yyerrstatus)
1257 /* If not already recovering from an error, report this error. */
1259 ++yynerrs;
1261 #ifdef YYERROR_VERBOSE
1262 yyn = yypact[yystate];
1264 if (yyn > YYFLAG && yyn < YYLAST)
1266 int size = 0;
1267 char *msg;
1268 int x, count;
1270 count = 0;
1271 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1272 for (x = (yyn < 0 ? -yyn : 0);
1273 x < (sizeof(yytname) / sizeof(char *)); x++)
1274 if (yycheck[x + yyn] == x)
1275 size += strlen(yytname[x]) + 15, count++;
1276 msg = (char *) malloc(size + 15);
1277 if (msg != 0)
1279 strcpy(msg, "parse error");
1281 if (count < 5)
1283 count = 0;
1284 for (x = (yyn < 0 ? -yyn : 0);
1285 x < (sizeof(yytname) / sizeof(char *)); x++)
1286 if (yycheck[x + yyn] == x)
1288 strcat(msg, count == 0 ? ", expecting `" : " or `");
1289 strcat(msg, yytname[x]);
1290 strcat(msg, "'");
1291 count++;
1294 yyerror(msg);
1295 free(msg);
1297 else
1298 yyerror ("parse error; also virtual memory exceeded");
1300 else
1301 #endif /* YYERROR_VERBOSE */
1302 yyerror("parse error");
1305 goto yyerrlab1;
1306 yyerrlab1: /* here on error raised explicitly by an action */
1308 if (yyerrstatus == 3)
1310 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1312 /* return failure if at end of input */
1313 if (yychar == YYEOF)
1314 YYABORT;
1316 #if YYDEBUG != 0
1317 if (yydebug)
1318 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1319 #endif
1321 yychar = YYEMPTY;
1324 /* Else will try to reuse lookahead token
1325 after shifting the error token. */
1327 yyerrstatus = 3; /* Each real token shifted decrements this */
1329 goto yyerrhandle;
1331 yyerrdefault: /* current state does not do anything special for the error token. */
1333 #if 0
1334 /* This is wrong; only states that explicitly want error tokens
1335 should shift them. */
1336 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1337 if (yyn) goto yydefault;
1338 #endif
1340 yyerrpop: /* pop the current state because it cannot handle the error token */
1342 if (yyssp == yyss) YYABORT;
1343 yyvsp--;
1344 yystate = *--yyssp;
1345 #ifdef YYLSP_NEEDED
1346 yylsp--;
1347 #endif
1349 #if YYDEBUG != 0
1350 if (yydebug)
1352 short *ssp1 = yyss - 1;
1353 fprintf (stderr, "Error: state stack now");
1354 while (ssp1 != yyssp)
1355 fprintf (stderr, " %d", *++ssp1);
1356 fprintf (stderr, "\n");
1358 #endif
1360 yyerrhandle:
1362 yyn = yypact[yystate];
1363 if (yyn == YYFLAG)
1364 goto yyerrdefault;
1366 yyn += YYTERROR;
1367 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1368 goto yyerrdefault;
1370 yyn = yytable[yyn];
1371 if (yyn < 0)
1373 if (yyn == YYFLAG)
1374 goto yyerrpop;
1375 yyn = -yyn;
1376 goto yyreduce;
1378 else if (yyn == 0)
1379 goto yyerrpop;
1381 if (yyn == YYFINAL)
1382 YYACCEPT;
1384 #if YYDEBUG != 0
1385 if (yydebug)
1386 fprintf(stderr, "Shifting error token, ");
1387 #endif
1389 *++yyvsp = yylval;
1390 #ifdef YYLSP_NEEDED
1391 *++yylsp = yylloc;
1392 #endif
1394 yystate = yyn;
1395 goto yynewstate;
1397 yyacceptlab:
1398 /* YYACCEPT comes here. */
1399 if (yyfree_stacks)
1401 free (yyss);
1402 free (yyvs);
1403 #ifdef YYLSP_NEEDED
1404 free (yyls);
1405 #endif
1407 return 0;
1409 yyabortlab:
1410 /* YYABORT comes here. */
1411 if (yyfree_stacks)
1413 free (yyss);
1414 free (yyvs);
1415 #ifdef YYLSP_NEEDED
1416 free (yyls);
1417 #endif
1419 return 1;
1421 #line 202 "grammar.y"
1424 Node *mainParse(const char *_code)
1426 initFlex( _code );
1427 top = 0L;
1428 yyparse();
1429 if( top )
1430 return top;
1431 else
1432 return 0L;
1435 void yyerror(const char * /*err*/)
1437 // printf("REALKING ERR[%s]\n",err);
1438 // if error, delete all nodes.
1439 Node *pNode = 0L;
1440 int ncount = nodelist.size();
1441 for( int i = 0 ; i < ncount ; i++){
1442 pNode = nodelist.front();
1443 nodelist.pop_front();
1444 delete pNode;
1446 top = 0L;
1449 #ifndef PARSE_DEBUG
1450 int debug(const char * /*format*/, ...)
1452 return 0;
1454 #endif
1456 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */