1 /* A Bison parser, made by GNU Bison 2.6.4. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "2.6.4"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 0
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61
62
63
64 /* Copy the first part of user declarations. */
65 /* Line 358 of yacc.c */
66 #line 23 "parser.y"
67
68 #include <list>
69 #include "ast.h"
70 #include <cstdio>
71
72 std::set<Sprite> g_oSprites;
73
74 /* Line 358 of yacc.c */
75 #line 76 "parser.cpp"
76
77 # ifndef YY_NULL
78 # if defined __cplusplus && 201103L <= __cplusplus
79 # define YY_NULL nullptr
80 # else
81 # define YY_NULL 0
82 # endif
83 # endif
84
85 /* Enabling verbose error messages. */
86 #ifdef YYERROR_VERBOSE
87 # undef YYERROR_VERBOSE
88 # define YYERROR_VERBOSE 1
89 #else
90 # define YYERROR_VERBOSE 0
91 #endif
92
93 /* In a future release of Bison, this section will be replaced
94 by #include "tokens.h". */
95 #ifndef YY_YY_TOKENS_H_INCLUDED
96 # define YY_YY_TOKENS_H_INCLUDED
97 /* Enabling traces. */
98 #ifndef YYDEBUG
99 # define YYDEBUG 0
100 #endif
101 #if YYDEBUG
102 extern int yydebug;
103 #endif
104
105 /* Tokens. */
106 #ifndef YYTOKENTYPE
107 # define YYTOKENTYPE
108 /* Put the tokens into the symbol table, so that GDB and other debuggers
109 know about them. */
110 enum yytokentype {
111 CURLY_OPEN = 258,
112 CURLY_CLOSE = 259,
113 EQUAL = 260,
114 SEMICOL = 261,
115 LEFTKW = 262,
116 TOPKW = 263,
117 WIDTHKW = 264,
118 HEIGHTKW = 265,
119 BASEIMGKW = 266,
120 RECOLOURKW = 267,
121 SPRITEKW = 268,
122 LAYERKW = 269,
123 NUMBER = 270,
124 STRING = 271
125 };
126 #endif
127
128
129 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
130
131 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
132 # define YYSTYPE_IS_DECLARED 1
133 #endif
134
135 extern YYSTYPE yylval;
136
137 #ifdef YYPARSE_PARAM
138 #if defined __STDC__ || defined __cplusplus
139 int yyparse (void *YYPARSE_PARAM);
140 #else
141 int yyparse ();
142 #endif
143 #else /* ! YYPARSE_PARAM */
144 #if defined __STDC__ || defined __cplusplus
145 int yyparse (void);
146 #else
147 int yyparse ();
148 #endif
149 #endif /* ! YYPARSE_PARAM */
150
151 #endif /* !YY_YY_TOKENS_H_INCLUDED */
152
153 /* Copy the second part of user declarations. */
154
155 /* Line 377 of yacc.c */
156 #line 157 "parser.cpp"
157
158 #ifdef short
159 # undef short
160 #endif
161
162 #ifdef YYTYPE_UINT8
163 typedef YYTYPE_UINT8 yytype_uint8;
164 #else
165 typedef unsigned char yytype_uint8;
166 #endif
167
168 #ifdef YYTYPE_INT8
169 typedef YYTYPE_INT8 yytype_int8;
170 #elif (defined __STDC__ || defined __C99__FUNC__ \
171 || defined __cplusplus || defined _MSC_VER)
172 typedef signed char yytype_int8;
173 #else
174 typedef short int yytype_int8;
175 #endif
176
177 #ifdef YYTYPE_UINT16
178 typedef YYTYPE_UINT16 yytype_uint16;
179 #else
180 typedef unsigned short int yytype_uint16;
181 #endif
182
183 #ifdef YYTYPE_INT16
184 typedef YYTYPE_INT16 yytype_int16;
185 #else
186 typedef short int yytype_int16;
187 #endif
188
189 #ifndef YYSIZE_T
190 # ifdef __SIZE_TYPE__
191 # define YYSIZE_T __SIZE_TYPE__
192 # elif defined size_t
193 # define YYSIZE_T size_t
194 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
195 || defined __cplusplus || defined _MSC_VER)
196 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
197 # define YYSIZE_T size_t
198 # else
199 # define YYSIZE_T unsigned int
200 # endif
201 #endif
202
203 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
204
205 #ifndef YY_
206 # if defined YYENABLE_NLS && YYENABLE_NLS
207 # if ENABLE_NLS
208 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
209 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
210 # endif
211 # endif
212 # ifndef YY_
213 # define YY_(Msgid) Msgid
214 # endif
215 #endif
216
217 /* Suppress unused-variable warnings by "using" E. */
218 #if ! defined lint || defined __GNUC__
219 # define YYUSE(E) ((void) (E))
220 #else
221 # define YYUSE(E) /* empty */
222 #endif
223
224 /* Identity function, used to suppress warnings about constant conditions. */
225 #ifndef lint
226 # define YYID(N) (N)
227 #else
228 #if (defined __STDC__ || defined __C99__FUNC__ \
229 || defined __cplusplus || defined _MSC_VER)
230 static int
YYID(int yyi)231 YYID (int yyi)
232 #else
233 static int
234 YYID (yyi)
235 int yyi;
236 #endif
237 {
238 return yyi;
239 }
240 #endif
241
242 #if ! defined yyoverflow || YYERROR_VERBOSE
243
244 /* The parser invokes alloca or malloc; define the necessary symbols. */
245
246 # ifdef YYSTACK_USE_ALLOCA
247 # if YYSTACK_USE_ALLOCA
248 # ifdef __GNUC__
249 # define YYSTACK_ALLOC __builtin_alloca
250 # elif defined __BUILTIN_VA_ARG_INCR
251 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
252 # elif defined _AIX
253 # define YYSTACK_ALLOC __alloca
254 # elif defined _MSC_VER
255 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
256 # define alloca _alloca
257 # else
258 # define YYSTACK_ALLOC alloca
259 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
260 || defined __cplusplus || defined _MSC_VER)
261 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
262 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
263 # ifndef EXIT_SUCCESS
264 # define EXIT_SUCCESS 0
265 # endif
266 # endif
267 # endif
268 # endif
269 # endif
270
271 # ifdef YYSTACK_ALLOC
272 /* Pacify GCC's `empty if-body' warning. */
273 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
274 # ifndef YYSTACK_ALLOC_MAXIMUM
275 /* The OS might guarantee only one guard page at the bottom of the stack,
276 and a page size can be as small as 4096 bytes. So we cannot safely
277 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
278 to allow for a few compiler-allocated temporary stack slots. */
279 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
280 # endif
281 # else
282 # define YYSTACK_ALLOC YYMALLOC
283 # define YYSTACK_FREE YYFREE
284 # ifndef YYSTACK_ALLOC_MAXIMUM
285 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
286 # endif
287 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
288 && ! ((defined YYMALLOC || defined malloc) \
289 && (defined YYFREE || defined free)))
290 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
291 # ifndef EXIT_SUCCESS
292 # define EXIT_SUCCESS 0
293 # endif
294 # endif
295 # ifndef YYMALLOC
296 # define YYMALLOC malloc
297 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
298 || defined __cplusplus || defined _MSC_VER)
299 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
300 # endif
301 # endif
302 # ifndef YYFREE
303 # define YYFREE free
304 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
305 || defined __cplusplus || defined _MSC_VER)
306 void free (void *); /* INFRINGES ON USER NAME SPACE */
307 # endif
308 # endif
309 # endif
310 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
311
312
313 #if (! defined yyoverflow \
314 && (! defined __cplusplus \
315 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
316
317 /* A type that is properly aligned for any stack member. */
318 union yyalloc
319 {
320 yytype_int16 yyss_alloc;
321 YYSTYPE yyvs_alloc;
322 };
323
324 /* The size of the maximum gap between one aligned stack and the next. */
325 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
326
327 /* The size of an array large to enough to hold all stacks, each with
328 N elements. */
329 # define YYSTACK_BYTES(N) \
330 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
331 + YYSTACK_GAP_MAXIMUM)
332
333 # define YYCOPY_NEEDED 1
334
335 /* Relocate STACK from its old location to the new one. The
336 local variables YYSIZE and YYSTACKSIZE give the old and new number of
337 elements in the stack, and YYPTR gives the new location of the
338 stack. Advance YYPTR to a properly aligned location for the next
339 stack. */
340 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
341 do \
342 { \
343 YYSIZE_T yynewbytes; \
344 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
345 Stack = &yyptr->Stack_alloc; \
346 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
347 yyptr += yynewbytes / sizeof (*yyptr); \
348 } \
349 while (YYID (0))
350
351 #endif
352
353 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
354 /* Copy COUNT objects from SRC to DST. The source and destination do
355 not overlap. */
356 # ifndef YYCOPY
357 # if defined __GNUC__ && 1 < __GNUC__
358 # define YYCOPY(Dst, Src, Count) \
359 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
360 # else
361 # define YYCOPY(Dst, Src, Count) \
362 do \
363 { \
364 YYSIZE_T yyi; \
365 for (yyi = 0; yyi < (Count); yyi++) \
366 (Dst)[yyi] = (Src)[yyi]; \
367 } \
368 while (YYID (0))
369 # endif
370 # endif
371 #endif /* !YYCOPY_NEEDED */
372
373 /* YYFINAL -- State number of the termination state. */
374 #define YYFINAL 2
375 /* YYLAST -- Last index in YYTABLE. */
376 #define YYLAST 38
377
378 /* YYNTOKENS -- Number of terminals. */
379 #define YYNTOKENS 17
380 /* YYNNTS -- Number of nonterminals. */
381 #define YYNNTS 4
382 /* YYNRULES -- Number of rules. */
383 #define YYNRULES 12
384 /* YYNRULES -- Number of states. */
385 #define YYNSTATES 38
386
387 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
388 #define YYUNDEFTOK 2
389 #define YYMAXUTOK 271
390
391 #define YYTRANSLATE(YYX) \
392 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
393
394 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
395 static const yytype_uint8 yytranslate[] =
396 {
397 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
423 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
424 15, 16
425 };
426
427 #if YYDEBUG
428 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
429 YYRHS. */
430 static const yytype_uint8 yyprhs[] =
431 {
432 0, 0, 3, 4, 7, 13, 14, 20, 26, 32,
433 38, 44, 50
434 };
435
436 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
437 static const yytype_int8 yyrhs[] =
438 {
439 18, 0, -1, -1, 18, 19, -1, 13, 15, 3,
440 20, 4, -1, -1, 20, 7, 5, 15, 6, -1,
441 20, 8, 5, 15, 6, -1, 20, 9, 5, 15,
442 6, -1, 20, 10, 5, 15, 6, -1, 20, 11,
443 5, 16, 6, -1, 20, 12, 5, 16, 6, -1,
444 20, 14, 15, 5, 15, 6, -1
445 };
446
447 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
448 static const yytype_uint8 yyrline[] =
449 {
450 0, 46, 46, 47, 51, 56, 57, 59, 61, 63,
451 65, 67, 69
452 };
453 #endif
454
455 #if YYDEBUG || YYERROR_VERBOSE || 0
456 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
457 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
458 static const char *const yytname[] =
459 {
460 "$end", "error", "$undefined", "CURLY_OPEN", "CURLY_CLOSE", "EQUAL",
461 "SEMICOL", "LEFTKW", "TOPKW", "WIDTHKW", "HEIGHTKW", "BASEIMGKW",
462 "RECOLOURKW", "SPRITEKW", "LAYERKW", "NUMBER", "STRING", "$accept",
463 "Program", "Sprite", "SpriteSettings", YY_NULL
464 };
465 #endif
466
467 # ifdef YYPRINT
468 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
469 token YYLEX-NUM. */
470 static const yytype_uint16 yytoknum[] =
471 {
472 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
473 265, 266, 267, 268, 269, 270, 271
474 };
475 # endif
476
477 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
478 static const yytype_uint8 yyr1[] =
479 {
480 0, 17, 18, 18, 19, 20, 20, 20, 20, 20,
481 20, 20, 20
482 };
483
484 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
485 static const yytype_uint8 yyr2[] =
486 {
487 0, 2, 0, 2, 5, 0, 5, 5, 5, 5,
488 5, 5, 6
489 };
490
491 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
492 Performed when YYTABLE doesn't specify something else to do. Zero
493 means the default is an error. */
494 static const yytype_uint8 yydefact[] =
495 {
496 2, 0, 1, 0, 3, 0, 5, 0, 4, 0,
497 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
498 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
499 6, 7, 8, 9, 10, 11, 0, 12
500 };
501
502 /* YYDEFGOTO[NTERM-NUM]. */
503 static const yytype_int8 yydefgoto[] =
504 {
505 -1, 1, 4, 7
506 };
507
508 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
509 STATE-NUM. */
510 #define YYPACT_NINF -14
511 static const yytype_int8 yypact[] =
512 {
513 -14, 0, -14, -13, -14, 7, -14, -3, -14, -2,
514 9, 10, 11, 12, 13, 4, 5, 6, 8, 14,
515 -4, 15, 17, 18, 19, 20, 21, 22, 24, 23,
516 -14, -14, -14, -14, -14, -14, 26, -14
517 };
518
519 /* YYPGOTO[NTERM-NUM]. */
520 static const yytype_int8 yypgoto[] =
521 {
522 -14, -14, -14, -14
523 };
524
525 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
526 positive, shift that token. If negative, reduce the rule which
527 number is the opposite. If YYTABLE_NINF, syntax error. */
528 #define YYTABLE_NINF -1
529 static const yytype_uint8 yytable[] =
530 {
531 2, 8, 5, 16, 9, 10, 11, 12, 13, 14,
532 6, 15, 27, 3, 17, 18, 19, 20, 21, 22,
533 23, 24, 29, 25, 30, 31, 32, 33, 34, 26,
534 35, 28, 37, 0, 0, 0, 0, 0, 36
535 };
536
537 #define yypact_value_is_default(Yystate) \
538 (!!((Yystate) == (-14)))
539
540 #define yytable_value_is_error(Yytable_value) \
541 YYID (0)
542
543 static const yytype_int8 yycheck[] =
544 {
545 0, 4, 15, 5, 7, 8, 9, 10, 11, 12,
546 3, 14, 16, 13, 5, 5, 5, 5, 5, 15,
547 15, 15, 5, 15, 6, 6, 6, 6, 6, 15,
548 6, 16, 6, -1, -1, -1, -1, -1, 15
549 };
550
551 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
552 symbol of state STATE-NUM. */
553 static const yytype_uint8 yystos[] =
554 {
555 0, 18, 0, 13, 19, 15, 3, 20, 4, 7,
556 8, 9, 10, 11, 12, 14, 5, 5, 5, 5,
557 5, 5, 15, 15, 15, 15, 15, 16, 16, 5,
558 6, 6, 6, 6, 6, 6, 15, 6
559 };
560
561 #define yyerrok (yyerrstatus = 0)
562 #define yyclearin (yychar = YYEMPTY)
563 #define YYEMPTY (-2)
564 #define YYEOF 0
565
566 #define YYACCEPT goto yyacceptlab
567 #define YYABORT goto yyabortlab
568 #define YYERROR goto yyerrorlab
569
570
571 /* Like YYERROR except do call yyerror. This remains here temporarily
572 to ease the transition to the new meaning of YYERROR, for GCC.
573 Once GCC version 2 has supplanted version 1, this can go. However,
574 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
575 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
576 discussed. */
577
578 #define YYFAIL goto yyerrlab
579 #if defined YYFAIL
580 /* This is here to suppress warnings from the GCC cpp's
581 -Wunused-macros. Normally we don't worry about that warning, but
582 some users do, and we want to make it easy for users to remove
583 YYFAIL uses, which will produce warnings from Bison 2.5. */
584 #endif
585
586 #define YYRECOVERING() (!!yyerrstatus)
587
588 #define YYBACKUP(Token, Value) \
589 do \
590 if (yychar == YYEMPTY) \
591 { \
592 yychar = (Token); \
593 yylval = (Value); \
594 YYPOPSTACK (yylen); \
595 yystate = *yyssp; \
596 goto yybackup; \
597 } \
598 else \
599 { \
600 yyerror (YY_("syntax error: cannot back up")); \
601 YYERROR; \
602 } \
603 while (YYID (0))
604
605
606 #define YYTERROR 1
607 #define YYERRCODE 256
608
609 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
610 If N is 0, then set CURRENT to the empty location which ends
611 the previous symbol: RHS[0] (always defined). */
612
613 #ifndef YYLLOC_DEFAULT
614 # define YYLLOC_DEFAULT(Current, Rhs, N) \
615 do \
616 if (YYID (N)) \
617 { \
618 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
619 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
620 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
621 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
622 } \
623 else \
624 { \
625 (Current).first_line = (Current).last_line = \
626 YYRHSLOC (Rhs, 0).last_line; \
627 (Current).first_column = (Current).last_column = \
628 YYRHSLOC (Rhs, 0).last_column; \
629 } \
630 while (YYID (0))
631 #endif
632
633 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
634
635
636
637 /* This macro is provided for backward compatibility. */
638
639 #ifndef YY_LOCATION_PRINT
640 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
641 #endif
642
643
644 /* YYLEX -- calling `yylex' with the right arguments. */
645
646 #ifdef YYLEX_PARAM
647 # define YYLEX yylex (YYLEX_PARAM)
648 #else
649 # define YYLEX yylex ()
650 #endif
651
652 /* Enable debugging if requested. */
653 #if YYDEBUG
654
655 # ifndef YYFPRINTF
656 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
657 # define YYFPRINTF fprintf
658 # endif
659
660 # define YYDPRINTF(Args) \
661 do { \
662 if (yydebug) \
663 YYFPRINTF Args; \
664 } while (YYID (0))
665
666 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
667 do { \
668 if (yydebug) \
669 { \
670 YYFPRINTF (stderr, "%s ", Title); \
671 yy_symbol_print (stderr, \
672 Type, Value); \
673 YYFPRINTF (stderr, "\n"); \
674 } \
675 } while (YYID (0))
676
677
678 /*--------------------------------.
679 | Print this symbol on YYOUTPUT. |
680 `--------------------------------*/
681
682 /*ARGSUSED*/
683 #if (defined __STDC__ || defined __C99__FUNC__ \
684 || defined __cplusplus || defined _MSC_VER)
685 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)686 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
687 #else
688 static void
689 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
690 FILE *yyoutput;
691 int yytype;
692 YYSTYPE const * const yyvaluep;
693 #endif
694 {
695 FILE *yyo = yyoutput;
696 YYUSE (yyo);
697 if (!yyvaluep)
698 return;
699 # ifdef YYPRINT
700 if (yytype < YYNTOKENS)
701 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
702 # else
703 YYUSE (yyoutput);
704 # endif
705 switch (yytype)
706 {
707 default:
708 break;
709 }
710 }
711
712
713 /*--------------------------------.
714 | Print this symbol on YYOUTPUT. |
715 `--------------------------------*/
716
717 #if (defined __STDC__ || defined __C99__FUNC__ \
718 || defined __cplusplus || defined _MSC_VER)
719 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)720 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
721 #else
722 static void
723 yy_symbol_print (yyoutput, yytype, yyvaluep)
724 FILE *yyoutput;
725 int yytype;
726 YYSTYPE const * const yyvaluep;
727 #endif
728 {
729 if (yytype < YYNTOKENS)
730 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
731 else
732 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
733
734 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
735 YYFPRINTF (yyoutput, ")");
736 }
737
738 /*------------------------------------------------------------------.
739 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
740 | TOP (included). |
741 `------------------------------------------------------------------*/
742
743 #if (defined __STDC__ || defined __C99__FUNC__ \
744 || defined __cplusplus || defined _MSC_VER)
745 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)746 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
747 #else
748 static void
749 yy_stack_print (yybottom, yytop)
750 yytype_int16 *yybottom;
751 yytype_int16 *yytop;
752 #endif
753 {
754 YYFPRINTF (stderr, "Stack now");
755 for (; yybottom <= yytop; yybottom++)
756 {
757 int yybot = *yybottom;
758 YYFPRINTF (stderr, " %d", yybot);
759 }
760 YYFPRINTF (stderr, "\n");
761 }
762
763 # define YY_STACK_PRINT(Bottom, Top) \
764 do { \
765 if (yydebug) \
766 yy_stack_print ((Bottom), (Top)); \
767 } while (YYID (0))
768
769
770 /*------------------------------------------------.
771 | Report that the YYRULE is going to be reduced. |
772 `------------------------------------------------*/
773
774 #if (defined __STDC__ || defined __C99__FUNC__ \
775 || defined __cplusplus || defined _MSC_VER)
776 static void
yy_reduce_print(YYSTYPE * yyvsp,int yyrule)777 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
778 #else
779 static void
780 yy_reduce_print (yyvsp, yyrule)
781 YYSTYPE *yyvsp;
782 int yyrule;
783 #endif
784 {
785 int yynrhs = yyr2[yyrule];
786 int yyi;
787 unsigned long int yylno = yyrline[yyrule];
788 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
789 yyrule - 1, yylno);
790 /* The symbols being reduced. */
791 for (yyi = 0; yyi < yynrhs; yyi++)
792 {
793 YYFPRINTF (stderr, " $%d = ", yyi + 1);
794 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
795 &(yyvsp[(yyi + 1) - (yynrhs)])
796 );
797 YYFPRINTF (stderr, "\n");
798 }
799 }
800
801 # define YY_REDUCE_PRINT(Rule) \
802 do { \
803 if (yydebug) \
804 yy_reduce_print (yyvsp, Rule); \
805 } while (YYID (0))
806
807 /* Nonzero means print parse trace. It is left uninitialized so that
808 multiple parsers can coexist. */
809 int yydebug;
810 #else /* !YYDEBUG */
811 # define YYDPRINTF(Args)
812 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
813 # define YY_STACK_PRINT(Bottom, Top)
814 # define YY_REDUCE_PRINT(Rule)
815 #endif /* !YYDEBUG */
816
817
818 /* YYINITDEPTH -- initial size of the parser's stacks. */
819 #ifndef YYINITDEPTH
820 # define YYINITDEPTH 200
821 #endif
822
823 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
824 if the built-in stack extension method is used).
825
826 Do not make this value too large; the results are undefined if
827 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
828 evaluated with infinite-precision integer arithmetic. */
829
830 #ifndef YYMAXDEPTH
831 # define YYMAXDEPTH 10000
832 #endif
833
834
835 #if YYERROR_VERBOSE
836
837 # ifndef yystrlen
838 # if defined __GLIBC__ && defined _STRING_H
839 # define yystrlen strlen
840 # else
841 /* Return the length of YYSTR. */
842 #if (defined __STDC__ || defined __C99__FUNC__ \
843 || defined __cplusplus || defined _MSC_VER)
844 static YYSIZE_T
yystrlen(const char * yystr)845 yystrlen (const char *yystr)
846 #else
847 static YYSIZE_T
848 yystrlen (yystr)
849 const char *yystr;
850 #endif
851 {
852 YYSIZE_T yylen;
853 for (yylen = 0; yystr[yylen]; yylen++)
854 continue;
855 return yylen;
856 }
857 # endif
858 # endif
859
860 # ifndef yystpcpy
861 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
862 # define yystpcpy stpcpy
863 # else
864 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
865 YYDEST. */
866 #if (defined __STDC__ || defined __C99__FUNC__ \
867 || defined __cplusplus || defined _MSC_VER)
868 static char *
yystpcpy(char * yydest,const char * yysrc)869 yystpcpy (char *yydest, const char *yysrc)
870 #else
871 static char *
872 yystpcpy (yydest, yysrc)
873 char *yydest;
874 const char *yysrc;
875 #endif
876 {
877 char *yyd = yydest;
878 const char *yys = yysrc;
879
880 while ((*yyd++ = *yys++) != '\0')
881 continue;
882
883 return yyd - 1;
884 }
885 # endif
886 # endif
887
888 # ifndef yytnamerr
889 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
890 quotes and backslashes, so that it's suitable for yyerror. The
891 heuristic is that double-quoting is unnecessary unless the string
892 contains an apostrophe, a comma, or backslash (other than
893 backslash-backslash). YYSTR is taken from yytname. If YYRES is
894 null, do not copy; instead, return the length of what the result
895 would have been. */
896 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)897 yytnamerr (char *yyres, const char *yystr)
898 {
899 if (*yystr == '"')
900 {
901 YYSIZE_T yyn = 0;
902 char const *yyp = yystr;
903
904 for (;;)
905 switch (*++yyp)
906 {
907 case '\'':
908 case ',':
909 goto do_not_strip_quotes;
910
911 case '\\':
912 if (*++yyp != '\\')
913 goto do_not_strip_quotes;
914 /* Fall through. */
915 default:
916 if (yyres)
917 yyres[yyn] = *yyp;
918 yyn++;
919 break;
920
921 case '"':
922 if (yyres)
923 yyres[yyn] = '\0';
924 return yyn;
925 }
926 do_not_strip_quotes: ;
927 }
928
929 if (! yyres)
930 return yystrlen (yystr);
931
932 return yystpcpy (yyres, yystr) - yyres;
933 }
934 # endif
935
936 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
937 about the unexpected token YYTOKEN for the state stack whose top is
938 YYSSP.
939
940 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
941 not large enough to hold the message. In that case, also set
942 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
943 required number of bytes is too large to store. */
944 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)945 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
946 yytype_int16 *yyssp, int yytoken)
947 {
948 YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
949 YYSIZE_T yysize = yysize0;
950 YYSIZE_T yysize1;
951 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
952 /* Internationalized format string. */
953 const char *yyformat = YY_NULL;
954 /* Arguments of yyformat. */
955 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
956 /* Number of reported tokens (one for the "unexpected", one per
957 "expected"). */
958 int yycount = 0;
959
960 /* There are many possibilities here to consider:
961 - Assume YYFAIL is not used. It's too flawed to consider. See
962 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
963 for details. YYERROR is fine as it does not invoke this
964 function.
965 - If this state is a consistent state with a default action, then
966 the only way this function was invoked is if the default action
967 is an error action. In that case, don't check for expected
968 tokens because there are none.
969 - The only way there can be no lookahead present (in yychar) is if
970 this state is a consistent state with a default action. Thus,
971 detecting the absence of a lookahead is sufficient to determine
972 that there is no unexpected or expected token to report. In that
973 case, just report a simple "syntax error".
974 - Don't assume there isn't a lookahead just because this state is a
975 consistent state with a default action. There might have been a
976 previous inconsistent state, consistent state with a non-default
977 action, or user semantic action that manipulated yychar.
978 - Of course, the expected token list depends on states to have
979 correct lookahead information, and it depends on the parser not
980 to perform extra reductions after fetching a lookahead from the
981 scanner and before detecting a syntax error. Thus, state merging
982 (from LALR or IELR) and default reductions corrupt the expected
983 token list. However, the list is correct for canonical LR with
984 one exception: it will still contain any token that will not be
985 accepted due to an error action in a later state.
986 */
987 if (yytoken != YYEMPTY)
988 {
989 int yyn = yypact[*yyssp];
990 yyarg[yycount++] = yytname[yytoken];
991 if (!yypact_value_is_default (yyn))
992 {
993 /* Start YYX at -YYN if negative to avoid negative indexes in
994 YYCHECK. In other words, skip the first -YYN actions for
995 this state because they are default actions. */
996 int yyxbegin = yyn < 0 ? -yyn : 0;
997 /* Stay within bounds of both yycheck and yytname. */
998 int yychecklim = YYLAST - yyn + 1;
999 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1000 int yyx;
1001
1002 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1003 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1004 && !yytable_value_is_error (yytable[yyx + yyn]))
1005 {
1006 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1007 {
1008 yycount = 1;
1009 yysize = yysize0;
1010 break;
1011 }
1012 yyarg[yycount++] = yytname[yyx];
1013 yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1014 if (! (yysize <= yysize1
1015 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1016 return 2;
1017 yysize = yysize1;
1018 }
1019 }
1020 }
1021
1022 switch (yycount)
1023 {
1024 # define YYCASE_(N, S) \
1025 case N: \
1026 yyformat = S; \
1027 break
1028 YYCASE_(0, YY_("syntax error"));
1029 YYCASE_(1, YY_("syntax error, unexpected %s"));
1030 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1031 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1032 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1033 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1034 # undef YYCASE_
1035 }
1036
1037 yysize1 = yysize + yystrlen (yyformat);
1038 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1039 return 2;
1040 yysize = yysize1;
1041
1042 if (*yymsg_alloc < yysize)
1043 {
1044 *yymsg_alloc = 2 * yysize;
1045 if (! (yysize <= *yymsg_alloc
1046 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1047 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1048 return 1;
1049 }
1050
1051 /* Avoid sprintf, as that infringes on the user's name space.
1052 Don't have undefined behavior even if the translation
1053 produced a string with the wrong number of "%s"s. */
1054 {
1055 char *yyp = *yymsg;
1056 int yyi = 0;
1057 while ((*yyp = *yyformat) != '\0')
1058 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1059 {
1060 yyp += yytnamerr (yyp, yyarg[yyi++]);
1061 yyformat += 2;
1062 }
1063 else
1064 {
1065 yyp++;
1066 yyformat++;
1067 }
1068 }
1069 return 0;
1070 }
1071 #endif /* YYERROR_VERBOSE */
1072
1073 /*-----------------------------------------------.
1074 | Release the memory associated to this symbol. |
1075 `-----------------------------------------------*/
1076
1077 /*ARGSUSED*/
1078 #if (defined __STDC__ || defined __C99__FUNC__ \
1079 || defined __cplusplus || defined _MSC_VER)
1080 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1081 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1082 #else
1083 static void
1084 yydestruct (yymsg, yytype, yyvaluep)
1085 const char *yymsg;
1086 int yytype;
1087 YYSTYPE *yyvaluep;
1088 #endif
1089 {
1090 YYUSE (yyvaluep);
1091
1092 if (!yymsg)
1093 yymsg = "Deleting";
1094 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1095
1096 switch (yytype)
1097 {
1098
1099 default:
1100 break;
1101 }
1102 }
1103
1104
1105
1106
1107 /* The lookahead symbol. */
1108 int yychar;
1109
1110
1111 #ifndef YYLVAL_INITIALIZE
1112 # define YYLVAL_INITIALIZE()
1113 #endif
1114 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1115 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1116 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1117 #endif
1118
1119 /* The semantic value of the lookahead symbol. */
1120 YYSTYPE yylval;
1121
1122 /* Number of syntax errors so far. */
1123 int yynerrs;
1124
1125
1126 /*----------.
1127 | yyparse. |
1128 `----------*/
1129
1130 #ifdef YYPARSE_PARAM
1131 #if (defined __STDC__ || defined __C99__FUNC__ \
1132 || defined __cplusplus || defined _MSC_VER)
1133 int
yyparse(void * YYPARSE_PARAM)1134 yyparse (void *YYPARSE_PARAM)
1135 #else
1136 int
1137 yyparse (YYPARSE_PARAM)
1138 void *YYPARSE_PARAM;
1139 #endif
1140 #else /* ! YYPARSE_PARAM */
1141 #if (defined __STDC__ || defined __C99__FUNC__ \
1142 || defined __cplusplus || defined _MSC_VER)
1143 int
1144 yyparse (void)
1145 #else
1146 int
1147 yyparse ()
1148
1149 #endif
1150 #endif
1151 {
1152 int yystate;
1153 /* Number of tokens to shift before error messages enabled. */
1154 int yyerrstatus;
1155
1156 /* The stacks and their tools:
1157 `yyss': related to states.
1158 `yyvs': related to semantic values.
1159
1160 Refer to the stacks through separate pointers, to allow yyoverflow
1161 to reallocate them elsewhere. */
1162
1163 /* The state stack. */
1164 yytype_int16 yyssa[YYINITDEPTH];
1165 yytype_int16 *yyss;
1166 yytype_int16 *yyssp;
1167
1168 /* The semantic value stack. */
1169 YYSTYPE yyvsa[YYINITDEPTH];
1170 YYSTYPE *yyvs;
1171 YYSTYPE *yyvsp;
1172
1173 YYSIZE_T yystacksize;
1174
1175 int yyn;
1176 int yyresult;
1177 /* Lookahead token as an internal (translated) token number. */
1178 int yytoken = 0;
1179 /* The variables used to return semantic value and location from the
1180 action routines. */
1181 YYSTYPE yyval;
1182
1183 #if YYERROR_VERBOSE
1184 /* Buffer for error messages, and its allocated size. */
1185 char yymsgbuf[128];
1186 char *yymsg = yymsgbuf;
1187 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1188 #endif
1189
1190 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1191
1192 /* The number of symbols on the RHS of the reduced rule.
1193 Keep to zero when no symbol should be popped. */
1194 int yylen = 0;
1195
1196 yyss = yyssa;
1197 yyvs = yyvsa;
1198 yystacksize = YYINITDEPTH;
1199
1200 YYDPRINTF ((stderr, "Starting parse\n"));
1201
1202 yystate = 0;
1203 yyerrstatus = 0;
1204 yynerrs = 0;
1205 yychar = YYEMPTY; /* Cause a token to be read. */
1206
1207 /* Initialize stack pointers.
1208 Waste one element of value and location stack
1209 so that they stay on the same level as the state stack.
1210 The wasted elements are never initialized. */
1211 yyssp = yyss;
1212 yyvsp = yyvs;
1213
1214 YYLVAL_INITIALIZE ();
1215 goto yysetstate;
1216
1217 /*------------------------------------------------------------.
1218 | yynewstate -- Push a new state, which is found in yystate. |
1219 `------------------------------------------------------------*/
1220 yynewstate:
1221 /* In all cases, when you get here, the value and location stacks
1222 have just been pushed. So pushing a state here evens the stacks. */
1223 yyssp++;
1224
1225 yysetstate:
1226 *yyssp = yystate;
1227
1228 if (yyss + yystacksize - 1 <= yyssp)
1229 {
1230 /* Get the current used size of the three stacks, in elements. */
1231 YYSIZE_T yysize = yyssp - yyss + 1;
1232
1233 #ifdef yyoverflow
1234 {
1235 /* Give user a chance to reallocate the stack. Use copies of
1236 these so that the &'s don't force the real ones into
1237 memory. */
1238 YYSTYPE *yyvs1 = yyvs;
1239 yytype_int16 *yyss1 = yyss;
1240
1241 /* Each stack pointer address is followed by the size of the
1242 data in use in that stack, in bytes. This used to be a
1243 conditional around just the two extra args, but that might
1244 be undefined if yyoverflow is a macro. */
1245 yyoverflow (YY_("memory exhausted"),
1246 &yyss1, yysize * sizeof (*yyssp),
1247 &yyvs1, yysize * sizeof (*yyvsp),
1248 &yystacksize);
1249
1250 yyss = yyss1;
1251 yyvs = yyvs1;
1252 }
1253 #else /* no yyoverflow */
1254 # ifndef YYSTACK_RELOCATE
1255 goto yyexhaustedlab;
1256 # else
1257 /* Extend the stack our own way. */
1258 if (YYMAXDEPTH <= yystacksize)
1259 goto yyexhaustedlab;
1260 yystacksize *= 2;
1261 if (YYMAXDEPTH < yystacksize)
1262 yystacksize = YYMAXDEPTH;
1263
1264 {
1265 yytype_int16 *yyss1 = yyss;
1266 union yyalloc *yyptr =
1267 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1268 if (! yyptr)
1269 goto yyexhaustedlab;
1270 YYSTACK_RELOCATE (yyss_alloc, yyss);
1271 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1272 # undef YYSTACK_RELOCATE
1273 if (yyss1 != yyssa)
1274 YYSTACK_FREE (yyss1);
1275 }
1276 # endif
1277 #endif /* no yyoverflow */
1278
1279 yyssp = yyss + yysize - 1;
1280 yyvsp = yyvs + yysize - 1;
1281
1282 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1283 (unsigned long int) yystacksize));
1284
1285 if (yyss + yystacksize - 1 <= yyssp)
1286 YYABORT;
1287 }
1288
1289 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1290
1291 if (yystate == YYFINAL)
1292 YYACCEPT;
1293
1294 goto yybackup;
1295
1296 /*-----------.
1297 | yybackup. |
1298 `-----------*/
1299 yybackup:
1300
1301 /* Do appropriate processing given the current state. Read a
1302 lookahead token if we need one and don't already have one. */
1303
1304 /* First try to decide what to do without reference to lookahead token. */
1305 yyn = yypact[yystate];
1306 if (yypact_value_is_default (yyn))
1307 goto yydefault;
1308
1309 /* Not known => get a lookahead token if don't already have one. */
1310
1311 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1312 if (yychar == YYEMPTY)
1313 {
1314 YYDPRINTF ((stderr, "Reading a token: "));
1315 yychar = YYLEX;
1316 }
1317
1318 if (yychar <= YYEOF)
1319 {
1320 yychar = yytoken = YYEOF;
1321 YYDPRINTF ((stderr, "Now at end of input.\n"));
1322 }
1323 else
1324 {
1325 yytoken = YYTRANSLATE (yychar);
1326 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1327 }
1328
1329 /* If the proper action on seeing token YYTOKEN is to reduce or to
1330 detect an error, take that action. */
1331 yyn += yytoken;
1332 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1333 goto yydefault;
1334 yyn = yytable[yyn];
1335 if (yyn <= 0)
1336 {
1337 if (yytable_value_is_error (yyn))
1338 goto yyerrlab;
1339 yyn = -yyn;
1340 goto yyreduce;
1341 }
1342
1343 /* Count tokens shifted since error; after three, turn off error
1344 status. */
1345 if (yyerrstatus)
1346 yyerrstatus--;
1347
1348 /* Shift the lookahead token. */
1349 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1350
1351 /* Discard the shifted token. */
1352 yychar = YYEMPTY;
1353
1354 yystate = yyn;
1355 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1356 *++yyvsp = yylval;
1357 YY_IGNORE_MAYBE_UNINITIALIZED_END
1358
1359 goto yynewstate;
1360
1361
1362 /*-----------------------------------------------------------.
1363 | yydefault -- do the default action for the current state. |
1364 `-----------------------------------------------------------*/
1365 yydefault:
1366 yyn = yydefact[yystate];
1367 if (yyn == 0)
1368 goto yyerrlab;
1369 goto yyreduce;
1370
1371
1372 /*-----------------------------.
1373 | yyreduce -- Do a reduction. |
1374 `-----------------------------*/
1375 yyreduce:
1376 /* yyn is the number of a rule to reduce with. */
1377 yylen = yyr2[yyn];
1378
1379 /* If YYLEN is nonzero, implement the default value of the action:
1380 `$$ = $1'.
1381
1382 Otherwise, the following line sets YYVAL to garbage.
1383 This behavior is undocumented and Bison
1384 users should not rely upon it. Assigning to YYVAL
1385 unconditionally makes the parser a bit smaller, and it avoids a
1386 GCC warning that YYVAL may be used uninitialized. */
1387 yyval = yyvsp[1-yylen];
1388
1389
1390 YY_REDUCE_PRINT (yyn);
1391 switch (yyn)
1392 {
1393 case 2:
1394 /* Line 1813 of yacc.c */
1395 #line 46 "parser.y"
1396 { g_oSprites.clear(); }
1397 break;
1398
1399 case 3:
1400 /* Line 1813 of yacc.c */
1401 #line 48 "parser.y"
1402 { g_oSprites.insert(*(yyvsp[(2) - (2)].m_pSprite)); delete (yyvsp[(2) - (2)].m_pSprite); }
1403 break;
1404
1405 case 4:
1406 /* Line 1813 of yacc.c */
1407 #line 52 "parser.y"
1408 { (yyval.m_pSprite) = (yyvsp[(4) - (5)].m_pSprite); (yyval.m_pSprite)->m_iSprite = (yyvsp[(2) - (5)].number); }
1409 break;
1410
1411 case 5:
1412 /* Line 1813 of yacc.c */
1413 #line 56 "parser.y"
1414 { (yyval.m_pSprite) = new Sprite; }
1415 break;
1416
1417 case 6:
1418 /* Line 1813 of yacc.c */
1419 #line 58 "parser.y"
1420 { (yyval.m_pSprite) = (yyvsp[(1) - (5)].m_pSprite); (yyval.m_pSprite)->m_iLeft = (yyvsp[(4) - (5)].number); }
1421 break;
1422
1423 case 7:
1424 /* Line 1813 of yacc.c */
1425 #line 60 "parser.y"
1426 { (yyval.m_pSprite) = (yyvsp[(1) - (5)].m_pSprite); (yyval.m_pSprite)->m_iTop = (yyvsp[(4) - (5)].number); }
1427 break;
1428
1429 case 8:
1430 /* Line 1813 of yacc.c */
1431 #line 62 "parser.y"
1432 { (yyval.m_pSprite) = (yyvsp[(1) - (5)].m_pSprite); (yyval.m_pSprite)->m_iWidth = (yyvsp[(4) - (5)].number); }
1433 break;
1434
1435 case 9:
1436 /* Line 1813 of yacc.c */
1437 #line 64 "parser.y"
1438 { (yyval.m_pSprite) = (yyvsp[(1) - (5)].m_pSprite); (yyval.m_pSprite)->m_iHeight = (yyvsp[(4) - (5)].number); }
1439 break;
1440
1441 case 10:
1442 /* Line 1813 of yacc.c */
1443 #line 66 "parser.y"
1444 { (yyval.m_pSprite) = (yyvsp[(1) - (5)].m_pSprite); (yyval.m_pSprite)->m_sBaseImage = (yyvsp[(4) - (5)].text); }
1445 break;
1446
1447 case 11:
1448 /* Line 1813 of yacc.c */
1449 #line 68 "parser.y"
1450 { (yyval.m_pSprite) = (yyvsp[(1) - (5)].m_pSprite); (yyval.m_pSprite)->SetRecolour((yyvsp[(4) - (5)].text)); }
1451 break;
1452
1453 case 12:
1454 /* Line 1813 of yacc.c */
1455 #line 70 "parser.y"
1456 { (yyval.m_pSprite) = (yyvsp[(1) - (6)].m_pSprite); (yyval.m_pSprite)->m_aNumber[((yyvsp[(3) - (6)].number)) & 0xFF] = ((yyvsp[(5) - (6)].number)) & 0xFF; }
1457 break;
1458
1459
1460 /* Line 1813 of yacc.c */
1461 #line 1462 "parser.cpp"
1462 default: break;
1463 }
1464 /* User semantic actions sometimes alter yychar, and that requires
1465 that yytoken be updated with the new translation. We take the
1466 approach of translating immediately before every use of yytoken.
1467 One alternative is translating here after every semantic action,
1468 but that translation would be missed if the semantic action invokes
1469 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1470 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1471 incorrect destructor might then be invoked immediately. In the
1472 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1473 to an incorrect destructor call or verbose syntax error message
1474 before the lookahead is translated. */
1475 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1476
1477 YYPOPSTACK (yylen);
1478 yylen = 0;
1479 YY_STACK_PRINT (yyss, yyssp);
1480
1481 *++yyvsp = yyval;
1482
1483 /* Now `shift' the result of the reduction. Determine what state
1484 that goes to, based on the state we popped back to and the rule
1485 number reduced by. */
1486
1487 yyn = yyr1[yyn];
1488
1489 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1490 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1491 yystate = yytable[yystate];
1492 else
1493 yystate = yydefgoto[yyn - YYNTOKENS];
1494
1495 goto yynewstate;
1496
1497
1498 /*------------------------------------.
1499 | yyerrlab -- here on detecting error |
1500 `------------------------------------*/
1501 yyerrlab:
1502 /* Make sure we have latest lookahead translation. See comments at
1503 user semantic actions for why this is necessary. */
1504 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1505
1506 /* If not already recovering from an error, report this error. */
1507 if (!yyerrstatus)
1508 {
1509 ++yynerrs;
1510 #if ! YYERROR_VERBOSE
1511 yyerror (YY_("syntax error"));
1512 #else
1513 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1514 yyssp, yytoken)
1515 {
1516 char const *yymsgp = YY_("syntax error");
1517 int yysyntax_error_status;
1518 yysyntax_error_status = YYSYNTAX_ERROR;
1519 if (yysyntax_error_status == 0)
1520 yymsgp = yymsg;
1521 else if (yysyntax_error_status == 1)
1522 {
1523 if (yymsg != yymsgbuf)
1524 YYSTACK_FREE (yymsg);
1525 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1526 if (!yymsg)
1527 {
1528 yymsg = yymsgbuf;
1529 yymsg_alloc = sizeof yymsgbuf;
1530 yysyntax_error_status = 2;
1531 }
1532 else
1533 {
1534 yysyntax_error_status = YYSYNTAX_ERROR;
1535 yymsgp = yymsg;
1536 }
1537 }
1538 yyerror (yymsgp);
1539 if (yysyntax_error_status == 2)
1540 goto yyexhaustedlab;
1541 }
1542 # undef YYSYNTAX_ERROR
1543 #endif
1544 }
1545
1546
1547
1548 if (yyerrstatus == 3)
1549 {
1550 /* If just tried and failed to reuse lookahead token after an
1551 error, discard it. */
1552
1553 if (yychar <= YYEOF)
1554 {
1555 /* Return failure if at end of input. */
1556 if (yychar == YYEOF)
1557 YYABORT;
1558 }
1559 else
1560 {
1561 yydestruct ("Error: discarding",
1562 yytoken, &yylval);
1563 yychar = YYEMPTY;
1564 }
1565 }
1566
1567 /* Else will try to reuse lookahead token after shifting the error
1568 token. */
1569 goto yyerrlab1;
1570
1571
1572 /*---------------------------------------------------.
1573 | yyerrorlab -- error raised explicitly by YYERROR. |
1574 `---------------------------------------------------*/
1575 yyerrorlab:
1576
1577 /* Pacify compilers like GCC when the user code never invokes
1578 YYERROR and the label yyerrorlab therefore never appears in user
1579 code. */
1580 if (/*CONSTCOND*/ 0)
1581 goto yyerrorlab;
1582
1583 /* Do not reclaim the symbols of the rule which action triggered
1584 this YYERROR. */
1585 YYPOPSTACK (yylen);
1586 yylen = 0;
1587 YY_STACK_PRINT (yyss, yyssp);
1588 yystate = *yyssp;
1589 goto yyerrlab1;
1590
1591
1592 /*-------------------------------------------------------------.
1593 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1594 `-------------------------------------------------------------*/
1595 yyerrlab1:
1596 yyerrstatus = 3; /* Each real token shifted decrements this. */
1597
1598 for (;;)
1599 {
1600 yyn = yypact[yystate];
1601 if (!yypact_value_is_default (yyn))
1602 {
1603 yyn += YYTERROR;
1604 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1605 {
1606 yyn = yytable[yyn];
1607 if (0 < yyn)
1608 break;
1609 }
1610 }
1611
1612 /* Pop the current state because it cannot handle the error token. */
1613 if (yyssp == yyss)
1614 YYABORT;
1615
1616
1617 yydestruct ("Error: popping",
1618 yystos[yystate], yyvsp);
1619 YYPOPSTACK (1);
1620 yystate = *yyssp;
1621 YY_STACK_PRINT (yyss, yyssp);
1622 }
1623
1624 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1625 *++yyvsp = yylval;
1626 YY_IGNORE_MAYBE_UNINITIALIZED_END
1627
1628
1629 /* Shift the error token. */
1630 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1631
1632 yystate = yyn;
1633 goto yynewstate;
1634
1635
1636 /*-------------------------------------.
1637 | yyacceptlab -- YYACCEPT comes here. |
1638 `-------------------------------------*/
1639 yyacceptlab:
1640 yyresult = 0;
1641 goto yyreturn;
1642
1643 /*-----------------------------------.
1644 | yyabortlab -- YYABORT comes here. |
1645 `-----------------------------------*/
1646 yyabortlab:
1647 yyresult = 1;
1648 goto yyreturn;
1649
1650 #if !defined yyoverflow || YYERROR_VERBOSE
1651 /*-------------------------------------------------.
1652 | yyexhaustedlab -- memory exhaustion comes here. |
1653 `-------------------------------------------------*/
1654 yyexhaustedlab:
1655 yyerror (YY_("memory exhausted"));
1656 yyresult = 2;
1657 /* Fall through. */
1658 #endif
1659
1660 yyreturn:
1661 if (yychar != YYEMPTY)
1662 {
1663 /* Make sure we have latest lookahead translation. See comments at
1664 user semantic actions for why this is necessary. */
1665 yytoken = YYTRANSLATE (yychar);
1666 yydestruct ("Cleanup: discarding lookahead",
1667 yytoken, &yylval);
1668 }
1669 /* Do not reclaim the symbols of the rule which action triggered
1670 this YYABORT or YYACCEPT. */
1671 YYPOPSTACK (yylen);
1672 YY_STACK_PRINT (yyss, yyssp);
1673 while (yyssp != yyss)
1674 {
1675 yydestruct ("Cleanup: popping",
1676 yystos[*yyssp], yyvsp);
1677 YYPOPSTACK (1);
1678 }
1679 #ifndef yyoverflow
1680 if (yyss != yyssa)
1681 YYSTACK_FREE (yyss);
1682 #endif
1683 #if YYERROR_VERBOSE
1684 if (yymsg != yymsgbuf)
1685 YYSTACK_FREE (yymsg);
1686 #endif
1687 /* Make sure YYID is used. */
1688 return YYID (yyresult);
1689 }
1690
1691
1692 /* Line 2076 of yacc.c */
1693 #line 73 "parser.y"
1694
1695
yyerror(const char * msg)1696 void yyerror(const char *msg)
1697 {
1698 fprintf(stderr, "Parse error at line %d: %s\n", yylval.line, msg);
1699 exit(1);
1700 }
1701