First import
[xorg_rtime.git] / xorg-server-1.4 / hw / dmx / config / parser.c
blobc8fc62e8b42494ad2ec7ab4753761c45971d1cf8
1 /* A Bison parser, made from /home/anholt/xserver-stable/hw/dmx/config/parser.y, by GNU bison 1.75. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
37 #define YYBISON 1
39 /* Pure parsers. */
40 #define YYPURE 0
42 /* Using locations. */
43 #define YYLSP_NEEDED 0
47 /* Tokens. */
48 #ifndef YYTOKENTYPE
49 # define YYTOKENTYPE
50 /* Put the tokens into the symbol table, so that GDB and other debuggers
51 know about them. */
52 enum yytokentype {
53 T_VIRTUAL = 258,
54 T_DISPLAY = 259,
55 T_WALL = 260,
56 T_OPTION = 261,
57 T_PARAM = 262,
58 T_STRING = 263,
59 T_DIMENSION = 264,
60 T_OFFSET = 265,
61 T_ORIGIN = 266,
62 T_COMMENT = 267,
63 T_LINE_COMMENT = 268
65 #endif
66 #define T_VIRTUAL 258
67 #define T_DISPLAY 259
68 #define T_WALL 260
69 #define T_OPTION 261
70 #define T_PARAM 262
71 #define T_STRING 263
72 #define T_DIMENSION 264
73 #define T_OFFSET 265
74 #define T_ORIGIN 266
75 #define T_COMMENT 267
76 #define T_LINE_COMMENT 268
81 /* Copy the first part of user declarations. */
82 #line 35 "parser.y"
84 #ifdef HAVE_DMX_CONFIG_H
85 #include <dmx-config.h>
86 #endif
88 #include "dmxparse.h"
89 #include <string.h>
90 #include <stdlib.h>
91 #define YYDEBUG 1
92 #define YYERROR_VERBOSE
93 #define YY_USE_PROTOS
95 DMXConfigEntryPtr dmxConfigEntry = NULL;
96 #define APPEND(type, h, t) \
97 { \
98 type pt; \
99 for (pt = h; pt->next; pt = pt->next); \
100 pt->next = t; \
104 /* Enabling traces. */
105 #ifndef YYDEBUG
106 # define YYDEBUG 0
107 #endif
109 /* Enabling verbose error messages. */
110 #ifdef YYERROR_VERBOSE
111 # undef YYERROR_VERBOSE
112 # define YYERROR_VERBOSE 1
113 #else
114 # define YYERROR_VERBOSE 0
115 #endif
117 #ifndef YYSTYPE
118 #line 56 "parser.y"
119 typedef union {
120 DMXConfigTokenPtr token;
121 DMXConfigStringPtr string;
122 DMXConfigNumberPtr number;
123 DMXConfigPairPtr pair;
124 DMXConfigFullDimPtr fdim;
125 DMXConfigPartDimPtr pdim;
126 DMXConfigDisplayPtr display;
127 DMXConfigWallPtr wall;
128 DMXConfigOptionPtr option;
129 DMXConfigParamPtr param;
130 DMXConfigCommentPtr comment;
131 DMXConfigSubPtr subentry;
132 DMXConfigVirtualPtr virtual;
133 DMXConfigEntryPtr entry;
134 } yystype;
135 /* Line 188 of /usr/local/share/bison/yacc.c. */
136 #line 137 "parser.c"
137 # define YYSTYPE yystype
138 # define YYSTYPE_IS_TRIVIAL 1
139 #endif
141 #ifndef YYLTYPE
142 typedef struct yyltype
144 int first_line;
145 int first_column;
146 int last_line;
147 int last_column;
148 } yyltype;
149 # define YYLTYPE yyltype
150 # define YYLTYPE_IS_TRIVIAL 1
151 #endif
153 /* Copy the second part of user declarations. */
156 /* Line 213 of /usr/local/share/bison/yacc.c. */
157 #line 158 "parser.c"
159 #if ! defined (yyoverflow) || YYERROR_VERBOSE
161 /* The parser invokes alloca or malloc; define the necessary symbols. */
163 # if YYSTACK_USE_ALLOCA
164 # define YYSTACK_ALLOC alloca
165 # else
166 # ifndef YYSTACK_USE_ALLOCA
167 # if defined (alloca) || defined (_ALLOCA_H)
168 # define YYSTACK_ALLOC alloca
169 # else
170 # ifdef __GNUC__
171 # define YYSTACK_ALLOC __builtin_alloca
172 # endif
173 # endif
174 # endif
175 # endif
177 # ifdef YYSTACK_ALLOC
178 /* Pacify GCC's `empty if-body' warning. */
179 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
180 # else
181 # if defined (__STDC__) || defined (__cplusplus)
182 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
183 # define YYSIZE_T size_t
184 # endif
185 # define YYSTACK_ALLOC malloc
186 # define YYSTACK_FREE free
187 # endif
188 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
191 #if (! defined (yyoverflow) \
192 && (! defined (__cplusplus) \
193 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
195 /* A type that is properly aligned for any stack member. */
196 union yyalloc
198 short yyss;
199 YYSTYPE yyvs;
202 /* The size of the maximum gap between one aligned stack and the next. */
203 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
205 /* The size of an array large to enough to hold all stacks, each with
206 N elements. */
207 # define YYSTACK_BYTES(N) \
208 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
209 + YYSTACK_GAP_MAX)
211 /* Copy COUNT objects from FROM to TO. The source and destination do
212 not overlap. */
213 # ifndef YYCOPY
214 # if 1 < __GNUC__
215 # define YYCOPY(To, From, Count) \
216 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
217 # else
218 # define YYCOPY(To, From, Count) \
219 do \
221 register YYSIZE_T yyi; \
222 for (yyi = 0; yyi < (Count); yyi++) \
223 (To)[yyi] = (From)[yyi]; \
225 while (0)
226 # endif
227 # endif
229 /* Relocate STACK from its old location to the new one. The
230 local variables YYSIZE and YYSTACKSIZE give the old and new number of
231 elements in the stack, and YYPTR gives the new location of the
232 stack. Advance YYPTR to a properly aligned location for the next
233 stack. */
234 # define YYSTACK_RELOCATE(Stack) \
235 do \
237 YYSIZE_T yynewbytes; \
238 YYCOPY (&yyptr->Stack, Stack, yysize); \
239 Stack = &yyptr->Stack; \
240 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
241 yyptr += yynewbytes / sizeof (*yyptr); \
243 while (0)
245 #endif
247 #if defined (__STDC__) || defined (__cplusplus)
248 typedef signed char yysigned_char;
249 #else
250 typedef short yysigned_char;
251 #endif
253 /* YYFINAL -- State number of the termination state. */
254 #define YYFINAL 13
255 #define YYLAST 106
257 /* YYNTOKENS -- Number of terminals. */
258 #define YYNTOKENS 18
259 /* YYNNTS -- Number of nonterminals. */
260 #define YYNNTS 25
261 /* YYNRULES -- Number of rules. */
262 #define YYNRULES 59
263 /* YYNRULES -- Number of states. */
264 #define YYNSTATES 95
266 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
267 #define YYUNDEFTOK 2
268 #define YYMAXUTOK 268
270 #define YYTRANSLATE(X) \
271 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
273 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
274 static const unsigned char yytranslate[] =
276 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
277 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
278 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
279 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
280 2, 2, 2, 2, 2, 2, 2, 6, 2, 2,
281 2, 2, 2, 2, 2, 2, 2, 2, 2, 5,
282 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
283 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
284 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
285 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
286 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
287 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
288 2, 2, 2, 3, 2, 4, 2, 2, 2, 2,
289 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
290 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
291 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
292 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
293 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
294 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
295 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
296 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
297 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
298 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
299 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
300 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
301 2, 2, 2, 2, 2, 2, 1, 2, 7, 8,
302 9, 10, 11, 12, 13, 14, 15, 16, 17
305 #if YYDEBUG
306 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
307 YYRHS. */
308 static const unsigned char yyprhs[] =
310 0, 0, 3, 5, 7, 10, 12, 14, 19, 25,
311 31, 38, 40, 43, 45, 47, 49, 51, 53, 57,
312 61, 66, 68, 71, 74, 77, 79, 81, 85, 88,
313 90, 96, 101, 106, 111, 115, 119, 122, 128, 133,
314 137, 139, 142, 144, 147, 149, 152, 154, 157, 159,
315 162, 164, 167, 169, 172, 174, 177, 179, 182, 184
318 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
319 static const yysigned_char yyrhs[] =
321 19, 0, -1, 20, -1, 21, -1, 20, 21, -1,
322 22, -1, 17, -1, 7, 39, 23, 40, -1, 7,
323 35, 39, 23, 40, -1, 7, 34, 39, 23, 40,
324 -1, 7, 34, 35, 39, 23, 40, -1, 24, -1,
325 23, 24, -1, 17, -1, 31, -1, 32, -1, 25,
326 -1, 26, -1, 10, 42, 38, -1, 11, 42, 38,
327 -1, 11, 39, 27, 40, -1, 28, -1, 27, 28,
328 -1, 42, 38, -1, 35, 36, -1, 35, -1, 36,
329 -1, 29, 6, 29, -1, 6, 29, -1, 29, -1,
330 33, 34, 30, 37, 38, -1, 33, 30, 37, 38,
331 -1, 33, 34, 37, 38, -1, 33, 34, 30, 38,
332 -1, 33, 30, 38, -1, 33, 34, 38, -1, 33,
333 38, -1, 41, 35, 35, 42, 38, -1, 41, 35,
334 42, 38, -1, 41, 42, 38, -1, 8, -1, 8,
335 16, -1, 12, -1, 12, 16, -1, 13, -1, 13,
336 16, -1, 14, -1, 14, 16, -1, 15, -1, 15,
337 16, -1, 5, -1, 5, 16, -1, 3, -1, 3,
338 16, -1, 4, -1, 4, 16, -1, 9, -1, 9,
339 16, -1, 34, -1, 42, 34, -1
342 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
343 static const unsigned char yyrline[] =
345 0, 95, 95, 98, 99, 102, 103, 106, 108, 110,
346 112, 116, 117, 120, 121, 122, 123, 124, 127, 131,
347 133, 139, 140, 143, 147, 149, 151, 155, 157, 159,
348 163, 165, 167, 170, 172, 174, 176, 180, 182, 184,
349 188, 189, 192, 193, 196, 197, 200, 201, 204, 205,
350 208, 209, 212, 213, 216, 217, 220, 221, 224, 225
352 #endif
354 #if YYDEBUG || YYERROR_VERBOSE
355 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
356 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
357 static const char *const yytname[] =
359 "$end", "error", "$undefined", "'{'", "'}'", "';'", "'/'", "T_VIRTUAL",
360 "T_DISPLAY", "T_WALL", "T_OPTION", "T_PARAM", "T_STRING", "T_DIMENSION",
361 "T_OFFSET", "T_ORIGIN", "T_COMMENT", "T_LINE_COMMENT", "$accept",
362 "Program", "EntryList", "Entry", "Virtual", "SubList", "Sub",
363 "OptionEntry", "ParamEntry", "ParamList", "Param", "PartialDim",
364 "FullDim", "DisplayEntry", "WallEntry", "Display", "Name", "Dimension",
365 "Offset", "Origin", "Terminal", "Open", "Close", "Wall", "NameList", 0
367 #endif
369 # ifdef YYPRINT
370 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
371 token YYLEX-NUM. */
372 static const unsigned short yytoknum[] =
374 0, 256, 257, 123, 125, 59, 47, 258, 259, 260,
375 261, 262, 263, 264, 265, 266, 267, 268
377 # endif
379 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
380 static const unsigned char yyr1[] =
382 0, 18, 19, 20, 20, 21, 21, 22, 22, 22,
383 22, 23, 23, 24, 24, 24, 24, 24, 25, 26,
384 26, 27, 27, 28, 29, 29, 29, 30, 30, 30,
385 31, 31, 31, 31, 31, 31, 31, 32, 32, 32,
386 33, 33, 34, 34, 35, 35, 36, 36, 37, 37,
387 38, 38, 39, 39, 40, 40, 41, 41, 42, 42
390 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
391 static const unsigned char yyr2[] =
393 0, 2, 1, 1, 2, 1, 1, 4, 5, 5,
394 6, 1, 2, 1, 1, 1, 1, 1, 3, 3,
395 4, 1, 2, 2, 2, 1, 1, 3, 2, 1,
396 5, 4, 4, 4, 3, 3, 2, 5, 4, 3,
397 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
398 1, 2, 1, 2, 1, 2, 1, 2, 1, 2
401 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
402 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
403 means the default is an error. */
404 static const unsigned char yydefact[] =
406 0, 0, 6, 0, 2, 3, 5, 52, 42, 44,
407 0, 0, 0, 1, 4, 53, 43, 45, 0, 0,
408 0, 40, 56, 0, 0, 13, 0, 11, 16, 17,
409 14, 15, 0, 0, 0, 0, 0, 41, 57, 58,
410 0, 0, 0, 54, 12, 7, 50, 0, 46, 29,
411 0, 0, 25, 26, 36, 0, 0, 0, 9, 8,
412 59, 18, 0, 21, 0, 19, 55, 51, 28, 47,
413 0, 48, 0, 34, 0, 0, 35, 24, 0, 0,
414 39, 10, 22, 20, 23, 27, 49, 31, 0, 33,
415 32, 0, 38, 30, 37
418 /* YYDEFGOTO[NTERM-NUM]. */
419 static const yysigned_char yydefgoto[] =
421 -1, 3, 4, 5, 6, 26, 27, 28, 29, 62,
422 63, 49, 50, 30, 31, 32, 39, 52, 53, 72,
423 54, 12, 45, 33, 64
426 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
427 STATE-NUM. */
428 #define YYPACT_NINF -32
429 static const yysigned_char yypact[] =
431 -3, 41, -32, 22, -3, -32, -32, 12, 35, 46,
432 5, 62, 75, -32, -32, -32, -32, -32, 62, 75,
433 75, 51, 54, 59, 18, -32, 65, -32, -32, -32,
434 -32, -32, 88, 37, 75, 65, 65, -32, -32, -32,
435 86, 59, 86, 61, -32, -32, 79, -4, 80, 28,
436 31, 74, 67, -32, -32, 37, 86, 65, -32, -32,
437 -32, -32, 56, -32, 86, -32, -32, -32, -32, -32,
438 -4, 81, 94, -32, 31, 94, -32, -32, 59, 86,
439 -32, -32, -32, -32, -32, -32, -32, -32, 94, -32,
440 -32, 86, -32, -32, -32
443 /* YYPGOTO[NTERM-NUM]. */
444 static const yysigned_char yypgoto[] =
446 -32, -32, -32, 99, -32, 6, -19, -32, -32, -32,
447 42, -28, 55, -32, -32, -32, -1, 2, 53, -31,
448 -27, 48, -30, -32, -22
451 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
452 positive, shift that token. If negative, reduce the rule which
453 number is the opposite. If zero, do what YYDEFACT says.
454 If YYTABLE_NINF, parse error. */
455 #define YYTABLE_NINF -1
456 static const unsigned char yytable[] =
458 10, 40, 42, 11, 1, 58, 59, 44, 7, 9,
459 48, 56, 18, 61, 2, 65, 44, 44, 9, 68,
460 75, 7, 13, 73, 76, 35, 36, 81, 15, 80,
461 8, 51, 83, 79, 70, 55, 46, 84, 44, 60,
462 57, 60, 85, 88, 7, 87, 71, 89, 90, 8,
463 9, 16, 92, 8, 9, 60, 91, 78, 19, 20,
464 43, 93, 17, 60, 94, 7, 34, 37, 8, 43,
465 38, 8, 41, 21, 22, 23, 24, 66, 60, 46,
466 47, 48, 25, 21, 22, 23, 24, 9, 48, 71,
467 60, 46, 25, 46, 47, 67, 69, 86, 8, 46,
468 8, 9, 48, 14, 82, 77, 74
471 static const unsigned char yycheck[] =
473 1, 23, 24, 1, 7, 35, 36, 26, 3, 13,
474 14, 33, 10, 40, 17, 42, 35, 36, 13, 47,
475 51, 3, 0, 50, 51, 19, 20, 57, 16, 56,
476 12, 32, 62, 55, 6, 33, 5, 64, 57, 40,
477 34, 42, 70, 74, 3, 72, 15, 74, 75, 12,
478 13, 16, 79, 12, 13, 56, 78, 55, 10, 11,
479 4, 88, 16, 64, 91, 3, 18, 16, 12, 4,
480 16, 12, 24, 8, 9, 10, 11, 16, 79, 5,
481 6, 14, 17, 8, 9, 10, 11, 13, 14, 15,
482 91, 5, 17, 5, 6, 16, 16, 16, 12, 5,
483 12, 13, 14, 4, 62, 52, 51
486 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
487 symbol of state STATE-NUM. */
488 static const unsigned char yystos[] =
490 0, 7, 17, 19, 20, 21, 22, 3, 12, 13,
491 34, 35, 39, 0, 21, 16, 16, 16, 35, 39,
492 39, 8, 9, 10, 11, 17, 23, 24, 25, 26,
493 31, 32, 33, 41, 39, 23, 23, 16, 16, 34,
494 42, 39, 42, 4, 24, 40, 5, 6, 14, 29,
495 30, 34, 35, 36, 38, 35, 42, 23, 40, 40,
496 34, 38, 27, 28, 42, 38, 16, 16, 29, 16,
497 6, 15, 37, 38, 30, 37, 38, 36, 35, 42,
498 38, 40, 28, 40, 38, 29, 16, 38, 37, 38,
499 38, 42, 38, 38, 38
502 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
503 # define YYSIZE_T __SIZE_TYPE__
504 #endif
505 #if ! defined (YYSIZE_T) && defined (size_t)
506 # define YYSIZE_T size_t
507 #endif
508 #if ! defined (YYSIZE_T)
509 # if defined (__STDC__) || defined (__cplusplus)
510 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
511 # define YYSIZE_T size_t
512 # endif
513 #endif
514 #if ! defined (YYSIZE_T)
515 # define YYSIZE_T unsigned int
516 #endif
518 #define yyerrok (yyerrstatus = 0)
519 #define yyclearin (yychar = YYEMPTY)
520 #define YYEMPTY -2
521 #define YYEOF 0
523 #define YYACCEPT goto yyacceptlab
524 #define YYABORT goto yyabortlab
525 #define YYERROR goto yyerrlab1
527 /* Like YYERROR except do call yyerror. This remains here temporarily
528 to ease the transition to the new meaning of YYERROR, for GCC.
529 Once GCC version 2 has supplanted version 1, this can go. */
531 #define YYFAIL goto yyerrlab
533 #define YYRECOVERING() (!!yyerrstatus)
535 #define YYBACKUP(Token, Value) \
536 do \
537 if (yychar == YYEMPTY && yylen == 1) \
539 yychar = (Token); \
540 yylval = (Value); \
541 yychar1 = YYTRANSLATE (yychar); \
542 YYPOPSTACK; \
543 goto yybackup; \
545 else \
547 yyerror ("syntax error: cannot back up"); \
548 YYERROR; \
550 while (0)
552 #define YYTERROR 1
553 #define YYERRCODE 256
555 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
556 are run). */
558 #ifndef YYLLOC_DEFAULT
559 # define YYLLOC_DEFAULT(Current, Rhs, N) \
560 Current.first_line = Rhs[1].first_line; \
561 Current.first_column = Rhs[1].first_column; \
562 Current.last_line = Rhs[N].last_line; \
563 Current.last_column = Rhs[N].last_column;
564 #endif
566 /* YYLEX -- calling `yylex' with the right arguments. */
568 #define YYLEX yylex ()
570 /* Enable debugging if requested. */
571 #if YYDEBUG
573 # ifndef YYFPRINTF
574 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
575 # define YYFPRINTF fprintf
576 # endif
578 # define YYDPRINTF(Args) \
579 do { \
580 if (yydebug) \
581 YYFPRINTF Args; \
582 } while (0)
583 # define YYDSYMPRINT(Args) \
584 do { \
585 if (yydebug) \
586 yysymprint Args; \
587 } while (0)
588 /* Nonzero means print parse trace. It is left uninitialized so that
589 multiple parsers can coexist. */
590 int yydebug;
591 #else /* !YYDEBUG */
592 # define YYDPRINTF(Args)
593 # define YYDSYMPRINT(Args)
594 #endif /* !YYDEBUG */
596 /* YYINITDEPTH -- initial size of the parser's stacks. */
597 #ifndef YYINITDEPTH
598 # define YYINITDEPTH 200
599 #endif
601 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
602 if the built-in stack extension method is used).
604 Do not make this value too large; the results are undefined if
605 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
606 evaluated with infinite-precision integer arithmetic. */
608 #if YYMAXDEPTH == 0
609 # undef YYMAXDEPTH
610 #endif
612 #ifndef YYMAXDEPTH
613 # define YYMAXDEPTH 10000
614 #endif
618 #if YYERROR_VERBOSE
620 # ifndef yystrlen
621 # if defined (__GLIBC__) && defined (_STRING_H)
622 # define yystrlen strlen
623 # else
624 /* Return the length of YYSTR. */
625 static YYSIZE_T
626 # if defined (__STDC__) || defined (__cplusplus)
627 yystrlen (const char *yystr)
628 # else
629 yystrlen (yystr)
630 const char *yystr;
631 # endif
633 register const char *yys = yystr;
635 while (*yys++ != '\0')
636 continue;
638 return yys - yystr - 1;
640 # endif
641 # endif
643 # ifndef yystpcpy
644 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
645 # define yystpcpy stpcpy
646 # else
647 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
648 YYDEST. */
649 static char *
650 # if defined (__STDC__) || defined (__cplusplus)
651 yystpcpy (char *yydest, const char *yysrc)
652 # else
653 yystpcpy (yydest, yysrc)
654 char *yydest;
655 const char *yysrc;
656 # endif
658 register char *yyd = yydest;
659 register const char *yys = yysrc;
661 while ((*yyd++ = *yys++) != '\0')
662 continue;
664 return yyd - 1;
666 # endif
667 # endif
669 #endif /* !YYERROR_VERBOSE */
673 #if YYDEBUG
674 /*-----------------------------.
675 | Print this symbol on YYOUT. |
676 `-----------------------------*/
678 static void
679 #if defined (__STDC__) || defined (__cplusplus)
680 yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
681 #else
682 yysymprint (yyout, yytype, yyvalue)
683 FILE* yyout;
684 int yytype;
685 YYSTYPE yyvalue;
686 #endif
688 /* Pacify ``unused variable'' warnings. */
689 (void) yyvalue;
691 if (yytype < YYNTOKENS)
693 YYFPRINTF (yyout, "token %s (", yytname[yytype]);
694 # ifdef YYPRINT
695 YYPRINT (yyout, yytoknum[yytype], yyvalue);
696 # endif
698 else
699 YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
701 switch (yytype)
703 default:
704 break;
706 YYFPRINTF (yyout, ")");
708 #endif /* YYDEBUG. */
711 /*-----------------------------------------------.
712 | Release the memory associated to this symbol. |
713 `-----------------------------------------------*/
715 static void
716 #if defined (__STDC__) || defined (__cplusplus)
717 yydestruct (int yytype, YYSTYPE yyvalue)
718 #else
719 yydestruct (yytype, yyvalue)
720 int yytype;
721 YYSTYPE yyvalue;
722 #endif
724 /* Pacify ``unused variable'' warnings. */
725 (void) yyvalue;
727 switch (yytype)
729 default:
730 break;
736 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
737 into yyparse. The argument should have type void *.
738 It should actually point to an object.
739 Grammar actions can access the variable by casting it
740 to the proper pointer type. */
742 #ifdef YYPARSE_PARAM
743 # if defined (__STDC__) || defined (__cplusplus)
744 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
745 # define YYPARSE_PARAM_DECL
746 # else
747 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
748 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
749 # endif
750 #else /* !YYPARSE_PARAM */
751 # define YYPARSE_PARAM_ARG
752 # define YYPARSE_PARAM_DECL
753 #endif /* !YYPARSE_PARAM */
755 /* Prevent warning if -Wstrict-prototypes. */
756 #ifdef __GNUC__
757 # ifdef YYPARSE_PARAM
758 int yyparse (void *);
759 # else
760 int yyparse (void);
761 # endif
762 #endif
765 /* The lookahead symbol. */
766 int yychar;
768 /* The semantic value of the lookahead symbol. */
769 YYSTYPE yylval;
771 /* Number of parse errors so far. */
772 int yynerrs;
776 yyparse (YYPARSE_PARAM_ARG)
777 YYPARSE_PARAM_DECL
780 register int yystate;
781 register int yyn;
782 int yyresult;
783 /* Number of tokens to shift before error messages enabled. */
784 int yyerrstatus;
785 /* Lookahead token as an internal (translated) token number. */
786 int yychar1 = 0;
788 /* Three stacks and their tools:
789 `yyss': related to states,
790 `yyvs': related to semantic values,
791 `yyls': related to locations.
793 Refer to the stacks thru separate pointers, to allow yyoverflow
794 to reallocate them elsewhere. */
796 /* The state stack. */
797 short yyssa[YYINITDEPTH];
798 short *yyss = yyssa;
799 register short *yyssp;
801 /* The semantic value stack. */
802 YYSTYPE yyvsa[YYINITDEPTH];
803 YYSTYPE *yyvs = yyvsa;
804 register YYSTYPE *yyvsp;
808 #define YYPOPSTACK (yyvsp--, yyssp--)
810 YYSIZE_T yystacksize = YYINITDEPTH;
812 /* The variables used to return semantic value and location from the
813 action routines. */
814 YYSTYPE yyval;
817 /* When reducing, the number of symbols on the RHS of the reduced
818 rule. */
819 int yylen;
821 YYDPRINTF ((stderr, "Starting parse\n"));
823 yystate = 0;
824 yyerrstatus = 0;
825 yynerrs = 0;
826 yychar = YYEMPTY; /* Cause a token to be read. */
828 /* Initialize stack pointers.
829 Waste one element of value and location stack
830 so that they stay on the same level as the state stack.
831 The wasted elements are never initialized. */
833 yyssp = yyss;
834 yyvsp = yyvs;
836 goto yysetstate;
838 /*------------------------------------------------------------.
839 | yynewstate -- Push a new state, which is found in yystate. |
840 `------------------------------------------------------------*/
841 yynewstate:
842 /* In all cases, when you get here, the value and location stacks
843 have just been pushed. so pushing a state here evens the stacks.
845 yyssp++;
847 yysetstate:
848 *yyssp = yystate;
850 if (yyssp >= yyss + yystacksize - 1)
852 /* Get the current used size of the three stacks, in elements. */
853 YYSIZE_T yysize = yyssp - yyss + 1;
855 #ifdef yyoverflow
857 /* Give user a chance to reallocate the stack. Use copies of
858 these so that the &'s don't force the real ones into
859 memory. */
860 YYSTYPE *yyvs1 = yyvs;
861 short *yyss1 = yyss;
864 /* Each stack pointer address is followed by the size of the
865 data in use in that stack, in bytes. This used to be a
866 conditional around just the two extra args, but that might
867 be undefined if yyoverflow is a macro. */
868 yyoverflow ("parser stack overflow",
869 &yyss1, yysize * sizeof (*yyssp),
870 &yyvs1, yysize * sizeof (*yyvsp),
872 &yystacksize);
874 yyss = yyss1;
875 yyvs = yyvs1;
877 #else /* no yyoverflow */
878 # ifndef YYSTACK_RELOCATE
879 goto yyoverflowlab;
880 # else
881 /* Extend the stack our own way. */
882 if (yystacksize >= YYMAXDEPTH)
883 goto yyoverflowlab;
884 yystacksize *= 2;
885 if (yystacksize > YYMAXDEPTH)
886 yystacksize = YYMAXDEPTH;
889 short *yyss1 = yyss;
890 union yyalloc *yyptr =
891 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
892 if (! yyptr)
893 goto yyoverflowlab;
894 YYSTACK_RELOCATE (yyss);
895 YYSTACK_RELOCATE (yyvs);
897 # undef YYSTACK_RELOCATE
898 if (yyss1 != yyssa)
899 YYSTACK_FREE (yyss1);
901 # endif
902 #endif /* no yyoverflow */
904 yyssp = yyss + yysize - 1;
905 yyvsp = yyvs + yysize - 1;
908 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
909 (unsigned long int) yystacksize));
911 if (yyssp >= yyss + yystacksize - 1)
912 YYABORT;
915 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
917 goto yybackup;
919 /*-----------.
920 | yybackup. |
921 `-----------*/
922 yybackup:
924 /* Do appropriate processing given the current state. */
925 /* Read a lookahead token if we need one and don't already have one. */
926 /* yyresume: */
928 /* First try to decide what to do without reference to lookahead token. */
930 yyn = yypact[yystate];
931 if (yyn == YYPACT_NINF)
932 goto yydefault;
934 /* Not known => get a lookahead token if don't already have one. */
936 /* yychar is either YYEMPTY or YYEOF
937 or a valid token in external form. */
939 if (yychar == YYEMPTY)
941 YYDPRINTF ((stderr, "Reading a token: "));
942 yychar = YYLEX;
945 /* Convert token to internal form (in yychar1) for indexing tables with. */
947 if (yychar <= 0) /* This means end of input. */
949 yychar1 = 0;
950 yychar = YYEOF; /* Don't call YYLEX any more. */
952 YYDPRINTF ((stderr, "Now at end of input.\n"));
954 else
956 yychar1 = YYTRANSLATE (yychar);
958 /* We have to keep this `#if YYDEBUG', since we use variables
959 which are defined only if `YYDEBUG' is set. */
960 YYDPRINTF ((stderr, "Next token is "));
961 YYDSYMPRINT ((stderr, yychar1, yylval));
962 YYDPRINTF ((stderr, "\n"));
965 /* If the proper action on seeing token YYCHAR1 is to reduce or to
966 detect an error, take that action. */
967 yyn += yychar1;
968 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
969 goto yydefault;
970 yyn = yytable[yyn];
971 if (yyn <= 0)
973 if (yyn == 0 || yyn == YYTABLE_NINF)
974 goto yyerrlab;
975 yyn = -yyn;
976 goto yyreduce;
979 if (yyn == YYFINAL)
980 YYACCEPT;
982 /* Shift the lookahead token. */
983 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
984 yychar, yytname[yychar1]));
986 /* Discard the token being shifted unless it is eof. */
987 if (yychar != YYEOF)
988 yychar = YYEMPTY;
990 *++yyvsp = yylval;
993 /* Count tokens shifted since error; after three, turn off error
994 status. */
995 if (yyerrstatus)
996 yyerrstatus--;
998 yystate = yyn;
999 goto yynewstate;
1002 /*-----------------------------------------------------------.
1003 | yydefault -- do the default action for the current state. |
1004 `-----------------------------------------------------------*/
1005 yydefault:
1006 yyn = yydefact[yystate];
1007 if (yyn == 0)
1008 goto yyerrlab;
1009 goto yyreduce;
1012 /*-----------------------------.
1013 | yyreduce -- Do a reduction. |
1014 `-----------------------------*/
1015 yyreduce:
1016 /* yyn is the number of a rule to reduce with. */
1017 yylen = yyr2[yyn];
1019 /* If YYLEN is nonzero, implement the default value of the action:
1020 `$$ = $1'.
1022 Otherwise, the following line sets YYVAL to garbage.
1023 This behavior is undocumented and Bison
1024 users should not rely upon it. Assigning to YYVAL
1025 unconditionally makes the parser a bit smaller, and it avoids a
1026 GCC warning that YYVAL may be used uninitialized. */
1027 yyval = yyvsp[1-yylen];
1031 #if YYDEBUG
1032 /* We have to keep this `#if YYDEBUG', since we use variables which
1033 are defined only if `YYDEBUG' is set. */
1034 if (yydebug)
1036 int yyi;
1038 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1039 yyn - 1, yyrline[yyn]);
1041 /* Print the symbols being reduced, and their result. */
1042 for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
1043 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1044 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1046 #endif
1047 switch (yyn)
1049 case 2:
1050 #line 95 "parser.y"
1051 { dmxConfigEntry = yyvsp[0].entry; }
1052 break;
1054 case 4:
1055 #line 99 "parser.y"
1056 { APPEND(DMXConfigEntryPtr,yyvsp[-1].entry,yyvsp[0].entry); yyval.entry = yyvsp[-1].entry; }
1057 break;
1059 case 5:
1060 #line 102 "parser.y"
1061 { yyval.entry = dmxConfigEntryVirtual(yyvsp[0].virtual); }
1062 break;
1064 case 6:
1065 #line 103 "parser.y"
1066 { yyval.entry = dmxConfigEntryComment(yyvsp[0].comment); }
1067 break;
1069 case 7:
1070 #line 107 "parser.y"
1071 { yyval.virtual = dmxConfigCreateVirtual(yyvsp[-3].token, NULL, NULL, yyvsp[-2].token, yyvsp[-1].subentry, yyvsp[0].token); }
1072 break;
1074 case 8:
1075 #line 109 "parser.y"
1076 { yyval.virtual = dmxConfigCreateVirtual(yyvsp[-4].token, NULL, yyvsp[-3].pair, yyvsp[-2].token, yyvsp[-1].subentry, yyvsp[0].token); }
1077 break;
1079 case 9:
1080 #line 111 "parser.y"
1081 { yyval.virtual = dmxConfigCreateVirtual(yyvsp[-4].token, yyvsp[-3].string, NULL, yyvsp[-2].token, yyvsp[-1].subentry, yyvsp[0].token); }
1082 break;
1084 case 10:
1085 #line 113 "parser.y"
1086 { yyval.virtual = dmxConfigCreateVirtual(yyvsp[-5].token, yyvsp[-4].string, yyvsp[-3].pair, yyvsp[-2].token, yyvsp[-1].subentry, yyvsp[0].token ); }
1087 break;
1089 case 12:
1090 #line 117 "parser.y"
1091 { APPEND(DMXConfigSubPtr,yyvsp[-1].subentry,yyvsp[0].subentry); yyval.subentry = yyvsp[-1].subentry; }
1092 break;
1094 case 13:
1095 #line 120 "parser.y"
1096 { yyval.subentry = dmxConfigSubComment(yyvsp[0].comment); }
1097 break;
1099 case 14:
1100 #line 121 "parser.y"
1101 { yyval.subentry = dmxConfigSubDisplay(yyvsp[0].display); }
1102 break;
1104 case 15:
1105 #line 122 "parser.y"
1106 { yyval.subentry = dmxConfigSubWall(yyvsp[0].wall); }
1107 break;
1109 case 16:
1110 #line 123 "parser.y"
1111 { yyval.subentry = dmxConfigSubOption(yyvsp[0].option); }
1112 break;
1114 case 17:
1115 #line 124 "parser.y"
1116 { yyval.subentry = dmxConfigSubParam(yyvsp[0].param); }
1117 break;
1119 case 18:
1120 #line 128 "parser.y"
1121 { yyval.option = dmxConfigCreateOption(yyvsp[-2].token, yyvsp[-1].string, yyvsp[0].token); }
1122 break;
1124 case 19:
1125 #line 132 "parser.y"
1126 { yyval.param = dmxConfigCreateParam(yyvsp[-2].token, NULL, yyvsp[-1].string, NULL, yyvsp[0].token); }
1127 break;
1129 case 20:
1130 #line 134 "parser.y"
1131 { yyval.param = dmxConfigCreateParam(yyvsp[-3].token, yyvsp[-2].token, NULL, yyvsp[0].token, NULL);
1132 yyval.param->next = yyvsp[-1].param;
1134 break;
1136 case 22:
1137 #line 140 "parser.y"
1138 { APPEND(DMXConfigParamPtr,yyvsp[-1].param,yyvsp[0].param); yyval.param = yyvsp[-1].param; }
1139 break;
1141 case 23:
1142 #line 144 "parser.y"
1143 { yyval.param = dmxConfigCreateParam(NULL, NULL, yyvsp[-1].string, NULL, yyvsp[0].token); }
1144 break;
1146 case 24:
1147 #line 148 "parser.y"
1148 { yyval.pdim = dmxConfigCreatePartDim(yyvsp[-1].pair, yyvsp[0].pair); }
1149 break;
1151 case 25:
1152 #line 150 "parser.y"
1153 { yyval.pdim = dmxConfigCreatePartDim(yyvsp[0].pair, NULL); }
1154 break;
1156 case 26:
1157 #line 152 "parser.y"
1158 { yyval.pdim = dmxConfigCreatePartDim(NULL, yyvsp[0].pair); }
1159 break;
1161 case 27:
1162 #line 156 "parser.y"
1163 { yyval.fdim = dmxConfigCreateFullDim(yyvsp[-2].pdim, yyvsp[0].pdim); }
1164 break;
1166 case 28:
1167 #line 158 "parser.y"
1168 { yyval.fdim = dmxConfigCreateFullDim(NULL, yyvsp[0].pdim); }
1169 break;
1171 case 29:
1172 #line 160 "parser.y"
1173 { yyval.fdim = dmxConfigCreateFullDim(yyvsp[0].pdim, NULL); }
1174 break;
1176 case 30:
1177 #line 164 "parser.y"
1178 { yyval.display = dmxConfigCreateDisplay(yyvsp[-4].token, yyvsp[-3].string, yyvsp[-2].fdim, yyvsp[-1].pair, yyvsp[0].token); }
1179 break;
1181 case 31:
1182 #line 166 "parser.y"
1183 { yyval.display = dmxConfigCreateDisplay(yyvsp[-3].token, NULL, yyvsp[-2].fdim, yyvsp[-1].pair, yyvsp[0].token); }
1184 break;
1186 case 32:
1187 #line 168 "parser.y"
1188 { yyval.display = dmxConfigCreateDisplay(yyvsp[-3].token, yyvsp[-2].string, NULL, yyvsp[-1].pair, yyvsp[0].token); }
1189 break;
1191 case 33:
1192 #line 171 "parser.y"
1193 { yyval.display = dmxConfigCreateDisplay(yyvsp[-3].token, yyvsp[-2].string, yyvsp[-1].fdim, NULL, yyvsp[0].token); }
1194 break;
1196 case 34:
1197 #line 173 "parser.y"
1198 { yyval.display = dmxConfigCreateDisplay(yyvsp[-2].token, NULL, yyvsp[-1].fdim, NULL, yyvsp[0].token); }
1199 break;
1201 case 35:
1202 #line 175 "parser.y"
1203 { yyval.display = dmxConfigCreateDisplay(yyvsp[-2].token, yyvsp[-1].string, NULL, NULL, yyvsp[0].token); }
1204 break;
1206 case 36:
1207 #line 177 "parser.y"
1208 { yyval.display = dmxConfigCreateDisplay(yyvsp[-1].token, NULL, NULL, NULL, yyvsp[0].token); }
1209 break;
1211 case 37:
1212 #line 181 "parser.y"
1213 { yyval.wall = dmxConfigCreateWall(yyvsp[-4].token, yyvsp[-3].pair, yyvsp[-2].pair, yyvsp[-1].string, yyvsp[0].token); }
1214 break;
1216 case 38:
1217 #line 183 "parser.y"
1218 { yyval.wall = dmxConfigCreateWall(yyvsp[-3].token, yyvsp[-2].pair, NULL, yyvsp[-1].string, yyvsp[0].token); }
1219 break;
1221 case 39:
1222 #line 185 "parser.y"
1223 { yyval.wall = dmxConfigCreateWall(yyvsp[-2].token, NULL, NULL, yyvsp[-1].string, yyvsp[0].token); }
1224 break;
1226 case 41:
1227 #line 189 "parser.y"
1228 { yyval.token = yyvsp[-1].token; yyval.token->comment = yyvsp[0].comment->comment; }
1229 break;
1231 case 43:
1232 #line 193 "parser.y"
1233 { yyval.string = yyvsp[-1].string; yyval.string->comment = yyvsp[0].comment->comment; }
1234 break;
1236 case 45:
1237 #line 197 "parser.y"
1238 { yyval.pair = yyvsp[-1].pair; yyval.pair->comment = yyvsp[0].comment->comment; }
1239 break;
1241 case 47:
1242 #line 201 "parser.y"
1243 { yyval.pair = yyvsp[-1].pair; yyval.pair->comment = yyvsp[0].comment->comment; }
1244 break;
1246 case 49:
1247 #line 205 "parser.y"
1248 { yyval.pair = yyvsp[-1].pair; yyval.pair->comment = yyvsp[0].comment->comment; }
1249 break;
1251 case 51:
1252 #line 209 "parser.y"
1253 { yyval.token = yyvsp[-1].token; yyval.token->comment = yyvsp[0].comment->comment; }
1254 break;
1256 case 53:
1257 #line 213 "parser.y"
1258 { yyval.token = yyvsp[-1].token; yyval.token->comment = yyvsp[0].comment->comment; }
1259 break;
1261 case 55:
1262 #line 217 "parser.y"
1263 { yyval.token = yyvsp[-1].token; yyval.token->comment = yyvsp[0].comment->comment; }
1264 break;
1266 case 57:
1267 #line 221 "parser.y"
1268 { yyval.token = yyvsp[-1].token; yyval.token->comment = yyvsp[0].comment->comment; }
1269 break;
1271 case 59:
1272 #line 225 "parser.y"
1273 { APPEND(DMXConfigStringPtr, yyvsp[-1].string, yyvsp[0].string); yyval.string = yyvsp[-1].string; }
1274 break;
1279 /* Line 1016 of /usr/local/share/bison/yacc.c. */
1280 #line 1281 "parser.c"
1282 yyvsp -= yylen;
1283 yyssp -= yylen;
1286 #if YYDEBUG
1287 if (yydebug)
1289 short *yyssp1 = yyss - 1;
1290 YYFPRINTF (stderr, "state stack now");
1291 while (yyssp1 != yyssp)
1292 YYFPRINTF (stderr, " %d", *++yyssp1);
1293 YYFPRINTF (stderr, "\n");
1295 #endif
1297 *++yyvsp = yyval;
1300 /* Now `shift' the result of the reduction. Determine what state
1301 that goes to, based on the state we popped back to and the rule
1302 number reduced by. */
1304 yyn = yyr1[yyn];
1306 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1307 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1308 yystate = yytable[yystate];
1309 else
1310 yystate = yydefgoto[yyn - YYNTOKENS];
1312 goto yynewstate;
1315 /*------------------------------------.
1316 | yyerrlab -- here on detecting error |
1317 `------------------------------------*/
1318 yyerrlab:
1319 /* If not already recovering from an error, report this error. */
1320 if (!yyerrstatus)
1322 ++yynerrs;
1323 #if YYERROR_VERBOSE
1324 yyn = yypact[yystate];
1326 if (YYPACT_NINF < yyn && yyn < YYLAST)
1328 YYSIZE_T yysize = 0;
1329 int yytype = YYTRANSLATE (yychar);
1330 char *yymsg;
1331 int yyx, yycount;
1333 yycount = 0;
1334 /* Start YYX at -YYN if negative to avoid negative indexes in
1335 YYCHECK. */
1336 for (yyx = yyn < 0 ? -yyn : 0;
1337 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1338 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1339 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1340 yysize += yystrlen ("parse error, unexpected ") + 1;
1341 yysize += yystrlen (yytname[yytype]);
1342 yymsg = (char *) YYSTACK_ALLOC (yysize);
1343 if (yymsg != 0)
1345 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1346 yyp = yystpcpy (yyp, yytname[yytype]);
1348 if (yycount < 5)
1350 yycount = 0;
1351 for (yyx = yyn < 0 ? -yyn : 0;
1352 yyx < (int) (sizeof (yytname) / sizeof (char *));
1353 yyx++)
1354 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1356 const char *yyq = ! yycount ? ", expecting " : " or ";
1357 yyp = yystpcpy (yyp, yyq);
1358 yyp = yystpcpy (yyp, yytname[yyx]);
1359 yycount++;
1362 yyerror (yymsg);
1363 YYSTACK_FREE (yymsg);
1365 else
1366 yyerror ("parse error; also virtual memory exhausted");
1368 else
1369 #endif /* YYERROR_VERBOSE */
1370 yyerror ("parse error");
1372 goto yyerrlab1;
1375 /*----------------------------------------------------.
1376 | yyerrlab1 -- error raised explicitly by an action. |
1377 `----------------------------------------------------*/
1378 yyerrlab1:
1379 if (yyerrstatus == 3)
1381 /* If just tried and failed to reuse lookahead token after an
1382 error, discard it. */
1384 /* Return failure if at end of input. */
1385 if (yychar == YYEOF)
1387 /* Pop the error token. */
1388 YYPOPSTACK;
1389 /* Pop the rest of the stack. */
1390 while (yyssp > yyss)
1392 YYDPRINTF ((stderr, "Error: popping "));
1393 YYDSYMPRINT ((stderr,
1394 yystos[*yyssp],
1395 *yyvsp));
1396 YYDPRINTF ((stderr, "\n"));
1397 yydestruct (yystos[*yyssp], *yyvsp);
1398 YYPOPSTACK;
1400 YYABORT;
1403 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1404 yychar, yytname[yychar1]));
1405 yydestruct (yychar1, yylval);
1406 yychar = YYEMPTY;
1409 /* Else will try to reuse lookahead token after shifting the error
1410 token. */
1412 yyerrstatus = 3; /* Each real token shifted decrements this. */
1414 for (;;)
1416 yyn = yypact[yystate];
1417 if (yyn != YYPACT_NINF)
1419 yyn += YYTERROR;
1420 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1422 yyn = yytable[yyn];
1423 if (0 < yyn)
1424 break;
1428 /* Pop the current state because it cannot handle the error token. */
1429 if (yyssp == yyss)
1430 YYABORT;
1432 YYDPRINTF ((stderr, "Error: popping "));
1433 YYDSYMPRINT ((stderr,
1434 yystos[*yyssp], *yyvsp));
1435 YYDPRINTF ((stderr, "\n"));
1437 yydestruct (yystos[yystate], *yyvsp);
1438 yyvsp--;
1439 yystate = *--yyssp;
1442 #if YYDEBUG
1443 if (yydebug)
1445 short *yyssp1 = yyss - 1;
1446 YYFPRINTF (stderr, "Error: state stack now");
1447 while (yyssp1 != yyssp)
1448 YYFPRINTF (stderr, " %d", *++yyssp1);
1449 YYFPRINTF (stderr, "\n");
1451 #endif
1454 if (yyn == YYFINAL)
1455 YYACCEPT;
1457 YYDPRINTF ((stderr, "Shifting error token, "));
1459 *++yyvsp = yylval;
1462 yystate = yyn;
1463 goto yynewstate;
1466 /*-------------------------------------.
1467 | yyacceptlab -- YYACCEPT comes here. |
1468 `-------------------------------------*/
1469 yyacceptlab:
1470 yyresult = 0;
1471 goto yyreturn;
1473 /*-----------------------------------.
1474 | yyabortlab -- YYABORT comes here. |
1475 `-----------------------------------*/
1476 yyabortlab:
1477 yyresult = 1;
1478 goto yyreturn;
1480 #ifndef yyoverflow
1481 /*----------------------------------------------.
1482 | yyoverflowlab -- parser overflow comes here. |
1483 `----------------------------------------------*/
1484 yyoverflowlab:
1485 yyerror ("parser stack overflow");
1486 yyresult = 2;
1487 /* Fall through. */
1488 #endif
1490 yyreturn:
1491 #ifndef yyoverflow
1492 if (yyss != yyssa)
1493 YYSTACK_FREE (yyss);
1494 #endif
1495 return yyresult;
1499 #line 95 "parser.y"