Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / hwpfilter / source / grammar.cxx
blob60edff49801e8e76602bb47c2516997f4f0c9ace
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 #define YYBISON 1 /* Identify Bison output. */
26 #ifndef YYDEBUG
27 #define YYDEBUG 0
28 #endif
29 #ifndef YYMAXDEPTH
30 #define YYMAXDEPTH 0
31 #endif
33 #define ACCENT 257
34 #define SMALL_GREEK 258
35 #define CAPITAL_GREEK 259
36 #define BINARY_OPERATOR 260
37 #define RELATION_OPERATOR 261
38 #define ARROW 262
39 #define GENERAL_IDEN 263
40 #define GENERAL_OPER 264
41 #define BIG_SYMBOL 265
42 #define FUNCTION 266
43 #define ROOT 267
44 #define FRACTION 268
45 #define SUBSUP 269
46 #define EQOVER 270
47 #define DELIMETER 271
48 #define LARGE_DELIM 272
49 #define DECORATION 273
50 #define SPACE_SYMBOL 274
51 #define CHARACTER 275
52 #define STRING 276
53 #define OPERATOR 277
54 #define EQBEGIN 278
55 #define EQEND 279
56 #define EQLEFT 280
57 #define EQRIGHT 281
58 #define NEWLINE 282
59 #define LEFT_DELIM 283
60 #define RIGHT_DELIM 284
61 #define DIGIT 285
63 #line 1 "grammar.y"
65 #include <list>
66 #include <stdlib.h>
67 #include <string.h>
69 #include "nodes.h"
71 std::list<Node*> nodelist;
73 Node *mainParse(const char *_code);
74 void yyerror(const char *);
75 int yylex();
76 void initFlex( const char *s );
77 void viewResult(Node *res);
79 Node *top=0L;
81 int Node::count = 0;
83 #define allocValue(x,y) \
84 x = (char *)malloc( strlen(y) +1 ); \
85 strcpy(x,y)
87 #define allocChar(x,y) \
88 x = (char *)malloc(2); \
89 sprintf(x,"%c",y)
90 #ifdef PARSE_DEBUG
91 #define debug printf
92 #else
93 int debug(const char *format, ...);
94 #endif
97 #line 35 "grammar.y"
98 typedef union {
99 char *dval;
100 char *str;
101 Node *ptr;
102 } YYSTYPE;
103 #include <stdio.h>
105 #ifndef __cplusplus
106 #ifndef __STDC__
107 #define const
108 #endif
109 #endif
113 #define YYFINAL 102
114 #define YYFLAG -32768
115 #define YYNTBASE 43
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,
148 27, 28, 29, 30, 31
151 #if YYDEBUG != 0
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,
160 192, 194
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,
183 0, 59, 0, 60, 0
186 #endif
188 #if YYDEBUG != 0
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,
197 197, 198
199 #endif
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
214 #endif
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,
224 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,
235 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,
249 0, 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,
255 46, 47
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,
269 23,-32768
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,
275 -24, -27
279 #define YYLAST 457
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)
389 any later version.
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
412 #ifdef alloca
413 #define YYSTACK_USE_ALLOCA
414 #else /* alloca not defined */
415 #ifdef __GNUC__
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 */
423 #if defined(_AIX)
424 #pragma alloca
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
434 #else
435 #define YYSTACK_ALLOC malloc
436 #endif
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)
444 #define YYEMPTY -2
445 #define YYEOF 0
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) \
456 do \
457 if (yychar == YYEMPTY && yylen == 1) \
458 { yychar = (token), yylval = (value); \
459 yychar1 = YYTRANSLATE (yychar); \
460 YYPOPSTACK; \
461 goto yybackup; \
463 else \
464 { yyerror ("syntax error: cannot back up"); YYERROR; } \
465 while (0)
467 #define YYTERROR 1
468 #define YYERRCODE 256
470 #ifndef YYPURE
471 #define YYLEX yylex()
472 #endif
474 #ifdef YYPURE
475 #ifdef YYLSP_NEEDED
476 #ifdef YYLEX_PARAM
477 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
478 #else
479 #define YYLEX yylex(&yylval, &yylloc)
480 #endif
481 #else /* not YYLSP_NEEDED */
482 #ifdef YYLEX_PARAM
483 #define YYLEX yylex(&yylval, YYLEX_PARAM)
484 #else
485 #define YYLEX yylex(&yylval)
486 #endif
487 #endif /* not YYLSP_NEEDED */
488 #endif
490 /* If nonreentrant, generate the variables here */
492 #ifndef YYPURE
494 int yychar; /* the lookahead symbol */
495 YYSTYPE yylval; /* the semantic value of the */
496 /* lookahead symbol */
498 #ifdef YYLSP_NEEDED
499 YYLTYPE yylloc; /* location data for the lookahead */
500 /* symbol */
501 #endif
503 int yynerrs; /* number of parse errors so far */
504 #endif /* not YYPURE */
506 #if YYDEBUG != 0
507 int yydebug; /* nonzero means print parse trace */
508 /* Since this is uninitialized, it does not stop multiple parsers
509 from coexisting. */
510 #endif
512 /* YYINITDEPTH indicates the initial size of the parser's stacks */
514 #ifndef YYINITDEPTH
515 #define YYINITDEPTH 200
516 #endif
518 /* YYMAXDEPTH is the maximum size the stacks can grow to
519 (effective only if the built-in stack extension method is used). */
521 #if YYMAXDEPTH == 0
522 #undef YYMAXDEPTH
523 #endif
525 #ifndef YYMAXDEPTH
526 #define YYMAXDEPTH 10000
527 #endif
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)
536 #else
537 #ifndef __cplusplus
539 /* This is the most reliable way to avoid incompatibilities
540 in available built-in functions on various systems. */
541 static void
542 __yy_memcpy (to, from, count)
543 char *to;
544 char *from;
545 unsigned int count;
547 register char *f = from;
548 register char *t = to;
549 register int i = count;
551 while (i-- > 0)
552 *t++ = *f++;
555 #else /* __cplusplus */
557 /* This is the most reliable way to avoid incompatibilities
558 in available built-in functions on various systems. */
559 static void
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;
566 while (i-- > 0)
567 *t++ = *f++;
570 #endif
571 #endif
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. */
581 #ifdef YYPARSE_PARAM
582 #ifdef __cplusplus
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. */
595 #ifdef __GNUC__
596 #ifdef YYPARSE_PARAM
597 int yyparse (void *);
598 #else
599 int yyparse (void);
600 #endif
601 #endif
604 yyparse(YYPARSE_PARAM_ARG)
605 YYPARSE_PARAM_DECL
607 register int yystate;
608 register int yyn;
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 */
620 #ifdef YYLSP_NEEDED
621 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
622 YYLTYPE *yyls = yylsa;
623 YYLTYPE *yylsp;
625 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
626 #else
627 #define YYPOPSTACK (yyvsp--, yyssp--)
628 #endif
630 int yystacksize = YYINITDEPTH;
631 int yyfree_stacks = 0;
633 #ifdef YYPURE
634 int yychar;
635 YYSTYPE yylval;
636 int yynerrs;
637 #ifdef YYLSP_NEEDED
638 YYLTYPE yylloc;
639 #endif
640 #endif
642 YYSTYPE yyval; /* the variable used to return */
643 yyval.dval = 0;
644 /* semantic values from the action */
645 /* routines */
647 int yylen;
649 #if YYDEBUG != 0
650 if (yydebug)
651 fprintf(stderr, "Starting parse\n");
652 #endif
654 yystate = 0;
655 yyerrstatus = 0;
656 yynerrs = 0;
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. */
664 yyssp = yyss - 1;
665 yyvsp = yyvs;
666 #ifdef YYLSP_NEEDED
667 yylsp = yyls;
668 #endif
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. */
673 yynewstate:
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;
682 short *yyss1 = yyss;
683 #ifdef YYLSP_NEEDED
684 YYLTYPE *yyls1 = yyls;
685 #endif
687 /* Get the current used size of the three stacks, in elements. */
688 int size = yyssp - yyss + 1;
690 #ifdef yyoverflow
691 /* Each stack pointer address is followed by the size of
692 the data in use in that stack, in bytes. */
693 #ifdef YYLSP_NEEDED
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),
700 &yystacksize);
701 #else
702 yyoverflow("parser stack overflow",
703 &yyss1, size * sizeof (*yyssp),
704 &yyvs1, size * sizeof (*yyvsp),
705 &yystacksize);
706 #endif
708 yyss = yyss1; yyvs = yyvs1;
709 #ifdef YYLSP_NEEDED
710 yyls = yyls1;
711 #endif
712 #else /* no yyoverflow */
713 /* Extend the stack our own way. */
714 if (yystacksize >= YYMAXDEPTH)
716 yyerror("parser stack overflow");
717 if (yyfree_stacks)
719 free (yyss);
720 free (yyvs);
721 #ifdef YYLSP_NEEDED
722 free (yyls);
723 #endif
725 return 2;
727 yystacksize *= 2;
728 if (yystacksize > YYMAXDEPTH)
729 yystacksize = YYMAXDEPTH;
730 #ifndef YYSTACK_USE_ALLOCA
731 yyfree_stacks = 1;
732 #endif
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));
739 #ifdef YYLSP_NEEDED
740 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
741 __yy_memcpy ((char *)yyls, (char *)yyls1,
742 size * (unsigned int) sizeof (*yylsp));
743 #endif
744 #endif /* no yyoverflow */
746 yyssp = yyss + size - 1;
747 yyvsp = yyvs + size - 1;
748 #ifdef YYLSP_NEEDED
749 yylsp = yyls + size - 1;
750 #endif
752 #if YYDEBUG != 0
753 if (yydebug)
754 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
755 #endif
757 if (yyssp >= yyss + yystacksize - 1)
758 YYABORT;
761 #if YYDEBUG != 0
762 if (yydebug)
763 fprintf(stderr, "Entering state %d\n", yystate);
764 #endif
766 goto yybackup;
767 yybackup:
769 /* Do appropriate processing given the current state. */
770 /* Read a lookahead token if we need one and don't already have one. */
771 /* yyresume: */
773 /* First try to decide what to do without reference to lookahead token. */
775 yyn = yypact[yystate];
776 if (yyn == YYFLAG)
777 goto yydefault;
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)
786 #if YYDEBUG != 0
787 if (yydebug)
788 fprintf(stderr, "Reading a token: ");
789 #endif
790 yychar = YYLEX;
793 /* Convert token to internal form (in yychar1) for indexing tables with */
795 if (yychar <= 0) /* This means end of input. */
797 yychar1 = 0;
798 yychar = YYEOF; /* Don't call YYLEX any more */
800 #if YYDEBUG != 0
801 if (yydebug)
802 fprintf(stderr, "Now at end of input.\n");
803 #endif
805 else
807 yychar1 = YYTRANSLATE(yychar);
809 #if YYDEBUG != 0
810 if (yydebug)
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. */
815 #ifdef YYPRINT
816 YYPRINT (stderr, yychar, yylval);
817 #endif
818 fprintf (stderr, ")\n");
820 #endif
823 yyn += yychar1;
824 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
825 goto yydefault;
827 yyn = yytable[yyn];
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,
833 just return success.
834 0, or most negative number => error. */
836 if (yyn < 0)
838 if (yyn == YYFLAG)
839 goto yyerrlab;
840 yyn = -yyn;
841 goto yyreduce;
843 else if (yyn == 0)
844 goto yyerrlab;
846 if (yyn == YYFINAL)
847 YYACCEPT;
849 /* Shift the lookahead token. */
851 #if YYDEBUG != 0
852 if (yydebug)
853 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
854 #endif
856 /* Discard the token being shifted unless it is eof. */
857 if (yychar != YYEOF)
858 yychar = YYEMPTY;
860 *++yyvsp = yylval;
861 #ifdef YYLSP_NEEDED
862 *++yylsp = yylloc;
863 #endif
865 /* count tokens shifted since error; after three, turn off error status. */
866 if (yyerrstatus) yyerrstatus--;
868 yystate = yyn;
869 goto yynewstate;
871 /* Do the default action for the current state. */
872 yydefault:
874 yyn = yydefact[yystate];
875 if (yyn == 0)
876 goto yyerrlab;
878 /* Do a reduction. yyn is the number of a rule to reduce with. */
879 yyreduce:
880 yylen = yyr2[yyn];
881 if (yylen > 0)
882 yyval = yyvsp[1-yylen]; /* implement default value of the action */
884 #if YYDEBUG != 0
885 if (yydebug)
887 int i;
889 fprintf (stderr, "Reducing via rule %d (line %d), ",
890 yyn, yyrline[yyn]);
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]]);
897 #endif
900 switch (yyn) {
902 case 1:
903 #line 60 "grammar.y"
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); ;
905 break;}
906 case 2:
907 #line 61 "grammar.y"
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); ;
909 break;}
910 case 3:
911 #line 62 "grammar.y"
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); ;
913 break;}
914 case 4:
915 #line 63 "grammar.y"
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); ;
917 break;}
918 case 5:
919 #line 64 "grammar.y"
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); ;
921 break;}
922 case 6:
923 #line 65 "grammar.y"
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); ;
925 break;}
926 case 7:
927 #line 66 "grammar.y"
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); ;
929 break;}
930 case 8:
931 #line 67 "grammar.y"
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); ;
933 break;}
934 case 9:
935 #line 68 "grammar.y"
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); ;
937 break;}
938 case 10:
939 #line 69 "grammar.y"
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); ;
941 break;}
942 case 11:
943 #line 70 "grammar.y"
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); ;
945 break;}
946 case 12:
947 #line 71 "grammar.y"
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); ;
949 break;}
950 case 13:
951 #line 72 "grammar.y"
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); ;
953 break;}
954 case 14:
955 #line 73 "grammar.y"
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); ;
957 break;}
958 case 15:
959 #line 74 "grammar.y"
960 { yyval.ptr = new Node(ID_CHARACTER); allocChar(yyval.ptr->value , '|'); debug("Identifier : '|'\n"); nodelist.push_back(yyval.ptr); ;
961 break;}
962 case 16:
963 #line 75 "grammar.y"
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); ;
965 break;}
966 case 17:
967 #line 76 "grammar.y"
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); ;
969 break;}
970 case 18:
971 #line 80 "grammar.y"
972 { yyval.ptr = new Node(ID_PRIMARYEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("PrimaryExpr\n"); nodelist.push_back(yyval.ptr); ;
973 break;}
974 case 19:
975 #line 81 "grammar.y"
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); ;
977 break;}
978 case 20:
979 #line 85 "grammar.y"
980 { yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '('); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
981 break;}
982 case 21:
983 #line 86 "grammar.y"
984 { yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '['); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
985 break;}
986 case 22:
987 #line 87 "grammar.y"
988 { yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '{'); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
989 break;}
990 case 23:
991 #line 88 "grammar.y"
992 { yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '<'); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
993 break;}
994 case 24:
995 #line 89 "grammar.y"
996 { yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '|'); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
997 break;}
998 case 25:
999 #line 90 "grammar.y"
1000 { yyval.ptr = new Node(ID_LEFT); allocValue(yyval.ptr->value , "||"); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ;
1001 break;}
1002 case 26:
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); ;
1005 break;}
1006 case 27:
1007 #line 95 "grammar.y"
1008 { yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , ')'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1009 break;}
1010 case 28:
1011 #line 96 "grammar.y"
1012 { yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , ']'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1013 break;}
1014 case 29:
1015 #line 97 "grammar.y"
1016 { yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '}'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1017 break;}
1018 case 30:
1019 #line 98 "grammar.y"
1020 { yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '>'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1021 break;}
1022 case 31:
1023 #line 99 "grammar.y"
1024 { yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '|'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1025 break;}
1026 case 32:
1027 #line 100 "grammar.y"
1028 { yyval.ptr = new Node(ID_RIGHT); allocValue(yyval.ptr->value , "||"); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ;
1029 break;}
1030 case 33:
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); ;
1033 break;}
1034 case 34:
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); ;
1037 break;}
1038 case 35:
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); ;
1041 break;}
1042 case 36:
1043 #line 110 "grammar.y"
1044 { yyval.ptr = new Node(ID_PARENTH); debug("Parenth: '(' ')' \n"); nodelist.push_back(yyval.ptr); ;
1045 break;}
1046 case 37:
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); ;
1049 break;}
1050 case 38:
1051 #line 115 "grammar.y"
1052 { yyval.ptr = new Node(ID_BLOCK); debug("Block: '{' '}' \n"); nodelist.push_back(yyval.ptr); ;
1053 break;}
1054 case 39:
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); ;
1057 break;}
1058 case 40:
1059 #line 120 "grammar.y"
1060 { yyval.ptr = new Node(ID_BRACKET); debug("Bracket \n"); nodelist.push_back(yyval.ptr); ;
1061 break;}
1062 case 41:
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); ;
1065 break;}
1066 case 42:
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); ;
1069 break;}
1070 case 43:
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); ;
1073 break;}
1074 case 44:
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); ;
1077 break;}
1078 case 45:
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); ;
1081 break;}
1082 case 46:
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); ;
1085 break;}
1086 case 47:
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); ;
1089 break;}
1090 case 48:
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); ;
1093 break;}
1094 case 49:
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); ;
1097 break;}
1098 case 50:
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); ;
1101 break;}
1102 case 51:
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); ;
1105 break;}
1106 case 52:
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"); ;
1109 break;}
1110 case 53:
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"); ;
1113 break;}
1114 case 54:
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"); ;
1117 break;}
1118 case 55:
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"); ;
1121 break;}
1122 case 56:
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"); ;
1125 break;}
1126 case 57:
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"); ;
1129 break;}
1130 case 58:
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"); ;
1133 break;}
1134 case 59:
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); ;
1137 break;}
1138 case 60:
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); ;
1141 break;}
1142 case 61:
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);;
1145 break;}
1146 case 62:
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);;
1149 break;}
1150 case 63:
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);;
1153 break;}
1154 case 64:
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);;
1157 break;}
1158 case 65:
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);;
1161 break;}
1162 case 66:
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);;
1165 break;}
1166 case 67:
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);;
1169 break;}
1170 case 68:
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);;
1173 break;}
1174 case 69:
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);;
1177 break;}
1178 case 70:
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);;
1181 break;}
1182 case 71:
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);;
1185 break;}
1186 case 72:
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);;
1189 break;}
1191 /* the action file gets copied in in place of this dollarsign */
1192 #line 543 "/usr/lib/bison.simple"
1194 yyvsp -= yylen;
1195 yyssp -= yylen;
1196 #ifdef YYLSP_NEEDED
1197 yylsp -= yylen;
1198 #endif
1200 #if YYDEBUG != 0
1201 if (yydebug)
1203 short *ssp1 = yyss - 1;
1204 fprintf (stderr, "state stack now");
1205 while (ssp1 != yyssp)
1206 fprintf (stderr, " %d", *++ssp1);
1207 fprintf (stderr, "\n");
1209 #endif
1211 *++yyvsp = yyval;
1213 #ifdef YYLSP_NEEDED
1214 yylsp++;
1215 if (yylen == 0)
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;
1221 yylsp->text = 0;
1223 else
1225 yylsp->last_line = (yylsp+yylen-1)->last_line;
1226 yylsp->last_column = (yylsp+yylen-1)->last_column;
1228 #endif
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. */
1235 yyn = yyr1[yyn];
1237 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1238 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1239 yystate = yytable[yystate];
1240 else
1241 yystate = yydefgoto[yyn - YYNTBASE];
1243 goto yynewstate;
1245 yyerrlab: /* here on detecting error */
1247 if (! yyerrstatus)
1248 /* If not already recovering from an error, report this error. */
1250 ++yynerrs;
1252 #ifdef YYERROR_VERBOSE
1253 yyn = yypact[yystate];
1255 if (yyn > YYFLAG && yyn < YYLAST)
1257 int size = 0;
1258 char *msg;
1259 int x, count;
1261 count = 0;
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);
1268 if (msg != 0)
1270 strcpy(msg, "parse error");
1272 if (count < 5)
1274 count = 0;
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]);
1281 strcat(msg, "'");
1282 count++;
1285 yyerror(msg);
1286 free(msg);
1288 else
1289 yyerror ("parse error; also virtual memory exceeded");
1291 else
1292 #endif /* YYERROR_VERBOSE */
1293 yyerror("parse error");
1296 goto yyerrlab1;
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)
1305 YYABORT;
1307 #if YYDEBUG != 0
1308 if (yydebug)
1309 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1310 #endif
1312 yychar = YYEMPTY;
1315 /* Else will try to reuse lookahead token
1316 after shifting the error token. */
1318 yyerrstatus = 3; /* Each real token shifted decrements this */
1320 goto yyerrhandle;
1322 yyerrdefault: /* current state does not do anything special for the error token. */
1324 #if 0
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;
1329 #endif
1331 yyerrpop: /* pop the current state because it cannot handle the error token */
1333 if (yyssp == yyss) YYABORT;
1334 yyvsp--;
1335 yystate = *--yyssp;
1336 #ifdef YYLSP_NEEDED
1337 yylsp--;
1338 #endif
1340 #if YYDEBUG != 0
1341 if (yydebug)
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");
1349 #endif
1351 yyerrhandle:
1353 yyn = yypact[yystate];
1354 if (yyn == YYFLAG)
1355 goto yyerrdefault;
1357 yyn += YYTERROR;
1358 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1359 goto yyerrdefault;
1361 yyn = yytable[yyn];
1362 if (yyn < 0)
1364 if (yyn == YYFLAG)
1365 goto yyerrpop;
1366 yyn = -yyn;
1367 goto yyreduce;
1369 else if (yyn == 0)
1370 goto yyerrpop;
1372 if (yyn == YYFINAL)
1373 YYACCEPT;
1375 #if YYDEBUG != 0
1376 if (yydebug)
1377 fprintf(stderr, "Shifting error token, ");
1378 #endif
1380 *++yyvsp = yylval;
1381 #ifdef YYLSP_NEEDED
1382 *++yylsp = yylloc;
1383 #endif
1385 yystate = yyn;
1386 goto yynewstate;
1388 yyacceptlab:
1389 /* YYACCEPT comes here. */
1390 if (yyfree_stacks)
1392 free (yyss);
1393 free (yyvs);
1394 #ifdef YYLSP_NEEDED
1395 free (yyls);
1396 #endif
1398 return 0;
1400 yyabortlab:
1401 /* YYABORT comes here. */
1402 if (yyfree_stacks)
1404 free (yyss);
1405 free (yyvs);
1406 #ifdef YYLSP_NEEDED
1407 free (yyls);
1408 #endif
1410 return 1;
1412 #line 202 "grammar.y"
1415 Node *mainParse(const char *_code)
1417 initFlex( _code );
1418 top = 0L;
1419 yyparse();
1420 if( top )
1421 return top;
1422 else
1423 return 0L;
1426 void yyerror(const char * /*err*/)
1428 // printf("REALKING ERR[%s]\n",err);
1429 // if error, delete all nodes.
1430 Node *pNode = 0L;
1431 int ncount = nodelist.size();
1432 for( int i = 0 ; i < ncount ; i++){
1433 pNode = nodelist.front();
1434 nodelist.pop_front();
1435 delete pNode;
1437 top = 0L;
1440 #ifndef PARSE_DEBUG
1441 int debug(const char * /*format*/, ...)
1443 return 0;
1445 #endif
1447 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */