1 /* A Bison parser, made by GNU Bison 3.0.4. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015 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 "3.0.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 21 "testpatterny.y" /* yacc.c:339 */
66
67
68 #ifdef HAVE_CONFIG_H
69 #include <config.h>
70 #endif
71
72 #include <string.h>
73 #include <strings.h>
74 #include <stdio.h>
75 #include <stdlib.h>
76 #include "testpattern.h"
77
78 extern int mylineno;
79
80 extern int yylex(void);
81 char *quotestrip(const char *i);
82 char *endstrip(const char *i);
83
84 extern char* yytext;
85
yyerror(const char * s)86 static int yyerror( const char *s )
87 {
88 fprintf(stderr,"stdin:%d: %s before '%s'\n",mylineno,s,yytext);
89 return 0;
90 }
91
92 typedef struct
93 {
94 const char *name;
95 int channel;
96 } color_t;
97
98 static color_t color_map[] =
99 {
100 { "black", 0 },
101 { "cyan", 1 },
102 { "red", 1 },
103 { "magenta", 2 },
104 { "green", 2 },
105 { "yellow", 3 },
106 { "blue", 3 },
107 { "l_black", 4 },
108 { "l_cyan", 5 },
109 { "l_magenta", 6 },
110 { "d_yellow", 4 },
111 { "l_l_black", 7 },
112 { NULL, -1 }
113 };
114
115 static int current_index = 0;
116 static testpattern_t *current_testpattern;
117 extern FILE *yyin;
118
119 static int
find_color(const char * name)120 find_color(const char *name)
121 {
122 int i = 0;
123 while (color_map[i].name)
124 {
125 if (strcasecmp(color_map[i].name, name) == 0)
126 return color_map[i].channel;
127 i++;
128 }
129 return -1;
130 }
131
132
133 #line 134 "testpatterny.c" /* yacc.c:339 */
134
135 # ifndef YY_NULLPTR
136 # if defined __cplusplus && 201103L <= __cplusplus
137 # define YY_NULLPTR nullptr
138 # else
139 # define YY_NULLPTR 0
140 # endif
141 # endif
142
143 /* Enabling verbose error messages. */
144 #ifdef YYERROR_VERBOSE
145 # undef YYERROR_VERBOSE
146 # define YYERROR_VERBOSE 1
147 #else
148 # define YYERROR_VERBOSE 0
149 #endif
150
151 /* In a future release of Bison, this section will be replaced
152 by #include "y.tab.h". */
153 #ifndef YY_YY_TESTPATTERNY_H_INCLUDED
154 # define YY_YY_TESTPATTERNY_H_INCLUDED
155 /* Debug traces. */
156 #ifndef YYDEBUG
157 # define YYDEBUG 0
158 #endif
159 #if YYDEBUG
160 extern int yydebug;
161 #endif
162
163 /* Token type. */
164 #ifndef YYTOKENTYPE
165 # define YYTOKENTYPE
166 enum yytokentype
167 {
168 tINT = 258,
169 tDOUBLE = 259,
170 tSTRING = 260,
171 COLOR = 261,
172 GAMMA = 262,
173 LEVEL = 263,
174 STEPS = 264,
175 INK_LIMIT = 265,
176 PRINTER = 266,
177 PARAMETER = 267,
178 PARAMETER_INT = 268,
179 PARAMETER_BOOL = 269,
180 PARAMETER_FLOAT = 270,
181 PARAMETER_CURVE = 271,
182 DENSITY = 272,
183 TOP = 273,
184 LEFT = 274,
185 SIZE_MODE = 275,
186 RELATIVE = 276,
187 PT = 277,
188 IN = 278,
189 MM = 279,
190 HSIZE = 280,
191 VSIZE = 281,
192 BLACKLINE = 282,
193 COLORLINE = 283,
194 NOSCALE = 284,
195 PATTERN = 285,
196 XPATTERN = 286,
197 EXTENDED = 287,
198 IMAGE = 288,
199 GRID = 289,
200 SEMI = 290,
201 CHANNEL = 291,
202 CMYK = 292,
203 KCMY = 293,
204 RGB = 294,
205 CMY = 295,
206 GRAY = 296,
207 WHITE = 297,
208 MODE = 298,
209 PAGESIZE = 299,
210 ROUND = 300,
211 MESSAGE = 301,
212 OUTPUT = 302,
213 START_JOB = 303,
214 END_JOB = 304,
215 END = 305
216 };
217 #endif
218 /* Tokens. */
219 #define tINT 258
220 #define tDOUBLE 259
221 #define tSTRING 260
222 #define COLOR 261
223 #define GAMMA 262
224 #define LEVEL 263
225 #define STEPS 264
226 #define INK_LIMIT 265
227 #define PRINTER 266
228 #define PARAMETER 267
229 #define PARAMETER_INT 268
230 #define PARAMETER_BOOL 269
231 #define PARAMETER_FLOAT 270
232 #define PARAMETER_CURVE 271
233 #define DENSITY 272
234 #define TOP 273
235 #define LEFT 274
236 #define SIZE_MODE 275
237 #define RELATIVE 276
238 #define PT 277
239 #define IN 278
240 #define MM 279
241 #define HSIZE 280
242 #define VSIZE 281
243 #define BLACKLINE 282
244 #define COLORLINE 283
245 #define NOSCALE 284
246 #define PATTERN 285
247 #define XPATTERN 286
248 #define EXTENDED 287
249 #define IMAGE 288
250 #define GRID 289
251 #define SEMI 290
252 #define CHANNEL 291
253 #define CMYK 292
254 #define KCMY 293
255 #define RGB 294
256 #define CMY 295
257 #define GRAY 296
258 #define WHITE 297
259 #define MODE 298
260 #define PAGESIZE 299
261 #define ROUND 300
262 #define MESSAGE 301
263 #define OUTPUT 302
264 #define START_JOB 303
265 #define END_JOB 304
266 #define END 305
267
268 /* Value type. */
269
270
271 extern YYSTYPE yylval;
272
273 int yyparse (void);
274
275 #endif /* !YY_YY_TESTPATTERNY_H_INCLUDED */
276
277 /* Copy the second part of user declarations. */
278
279 #line 280 "testpatterny.c" /* yacc.c:358 */
280
281 #ifdef short
282 # undef short
283 #endif
284
285 #ifdef YYTYPE_UINT8
286 typedef YYTYPE_UINT8 yytype_uint8;
287 #else
288 typedef unsigned char yytype_uint8;
289 #endif
290
291 #ifdef YYTYPE_INT8
292 typedef YYTYPE_INT8 yytype_int8;
293 #else
294 typedef signed char yytype_int8;
295 #endif
296
297 #ifdef YYTYPE_UINT16
298 typedef YYTYPE_UINT16 yytype_uint16;
299 #else
300 typedef unsigned short int yytype_uint16;
301 #endif
302
303 #ifdef YYTYPE_INT16
304 typedef YYTYPE_INT16 yytype_int16;
305 #else
306 typedef short int yytype_int16;
307 #endif
308
309 #ifndef YYSIZE_T
310 # ifdef __SIZE_TYPE__
311 # define YYSIZE_T __SIZE_TYPE__
312 # elif defined size_t
313 # define YYSIZE_T size_t
314 # elif ! defined YYSIZE_T
315 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
316 # define YYSIZE_T size_t
317 # else
318 # define YYSIZE_T unsigned int
319 # endif
320 #endif
321
322 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
323
324 #ifndef YY_
325 # if defined YYENABLE_NLS && YYENABLE_NLS
326 # if ENABLE_NLS
327 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
328 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
329 # endif
330 # endif
331 # ifndef YY_
332 # define YY_(Msgid) Msgid
333 # endif
334 #endif
335
336 #ifndef YY_ATTRIBUTE
337 # if (defined __GNUC__ \
338 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
339 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
340 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
341 # else
342 # define YY_ATTRIBUTE(Spec) /* empty */
343 # endif
344 #endif
345
346 #ifndef YY_ATTRIBUTE_PURE
347 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
348 #endif
349
350 #ifndef YY_ATTRIBUTE_UNUSED
351 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
352 #endif
353
354 #if !defined _Noreturn \
355 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
356 # if defined _MSC_VER && 1200 <= _MSC_VER
357 # define _Noreturn __declspec (noreturn)
358 # else
359 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
360 # endif
361 #endif
362
363 /* Suppress unused-variable warnings by "using" E. */
364 #if ! defined lint || defined __GNUC__
365 # define YYUSE(E) ((void) (E))
366 #else
367 # define YYUSE(E) /* empty */
368 #endif
369
370 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
371 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
372 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
373 _Pragma ("GCC diagnostic push") \
374 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
375 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
376 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
377 _Pragma ("GCC diagnostic pop")
378 #else
379 # define YY_INITIAL_VALUE(Value) Value
380 #endif
381 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
382 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
383 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
384 #endif
385 #ifndef YY_INITIAL_VALUE
386 # define YY_INITIAL_VALUE(Value) /* Nothing. */
387 #endif
388
389
390 #if ! defined yyoverflow || YYERROR_VERBOSE
391
392 /* The parser invokes alloca or malloc; define the necessary symbols. */
393
394 # ifdef YYSTACK_USE_ALLOCA
395 # if YYSTACK_USE_ALLOCA
396 # ifdef __GNUC__
397 # define YYSTACK_ALLOC __builtin_alloca
398 # elif defined __BUILTIN_VA_ARG_INCR
399 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
400 # elif defined _AIX
401 # define YYSTACK_ALLOC __alloca
402 # elif defined _MSC_VER
403 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
404 # define alloca _alloca
405 # else
406 # define YYSTACK_ALLOC alloca
407 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
408 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
409 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
410 # ifndef EXIT_SUCCESS
411 # define EXIT_SUCCESS 0
412 # endif
413 # endif
414 # endif
415 # endif
416 # endif
417
418 # ifdef YYSTACK_ALLOC
419 /* Pacify GCC's 'empty if-body' warning. */
420 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
421 # ifndef YYSTACK_ALLOC_MAXIMUM
422 /* The OS might guarantee only one guard page at the bottom of the stack,
423 and a page size can be as small as 4096 bytes. So we cannot safely
424 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
425 to allow for a few compiler-allocated temporary stack slots. */
426 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
427 # endif
428 # else
429 # define YYSTACK_ALLOC YYMALLOC
430 # define YYSTACK_FREE YYFREE
431 # ifndef YYSTACK_ALLOC_MAXIMUM
432 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
433 # endif
434 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
435 && ! ((defined YYMALLOC || defined malloc) \
436 && (defined YYFREE || defined free)))
437 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
438 # ifndef EXIT_SUCCESS
439 # define EXIT_SUCCESS 0
440 # endif
441 # endif
442 # ifndef YYMALLOC
443 # define YYMALLOC malloc
444 # if ! defined malloc && ! defined EXIT_SUCCESS
445 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
446 # endif
447 # endif
448 # ifndef YYFREE
449 # define YYFREE free
450 # if ! defined free && ! defined EXIT_SUCCESS
451 void free (void *); /* INFRINGES ON USER NAME SPACE */
452 # endif
453 # endif
454 # endif
455 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
456
457
458 #if (! defined yyoverflow \
459 && (! defined __cplusplus \
460 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
461
462 /* A type that is properly aligned for any stack member. */
463 union yyalloc
464 {
465 yytype_int16 yyss_alloc;
466 YYSTYPE yyvs_alloc;
467 };
468
469 /* The size of the maximum gap between one aligned stack and the next. */
470 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
471
472 /* The size of an array large to enough to hold all stacks, each with
473 N elements. */
474 # define YYSTACK_BYTES(N) \
475 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
476 + YYSTACK_GAP_MAXIMUM)
477
478 # define YYCOPY_NEEDED 1
479
480 /* Relocate STACK from its old location to the new one. The
481 local variables YYSIZE and YYSTACKSIZE give the old and new number of
482 elements in the stack, and YYPTR gives the new location of the
483 stack. Advance YYPTR to a properly aligned location for the next
484 stack. */
485 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
486 do \
487 { \
488 YYSIZE_T yynewbytes; \
489 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
490 Stack = &yyptr->Stack_alloc; \
491 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
492 yyptr += yynewbytes / sizeof (*yyptr); \
493 } \
494 while (0)
495
496 #endif
497
498 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
499 /* Copy COUNT objects from SRC to DST. The source and destination do
500 not overlap. */
501 # ifndef YYCOPY
502 # if defined __GNUC__ && 1 < __GNUC__
503 # define YYCOPY(Dst, Src, Count) \
504 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
505 # else
506 # define YYCOPY(Dst, Src, Count) \
507 do \
508 { \
509 YYSIZE_T yyi; \
510 for (yyi = 0; yyi < (Count); yyi++) \
511 (Dst)[yyi] = (Src)[yyi]; \
512 } \
513 while (0)
514 # endif
515 # endif
516 #endif /* !YYCOPY_NEEDED */
517
518 /* YYFINAL -- State number of the termination state. */
519 #define YYFINAL 66
520 /* YYLAST -- Last index in YYTABLE. */
521 #define YYLAST 182
522
523 /* YYNTOKENS -- Number of terminals. */
524 #define YYNTOKENS 51
525 /* YYNNTS -- Number of nonterminals. */
526 #define YYNNTS 79
527 /* YYNRULES -- Number of rules. */
528 #define YYNRULES 134
529 /* YYNSTATES -- Number of states. */
530 #define YYNSTATES 188
531
532 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
533 by yylex, with out-of-bounds checking. */
534 #define YYUNDEFTOK 2
535 #define YYMAXUTOK 305
536
537 #define YYTRANSLATE(YYX) \
538 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
539
540 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
541 as returned by yylex, without out-of-bounds checking. */
542 static const yytype_uint8 yytranslate[] =
543 {
544 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
570 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
571 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
572 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
573 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
574 45, 46, 47, 48, 49, 50
575 };
576
577 #if YYDEBUG
578 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
579 static const yytype_uint16 yyrline[] =
580 {
581 0, 145, 145, 145, 150, 160, 170, 180, 190, 200,
582 210, 220, 220, 220, 220, 220, 220, 220, 223, 231,
583 231, 234, 241, 244, 254, 263, 273, 282, 289, 296,
584 303, 312, 321, 330, 330, 333, 343, 352, 361, 370,
585 384, 384, 384, 384, 384, 386, 393, 400, 407, 414,
586 421, 428, 435, 435, 435, 435, 437, 439, 446, 453,
587 461, 469, 477, 492, 492, 495, 495, 498, 501, 515,
588 528, 528, 531, 531, 534, 534, 537, 537, 540, 555,
589 558, 573, 584, 601, 608, 608, 611, 614, 624, 630,
590 630, 633, 637, 641, 641, 641, 641, 641, 641, 642,
591 642, 642, 642, 642, 642, 642, 643, 643, 643, 643,
592 643, 643, 644, 644, 644, 644, 644, 644, 647, 651,
593 651, 651, 651, 654, 658, 658, 661, 665, 665, 668,
594 668, 671, 671, 676, 675
595 };
596 #endif
597
598 #if YYDEBUG || YYERROR_VERBOSE || 0
599 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
600 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
601 static const char *const yytname[] =
602 {
603 "$end", "error", "$undefined", "tINT", "tDOUBLE", "tSTRING", "COLOR",
604 "GAMMA", "LEVEL", "STEPS", "INK_LIMIT", "PRINTER", "PARAMETER",
605 "PARAMETER_INT", "PARAMETER_BOOL", "PARAMETER_FLOAT", "PARAMETER_CURVE",
606 "DENSITY", "TOP", "LEFT", "SIZE_MODE", "RELATIVE", "PT", "IN", "MM",
607 "HSIZE", "VSIZE", "BLACKLINE", "COLORLINE", "NOSCALE", "PATTERN",
608 "XPATTERN", "EXTENDED", "IMAGE", "GRID", "SEMI", "CHANNEL", "CMYK",
609 "KCMY", "RGB", "CMY", "GRAY", "WHITE", "MODE", "PAGESIZE", "ROUND",
610 "MESSAGE", "OUTPUT", "START_JOB", "END_JOB", "END", "$accept", "NUMBER",
611 "cmykspec", "kcmyspec", "rgbspec", "cmyspec", "grayspec", "whitespec",
612 "extendedspec", "modespec1", "modespec2", "modespec", "round",
613 "inputspec", "level", "channel_level", "gamma", "channel_gamma",
614 "global_gamma", "steps", "ink_limit", "printer", "page_size_name",
615 "page_size_custom", "page_size", "parameter_string", "parameter_int",
616 "parameter_bool", "parameter_float", "parameter_curve", "parameter",
617 "density", "top", "left", "size_relative", "size_in", "size_pt",
618 "size_mm", "size_mode_1", "size_mode", "hsize", "vsize", "blackline",
619 "colorline", "noscale", "color_block1", "color_blocks1a",
620 "color_blocks1b", "color_blocks1", "color_block2a", "color_block2b",
621 "color_block2", "color_blocks2a", "color_blocks2", "color_blocks",
622 "patvars", "pattern", "xpattern", "grid", "image", "Message", "Messages",
623 "message", "Output0", "Output1", "output", "start_job", "end_job",
624 "A_Rule", "Rule", "A_Pattern", "Pattern", "Patterns", "Image", "Rules",
625 "Print", "EOF", "Thing", "$@1", YY_NULLPTR
626 };
627 #endif
628
629 # ifdef YYPRINT
630 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
631 (internal) symbol number NUM (which must be that of a token). */
632 static const yytype_uint16 yytoknum[] =
633 {
634 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
635 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
636 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
637 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
638 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
639 305
640 };
641 # endif
642
643 #define YYPACT_NINF -146
644
645 #define yypact_value_is_default(Yystate) \
646 (!!((Yystate) == (-146)))
647
648 #define YYTABLE_NINF -1
649
650 #define yytable_value_is_error(Yytable_value) \
651 0
652
653 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
654 STATE-NUM. */
655 static const yytype_int16 yypact[] =
656 {
657 -146, 9, 4, 57, -1, 5, 29, 36, 40, 41,
658 62, 71, 73, 29, 29, 29, 27, 29, 29, 59,
659 76, 77, 33, 37, -146, -146, 78, -146, -146, -146,
660 -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
661 -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
662 -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
663 -146, -146, -146, 46, -146, 49, -146, 29, -146, 29,
664 -146, 29, 29, -146, -146, -146, -146, 79, 82, 83,
665 29, 84, -146, -146, -146, -146, -146, -146, -146, -146,
666 -146, -146, -146, -146, -146, -146, -146, -146, -146, 85,
667 -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
668 -146, -146, -146, 87, -146, -146, 88, -146, 89, -146,
669 -146, 90, -146, 13, -146, 42, -146, -146, -146, -146,
670 -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
671 92, 29, 3, 93, -146, -146, -146, -146, 52, -146,
672 63, -146, -146, 29, 3, 29, 94, 29, 29, -146,
673 -146, -146, -146, -5, -146, -146, -146, -146, -146, 29,
674 -146, 29, 29, 29, -146, 29, -146, -146, 29, 29,
675 29, -146, -146, 29, -146, 29, -146, -146
676 };
677
678 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
679 Performed when YYTABLE does not specify something else to do. Zero
680 means the default is an error. */
681 static const yytype_uint8 yydefact[] =
682 {
683 127, 133, 0, 0, 0, 0, 0, 0, 0, 0,
684 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
685 0, 0, 0, 0, 21, 84, 87, 91, 92, 116,
686 109, 95, 96, 93, 94, 97, 98, 99, 100, 33,
687 34, 110, 40, 41, 44, 42, 43, 101, 102, 103,
688 104, 115, 105, 106, 107, 117, 108, 111, 89, 90,
689 112, 113, 114, 0, 128, 124, 1, 3, 2, 0,
690 27, 0, 0, 28, 3, 29, 30, 0, 0, 0,
691 0, 0, 45, 46, 47, 48, 50, 49, 51, 52,
692 54, 53, 55, 56, 57, 58, 59, 60, 61, 0,
693 4, 5, 6, 7, 8, 9, 11, 12, 13, 14,
694 15, 16, 17, 19, 20, 22, 0, 31, 86, 88,
695 118, 0, 126, 129, 130, 131, 26, 25, 24, 23,
696 35, 36, 37, 38, 39, 10, 18, 32, 83, 85,
697 0, 0, 74, 0, 119, 120, 121, 122, 0, 125,
698 0, 134, 82, 0, 74, 0, 0, 0, 65, 76,
699 70, 71, 72, 75, 77, 80, 81, 123, 132, 0,
700 79, 0, 0, 0, 63, 66, 67, 73, 0, 0,
701 0, 62, 64, 0, 68, 0, 78, 69
702 };
703
704 /* YYPGOTO[NTERM-NUM]. */
705 static const yytype_int16 yypgoto[] =
706 {
707 -146, -3, -146, -146, -146, -146, -146, -146, -146, -146,
708 -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
709 -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
710 -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
711 -146, -146, -146, -146, -146, -145, -146, -146, -146, -146,
712 -146, -64, -146, -146, -54, -146, -146, -146, -146, -146,
713 -146, -146, -22, -146, -146, -146, -146, -146, -146, -146,
714 -146, -146, -146, -146, -146, -146, -146, -146, -146
715 };
716
717 /* YYDEFGOTO[NTERM-NUM]. */
718 static const yytype_int16 yydefgoto[] =
719 {
720 -1, 157, 106, 107, 108, 109, 110, 111, 112, 113,
721 114, 115, 29, 30, 31, 32, 33, 34, 35, 36,
722 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
723 47, 48, 49, 50, 89, 90, 91, 92, 93, 51,
724 52, 53, 54, 55, 56, 158, 175, 176, 159, 160,
725 161, 162, 163, 164, 165, 154, 144, 145, 146, 122,
726 139, 118, 57, 58, 59, 60, 61, 62, 63, 64,
727 148, 149, 123, 124, 1, 125, 151, 2, 65
728 };
729
730 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
731 positive, shift that token. If negative, reduce the rule whose
732 number is the opposite. If YYTABLE_NINF, syntax error. */
733 static const yytype_uint8 yytable[] =
734 {
735 70, 155, 71, 75, 66, 72, 74, 68, 73, 155,
736 82, 83, 84, 174, 94, 95, 3, 4, 5, 6,
737 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
738 182, 156, 74, 68, 17, 18, 19, 20, 21, 156,
739 116, 76, 117, 141, 142, 77, 78, 143, 85, 86,
740 87, 88, 22, 23, 24, 25, 26, 27, 28, 25,
741 67, 68, 96, 69, 126, 99, 127, 79, 128, 129,
742 100, 101, 102, 103, 104, 105, 80, 133, 81, 97,
743 98, 120, 121, 119, 130, 131, 132, 167, 135, 134,
744 136, 137, 150, 140, 138, 152, 166, 172, 168, 177,
745 170, 147, 0, 0, 0, 0, 0, 0, 0, 0,
746 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
747 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
748 0, 0, 0, 0, 0, 0, 0, 0, 153, 0,
749 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
750 169, 0, 171, 0, 173, 0, 0, 0, 0, 0,
751 0, 0, 0, 0, 0, 0, 178, 0, 179, 180,
752 181, 0, 0, 0, 0, 183, 184, 185, 0, 0,
753 186, 0, 187
754 };
755
756 static const yytype_int16 yycheck[] =
757 {
758 3, 6, 3, 6, 0, 6, 3, 4, 3, 6,
759 13, 14, 15, 158, 17, 18, 7, 8, 9, 10,
760 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
761 175, 36, 3, 4, 25, 26, 27, 28, 29, 36,
762 3, 5, 5, 30, 31, 5, 5, 34, 21, 22,
763 23, 24, 43, 44, 45, 46, 47, 48, 49, 46,
764 3, 4, 3, 6, 67, 32, 69, 5, 71, 72,
765 37, 38, 39, 40, 41, 42, 5, 80, 5, 3,
766 3, 35, 33, 5, 5, 3, 3, 35, 3, 5,
767 3, 3, 50, 3, 5, 3, 3, 3, 35, 163,
768 154, 123, -1, -1, -1, -1, -1, -1, -1, -1,
769 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
770 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
771 -1, -1, -1, -1, -1, -1, -1, -1, 141, -1,
772 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
773 153, -1, 155, -1, 157, -1, -1, -1, -1, -1,
774 -1, -1, -1, -1, -1, -1, 169, -1, 171, 172,
775 173, -1, -1, -1, -1, 178, 179, 180, -1, -1,
776 183, -1, 185
777 };
778
779 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
780 symbol of state STATE-NUM. */
781 static const yytype_uint8 yystos[] =
782 {
783 0, 125, 128, 7, 8, 9, 10, 11, 12, 13,
784 14, 15, 16, 17, 18, 19, 20, 25, 26, 27,
785 28, 29, 43, 44, 45, 46, 47, 48, 49, 63,
786 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
787 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
788 84, 90, 91, 92, 93, 94, 95, 113, 114, 115,
789 116, 117, 118, 119, 120, 129, 0, 3, 4, 6,
790 52, 3, 6, 3, 3, 52, 5, 5, 5, 5,
791 5, 5, 52, 52, 52, 21, 22, 23, 24, 85,
792 86, 87, 88, 89, 52, 52, 3, 3, 3, 32,
793 37, 38, 39, 40, 41, 42, 53, 54, 55, 56,
794 57, 58, 59, 60, 61, 62, 3, 5, 112, 5,
795 35, 33, 110, 123, 124, 126, 52, 52, 52, 52,
796 5, 3, 3, 52, 5, 3, 3, 3, 5, 111,
797 3, 30, 31, 34, 107, 108, 109, 113, 121, 122,
798 50, 127, 3, 52, 106, 6, 36, 52, 96, 99,
799 100, 101, 102, 103, 104, 105, 3, 35, 35, 52,
800 105, 52, 3, 52, 96, 97, 98, 102, 52, 52,
801 52, 52, 96, 52, 52, 52, 52, 52
802 };
803
804 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
805 static const yytype_uint8 yyr1[] =
806 {
807 0, 51, 52, 52, 53, 54, 55, 56, 57, 58,
808 59, 60, 60, 60, 60, 60, 60, 60, 61, 62,
809 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
810 72, 73, 74, 75, 75, 76, 77, 78, 79, 80,
811 81, 81, 81, 81, 81, 82, 83, 84, 85, 86,
812 87, 88, 89, 89, 89, 89, 90, 91, 92, 93,
813 94, 95, 96, 97, 97, 98, 98, 99, 100, 101,
814 102, 102, 103, 103, 104, 104, 105, 105, 106, 107,
815 108, 109, 110, 111, 112, 112, 113, 114, 115, 116,
816 116, 117, 118, 119, 119, 119, 119, 119, 119, 119,
817 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
818 119, 119, 119, 119, 119, 119, 119, 119, 120, 121,
819 121, 121, 121, 122, 123, 123, 124, 125, 125, 126,
820 126, 127, 127, 129, 128
821 };
822
823 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
824 static const yytype_uint8 yyr2[] =
825 {
826 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
827 2, 1, 1, 1, 1, 1, 1, 1, 2, 1,
828 1, 1, 2, 3, 3, 3, 3, 2, 2, 2,
829 2, 2, 3, 1, 1, 3, 3, 3, 3, 3,
830 1, 1, 1, 1, 1, 2, 2, 2, 1, 1,
831 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
832 2, 2, 3, 1, 2, 0, 1, 2, 4, 5,
833 1, 1, 1, 2, 0, 1, 1, 1, 5, 3,
834 2, 2, 3, 1, 0, 2, 2, 1, 2, 1,
835 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
836 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
837 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
838 1, 1, 1, 2, 0, 2, 1, 0, 2, 1,
839 1, 0, 2, 0, 4
840 };
841
842
843 #define yyerrok (yyerrstatus = 0)
844 #define yyclearin (yychar = YYEMPTY)
845 #define YYEMPTY (-2)
846 #define YYEOF 0
847
848 #define YYACCEPT goto yyacceptlab
849 #define YYABORT goto yyabortlab
850 #define YYERROR goto yyerrorlab
851
852
853 #define YYRECOVERING() (!!yyerrstatus)
854
855 #define YYBACKUP(Token, Value) \
856 do \
857 if (yychar == YYEMPTY) \
858 { \
859 yychar = (Token); \
860 yylval = (Value); \
861 YYPOPSTACK (yylen); \
862 yystate = *yyssp; \
863 goto yybackup; \
864 } \
865 else \
866 { \
867 yyerror (YY_("syntax error: cannot back up")); \
868 YYERROR; \
869 } \
870 while (0)
871
872 /* Error token number */
873 #define YYTERROR 1
874 #define YYERRCODE 256
875
876
877
878 /* Enable debugging if requested. */
879 #if YYDEBUG
880
881 # ifndef YYFPRINTF
882 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
883 # define YYFPRINTF fprintf
884 # endif
885
886 # define YYDPRINTF(Args) \
887 do { \
888 if (yydebug) \
889 YYFPRINTF Args; \
890 } while (0)
891
892 /* This macro is provided for backward compatibility. */
893 #ifndef YY_LOCATION_PRINT
894 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
895 #endif
896
897
898 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
899 do { \
900 if (yydebug) \
901 { \
902 YYFPRINTF (stderr, "%s ", Title); \
903 yy_symbol_print (stderr, \
904 Type, Value); \
905 YYFPRINTF (stderr, "\n"); \
906 } \
907 } while (0)
908
909
910 /*----------------------------------------.
911 | Print this symbol's value on YYOUTPUT. |
912 `----------------------------------------*/
913
914 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)915 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
916 {
917 FILE *yyo = yyoutput;
918 YYUSE (yyo);
919 if (!yyvaluep)
920 return;
921 # ifdef YYPRINT
922 if (yytype < YYNTOKENS)
923 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
924 # endif
925 YYUSE (yytype);
926 }
927
928
929 /*--------------------------------.
930 | Print this symbol on YYOUTPUT. |
931 `--------------------------------*/
932
933 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)934 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
935 {
936 YYFPRINTF (yyoutput, "%s %s (",
937 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
938
939 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
940 YYFPRINTF (yyoutput, ")");
941 }
942
943 /*------------------------------------------------------------------.
944 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
945 | TOP (included). |
946 `------------------------------------------------------------------*/
947
948 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)949 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
950 {
951 YYFPRINTF (stderr, "Stack now");
952 for (; yybottom <= yytop; yybottom++)
953 {
954 int yybot = *yybottom;
955 YYFPRINTF (stderr, " %d", yybot);
956 }
957 YYFPRINTF (stderr, "\n");
958 }
959
960 # define YY_STACK_PRINT(Bottom, Top) \
961 do { \
962 if (yydebug) \
963 yy_stack_print ((Bottom), (Top)); \
964 } while (0)
965
966
967 /*------------------------------------------------.
968 | Report that the YYRULE is going to be reduced. |
969 `------------------------------------------------*/
970
971 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule)972 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
973 {
974 unsigned long int yylno = yyrline[yyrule];
975 int yynrhs = yyr2[yyrule];
976 int yyi;
977 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
978 yyrule - 1, yylno);
979 /* The symbols being reduced. */
980 for (yyi = 0; yyi < yynrhs; yyi++)
981 {
982 YYFPRINTF (stderr, " $%d = ", yyi + 1);
983 yy_symbol_print (stderr,
984 yystos[yyssp[yyi + 1 - yynrhs]],
985 &(yyvsp[(yyi + 1) - (yynrhs)])
986 );
987 YYFPRINTF (stderr, "\n");
988 }
989 }
990
991 # define YY_REDUCE_PRINT(Rule) \
992 do { \
993 if (yydebug) \
994 yy_reduce_print (yyssp, yyvsp, Rule); \
995 } while (0)
996
997 /* Nonzero means print parse trace. It is left uninitialized so that
998 multiple parsers can coexist. */
999 int yydebug;
1000 #else /* !YYDEBUG */
1001 # define YYDPRINTF(Args)
1002 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1003 # define YY_STACK_PRINT(Bottom, Top)
1004 # define YY_REDUCE_PRINT(Rule)
1005 #endif /* !YYDEBUG */
1006
1007
1008 /* YYINITDEPTH -- initial size of the parser's stacks. */
1009 #ifndef YYINITDEPTH
1010 # define YYINITDEPTH 200
1011 #endif
1012
1013 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1014 if the built-in stack extension method is used).
1015
1016 Do not make this value too large; the results are undefined if
1017 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1018 evaluated with infinite-precision integer arithmetic. */
1019
1020 #ifndef YYMAXDEPTH
1021 # define YYMAXDEPTH 10000
1022 #endif
1023
1024
1025 #if YYERROR_VERBOSE
1026
1027 # ifndef yystrlen
1028 # if defined __GLIBC__ && defined _STRING_H
1029 # define yystrlen strlen
1030 # else
1031 /* Return the length of YYSTR. */
1032 static YYSIZE_T
yystrlen(const char * yystr)1033 yystrlen (const char *yystr)
1034 {
1035 YYSIZE_T yylen;
1036 for (yylen = 0; yystr[yylen]; yylen++)
1037 continue;
1038 return yylen;
1039 }
1040 # endif
1041 # endif
1042
1043 # ifndef yystpcpy
1044 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1045 # define yystpcpy stpcpy
1046 # else
1047 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1048 YYDEST. */
1049 static char *
yystpcpy(char * yydest,const char * yysrc)1050 yystpcpy (char *yydest, const char *yysrc)
1051 {
1052 char *yyd = yydest;
1053 const char *yys = yysrc;
1054
1055 while ((*yyd++ = *yys++) != '\0')
1056 continue;
1057
1058 return yyd - 1;
1059 }
1060 # endif
1061 # endif
1062
1063 # ifndef yytnamerr
1064 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1065 quotes and backslashes, so that it's suitable for yyerror. The
1066 heuristic is that double-quoting is unnecessary unless the string
1067 contains an apostrophe, a comma, or backslash (other than
1068 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1069 null, do not copy; instead, return the length of what the result
1070 would have been. */
1071 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1072 yytnamerr (char *yyres, const char *yystr)
1073 {
1074 if (*yystr == '"')
1075 {
1076 YYSIZE_T yyn = 0;
1077 char const *yyp = yystr;
1078
1079 for (;;)
1080 switch (*++yyp)
1081 {
1082 case '\'':
1083 case ',':
1084 goto do_not_strip_quotes;
1085
1086 case '\\':
1087 if (*++yyp != '\\')
1088 goto do_not_strip_quotes;
1089 /* Fall through. */
1090 default:
1091 if (yyres)
1092 yyres[yyn] = *yyp;
1093 yyn++;
1094 break;
1095
1096 case '"':
1097 if (yyres)
1098 yyres[yyn] = '\0';
1099 return yyn;
1100 }
1101 do_not_strip_quotes: ;
1102 }
1103
1104 if (! yyres)
1105 return yystrlen (yystr);
1106
1107 return yystpcpy (yyres, yystr) - yyres;
1108 }
1109 # endif
1110
1111 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1112 about the unexpected token YYTOKEN for the state stack whose top is
1113 YYSSP.
1114
1115 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1116 not large enough to hold the message. In that case, also set
1117 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1118 required number of bytes is too large to store. */
1119 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)1120 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1121 yytype_int16 *yyssp, int yytoken)
1122 {
1123 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1124 YYSIZE_T yysize = yysize0;
1125 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1126 /* Internationalized format string. */
1127 const char *yyformat = YY_NULLPTR;
1128 /* Arguments of yyformat. */
1129 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1130 /* Number of reported tokens (one for the "unexpected", one per
1131 "expected"). */
1132 int yycount = 0;
1133
1134 /* There are many possibilities here to consider:
1135 - If this state is a consistent state with a default action, then
1136 the only way this function was invoked is if the default action
1137 is an error action. In that case, don't check for expected
1138 tokens because there are none.
1139 - The only way there can be no lookahead present (in yychar) is if
1140 this state is a consistent state with a default action. Thus,
1141 detecting the absence of a lookahead is sufficient to determine
1142 that there is no unexpected or expected token to report. In that
1143 case, just report a simple "syntax error".
1144 - Don't assume there isn't a lookahead just because this state is a
1145 consistent state with a default action. There might have been a
1146 previous inconsistent state, consistent state with a non-default
1147 action, or user semantic action that manipulated yychar.
1148 - Of course, the expected token list depends on states to have
1149 correct lookahead information, and it depends on the parser not
1150 to perform extra reductions after fetching a lookahead from the
1151 scanner and before detecting a syntax error. Thus, state merging
1152 (from LALR or IELR) and default reductions corrupt the expected
1153 token list. However, the list is correct for canonical LR with
1154 one exception: it will still contain any token that will not be
1155 accepted due to an error action in a later state.
1156 */
1157 if (yytoken != YYEMPTY)
1158 {
1159 int yyn = yypact[*yyssp];
1160 yyarg[yycount++] = yytname[yytoken];
1161 if (!yypact_value_is_default (yyn))
1162 {
1163 /* Start YYX at -YYN if negative to avoid negative indexes in
1164 YYCHECK. In other words, skip the first -YYN actions for
1165 this state because they are default actions. */
1166 int yyxbegin = yyn < 0 ? -yyn : 0;
1167 /* Stay within bounds of both yycheck and yytname. */
1168 int yychecklim = YYLAST - yyn + 1;
1169 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1170 int yyx;
1171
1172 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1173 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1174 && !yytable_value_is_error (yytable[yyx + yyn]))
1175 {
1176 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1177 {
1178 yycount = 1;
1179 yysize = yysize0;
1180 break;
1181 }
1182 yyarg[yycount++] = yytname[yyx];
1183 {
1184 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1185 if (! (yysize <= yysize1
1186 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1187 return 2;
1188 yysize = yysize1;
1189 }
1190 }
1191 }
1192 }
1193
1194 switch (yycount)
1195 {
1196 # define YYCASE_(N, S) \
1197 case N: \
1198 yyformat = S; \
1199 break
1200 YYCASE_(0, YY_("syntax error"));
1201 YYCASE_(1, YY_("syntax error, unexpected %s"));
1202 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1203 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1204 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1205 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1206 # undef YYCASE_
1207 }
1208
1209 {
1210 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1211 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1212 return 2;
1213 yysize = yysize1;
1214 }
1215
1216 if (*yymsg_alloc < yysize)
1217 {
1218 *yymsg_alloc = 2 * yysize;
1219 if (! (yysize <= *yymsg_alloc
1220 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1221 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1222 return 1;
1223 }
1224
1225 /* Avoid sprintf, as that infringes on the user's name space.
1226 Don't have undefined behavior even if the translation
1227 produced a string with the wrong number of "%s"s. */
1228 {
1229 char *yyp = *yymsg;
1230 int yyi = 0;
1231 while ((*yyp = *yyformat) != '\0')
1232 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1233 {
1234 yyp += yytnamerr (yyp, yyarg[yyi++]);
1235 yyformat += 2;
1236 }
1237 else
1238 {
1239 yyp++;
1240 yyformat++;
1241 }
1242 }
1243 return 0;
1244 }
1245 #endif /* YYERROR_VERBOSE */
1246
1247 /*-----------------------------------------------.
1248 | Release the memory associated to this symbol. |
1249 `-----------------------------------------------*/
1250
1251 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1252 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1253 {
1254 YYUSE (yyvaluep);
1255 if (!yymsg)
1256 yymsg = "Deleting";
1257 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1258
1259 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1260 YYUSE (yytype);
1261 YY_IGNORE_MAYBE_UNINITIALIZED_END
1262 }
1263
1264
1265
1266
1267 /* The lookahead symbol. */
1268 int yychar;
1269
1270 /* The semantic value of the lookahead symbol. */
1271 YYSTYPE yylval;
1272 /* Number of syntax errors so far. */
1273 int yynerrs;
1274
1275
1276 /*----------.
1277 | yyparse. |
1278 `----------*/
1279
1280 int
yyparse(void)1281 yyparse (void)
1282 {
1283 int yystate;
1284 /* Number of tokens to shift before error messages enabled. */
1285 int yyerrstatus;
1286
1287 /* The stacks and their tools:
1288 'yyss': related to states.
1289 'yyvs': related to semantic values.
1290
1291 Refer to the stacks through separate pointers, to allow yyoverflow
1292 to reallocate them elsewhere. */
1293
1294 /* The state stack. */
1295 yytype_int16 yyssa[YYINITDEPTH];
1296 yytype_int16 *yyss;
1297 yytype_int16 *yyssp;
1298
1299 /* The semantic value stack. */
1300 YYSTYPE yyvsa[YYINITDEPTH];
1301 YYSTYPE *yyvs;
1302 YYSTYPE *yyvsp;
1303
1304 YYSIZE_T yystacksize;
1305
1306 int yyn;
1307 int yyresult;
1308 /* Lookahead token as an internal (translated) token number. */
1309 int yytoken = 0;
1310 /* The variables used to return semantic value and location from the
1311 action routines. */
1312 YYSTYPE yyval;
1313
1314 #if YYERROR_VERBOSE
1315 /* Buffer for error messages, and its allocated size. */
1316 char yymsgbuf[128];
1317 char *yymsg = yymsgbuf;
1318 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1319 #endif
1320
1321 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1322
1323 /* The number of symbols on the RHS of the reduced rule.
1324 Keep to zero when no symbol should be popped. */
1325 int yylen = 0;
1326
1327 yyssp = yyss = yyssa;
1328 yyvsp = yyvs = yyvsa;
1329 yystacksize = YYINITDEPTH;
1330
1331 YYDPRINTF ((stderr, "Starting parse\n"));
1332
1333 yystate = 0;
1334 yyerrstatus = 0;
1335 yynerrs = 0;
1336 yychar = YYEMPTY; /* Cause a token to be read. */
1337 goto yysetstate;
1338
1339 /*------------------------------------------------------------.
1340 | yynewstate -- Push a new state, which is found in yystate. |
1341 `------------------------------------------------------------*/
1342 yynewstate:
1343 /* In all cases, when you get here, the value and location stacks
1344 have just been pushed. So pushing a state here evens the stacks. */
1345 yyssp++;
1346
1347 yysetstate:
1348 *yyssp = yystate;
1349
1350 if (yyss + yystacksize - 1 <= yyssp)
1351 {
1352 /* Get the current used size of the three stacks, in elements. */
1353 YYSIZE_T yysize = yyssp - yyss + 1;
1354
1355 #ifdef yyoverflow
1356 {
1357 /* Give user a chance to reallocate the stack. Use copies of
1358 these so that the &'s don't force the real ones into
1359 memory. */
1360 YYSTYPE *yyvs1 = yyvs;
1361 yytype_int16 *yyss1 = yyss;
1362
1363 /* Each stack pointer address is followed by the size of the
1364 data in use in that stack, in bytes. This used to be a
1365 conditional around just the two extra args, but that might
1366 be undefined if yyoverflow is a macro. */
1367 yyoverflow (YY_("memory exhausted"),
1368 &yyss1, yysize * sizeof (*yyssp),
1369 &yyvs1, yysize * sizeof (*yyvsp),
1370 &yystacksize);
1371
1372 yyss = yyss1;
1373 yyvs = yyvs1;
1374 }
1375 #else /* no yyoverflow */
1376 # ifndef YYSTACK_RELOCATE
1377 goto yyexhaustedlab;
1378 # else
1379 /* Extend the stack our own way. */
1380 if (YYMAXDEPTH <= yystacksize)
1381 goto yyexhaustedlab;
1382 yystacksize *= 2;
1383 if (YYMAXDEPTH < yystacksize)
1384 yystacksize = YYMAXDEPTH;
1385
1386 {
1387 yytype_int16 *yyss1 = yyss;
1388 union yyalloc *yyptr =
1389 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1390 if (! yyptr)
1391 goto yyexhaustedlab;
1392 YYSTACK_RELOCATE (yyss_alloc, yyss);
1393 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1394 # undef YYSTACK_RELOCATE
1395 if (yyss1 != yyssa)
1396 YYSTACK_FREE (yyss1);
1397 }
1398 # endif
1399 #endif /* no yyoverflow */
1400
1401 yyssp = yyss + yysize - 1;
1402 yyvsp = yyvs + yysize - 1;
1403
1404 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1405 (unsigned long int) yystacksize));
1406
1407 if (yyss + yystacksize - 1 <= yyssp)
1408 YYABORT;
1409 }
1410
1411 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1412
1413 if (yystate == YYFINAL)
1414 YYACCEPT;
1415
1416 goto yybackup;
1417
1418 /*-----------.
1419 | yybackup. |
1420 `-----------*/
1421 yybackup:
1422
1423 /* Do appropriate processing given the current state. Read a
1424 lookahead token if we need one and don't already have one. */
1425
1426 /* First try to decide what to do without reference to lookahead token. */
1427 yyn = yypact[yystate];
1428 if (yypact_value_is_default (yyn))
1429 goto yydefault;
1430
1431 /* Not known => get a lookahead token if don't already have one. */
1432
1433 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1434 if (yychar == YYEMPTY)
1435 {
1436 YYDPRINTF ((stderr, "Reading a token: "));
1437 yychar = yylex ();
1438 }
1439
1440 if (yychar <= YYEOF)
1441 {
1442 yychar = yytoken = YYEOF;
1443 YYDPRINTF ((stderr, "Now at end of input.\n"));
1444 }
1445 else
1446 {
1447 yytoken = YYTRANSLATE (yychar);
1448 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1449 }
1450
1451 /* If the proper action on seeing token YYTOKEN is to reduce or to
1452 detect an error, take that action. */
1453 yyn += yytoken;
1454 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1455 goto yydefault;
1456 yyn = yytable[yyn];
1457 if (yyn <= 0)
1458 {
1459 if (yytable_value_is_error (yyn))
1460 goto yyerrlab;
1461 yyn = -yyn;
1462 goto yyreduce;
1463 }
1464
1465 /* Count tokens shifted since error; after three, turn off error
1466 status. */
1467 if (yyerrstatus)
1468 yyerrstatus--;
1469
1470 /* Shift the lookahead token. */
1471 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1472
1473 /* Discard the shifted token. */
1474 yychar = YYEMPTY;
1475
1476 yystate = yyn;
1477 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1478 *++yyvsp = yylval;
1479 YY_IGNORE_MAYBE_UNINITIALIZED_END
1480
1481 goto yynewstate;
1482
1483
1484 /*-----------------------------------------------------------.
1485 | yydefault -- do the default action for the current state. |
1486 `-----------------------------------------------------------*/
1487 yydefault:
1488 yyn = yydefact[yystate];
1489 if (yyn == 0)
1490 goto yyerrlab;
1491 goto yyreduce;
1492
1493
1494 /*-----------------------------.
1495 | yyreduce -- Do a reduction. |
1496 `-----------------------------*/
1497 yyreduce:
1498 /* yyn is the number of a rule to reduce with. */
1499 yylen = yyr2[yyn];
1500
1501 /* If YYLEN is nonzero, implement the default value of the action:
1502 '$$ = $1'.
1503
1504 Otherwise, the following line sets YYVAL to garbage.
1505 This behavior is undocumented and Bison
1506 users should not rely upon it. Assigning to YYVAL
1507 unconditionally makes the parser a bit smaller, and it avoids a
1508 GCC warning that YYVAL may be used uninitialized. */
1509 yyval = yyvsp[1-yylen];
1510
1511
1512 YY_REDUCE_PRINT (yyn);
1513 switch (yyn)
1514 {
1515 case 3:
1516 #line 146 "testpatterny.y" /* yacc.c:1646 */
1517 {
1518 }
1519 #line 1520 "testpatterny.c" /* yacc.c:1646 */
1520 break;
1521
1522 case 4:
1523 #line 151 "testpatterny.y" /* yacc.c:1646 */
1524 {
1525 if (getenv("STP_TESTPATTERN_DEBUG"))
1526 fprintf(stderr, ">>>cmykspec\n");
1527 global_image_type = "CMYK";
1528 global_channel_depth = 4;
1529 global_invert_data = 0;
1530 }
1531 #line 1532 "testpatterny.c" /* yacc.c:1646 */
1532 break;
1533
1534 case 5:
1535 #line 161 "testpatterny.y" /* yacc.c:1646 */
1536 {
1537 if (getenv("STP_TESTPATTERN_DEBUG"))
1538 fprintf(stderr, ">>>kcmyspec\n");
1539 global_image_type = "KCMY";
1540 global_channel_depth = 4;
1541 global_invert_data = 0;
1542 }
1543 #line 1544 "testpatterny.c" /* yacc.c:1646 */
1544 break;
1545
1546 case 6:
1547 #line 171 "testpatterny.y" /* yacc.c:1646 */
1548 {
1549 if (getenv("STP_TESTPATTERN_DEBUG"))
1550 fprintf(stderr, ">>>rgbspec\n");
1551 global_image_type = "RGB";
1552 global_channel_depth = 3;
1553 global_invert_data = 1;
1554 }
1555 #line 1556 "testpatterny.c" /* yacc.c:1646 */
1556 break;
1557
1558 case 7:
1559 #line 181 "testpatterny.y" /* yacc.c:1646 */
1560 {
1561 if (getenv("STP_TESTPATTERN_DEBUG"))
1562 fprintf(stderr, ">>>cmyspec\n");
1563 global_image_type = "CMY";
1564 global_channel_depth = 3;
1565 global_invert_data = 0;
1566 }
1567 #line 1568 "testpatterny.c" /* yacc.c:1646 */
1568 break;
1569
1570 case 8:
1571 #line 191 "testpatterny.y" /* yacc.c:1646 */
1572 {
1573 if (getenv("STP_TESTPATTERN_DEBUG"))
1574 fprintf(stderr, ">>>grayspec\n");
1575 global_image_type = "Grayscale";
1576 global_channel_depth = 1;
1577 global_invert_data = 0;
1578 }
1579 #line 1580 "testpatterny.c" /* yacc.c:1646 */
1580 break;
1581
1582 case 9:
1583 #line 201 "testpatterny.y" /* yacc.c:1646 */
1584 {
1585 if (getenv("STP_TESTPATTERN_DEBUG"))
1586 fprintf(stderr, ">>>whitespec\n");
1587 global_image_type = "Whitescale";
1588 global_channel_depth = 1;
1589 global_invert_data = 1;
1590 }
1591 #line 1592 "testpatterny.c" /* yacc.c:1646 */
1592 break;
1593
1594 case 10:
1595 #line 211 "testpatterny.y" /* yacc.c:1646 */
1596 {
1597 if (getenv("STP_TESTPATTERN_DEBUG"))
1598 fprintf(stderr, ">>>extendedspec %d\n", (yyvsp[0].ival));
1599 global_image_type = "Raw";
1600 global_invert_data = 0;
1601 global_channel_depth = (yyvsp[0].ival);
1602 }
1603 #line 1604 "testpatterny.c" /* yacc.c:1646 */
1604 break;
1605
1606 case 18:
1607 #line 224 "testpatterny.y" /* yacc.c:1646 */
1608 {
1609 if (getenv("STP_TESTPATTERN_DEBUG"))
1610 fprintf(stderr, ">>>modespec2 %d\n", (yyvsp[0].ival));
1611 if ((yyvsp[0].ival) == 8 || (yyvsp[0].ival) == 16)
1612 global_bit_depth = (yyvsp[0].ival);
1613 }
1614 #line 1615 "testpatterny.c" /* yacc.c:1646 */
1615 break;
1616
1617 case 21:
1618 #line 235 "testpatterny.y" /* yacc.c:1646 */
1619 {
1620 if (getenv("STP_TESTPATTERN_DEBUG"))
1621 fprintf(stderr, ">>>round\n");
1622 global_round_size = 1;
1623 }
1624 #line 1625 "testpatterny.c" /* yacc.c:1646 */
1625 break;
1626
1627 case 23:
1628 #line 245 "testpatterny.y" /* yacc.c:1646 */
1629 {
1630 int channel = find_color((yyvsp[-1].sval));
1631 if (getenv("STP_TESTPATTERN_DEBUG"))
1632 fprintf(stderr, ">>>level %s %f\n", (yyvsp[-1].sval), (yyvsp[0].dval));
1633 if (channel >= 0)
1634 global_levels[channel] = (yyvsp[0].dval);
1635 }
1636 #line 1637 "testpatterny.c" /* yacc.c:1646 */
1637 break;
1638
1639 case 24:
1640 #line 255 "testpatterny.y" /* yacc.c:1646 */
1641 {
1642 if (getenv("STP_TESTPATTERN_DEBUG"))
1643 fprintf(stderr, ">>>channel_level %d %f\n", (yyvsp[-1].ival), (yyvsp[0].dval));
1644 if ((yyvsp[-1].ival) >= 0 && (yyvsp[-1].ival) <= STP_CHANNEL_LIMIT)
1645 global_levels[(yyvsp[-1].ival)] = (yyvsp[0].dval);
1646 }
1647 #line 1648 "testpatterny.c" /* yacc.c:1646 */
1648 break;
1649
1650 case 25:
1651 #line 264 "testpatterny.y" /* yacc.c:1646 */
1652 {
1653 int channel = find_color((yyvsp[-1].sval));
1654 if (getenv("STP_TESTPATTERN_DEBUG"))
1655 fprintf(stderr, ">>>gamma %s %f\n", (yyvsp[-1].sval), (yyvsp[0].dval));
1656 if (channel >= 0)
1657 global_gammas[channel] = (yyvsp[0].dval);
1658 }
1659 #line 1660 "testpatterny.c" /* yacc.c:1646 */
1660 break;
1661
1662 case 26:
1663 #line 274 "testpatterny.y" /* yacc.c:1646 */
1664 {
1665 if (getenv("STP_TESTPATTERN_DEBUG"))
1666 fprintf(stderr, ">>>channel_gamma %d %f\n", (yyvsp[-1].ival), (yyvsp[0].dval));
1667 if ((yyvsp[-1].ival) >= 0 && (yyvsp[-1].ival) <= STP_CHANNEL_LIMIT)
1668 global_gammas[(yyvsp[-1].ival)] = (yyvsp[0].dval);
1669 }
1670 #line 1671 "testpatterny.c" /* yacc.c:1646 */
1671 break;
1672
1673 case 27:
1674 #line 283 "testpatterny.y" /* yacc.c:1646 */
1675 {
1676 if (getenv("STP_TESTPATTERN_DEBUG"))
1677 fprintf(stderr, ">>>global_gamma %f\n", (yyvsp[0].dval));
1678 global_gamma = (yyvsp[0].dval);
1679 }
1680 #line 1681 "testpatterny.c" /* yacc.c:1646 */
1681 break;
1682
1683 case 28:
1684 #line 290 "testpatterny.y" /* yacc.c:1646 */
1685 {
1686 if (getenv("STP_TESTPATTERN_DEBUG"))
1687 fprintf(stderr, ">>>steps %d\n", (yyvsp[0].ival));
1688 global_steps = (yyvsp[0].ival);
1689 }
1690 #line 1691 "testpatterny.c" /* yacc.c:1646 */
1691 break;
1692
1693 case 29:
1694 #line 297 "testpatterny.y" /* yacc.c:1646 */
1695 {
1696 if (getenv("STP_TESTPATTERN_DEBUG"))
1697 fprintf(stderr, ">>>ink_limit %f\n", (yyvsp[0].dval));
1698 global_ink_limit = (yyvsp[0].dval);
1699 }
1700 #line 1701 "testpatterny.c" /* yacc.c:1646 */
1701 break;
1702
1703 case 30:
1704 #line 304 "testpatterny.y" /* yacc.c:1646 */
1705 {
1706 if (getenv("STP_TESTPATTERN_DEBUG"))
1707 fprintf(stderr, ">>>printer %s\n", (yyvsp[0].sval));
1708 global_printer = stp_strdup((yyvsp[0].sval));
1709 free((yyvsp[0].sval));
1710 }
1711 #line 1712 "testpatterny.c" /* yacc.c:1646 */
1712 break;
1713
1714 case 31:
1715 #line 313 "testpatterny.y" /* yacc.c:1646 */
1716 {
1717 if (getenv("STP_TESTPATTERN_DEBUG"))
1718 fprintf(stderr, ">>>page_size_name %s\n", (yyvsp[0].sval));
1719 stp_set_string_parameter(global_vars, "PageSize", (yyvsp[0].sval));
1720 free((yyvsp[0].sval));
1721 }
1722 #line 1723 "testpatterny.c" /* yacc.c:1646 */
1723 break;
1724
1725 case 32:
1726 #line 322 "testpatterny.y" /* yacc.c:1646 */
1727 {
1728 if (getenv("STP_TESTPATTERN_DEBUG"))
1729 fprintf(stderr, ">>>page_size_custom %d %d\n", (yyvsp[-1].ival), (yyvsp[0].ival));
1730 stp_set_page_width(global_vars, (yyvsp[-1].ival));
1731 stp_set_page_height(global_vars, (yyvsp[0].ival));
1732 }
1733 #line 1734 "testpatterny.c" /* yacc.c:1646 */
1734 break;
1735
1736 case 35:
1737 #line 334 "testpatterny.y" /* yacc.c:1646 */
1738 {
1739 if (getenv("STP_TESTPATTERN_DEBUG"))
1740 fprintf(stderr, ">>>parameter_string %s %s\n", (yyvsp[-1].sval), (yyvsp[0].sval));
1741 stp_set_string_parameter(global_vars, (yyvsp[-1].sval), (yyvsp[0].sval));
1742 free((yyvsp[-1].sval));
1743 free((yyvsp[0].sval));
1744 }
1745 #line 1746 "testpatterny.c" /* yacc.c:1646 */
1746 break;
1747
1748 case 36:
1749 #line 344 "testpatterny.y" /* yacc.c:1646 */
1750 {
1751 if (getenv("STP_TESTPATTERN_DEBUG"))
1752 fprintf(stderr, ">>>parameter_int %s %d\n", (yyvsp[-1].sval), (yyvsp[0].ival));
1753 stp_set_int_parameter(global_vars, (yyvsp[-1].sval), (yyvsp[0].ival));
1754 free((yyvsp[-1].sval));
1755 }
1756 #line 1757 "testpatterny.c" /* yacc.c:1646 */
1757 break;
1758
1759 case 37:
1760 #line 353 "testpatterny.y" /* yacc.c:1646 */
1761 {
1762 if (getenv("STP_TESTPATTERN_DEBUG"))
1763 fprintf(stderr, ">>>parameter_bool %s %d\n", (yyvsp[-1].sval), (yyvsp[0].ival));
1764 stp_set_boolean_parameter(global_vars, (yyvsp[-1].sval), (yyvsp[0].ival));
1765 free((yyvsp[-1].sval));
1766 }
1767 #line 1768 "testpatterny.c" /* yacc.c:1646 */
1768 break;
1769
1770 case 38:
1771 #line 362 "testpatterny.y" /* yacc.c:1646 */
1772 {
1773 if (getenv("STP_TESTPATTERN_DEBUG"))
1774 fprintf(stderr, ">>>parameter_float %s %f\n", (yyvsp[-1].sval), (yyvsp[0].dval));
1775 stp_set_float_parameter(global_vars, (yyvsp[-1].sval), (yyvsp[0].dval));
1776 free((yyvsp[-1].sval));
1777 }
1778 #line 1779 "testpatterny.c" /* yacc.c:1646 */
1779 break;
1780
1781 case 39:
1782 #line 371 "testpatterny.y" /* yacc.c:1646 */
1783 {
1784 stp_curve_t *curve = stp_curve_create_from_string((yyvsp[0].sval));
1785 if (getenv("STP_TESTPATTERN_DEBUG"))
1786 fprintf(stderr, ">>>parameter_curve %s %s\n", (yyvsp[-1].sval), (yyvsp[0].sval));
1787 if (curve)
1788 {
1789 stp_set_curve_parameter(global_vars, (yyvsp[-1].sval), curve);
1790 stp_curve_destroy(curve);
1791 }
1792 free((yyvsp[-1].sval));
1793 }
1794 #line 1795 "testpatterny.c" /* yacc.c:1646 */
1795 break;
1796
1797 case 45:
1798 #line 387 "testpatterny.y" /* yacc.c:1646 */
1799 {
1800 if (getenv("STP_TESTPATTERN_DEBUG"))
1801 fprintf(stderr, ">>>density %f\n", (yyvsp[0].dval));
1802 global_density = (yyvsp[0].dval);
1803 }
1804 #line 1805 "testpatterny.c" /* yacc.c:1646 */
1805 break;
1806
1807 case 46:
1808 #line 394 "testpatterny.y" /* yacc.c:1646 */
1809 {
1810 if (getenv("STP_TESTPATTERN_DEBUG"))
1811 fprintf(stderr, ">>>top %f\n", (yyvsp[0].dval));
1812 global_xtop = (yyvsp[0].dval);
1813 }
1814 #line 1815 "testpatterny.c" /* yacc.c:1646 */
1815 break;
1816
1817 case 47:
1818 #line 401 "testpatterny.y" /* yacc.c:1646 */
1819 {
1820 if (getenv("STP_TESTPATTERN_DEBUG"))
1821 fprintf(stderr, ">>>left %f\n", (yyvsp[0].dval));
1822 global_xleft = (yyvsp[0].dval);
1823 }
1824 #line 1825 "testpatterny.c" /* yacc.c:1646 */
1825 break;
1826
1827 case 48:
1828 #line 408 "testpatterny.y" /* yacc.c:1646 */
1829 {
1830 if (getenv("STP_TESTPATTERN_DEBUG"))
1831 fprintf(stderr, ">>>relative size\n");
1832 global_size_mode = SIZE_RELATIVE;
1833 }
1834 #line 1835 "testpatterny.c" /* yacc.c:1646 */
1835 break;
1836
1837 case 49:
1838 #line 415 "testpatterny.y" /* yacc.c:1646 */
1839 {
1840 if (getenv("STP_TESTPATTERN_DEBUG"))
1841 fprintf(stderr, ">>>size inches\n");
1842 global_size_mode = SIZE_IN;
1843 }
1844 #line 1845 "testpatterny.c" /* yacc.c:1646 */
1845 break;
1846
1847 case 50:
1848 #line 422 "testpatterny.y" /* yacc.c:1646 */
1849 {
1850 if (getenv("STP_TESTPATTERN_DEBUG"))
1851 fprintf(stderr, ">>>size pt\n");
1852 global_size_mode = SIZE_PT;
1853 }
1854 #line 1855 "testpatterny.c" /* yacc.c:1646 */
1855 break;
1856
1857 case 51:
1858 #line 429 "testpatterny.y" /* yacc.c:1646 */
1859 {
1860 if (getenv("STP_TESTPATTERN_DEBUG"))
1861 fprintf(stderr, ">>>size mm\n");
1862 global_size_mode = SIZE_MM;
1863 }
1864 #line 1865 "testpatterny.c" /* yacc.c:1646 */
1865 break;
1866
1867 case 57:
1868 #line 440 "testpatterny.y" /* yacc.c:1646 */
1869 {
1870 if (getenv("STP_TESTPATTERN_DEBUG"))
1871 fprintf(stderr, ">>>hsize %f\n", (yyvsp[0].dval));
1872 global_hsize = (yyvsp[0].dval);
1873 }
1874 #line 1875 "testpatterny.c" /* yacc.c:1646 */
1875 break;
1876
1877 case 58:
1878 #line 447 "testpatterny.y" /* yacc.c:1646 */
1879 {
1880 if (getenv("STP_TESTPATTERN_DEBUG"))
1881 fprintf(stderr, ">>>vsize %f\n", (yyvsp[0].dval));
1882 global_vsize = (yyvsp[0].dval);
1883 }
1884 #line 1885 "testpatterny.c" /* yacc.c:1646 */
1885 break;
1886
1887 case 59:
1888 #line 454 "testpatterny.y" /* yacc.c:1646 */
1889 {
1890 if (getenv("STP_TESTPATTERN_DEBUG"))
1891 fprintf(stderr, ">>>blackline %d\n", (yyvsp[0].ival));
1892 global_noblackline = !((yyvsp[0].ival));
1893 }
1894 #line 1895 "testpatterny.c" /* yacc.c:1646 */
1895 break;
1896
1897 case 60:
1898 #line 462 "testpatterny.y" /* yacc.c:1646 */
1899 {
1900 if (getenv("STP_TESTPATTERN_DEBUG"))
1901 fprintf(stderr, ">>>colorline %d\n", (yyvsp[0].ival));
1902 global_colorline = ((yyvsp[0].ival) != 0);
1903 }
1904 #line 1905 "testpatterny.c" /* yacc.c:1646 */
1905 break;
1906
1907 case 61:
1908 #line 470 "testpatterny.y" /* yacc.c:1646 */
1909 {
1910 if (getenv("STP_TESTPATTERN_DEBUG"))
1911 fprintf(stderr, ">>>noscale %d\n", (yyvsp[0].ival));
1912 global_noscale = (yyvsp[0].ival);
1913 }
1914 #line 1915 "testpatterny.c" /* yacc.c:1646 */
1915 break;
1916
1917 case 62:
1918 #line 478 "testpatterny.y" /* yacc.c:1646 */
1919 {
1920 if (getenv("STP_TESTPATTERN_DEBUG"))
1921 fprintf(stderr, ">>>color_block1 %f %f %f (%d)\n", (yyvsp[-2].dval), (yyvsp[-1].dval), (yyvsp[0].dval),
1922 current_index);
1923 if (current_index < STP_CHANNEL_LIMIT)
1924 {
1925 current_testpattern->d.pattern.mins[current_index] = (yyvsp[-2].dval);
1926 current_testpattern->d.pattern.vals[current_index] = (yyvsp[-1].dval);
1927 current_testpattern->d.pattern.gammas[current_index] = (yyvsp[0].dval);
1928 current_index++;
1929 }
1930 }
1931 #line 1932 "testpatterny.c" /* yacc.c:1646 */
1932 break;
1933
1934 case 68:
1935 #line 502 "testpatterny.y" /* yacc.c:1646 */
1936 {
1937 int channel = find_color((yyvsp[-3].sval));
1938 if (getenv("STP_TESTPATTERN_DEBUG"))
1939 fprintf(stderr, ">>>color_block2a %s %f %f %f\n", (yyvsp[-3].sval), (yyvsp[-2].dval), (yyvsp[-1].dval), (yyvsp[0].dval));
1940 if (channel >= 0 && channel < STP_CHANNEL_LIMIT)
1941 {
1942 current_testpattern->d.pattern.mins[channel] = (yyvsp[-2].dval);
1943 current_testpattern->d.pattern.vals[channel] = (yyvsp[-1].dval);
1944 current_testpattern->d.pattern.gammas[channel] = (yyvsp[0].dval);
1945 }
1946 }
1947 #line 1948 "testpatterny.c" /* yacc.c:1646 */
1948 break;
1949
1950 case 69:
1951 #line 516 "testpatterny.y" /* yacc.c:1646 */
1952 {
1953 if (getenv("STP_TESTPATTERN_DEBUG"))
1954 fprintf(stderr, ">>>color_block2b %d %f %f %f\n", (yyvsp[-3].ival), (yyvsp[-2].dval), (yyvsp[-1].dval), (yyvsp[0].dval));
1955 if ((yyvsp[-3].ival) >= 0 && (yyvsp[-3].ival) < STP_CHANNEL_LIMIT)
1956 {
1957 current_testpattern->d.pattern.mins[(yyvsp[-3].ival)] = (yyvsp[-2].dval);
1958 current_testpattern->d.pattern.vals[(yyvsp[-3].ival)] = (yyvsp[-1].dval);
1959 current_testpattern->d.pattern.gammas[(yyvsp[-3].ival)] = (yyvsp[0].dval);
1960 }
1961 }
1962 #line 1963 "testpatterny.c" /* yacc.c:1646 */
1963 break;
1964
1965 case 78:
1966 #line 541 "testpatterny.y" /* yacc.c:1646 */
1967 {
1968 if (getenv("STP_TESTPATTERN_DEBUG"))
1969 fprintf(stderr, ">>>patvars %f %f %f %f %f\n", (yyvsp[-4].dval), (yyvsp[-3].dval), (yyvsp[-2].dval), (yyvsp[-1].dval), (yyvsp[0].dval));
1970 current_testpattern->type = E_PATTERN;
1971 current_testpattern->d.pattern.lower = (yyvsp[-4].dval);
1972 current_testpattern->d.pattern.upper = (yyvsp[-3].dval);
1973 current_testpattern->d.pattern.levels[1] = (yyvsp[-2].dval);
1974 current_testpattern->d.pattern.levels[2] = (yyvsp[-1].dval);
1975 current_testpattern->d.pattern.levels[3] = (yyvsp[0].dval);
1976 current_testpattern = get_next_testpattern();
1977 current_index = 0;
1978 }
1979 #line 1980 "testpatterny.c" /* yacc.c:1646 */
1980 break;
1981
1982 case 80:
1983 #line 559 "testpatterny.y" /* yacc.c:1646 */
1984 {
1985 if (getenv("STP_TESTPATTERN_DEBUG"))
1986 fprintf(stderr, ">>>xpattern\n");
1987 if (global_channel_depth == 0)
1988 {
1989 fprintf(stderr, "xpattern may only be used with extended color depth\n");
1990 exit(1);
1991 }
1992 current_testpattern->type = E_XPATTERN;
1993 current_testpattern = get_next_testpattern();
1994 current_index = 0;
1995 }
1996 #line 1997 "testpatterny.c" /* yacc.c:1646 */
1997 break;
1998
1999 case 81:
2000 #line 574 "testpatterny.y" /* yacc.c:1646 */
2001 {
2002 if (getenv("STP_TESTPATTERN_DEBUG"))
2003 fprintf(stderr, ">>>grid %d\n", (yyvsp[0].ival));
2004 current_testpattern->type = E_GRID;
2005 current_testpattern->d.grid.ticks = (yyvsp[0].ival);
2006 current_testpattern = get_next_testpattern();
2007 current_index = 0;
2008 }
2009 #line 2010 "testpatterny.c" /* yacc.c:1646 */
2010 break;
2011
2012 case 82:
2013 #line 585 "testpatterny.y" /* yacc.c:1646 */
2014 {
2015 if (getenv("STP_TESTPATTERN_DEBUG"))
2016 fprintf(stderr, ">>>image %d %d\n", (yyvsp[-1].ival), (yyvsp[0].ival));
2017 current_testpattern->type = E_IMAGE;
2018 current_testpattern->d.image.x = (yyvsp[-1].ival);
2019 current_testpattern->d.image.y = (yyvsp[0].ival);
2020 if (current_testpattern->d.image.x <= 0 ||
2021 current_testpattern->d.image.y <= 0)
2022 {
2023 fprintf(stderr, "image width and height must be greater than zero\n");
2024 exit(1);
2025 }
2026 return 0;
2027 }
2028 #line 2029 "testpatterny.c" /* yacc.c:1646 */
2029 break;
2030
2031 case 83:
2032 #line 602 "testpatterny.y" /* yacc.c:1646 */
2033 {
2034 fprintf(stderr,"%s",(yyvsp[0].sval));
2035 free((yyvsp[0].sval));
2036 }
2037 #line 2038 "testpatterny.c" /* yacc.c:1646 */
2038 break;
2039
2040 case 87:
2041 #line 615 "testpatterny.y" /* yacc.c:1646 */
2042 {
2043 close_output();
2044 if (global_output)
2045 free(global_output);
2046 global_output = NULL;
2047 output = stdout;
2048 }
2049 #line 2050 "testpatterny.c" /* yacc.c:1646 */
2050 break;
2051
2052 case 88:
2053 #line 625 "testpatterny.y" /* yacc.c:1646 */
2054 {
2055 global_output = (yyvsp[0].sval);
2056 }
2057 #line 2058 "testpatterny.c" /* yacc.c:1646 */
2058 break;
2059
2060 case 91:
2061 #line 634 "testpatterny.y" /* yacc.c:1646 */
2062 { start_job = 1; }
2063 #line 2064 "testpatterny.c" /* yacc.c:1646 */
2064 break;
2065
2066 case 92:
2067 #line 638 "testpatterny.y" /* yacc.c:1646 */
2068 { end_job = 1; }
2069 #line 2070 "testpatterny.c" /* yacc.c:1646 */
2070 break;
2071
2072 case 118:
2073 #line 648 "testpatterny.y" /* yacc.c:1646 */
2074 { global_did_something = 1; }
2075 #line 2076 "testpatterny.c" /* yacc.c:1646 */
2076 break;
2077
2078 case 123:
2079 #line 655 "testpatterny.y" /* yacc.c:1646 */
2080 { global_did_something = 1; }
2081 #line 2082 "testpatterny.c" /* yacc.c:1646 */
2082 break;
2083
2084 case 126:
2085 #line 662 "testpatterny.y" /* yacc.c:1646 */
2086 { global_did_something = 1; }
2087 #line 2088 "testpatterny.c" /* yacc.c:1646 */
2088 break;
2089
2090 case 132:
2091 #line 672 "testpatterny.y" /* yacc.c:1646 */
2092 { return 0; }
2093 #line 2094 "testpatterny.c" /* yacc.c:1646 */
2094 break;
2095
2096 case 133:
2097 #line 676 "testpatterny.y" /* yacc.c:1646 */
2098 {
2099 current_testpattern = get_next_testpattern();
2100 }
2101 #line 2102 "testpatterny.c" /* yacc.c:1646 */
2102 break;
2103
2104
2105 #line 2106 "testpatterny.c" /* yacc.c:1646 */
2106 default: break;
2107 }
2108 /* User semantic actions sometimes alter yychar, and that requires
2109 that yytoken be updated with the new translation. We take the
2110 approach of translating immediately before every use of yytoken.
2111 One alternative is translating here after every semantic action,
2112 but that translation would be missed if the semantic action invokes
2113 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2114 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2115 incorrect destructor might then be invoked immediately. In the
2116 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2117 to an incorrect destructor call or verbose syntax error message
2118 before the lookahead is translated. */
2119 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2120
2121 YYPOPSTACK (yylen);
2122 yylen = 0;
2123 YY_STACK_PRINT (yyss, yyssp);
2124
2125 *++yyvsp = yyval;
2126
2127 /* Now 'shift' the result of the reduction. Determine what state
2128 that goes to, based on the state we popped back to and the rule
2129 number reduced by. */
2130
2131 yyn = yyr1[yyn];
2132
2133 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2134 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2135 yystate = yytable[yystate];
2136 else
2137 yystate = yydefgoto[yyn - YYNTOKENS];
2138
2139 goto yynewstate;
2140
2141
2142 /*--------------------------------------.
2143 | yyerrlab -- here on detecting error. |
2144 `--------------------------------------*/
2145 yyerrlab:
2146 /* Make sure we have latest lookahead translation. See comments at
2147 user semantic actions for why this is necessary. */
2148 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2149
2150 /* If not already recovering from an error, report this error. */
2151 if (!yyerrstatus)
2152 {
2153 ++yynerrs;
2154 #if ! YYERROR_VERBOSE
2155 yyerror (YY_("syntax error"));
2156 #else
2157 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2158 yyssp, yytoken)
2159 {
2160 char const *yymsgp = YY_("syntax error");
2161 int yysyntax_error_status;
2162 yysyntax_error_status = YYSYNTAX_ERROR;
2163 if (yysyntax_error_status == 0)
2164 yymsgp = yymsg;
2165 else if (yysyntax_error_status == 1)
2166 {
2167 if (yymsg != yymsgbuf)
2168 YYSTACK_FREE (yymsg);
2169 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2170 if (!yymsg)
2171 {
2172 yymsg = yymsgbuf;
2173 yymsg_alloc = sizeof yymsgbuf;
2174 yysyntax_error_status = 2;
2175 }
2176 else
2177 {
2178 yysyntax_error_status = YYSYNTAX_ERROR;
2179 yymsgp = yymsg;
2180 }
2181 }
2182 yyerror (yymsgp);
2183 if (yysyntax_error_status == 2)
2184 goto yyexhaustedlab;
2185 }
2186 # undef YYSYNTAX_ERROR
2187 #endif
2188 }
2189
2190
2191
2192 if (yyerrstatus == 3)
2193 {
2194 /* If just tried and failed to reuse lookahead token after an
2195 error, discard it. */
2196
2197 if (yychar <= YYEOF)
2198 {
2199 /* Return failure if at end of input. */
2200 if (yychar == YYEOF)
2201 YYABORT;
2202 }
2203 else
2204 {
2205 yydestruct ("Error: discarding",
2206 yytoken, &yylval);
2207 yychar = YYEMPTY;
2208 }
2209 }
2210
2211 /* Else will try to reuse lookahead token after shifting the error
2212 token. */
2213 goto yyerrlab1;
2214
2215
2216 /*---------------------------------------------------.
2217 | yyerrorlab -- error raised explicitly by YYERROR. |
2218 `---------------------------------------------------*/
2219 yyerrorlab:
2220
2221 /* Pacify compilers like GCC when the user code never invokes
2222 YYERROR and the label yyerrorlab therefore never appears in user
2223 code. */
2224 if (/*CONSTCOND*/ 0)
2225 goto yyerrorlab;
2226
2227 /* Do not reclaim the symbols of the rule whose action triggered
2228 this YYERROR. */
2229 YYPOPSTACK (yylen);
2230 yylen = 0;
2231 YY_STACK_PRINT (yyss, yyssp);
2232 yystate = *yyssp;
2233 goto yyerrlab1;
2234
2235
2236 /*-------------------------------------------------------------.
2237 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2238 `-------------------------------------------------------------*/
2239 yyerrlab1:
2240 yyerrstatus = 3; /* Each real token shifted decrements this. */
2241
2242 for (;;)
2243 {
2244 yyn = yypact[yystate];
2245 if (!yypact_value_is_default (yyn))
2246 {
2247 yyn += YYTERROR;
2248 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2249 {
2250 yyn = yytable[yyn];
2251 if (0 < yyn)
2252 break;
2253 }
2254 }
2255
2256 /* Pop the current state because it cannot handle the error token. */
2257 if (yyssp == yyss)
2258 YYABORT;
2259
2260
2261 yydestruct ("Error: popping",
2262 yystos[yystate], yyvsp);
2263 YYPOPSTACK (1);
2264 yystate = *yyssp;
2265 YY_STACK_PRINT (yyss, yyssp);
2266 }
2267
2268 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2269 *++yyvsp = yylval;
2270 YY_IGNORE_MAYBE_UNINITIALIZED_END
2271
2272
2273 /* Shift the error token. */
2274 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2275
2276 yystate = yyn;
2277 goto yynewstate;
2278
2279
2280 /*-------------------------------------.
2281 | yyacceptlab -- YYACCEPT comes here. |
2282 `-------------------------------------*/
2283 yyacceptlab:
2284 yyresult = 0;
2285 goto yyreturn;
2286
2287 /*-----------------------------------.
2288 | yyabortlab -- YYABORT comes here. |
2289 `-----------------------------------*/
2290 yyabortlab:
2291 yyresult = 1;
2292 goto yyreturn;
2293
2294 #if !defined yyoverflow || YYERROR_VERBOSE
2295 /*-------------------------------------------------.
2296 | yyexhaustedlab -- memory exhaustion comes here. |
2297 `-------------------------------------------------*/
2298 yyexhaustedlab:
2299 yyerror (YY_("memory exhausted"));
2300 yyresult = 2;
2301 /* Fall through. */
2302 #endif
2303
2304 yyreturn:
2305 if (yychar != YYEMPTY)
2306 {
2307 /* Make sure we have latest lookahead translation. See comments at
2308 user semantic actions for why this is necessary. */
2309 yytoken = YYTRANSLATE (yychar);
2310 yydestruct ("Cleanup: discarding lookahead",
2311 yytoken, &yylval);
2312 }
2313 /* Do not reclaim the symbols of the rule whose action triggered
2314 this YYABORT or YYACCEPT. */
2315 YYPOPSTACK (yylen);
2316 YY_STACK_PRINT (yyss, yyssp);
2317 while (yyssp != yyss)
2318 {
2319 yydestruct ("Cleanup: popping",
2320 yystos[*yyssp], yyvsp);
2321 YYPOPSTACK (1);
2322 }
2323 #ifndef yyoverflow
2324 if (yyss != yyssa)
2325 YYSTACK_FREE (yyss);
2326 #endif
2327 #if YYERROR_VERBOSE
2328 if (yymsg != yymsgbuf)
2329 YYSTACK_FREE (yymsg);
2330 #endif
2331 return yyresult;
2332 }
2333 #line 682 "testpatterny.y" /* yacc.c:1906 */
2334
2335