ARB prog parser: Add new constructor for asm_instruction
[mesa.git] / src / mesa / shader / program_parse.tab.c
1
2 /* A Bison parser, made by GNU Bison 2.4.1. */
3
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
5
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
8
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22 /* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
31
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
34
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
37
38 /* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
44
45 /* Identify Bison output. */
46 #define YYBISON 1
47
48 /* Bison version. */
49 #define YYBISON_VERSION "2.4.1"
50
51 /* Skeleton name. */
52 #define YYSKELETON_NAME "yacc.c"
53
54 /* Pure parsers. */
55 #define YYPURE 1
56
57 /* Push parsers. */
58 #define YYPUSH 0
59
60 /* Pull parsers. */
61 #define YYPULL 1
62
63 /* Using locations. */
64 #define YYLSP_NEEDED 1
65
66
67
68 /* Copy the first part of user declarations. */
69
70 /* Line 189 of yacc.c */
71 #line 1 "program_parse.y"
72
73 /*
74 * Copyright © 2009 Intel Corporation
75 *
76 * Permission is hereby granted, free of charge, to any person obtaining a
77 * copy of this software and associated documentation files (the "Software"),
78 * to deal in the Software without restriction, including without limitation
79 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
80 * and/or sell copies of the Software, and to permit persons to whom the
81 * Software is furnished to do so, subject to the following conditions:
82 *
83 * The above copyright notice and this permission notice (including the next
84 * paragraph) shall be included in all copies or substantial portions of the
85 * Software.
86 *
87 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
88 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
89 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
90 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
91 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
93 * DEALINGS IN THE SOFTWARE.
94 */
95 #include <stdio.h>
96 #include <stdlib.h>
97 #include <string.h>
98
99 #include "main/mtypes.h"
100 #include "main/imports.h"
101 #include "program.h"
102 #include "prog_parameter.h"
103 #include "prog_parameter_layout.h"
104 #include "prog_statevars.h"
105 #include "prog_instruction.h"
106
107 #include "symbol_table.h"
108 #include "program_parser.h"
109
110 extern void *yy_scan_string(char *);
111 extern void yy_delete_buffer(void *);
112
113 static struct asm_symbol *declare_variable(struct asm_parser_state *state,
114 char *name, enum asm_type t, struct YYLTYPE *locp);
115
116 static int add_state_reference(struct gl_program_parameter_list *param_list,
117 const gl_state_index tokens[STATE_LENGTH]);
118
119 static int initialize_symbol_from_state(struct gl_program *prog,
120 struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
121
122 static int initialize_symbol_from_param(struct gl_program *prog,
123 struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
124
125 static int initialize_symbol_from_const(struct gl_program *prog,
126 struct asm_symbol *param_var, const struct asm_vector *vec);
127
128 static int yyparse(struct asm_parser_state *state);
129
130 static char *make_error_string(const char *fmt, ...);
131
132 static void yyerror(struct YYLTYPE *locp, struct asm_parser_state *state,
133 const char *s);
134
135 static int validate_inputs(struct YYLTYPE *locp,
136 struct asm_parser_state *state);
137
138 static void init_dst_reg(struct prog_dst_register *r);
139
140 static void init_src_reg(struct asm_src_register *r);
141
142 static void asm_instruction_set_operands(struct asm_instruction *inst,
143 const struct prog_dst_register *dst, const struct asm_src_register *src0,
144 const struct asm_src_register *src1, const struct asm_src_register *src2);
145
146 static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
147 const struct prog_dst_register *dst, const struct asm_src_register *src0,
148 const struct asm_src_register *src1, const struct asm_src_register *src2);
149
150 static struct asm_instruction *asm_instruction_copy_ctor(
151 const struct prog_instruction *base, const struct prog_dst_register *dst,
152 const struct asm_src_register *src0, const struct asm_src_register *src1,
153 const struct asm_src_register *src2);
154
155 #ifndef FALSE
156 #define FALSE 0
157 #define TRUE (!FALSE)
158 #endif
159
160 #define YYLLOC_DEFAULT(Current, Rhs, N) \
161 do { \
162 if (YYID(N)) { \
163 (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
164 (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
165 (Current).position = YYRHSLOC(Rhs, 1).position; \
166 (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
167 (Current).last_column = YYRHSLOC(Rhs, N).last_column; \
168 } else { \
169 (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
170 (Current).last_line = (Current).first_line; \
171 (Current).first_column = YYRHSLOC(Rhs, 0).last_column; \
172 (Current).last_column = (Current).first_column; \
173 (Current).position = YYRHSLOC(Rhs, 0).position \
174 + (Current).first_column; \
175 } \
176 } while(YYID(0))
177
178 #define YYLEX_PARAM state->scanner
179
180
181 /* Line 189 of yacc.c */
182 #line 183 "program_parse.tab.c"
183
184 /* Enabling traces. */
185 #ifndef YYDEBUG
186 # define YYDEBUG 0
187 #endif
188
189 /* Enabling verbose error messages. */
190 #ifdef YYERROR_VERBOSE
191 # undef YYERROR_VERBOSE
192 # define YYERROR_VERBOSE 1
193 #else
194 # define YYERROR_VERBOSE 1
195 #endif
196
197 /* Enabling the token table. */
198 #ifndef YYTOKEN_TABLE
199 # define YYTOKEN_TABLE 0
200 #endif
201
202
203 /* Tokens. */
204 #ifndef YYTOKENTYPE
205 # define YYTOKENTYPE
206 /* Put the tokens into the symbol table, so that GDB and other debuggers
207 know about them. */
208 enum yytokentype {
209 ARBvp_10 = 258,
210 ARBfp_10 = 259,
211 ADDRESS = 260,
212 ALIAS = 261,
213 ATTRIB = 262,
214 OPTION = 263,
215 OUTPUT = 264,
216 PARAM = 265,
217 TEMP = 266,
218 END = 267,
219 BIN_OP = 268,
220 BINSC_OP = 269,
221 SAMPLE_OP = 270,
222 SCALAR_OP = 271,
223 TRI_OP = 272,
224 VECTOR_OP = 273,
225 ARL = 274,
226 KIL = 275,
227 SWZ = 276,
228 TXD_OP = 277,
229 INTEGER = 278,
230 REAL = 279,
231 AMBIENT = 280,
232 ATTENUATION = 281,
233 BACK = 282,
234 CLIP = 283,
235 COLOR = 284,
236 DEPTH = 285,
237 DIFFUSE = 286,
238 DIRECTION = 287,
239 EMISSION = 288,
240 ENV = 289,
241 EYE = 290,
242 FOG = 291,
243 FOGCOORD = 292,
244 FRAGMENT = 293,
245 FRONT = 294,
246 HALF = 295,
247 INVERSE = 296,
248 INVTRANS = 297,
249 LIGHT = 298,
250 LIGHTMODEL = 299,
251 LIGHTPROD = 300,
252 LOCAL = 301,
253 MATERIAL = 302,
254 MAT_PROGRAM = 303,
255 MATRIX = 304,
256 MATRIXINDEX = 305,
257 MODELVIEW = 306,
258 MVP = 307,
259 NORMAL = 308,
260 OBJECT = 309,
261 PALETTE = 310,
262 PARAMS = 311,
263 PLANE = 312,
264 POINT = 313,
265 POINTSIZE = 314,
266 POSITION = 315,
267 PRIMARY = 316,
268 PROGRAM = 317,
269 PROJECTION = 318,
270 RANGE = 319,
271 RESULT = 320,
272 ROW = 321,
273 SCENECOLOR = 322,
274 SECONDARY = 323,
275 SHININESS = 324,
276 SIZE = 325,
277 SPECULAR = 326,
278 SPOT = 327,
279 STATE = 328,
280 TEXCOORD = 329,
281 TEXENV = 330,
282 TEXGEN = 331,
283 TEXGEN_Q = 332,
284 TEXGEN_R = 333,
285 TEXGEN_S = 334,
286 TEXGEN_T = 335,
287 TEXTURE = 336,
288 TRANSPOSE = 337,
289 TEXTURE_UNIT = 338,
290 TEX_1D = 339,
291 TEX_2D = 340,
292 TEX_3D = 341,
293 TEX_CUBE = 342,
294 TEX_RECT = 343,
295 TEX_SHADOW1D = 344,
296 TEX_SHADOW2D = 345,
297 TEX_SHADOWRECT = 346,
298 TEX_ARRAY1D = 347,
299 TEX_ARRAY2D = 348,
300 TEX_ARRAYSHADOW1D = 349,
301 TEX_ARRAYSHADOW2D = 350,
302 VERTEX = 351,
303 VTXATTRIB = 352,
304 WEIGHT = 353,
305 IDENTIFIER = 354,
306 MASK4 = 355,
307 MASK3 = 356,
308 MASK2 = 357,
309 MASK1 = 358,
310 SWIZZLE = 359,
311 DOT_DOT = 360,
312 DOT = 361
313 };
314 #endif
315
316
317
318 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
319 typedef union YYSTYPE
320 {
321
322 /* Line 214 of yacc.c */
323 #line 116 "program_parse.y"
324
325 struct asm_instruction *inst;
326 struct asm_symbol *sym;
327 struct asm_symbol temp_sym;
328 struct asm_swizzle_mask swiz_mask;
329 struct asm_src_register src_reg;
330 struct prog_dst_register dst_reg;
331 struct prog_instruction temp_inst;
332 char *string;
333 unsigned result;
334 unsigned attrib;
335 int integer;
336 float real;
337 unsigned state[5];
338 int negate;
339 struct asm_vector vector;
340 gl_inst_opcode opcode;
341
342 struct {
343 unsigned swz;
344 unsigned rgba_valid:1;
345 unsigned xyzw_valid:1;
346 unsigned negate:1;
347 } ext_swizzle;
348
349
350
351 /* Line 214 of yacc.c */
352 #line 353 "program_parse.tab.c"
353 } YYSTYPE;
354 # define YYSTYPE_IS_TRIVIAL 1
355 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
356 # define YYSTYPE_IS_DECLARED 1
357 #endif
358
359 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
360 typedef struct YYLTYPE
361 {
362 int first_line;
363 int first_column;
364 int last_line;
365 int last_column;
366 } YYLTYPE;
367 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
368 # define YYLTYPE_IS_DECLARED 1
369 # define YYLTYPE_IS_TRIVIAL 1
370 #endif
371
372
373 /* Copy the second part of user declarations. */
374
375 /* Line 264 of yacc.c */
376 #line 258 "program_parse.y"
377
378 extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
379 void *yyscanner);
380
381
382 /* Line 264 of yacc.c */
383 #line 384 "program_parse.tab.c"
384
385 #ifdef short
386 # undef short
387 #endif
388
389 #ifdef YYTYPE_UINT8
390 typedef YYTYPE_UINT8 yytype_uint8;
391 #else
392 typedef unsigned char yytype_uint8;
393 #endif
394
395 #ifdef YYTYPE_INT8
396 typedef YYTYPE_INT8 yytype_int8;
397 #elif (defined __STDC__ || defined __C99__FUNC__ \
398 || defined __cplusplus || defined _MSC_VER)
399 typedef signed char yytype_int8;
400 #else
401 typedef short int yytype_int8;
402 #endif
403
404 #ifdef YYTYPE_UINT16
405 typedef YYTYPE_UINT16 yytype_uint16;
406 #else
407 typedef unsigned short int yytype_uint16;
408 #endif
409
410 #ifdef YYTYPE_INT16
411 typedef YYTYPE_INT16 yytype_int16;
412 #else
413 typedef short int yytype_int16;
414 #endif
415
416 #ifndef YYSIZE_T
417 # ifdef __SIZE_TYPE__
418 # define YYSIZE_T __SIZE_TYPE__
419 # elif defined size_t
420 # define YYSIZE_T size_t
421 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
422 || defined __cplusplus || defined _MSC_VER)
423 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
424 # define YYSIZE_T size_t
425 # else
426 # define YYSIZE_T unsigned int
427 # endif
428 #endif
429
430 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
431
432 #ifndef YY_
433 # if YYENABLE_NLS
434 # if ENABLE_NLS
435 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
436 # define YY_(msgid) dgettext ("bison-runtime", msgid)
437 # endif
438 # endif
439 # ifndef YY_
440 # define YY_(msgid) msgid
441 # endif
442 #endif
443
444 /* Suppress unused-variable warnings by "using" E. */
445 #if ! defined lint || defined __GNUC__
446 # define YYUSE(e) ((void) (e))
447 #else
448 # define YYUSE(e) /* empty */
449 #endif
450
451 /* Identity function, used to suppress warnings about constant conditions. */
452 #ifndef lint
453 # define YYID(n) (n)
454 #else
455 #if (defined __STDC__ || defined __C99__FUNC__ \
456 || defined __cplusplus || defined _MSC_VER)
457 static int
458 YYID (int yyi)
459 #else
460 static int
461 YYID (yyi)
462 int yyi;
463 #endif
464 {
465 return yyi;
466 }
467 #endif
468
469 #if ! defined yyoverflow || YYERROR_VERBOSE
470
471 /* The parser invokes alloca or malloc; define the necessary symbols. */
472
473 # ifdef YYSTACK_USE_ALLOCA
474 # if YYSTACK_USE_ALLOCA
475 # ifdef __GNUC__
476 # define YYSTACK_ALLOC __builtin_alloca
477 # elif defined __BUILTIN_VA_ARG_INCR
478 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
479 # elif defined _AIX
480 # define YYSTACK_ALLOC __alloca
481 # elif defined _MSC_VER
482 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
483 # define alloca _alloca
484 # else
485 # define YYSTACK_ALLOC alloca
486 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
487 || defined __cplusplus || defined _MSC_VER)
488 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
489 # ifndef _STDLIB_H
490 # define _STDLIB_H 1
491 # endif
492 # endif
493 # endif
494 # endif
495 # endif
496
497 # ifdef YYSTACK_ALLOC
498 /* Pacify GCC's `empty if-body' warning. */
499 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
500 # ifndef YYSTACK_ALLOC_MAXIMUM
501 /* The OS might guarantee only one guard page at the bottom of the stack,
502 and a page size can be as small as 4096 bytes. So we cannot safely
503 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
504 to allow for a few compiler-allocated temporary stack slots. */
505 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
506 # endif
507 # else
508 # define YYSTACK_ALLOC YYMALLOC
509 # define YYSTACK_FREE YYFREE
510 # ifndef YYSTACK_ALLOC_MAXIMUM
511 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
512 # endif
513 # if (defined __cplusplus && ! defined _STDLIB_H \
514 && ! ((defined YYMALLOC || defined malloc) \
515 && (defined YYFREE || defined free)))
516 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
517 # ifndef _STDLIB_H
518 # define _STDLIB_H 1
519 # endif
520 # endif
521 # ifndef YYMALLOC
522 # define YYMALLOC malloc
523 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
524 || defined __cplusplus || defined _MSC_VER)
525 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
526 # endif
527 # endif
528 # ifndef YYFREE
529 # define YYFREE free
530 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
531 || defined __cplusplus || defined _MSC_VER)
532 void free (void *); /* INFRINGES ON USER NAME SPACE */
533 # endif
534 # endif
535 # endif
536 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
537
538
539 #if (! defined yyoverflow \
540 && (! defined __cplusplus \
541 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
542 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
543
544 /* A type that is properly aligned for any stack member. */
545 union yyalloc
546 {
547 yytype_int16 yyss_alloc;
548 YYSTYPE yyvs_alloc;
549 YYLTYPE yyls_alloc;
550 };
551
552 /* The size of the maximum gap between one aligned stack and the next. */
553 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
554
555 /* The size of an array large to enough to hold all stacks, each with
556 N elements. */
557 # define YYSTACK_BYTES(N) \
558 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
559 + 2 * YYSTACK_GAP_MAXIMUM)
560
561 /* Copy COUNT objects from FROM to TO. The source and destination do
562 not overlap. */
563 # ifndef YYCOPY
564 # if defined __GNUC__ && 1 < __GNUC__
565 # define YYCOPY(To, From, Count) \
566 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
567 # else
568 # define YYCOPY(To, From, Count) \
569 do \
570 { \
571 YYSIZE_T yyi; \
572 for (yyi = 0; yyi < (Count); yyi++) \
573 (To)[yyi] = (From)[yyi]; \
574 } \
575 while (YYID (0))
576 # endif
577 # endif
578
579 /* Relocate STACK from its old location to the new one. The
580 local variables YYSIZE and YYSTACKSIZE give the old and new number of
581 elements in the stack, and YYPTR gives the new location of the
582 stack. Advance YYPTR to a properly aligned location for the next
583 stack. */
584 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
585 do \
586 { \
587 YYSIZE_T yynewbytes; \
588 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
589 Stack = &yyptr->Stack_alloc; \
590 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
591 yyptr += yynewbytes / sizeof (*yyptr); \
592 } \
593 while (YYID (0))
594
595 #endif
596
597 /* YYFINAL -- State number of the termination state. */
598 #define YYFINAL 5
599 /* YYLAST -- Last index in YYTABLE. */
600 #define YYLAST 375
601
602 /* YYNTOKENS -- Number of terminals. */
603 #define YYNTOKENS 117
604 /* YYNNTS -- Number of nonterminals. */
605 #define YYNNTS 136
606 /* YYNRULES -- Number of rules. */
607 #define YYNRULES 270
608 /* YYNRULES -- Number of states. */
609 #define YYNSTATES 456
610
611 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
612 #define YYUNDEFTOK 2
613 #define YYMAXUTOK 361
614
615 #define YYTRANSLATE(YYX) \
616 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
617
618 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
619 static const yytype_uint8 yytranslate[] =
620 {
621 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 112, 108, 113, 2, 2, 2, 2,
626 2, 2, 2, 2, 2, 2, 2, 2, 2, 107,
627 2, 114, 2, 2, 2, 2, 2, 2, 2, 2,
628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
630 2, 110, 2, 111, 2, 2, 2, 2, 2, 2,
631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
633 2, 2, 2, 115, 109, 116, 2, 2, 2, 2,
634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
635 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
646 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
647 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
648 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
649 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
650 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
651 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
652 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
653 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
654 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
655 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
656 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
657 105, 106
658 };
659
660 #if YYDEBUG
661 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
662 YYRHS. */
663 static const yytype_uint16 yyprhs[] =
664 {
665 0, 0, 3, 8, 10, 12, 15, 16, 20, 23,
666 24, 27, 30, 32, 34, 36, 38, 40, 42, 44,
667 46, 48, 50, 52, 54, 59, 64, 69, 76, 83,
668 92, 101, 104, 117, 120, 122, 124, 126, 128, 130,
669 132, 134, 136, 138, 140, 142, 144, 151, 154, 159,
670 162, 164, 168, 174, 177, 180, 188, 191, 193, 195,
671 197, 199, 204, 206, 208, 210, 212, 214, 216, 218,
672 222, 223, 226, 229, 231, 233, 235, 237, 239, 241,
673 243, 245, 247, 248, 250, 252, 254, 256, 257, 259,
674 261, 263, 265, 267, 269, 274, 277, 280, 282, 285,
675 287, 290, 292, 295, 300, 305, 307, 308, 312, 314,
676 316, 319, 321, 324, 326, 328, 332, 339, 340, 342,
677 345, 350, 352, 356, 358, 360, 362, 364, 366, 368,
678 370, 372, 374, 376, 379, 382, 385, 388, 391, 394,
679 397, 400, 403, 406, 409, 412, 416, 418, 420, 422,
680 428, 430, 432, 434, 437, 439, 441, 444, 446, 449,
681 456, 458, 462, 464, 466, 468, 470, 472, 477, 479,
682 481, 483, 485, 487, 489, 492, 494, 496, 502, 504,
683 507, 509, 511, 517, 520, 521, 528, 532, 533, 535,
684 537, 539, 541, 543, 546, 548, 550, 553, 558, 563,
685 564, 566, 568, 570, 572, 575, 577, 579, 581, 583,
686 589, 591, 595, 601, 607, 609, 613, 619, 621, 623,
687 625, 627, 629, 631, 633, 635, 637, 641, 647, 655,
688 665, 668, 671, 673, 675, 676, 677, 681, 682, 686,
689 690, 692, 697, 700, 703, 706, 709, 713, 716, 720,
690 721, 723, 725, 726, 728, 730, 731, 733, 735, 736,
691 738, 740, 741, 745, 746, 750, 751, 755, 757, 759,
692 761
693 };
694
695 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
696 static const yytype_int16 yyrhs[] =
697 {
698 118, 0, -1, 119, 120, 122, 12, -1, 3, -1,
699 4, -1, 120, 121, -1, -1, 8, 99, 107, -1,
700 122, 123, -1, -1, 124, 107, -1, 162, 107, -1,
701 125, -1, 126, -1, 127, -1, 128, -1, 129, -1,
702 130, -1, 131, -1, 132, -1, 138, -1, 133, -1,
703 134, -1, 135, -1, 19, 143, 108, 139, -1, 18,
704 142, 108, 141, -1, 16, 142, 108, 139, -1, 14,
705 142, 108, 139, 108, 139, -1, 13, 142, 108, 141,
706 108, 141, -1, 17, 142, 108, 141, 108, 141, 108,
707 141, -1, 15, 142, 108, 141, 108, 136, 108, 137,
708 -1, 20, 141, -1, 22, 142, 108, 141, 108, 141,
709 108, 141, 108, 136, 108, 137, -1, 83, 247, -1,
710 84, -1, 85, -1, 86, -1, 87, -1, 88, -1,
711 89, -1, 90, -1, 91, -1, 92, -1, 93, -1,
712 94, -1, 95, -1, 21, 142, 108, 147, 108, 144,
713 -1, 233, 140, -1, 233, 109, 140, 109, -1, 147,
714 159, -1, 230, -1, 233, 147, 160, -1, 233, 109,
715 147, 160, 109, -1, 148, 161, -1, 156, 158, -1,
716 145, 108, 145, 108, 145, 108, 145, -1, 233, 146,
717 -1, 23, -1, 99, -1, 99, -1, 164, -1, 149,
718 110, 150, 111, -1, 178, -1, 240, -1, 99, -1,
719 99, -1, 151, -1, 152, -1, 23, -1, 156, 157,
720 153, -1, -1, 112, 154, -1, 113, 155, -1, 23,
721 -1, 23, -1, 99, -1, 103, -1, 103, -1, 103,
722 -1, 103, -1, 100, -1, 104, -1, -1, 100, -1,
723 101, -1, 102, -1, 103, -1, -1, 163, -1, 170,
724 -1, 234, -1, 236, -1, 239, -1, 252, -1, 7,
725 99, 114, 164, -1, 96, 165, -1, 38, 169, -1,
726 60, -1, 98, 167, -1, 53, -1, 29, 245, -1,
727 37, -1, 74, 246, -1, 50, 110, 168, 111, -1,
728 97, 110, 166, 111, -1, 23, -1, -1, 110, 168,
729 111, -1, 23, -1, 60, -1, 29, 245, -1, 37,
730 -1, 74, 246, -1, 171, -1, 172, -1, 10, 99,
731 174, -1, 10, 99, 110, 173, 111, 175, -1, -1,
732 23, -1, 114, 177, -1, 114, 115, 176, 116, -1,
733 179, -1, 176, 108, 179, -1, 181, -1, 217, -1,
734 227, -1, 181, -1, 217, -1, 228, -1, 180, -1,
735 218, -1, 227, -1, 181, -1, 73, 205, -1, 73,
736 182, -1, 73, 184, -1, 73, 187, -1, 73, 189,
737 -1, 73, 195, -1, 73, 191, -1, 73, 198, -1,
738 73, 200, -1, 73, 202, -1, 73, 204, -1, 73,
739 216, -1, 47, 244, 183, -1, 193, -1, 33, -1,
740 69, -1, 43, 110, 194, 111, 185, -1, 193, -1,
741 60, -1, 26, -1, 72, 186, -1, 40, -1, 32,
742 -1, 44, 188, -1, 25, -1, 244, 67, -1, 45,
743 110, 194, 111, 244, 190, -1, 193, -1, 75, 248,
744 192, -1, 29, -1, 25, -1, 31, -1, 71, -1,
745 23, -1, 76, 246, 196, 197, -1, 35, -1, 54,
746 -1, 79, -1, 80, -1, 78, -1, 77, -1, 36,
747 199, -1, 29, -1, 56, -1, 28, 110, 201, 111,
748 57, -1, 23, -1, 58, 203, -1, 70, -1, 26,
749 -1, 207, 66, 110, 210, 111, -1, 207, 206, -1,
750 -1, 66, 110, 210, 105, 210, 111, -1, 49, 211,
751 208, -1, -1, 209, -1, 41, -1, 82, -1, 42,
752 -1, 23, -1, 51, 212, -1, 63, -1, 52, -1,
753 81, 246, -1, 55, 110, 214, 111, -1, 48, 110,
754 215, 111, -1, -1, 213, -1, 23, -1, 23, -1,
755 23, -1, 30, 64, -1, 221, -1, 224, -1, 219,
756 -1, 222, -1, 62, 34, 110, 220, 111, -1, 225,
757 -1, 225, 105, 225, -1, 62, 34, 110, 225, 111,
758 -1, 62, 46, 110, 223, 111, -1, 226, -1, 226,
759 105, 226, -1, 62, 46, 110, 226, 111, -1, 23,
760 -1, 23, -1, 229, -1, 231, -1, 230, -1, 231,
761 -1, 232, -1, 24, -1, 23, -1, 115, 232, 116,
762 -1, 115, 232, 108, 232, 116, -1, 115, 232, 108,
763 232, 108, 232, 116, -1, 115, 232, 108, 232, 108,
764 232, 108, 232, 116, -1, 233, 24, -1, 233, 23,
765 -1, 112, -1, 113, -1, -1, -1, 11, 235, 238,
766 -1, -1, 5, 237, 238, -1, 238, 108, 99, -1,
767 99, -1, 9, 99, 114, 240, -1, 65, 60, -1,
768 65, 37, -1, 65, 241, -1, 65, 59, -1, 65,
769 74, 246, -1, 65, 30, -1, 29, 242, 243, -1,
770 -1, 39, -1, 27, -1, -1, 61, -1, 68, -1,
771 -1, 39, -1, 27, -1, -1, 61, -1, 68, -1,
772 -1, 110, 249, 111, -1, -1, 110, 250, 111, -1,
773 -1, 110, 251, 111, -1, 23, -1, 23, -1, 23,
774 -1, 6, 99, 114, 99, -1
775 };
776
777 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
778 static const yytype_uint16 yyrline[] =
779 {
780 0, 265, 265, 268, 276, 288, 289, 292, 314, 315,
781 318, 333, 336, 341, 348, 349, 350, 351, 352, 353,
782 354, 357, 358, 359, 362, 368, 374, 380, 387, 393,
783 400, 444, 451, 495, 501, 502, 503, 504, 505, 506,
784 507, 508, 509, 510, 511, 512, 515, 527, 535, 552,
785 559, 578, 589, 609, 631, 640, 673, 680, 695, 745,
786 787, 798, 819, 829, 835, 866, 883, 883, 885, 892,
787 904, 905, 906, 909, 921, 933, 951, 962, 974, 976,
788 977, 978, 979, 982, 982, 982, 982, 983, 986, 987,
789 988, 989, 990, 991, 994, 1012, 1016, 1022, 1026, 1030,
790 1034, 1043, 1052, 1056, 1061, 1067, 1078, 1078, 1079, 1081,
791 1085, 1089, 1093, 1099, 1099, 1101, 1117, 1140, 1143, 1154,
792 1160, 1166, 1167, 1174, 1180, 1186, 1194, 1200, 1206, 1214,
793 1220, 1226, 1234, 1235, 1238, 1239, 1240, 1241, 1242, 1243,
794 1244, 1245, 1246, 1247, 1248, 1251, 1260, 1264, 1268, 1274,
795 1283, 1287, 1291, 1300, 1304, 1310, 1316, 1323, 1328, 1336,
796 1346, 1348, 1356, 1362, 1366, 1370, 1376, 1387, 1396, 1400,
797 1405, 1409, 1413, 1417, 1423, 1430, 1434, 1440, 1448, 1459,
798 1466, 1470, 1476, 1486, 1497, 1501, 1519, 1528, 1531, 1537,
799 1541, 1545, 1551, 1562, 1567, 1572, 1577, 1582, 1587, 1595,
800 1598, 1603, 1616, 1624, 1635, 1643, 1643, 1645, 1645, 1647,
801 1657, 1662, 1669, 1679, 1688, 1693, 1700, 1710, 1720, 1732,
802 1732, 1733, 1733, 1735, 1745, 1753, 1763, 1771, 1779, 1788,
803 1799, 1803, 1809, 1810, 1811, 1814, 1814, 1817, 1817, 1820,
804 1826, 1834, 1847, 1856, 1865, 1869, 1878, 1887, 1898, 1905,
805 1910, 1919, 1931, 1934, 1943, 1954, 1955, 1956, 1959, 1960,
806 1961, 1964, 1965, 1968, 1969, 1972, 1973, 1976, 1987, 1998,
807 2009
808 };
809 #endif
810
811 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
812 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
813 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
814 static const char *const yytname[] =
815 {
816 "$end", "error", "$undefined", "ARBvp_10", "ARBfp_10", "ADDRESS",
817 "ALIAS", "ATTRIB", "OPTION", "OUTPUT", "PARAM", "TEMP", "END", "BIN_OP",
818 "BINSC_OP", "SAMPLE_OP", "SCALAR_OP", "TRI_OP", "VECTOR_OP", "ARL",
819 "KIL", "SWZ", "TXD_OP", "INTEGER", "REAL", "AMBIENT", "ATTENUATION",
820 "BACK", "CLIP", "COLOR", "DEPTH", "DIFFUSE", "DIRECTION", "EMISSION",
821 "ENV", "EYE", "FOG", "FOGCOORD", "FRAGMENT", "FRONT", "HALF", "INVERSE",
822 "INVTRANS", "LIGHT", "LIGHTMODEL", "LIGHTPROD", "LOCAL", "MATERIAL",
823 "MAT_PROGRAM", "MATRIX", "MATRIXINDEX", "MODELVIEW", "MVP", "NORMAL",
824 "OBJECT", "PALETTE", "PARAMS", "PLANE", "POINT", "POINTSIZE", "POSITION",
825 "PRIMARY", "PROGRAM", "PROJECTION", "RANGE", "RESULT", "ROW",
826 "SCENECOLOR", "SECONDARY", "SHININESS", "SIZE", "SPECULAR", "SPOT",
827 "STATE", "TEXCOORD", "TEXENV", "TEXGEN", "TEXGEN_Q", "TEXGEN_R",
828 "TEXGEN_S", "TEXGEN_T", "TEXTURE", "TRANSPOSE", "TEXTURE_UNIT", "TEX_1D",
829 "TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT", "TEX_SHADOW1D",
830 "TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D", "TEX_ARRAY2D",
831 "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB",
832 "WEIGHT", "IDENTIFIER", "MASK4", "MASK3", "MASK2", "MASK1", "SWIZZLE",
833 "DOT_DOT", "DOT", "';'", "','", "'|'", "'['", "']'", "'+'", "'-'", "'='",
834 "'{'", "'}'", "$accept", "program", "language", "optionSequence",
835 "option", "statementSequence", "statement", "instruction",
836 "ALU_instruction", "TexInstruction", "ARL_instruction",
837 "VECTORop_instruction", "SCALARop_instruction", "BINSCop_instruction",
838 "BINop_instruction", "TRIop_instruction", "SAMPLE_instruction",
839 "KIL_instruction", "TXD_instruction", "texImageUnit", "texTarget",
840 "SWZ_instruction", "scalarSrcReg", "scalarUse", "swizzleSrcReg",
841 "maskedDstReg", "maskedAddrReg", "extendedSwizzle", "extSwizComp",
842 "extSwizSel", "srcReg", "dstReg", "progParamArray", "progParamArrayMem",
843 "progParamArrayAbs", "progParamArrayRel", "addrRegRelOffset",
844 "addrRegPosOffset", "addrRegNegOffset", "addrReg", "addrComponent",
845 "addrWriteMask", "scalarSuffix", "swizzleSuffix", "optionalMask",
846 "namingStatement", "ATTRIB_statement", "attribBinding", "vtxAttribItem",
847 "vtxAttribNum", "vtxOptWeightNum", "vtxWeightNum", "fragAttribItem",
848 "PARAM_statement", "PARAM_singleStmt", "PARAM_multipleStmt",
849 "optArraySize", "paramSingleInit", "paramMultipleInit",
850 "paramMultInitList", "paramSingleItemDecl", "paramSingleItemUse",
851 "paramMultipleItem", "stateMultipleItem", "stateSingleItem",
852 "stateMaterialItem", "stateMatProperty", "stateLightItem",
853 "stateLightProperty", "stateSpotProperty", "stateLightModelItem",
854 "stateLModProperty", "stateLightProdItem", "stateLProdProperty",
855 "stateTexEnvItem", "stateTexEnvProperty", "ambDiffSpecProperty",
856 "stateLightNumber", "stateTexGenItem", "stateTexGenType",
857 "stateTexGenCoord", "stateFogItem", "stateFogProperty",
858 "stateClipPlaneItem", "stateClipPlaneNum", "statePointItem",
859 "statePointProperty", "stateMatrixRow", "stateMatrixRows",
860 "optMatrixRows", "stateMatrixItem", "stateOptMatModifier",
861 "stateMatModifier", "stateMatrixRowNum", "stateMatrixName",
862 "stateOptModMatNum", "stateModMatNum", "statePaletteMatNum",
863 "stateProgramMatNum", "stateDepthItem", "programSingleItem",
864 "programMultipleItem", "progEnvParams", "progEnvParamNums",
865 "progEnvParam", "progLocalParams", "progLocalParamNums",
866 "progLocalParam", "progEnvParamNum", "progLocalParamNum",
867 "paramConstDecl", "paramConstUse", "paramConstScalarDecl",
868 "paramConstScalarUse", "paramConstVector", "signedFloatConstant",
869 "optionalSign", "TEMP_statement", "@1", "ADDRESS_statement", "@2",
870 "varNameList", "OUTPUT_statement", "resultBinding", "resultColBinding",
871 "optResultFaceType", "optResultColorType", "optFaceType", "optColorType",
872 "optTexCoordUnitNum", "optTexImageUnitNum", "optLegacyTexUnitNum",
873 "texCoordUnitNum", "texImageUnitNum", "legacyTexUnitNum",
874 "ALIAS_statement", 0
875 };
876 #endif
877
878 # ifdef YYPRINT
879 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
880 token YYLEX-NUM. */
881 static const yytype_uint16 yytoknum[] =
882 {
883 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
884 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
885 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
886 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
887 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
888 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
889 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
890 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
891 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
892 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
893 355, 356, 357, 358, 359, 360, 361, 59, 44, 124,
894 91, 93, 43, 45, 61, 123, 125
895 };
896 # endif
897
898 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
899 static const yytype_uint8 yyr1[] =
900 {
901 0, 117, 118, 119, 119, 120, 120, 121, 122, 122,
902 123, 123, 124, 124, 125, 125, 125, 125, 125, 125,
903 125, 126, 126, 126, 127, 128, 129, 130, 131, 132,
904 133, 134, 135, 136, 137, 137, 137, 137, 137, 137,
905 137, 137, 137, 137, 137, 137, 138, 139, 139, 140,
906 140, 141, 141, 142, 143, 144, 145, 146, 146, 147,
907 147, 147, 147, 148, 148, 149, 150, 150, 151, 152,
908 153, 153, 153, 154, 155, 156, 157, 158, 159, 160,
909 160, 160, 160, 161, 161, 161, 161, 161, 162, 162,
910 162, 162, 162, 162, 163, 164, 164, 165, 165, 165,
911 165, 165, 165, 165, 165, 166, 167, 167, 168, 169,
912 169, 169, 169, 170, 170, 171, 172, 173, 173, 174,
913 175, 176, 176, 177, 177, 177, 178, 178, 178, 179,
914 179, 179, 180, 180, 181, 181, 181, 181, 181, 181,
915 181, 181, 181, 181, 181, 182, 183, 183, 183, 184,
916 185, 185, 185, 185, 185, 186, 187, 188, 188, 189,
917 190, 191, 192, 193, 193, 193, 194, 195, 196, 196,
918 197, 197, 197, 197, 198, 199, 199, 200, 201, 202,
919 203, 203, 204, 205, 206, 206, 207, 208, 208, 209,
920 209, 209, 210, 211, 211, 211, 211, 211, 211, 212,
921 212, 213, 214, 215, 216, 217, 217, 218, 218, 219,
922 220, 220, 221, 222, 223, 223, 224, 225, 226, 227,
923 227, 228, 228, 229, 230, 230, 231, 231, 231, 231,
924 232, 232, 233, 233, 233, 235, 234, 237, 236, 238,
925 238, 239, 240, 240, 240, 240, 240, 240, 241, 242,
926 242, 242, 243, 243, 243, 244, 244, 244, 245, 245,
927 245, 246, 246, 247, 247, 248, 248, 249, 250, 251,
928 252
929 };
930
931 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
932 static const yytype_uint8 yyr2[] =
933 {
934 0, 2, 4, 1, 1, 2, 0, 3, 2, 0,
935 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
936 1, 1, 1, 1, 4, 4, 4, 6, 6, 8,
937 8, 2, 12, 2, 1, 1, 1, 1, 1, 1,
938 1, 1, 1, 1, 1, 1, 6, 2, 4, 2,
939 1, 3, 5, 2, 2, 7, 2, 1, 1, 1,
940 1, 4, 1, 1, 1, 1, 1, 1, 1, 3,
941 0, 2, 2, 1, 1, 1, 1, 1, 1, 1,
942 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
943 1, 1, 1, 1, 4, 2, 2, 1, 2, 1,
944 2, 1, 2, 4, 4, 1, 0, 3, 1, 1,
945 2, 1, 2, 1, 1, 3, 6, 0, 1, 2,
946 4, 1, 3, 1, 1, 1, 1, 1, 1, 1,
947 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
948 2, 2, 2, 2, 2, 3, 1, 1, 1, 5,
949 1, 1, 1, 2, 1, 1, 2, 1, 2, 6,
950 1, 3, 1, 1, 1, 1, 1, 4, 1, 1,
951 1, 1, 1, 1, 2, 1, 1, 5, 1, 2,
952 1, 1, 5, 2, 0, 6, 3, 0, 1, 1,
953 1, 1, 1, 2, 1, 1, 2, 4, 4, 0,
954 1, 1, 1, 1, 2, 1, 1, 1, 1, 5,
955 1, 3, 5, 5, 1, 3, 5, 1, 1, 1,
956 1, 1, 1, 1, 1, 1, 3, 5, 7, 9,
957 2, 2, 1, 1, 0, 0, 3, 0, 3, 3,
958 1, 4, 2, 2, 2, 2, 3, 2, 3, 0,
959 1, 1, 0, 1, 1, 0, 1, 1, 0, 1,
960 1, 0, 3, 0, 3, 0, 3, 1, 1, 1,
961 4
962 };
963
964 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
965 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
966 means the default is an error. */
967 static const yytype_uint16 yydefact[] =
968 {
969 0, 3, 4, 0, 6, 1, 9, 0, 5, 0,
970 0, 237, 0, 0, 0, 0, 235, 2, 0, 0,
971 0, 0, 0, 0, 0, 234, 0, 0, 8, 0,
972 12, 13, 14, 15, 16, 17, 18, 19, 21, 22,
973 23, 20, 0, 88, 89, 113, 114, 90, 91, 92,
974 93, 7, 0, 0, 0, 0, 0, 0, 0, 64,
975 0, 87, 63, 0, 0, 0, 0, 0, 75, 0,
976 0, 232, 233, 31, 0, 0, 0, 10, 11, 240,
977 238, 0, 0, 0, 117, 234, 115, 236, 249, 247,
978 243, 245, 242, 261, 244, 234, 83, 84, 85, 86,
979 53, 234, 234, 234, 234, 234, 234, 77, 54, 225,
980 224, 0, 0, 0, 0, 59, 0, 234, 82, 0,
981 60, 62, 126, 127, 205, 206, 128, 221, 222, 0,
982 234, 0, 270, 94, 241, 118, 0, 119, 123, 124,
983 125, 219, 220, 223, 0, 251, 250, 252, 0, 246,
984 0, 0, 0, 0, 26, 0, 25, 24, 258, 111,
985 109, 261, 96, 0, 0, 0, 0, 0, 0, 255,
986 0, 255, 0, 0, 265, 261, 134, 135, 136, 137,
987 139, 138, 140, 141, 142, 143, 0, 144, 258, 101,
988 0, 99, 97, 261, 0, 106, 95, 82, 0, 80,
989 79, 81, 51, 0, 0, 0, 239, 0, 231, 230,
990 253, 254, 248, 267, 0, 234, 234, 0, 47, 0,
991 50, 0, 234, 259, 260, 110, 112, 0, 0, 0,
992 204, 175, 176, 174, 0, 157, 257, 256, 156, 0,
993 0, 0, 0, 199, 195, 0, 194, 261, 187, 181,
994 180, 179, 0, 0, 0, 0, 100, 0, 102, 0,
995 0, 98, 0, 234, 226, 68, 0, 66, 67, 0,
996 234, 234, 0, 116, 262, 28, 27, 0, 78, 49,
997 263, 0, 0, 217, 0, 218, 0, 178, 0, 166,
998 0, 158, 0, 163, 164, 147, 148, 165, 145, 146,
999 0, 201, 193, 200, 0, 196, 189, 191, 190, 186,
1000 188, 269, 0, 162, 161, 168, 169, 0, 0, 108,
1001 0, 105, 0, 0, 52, 0, 61, 76, 70, 46,
1002 0, 0, 0, 234, 48, 0, 33, 0, 234, 212,
1003 216, 0, 0, 255, 203, 0, 202, 0, 266, 173,
1004 172, 170, 171, 167, 192, 0, 103, 104, 107, 234,
1005 227, 0, 0, 69, 234, 57, 58, 56, 234, 0,
1006 0, 0, 121, 129, 132, 130, 207, 208, 131, 268,
1007 0, 34, 35, 36, 37, 38, 39, 40, 41, 42,
1008 43, 44, 45, 30, 29, 177, 152, 154, 151, 0,
1009 149, 150, 0, 198, 197, 182, 0, 73, 71, 74,
1010 72, 0, 0, 0, 0, 133, 184, 234, 120, 264,
1011 155, 153, 159, 160, 234, 228, 234, 0, 0, 0,
1012 0, 183, 122, 0, 0, 0, 0, 210, 0, 214,
1013 0, 229, 234, 0, 209, 0, 213, 0, 0, 55,
1014 32, 211, 215, 0, 0, 185
1015 };
1016
1017 /* YYDEFGOTO[NTERM-NUM]. */
1018 static const yytype_int16 yydefgoto[] =
1019 {
1020 -1, 3, 4, 6, 8, 9, 28, 29, 30, 31,
1021 32, 33, 34, 35, 36, 37, 38, 39, 40, 281,
1022 393, 41, 151, 218, 73, 60, 69, 329, 330, 367,
1023 219, 61, 119, 266, 267, 268, 363, 408, 410, 70,
1024 328, 108, 279, 202, 100, 42, 43, 120, 196, 322,
1025 261, 320, 162, 44, 45, 46, 136, 86, 273, 371,
1026 137, 121, 372, 373, 122, 176, 298, 177, 400, 421,
1027 178, 238, 179, 422, 180, 314, 299, 290, 181, 317,
1028 353, 182, 233, 183, 288, 184, 251, 185, 415, 431,
1029 186, 309, 310, 355, 248, 302, 303, 347, 345, 187,
1030 123, 375, 376, 436, 124, 377, 438, 125, 284, 286,
1031 378, 126, 141, 127, 128, 143, 74, 47, 57, 48,
1032 52, 80, 49, 62, 94, 147, 212, 239, 225, 149,
1033 336, 253, 214, 380, 312, 50
1034 };
1035
1036 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1037 STATE-NUM. */
1038 #define YYPACT_NINF -403
1039 static const yytype_int16 yypact[] =
1040 {
1041 62, -403, -403, 41, -403, -403, 81, -36, -403, 198,
1042 -8, -403, -5, 18, 20, 35, -403, -403, -23, -23,
1043 -23, -23, -23, -23, 45, 131, -23, -23, -403, 58,
1044 -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,
1045 -403, -403, 67, -403, -403, -403, -403, -403, -403, -403,
1046 -403, -403, 63, 86, 92, 128, 84, 63, 99, -403,
1047 69, 133, -403, 87, 89, 129, 145, 146, -403, 147,
1048 154, -403, -403, -403, -13, 150, 151, -403, -403, -403,
1049 152, 162, -14, 197, 240, -34, -403, 152, 98, -403,
1050 -403, -403, -403, 155, -403, 131, -403, -403, -403, -403,
1051 -403, 131, 131, 131, 131, 131, 131, -403, -403, -403,
1052 -403, 72, 105, 77, 17, 156, 12, 131, 68, 157,
1053 -403, -403, -403, -403, -403, -403, -403, -403, -403, 12,
1054 131, 165, -403, -403, -403, -403, 158, -403, -403, -403,
1055 -403, -403, -403, -403, 223, -403, -403, -16, 245, -403,
1056 163, 164, -9, 167, -403, 168, -403, -403, 55, -403,
1057 -403, 155, -403, 170, 171, 172, 206, 2, 173, 34,
1058 174, 127, 112, 1, 175, 155, -403, -403, -403, -403,
1059 -403, -403, -403, -403, -403, -403, 207, -403, 55, -403,
1060 177, -403, -403, 155, 178, 179, -403, 68, 22, -403,
1061 -403, -403, -403, -6, 169, 182, -403, 180, -403, -403,
1062 -403, -403, -403, -403, 181, 131, 131, 12, -403, 188,
1063 190, 195, 131, -403, -403, -403, -403, 272, 273, 274,
1064 -403, -403, -403, -403, 275, -403, -403, -403, -403, 232,
1065 275, 79, 191, 277, -403, 192, -403, 155, 15, -403,
1066 -403, -403, 280, 276, 8, 194, -403, 283, -403, 284,
1067 283, -403, 199, 131, -403, -403, 200, -403, -403, 209,
1068 131, 131, 201, -403, -403, -403, -403, 204, -403, -403,
1069 205, 210, 211, -403, 203, -403, 212, -403, 213, -403,
1070 214, -403, 215, -403, -403, -403, -403, -403, -403, -403,
1071 286, -403, -403, -403, 294, -403, -403, -403, -403, -403,
1072 -403, -403, 216, -403, -403, -403, -403, 161, 297, -403,
1073 217, -403, 218, 219, -403, 76, -403, -403, 139, -403,
1074 227, -4, 228, 30, -403, 298, -403, 137, 131, -403,
1075 -403, 265, 130, 127, -403, 220, -403, 226, -403, -403,
1076 -403, -403, -403, -403, -403, 229, -403, -403, -403, 131,
1077 -403, 315, 319, -403, 131, -403, -403, -403, 131, 123,
1078 77, 80, -403, -403, -403, -403, -403, -403, -403, -403,
1079 233, -403, -403, -403, -403, -403, -403, -403, -403, -403,
1080 -403, -403, -403, -403, -403, -403, -403, -403, -403, 311,
1081 -403, -403, 9, -403, -403, -403, 83, -403, -403, -403,
1082 -403, 237, 238, 239, 241, -403, 281, 30, -403, -403,
1083 -403, -403, -403, -403, 131, -403, 131, 195, 272, 273,
1084 242, -403, -403, 234, 246, 247, 248, 243, 249, 251,
1085 297, -403, 131, 137, -403, 272, -403, 273, 36, -403,
1086 -403, -403, -403, 297, 250, -403
1087 };
1088
1089 /* YYPGOTO[NTERM-NUM]. */
1090 static const yytype_int16 yypgoto[] =
1091 {
1092 -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,
1093 -403, -403, -403, -403, -403, -403, -403, -403, -403, -74,
1094 -81, -403, -98, 141, -82, 160, -403, -403, -358, -403,
1095 -41, -403, -403, -403, -403, -403, -403, -403, -403, 166,
1096 -403, -403, -403, 176, -403, -403, -403, 282, -403, -403,
1097 -403, 103, -403, -403, -403, -403, -403, -403, -403, -403,
1098 -403, -403, -52, -403, -84, -403, -403, -403, -403, -403,
1099 -403, -403, -403, -403, -403, -403, -333, 126, -403, -403,
1100 -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,
1101 -3, -403, -403, -402, -403, -403, -403, -403, -403, -403,
1102 285, -403, -403, -403, -403, -403, -403, -403, -398, -392,
1103 287, -403, -403, -145, -83, -114, -85, -403, -403, -403,
1104 -403, 314, -403, 291, -403, -403, -403, -167, 187, -149,
1105 -403, -403, -403, -403, -403, -403
1106 };
1107
1108 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1109 positive, shift that token. If negative, reduce the rule which
1110 number is the opposite. If zero, do what YYDEFACT says.
1111 If YYTABLE_NINF, syntax error. */
1112 #define YYTABLE_NINF -222
1113 static const yytype_int16 yytable[] =
1114 {
1115 144, 138, 142, 198, 241, 154, 411, 220, 157, 401,
1116 109, 110, 226, 150, 109, 110, 152, 265, 152, 365,
1117 153, 152, 155, 156, 111, 111, 254, 249, 112, 111,
1118 437, 231, 144, 118, 293, 109, 110, 439, 448, 113,
1119 294, 5, 58, 315, 258, 210, 188, 451, 205, 112,
1120 111, 454, 211, 112, 189, 452, 306, 307, 232, 235,
1121 113, 236, 316, 10, 113, 1, 2, 190, 434, 423,
1122 191, 250, 220, 237, 112, 197, 59, 192, 71, 72,
1123 297, 117, 114, 114, 449, 113, 115, 114, 204, 7,
1124 115, 193, 369, 68, 53, 366, 116, 308, 305, 51,
1125 217, 158, 117, 370, 293, 165, 117, 166, 114, 159,
1126 294, 115, 295, 167, 194, 195, 223, 54, 276, 55,
1127 168, 169, 170, 224, 171, 145, 172, 117, 88, 89,
1128 263, 152, 160, 275, 56, 173, 90, 146, 264, 163,
1129 282, 453, 71, 72, 68, 117, 161, 405, 296, 325,
1130 297, 164, 174, 175, 236, 293, 396, 413, 91, 92,
1131 242, 294, 79, 243, 244, 77, 237, 245, 199, 414,
1132 397, 200, 201, 93, 78, 246, 402, 95, 144, 63,
1133 64, 65, 66, 67, 359, 331, 75, 76, 417, 332,
1134 398, 424, 360, 247, 84, 101, 418, 102, 85, 425,
1135 81, 297, 399, 11, 12, 13, 82, 14, 15, 16,
1136 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1137 27, 381, 382, 383, 384, 385, 386, 387, 388, 389,
1138 390, 391, 392, 96, 97, 98, 99, 103, 349, 350,
1139 351, 352, 83, 71, 72, 406, 208, 209, 144, 374,
1140 142, 361, 362, 104, 105, 106, 394, 107, 129, 130,
1141 131, 132, 58, 135, 206, 148, -65, 203, 213, 207,
1142 230, 215, 216, 255, 144, 221, 222, 270, 280, 331,
1143 227, 228, 229, 234, 240, 252, 412, 257, 259, 260,
1144 271, 278, 274, -221, 272, 283, 285, 287, 289, 291,
1145 301, 300, 304, 311, 318, 313, 319, 321, 324, 344,
1146 433, 326, 327, 334, 339, 335, 333, 346, 337, 338,
1147 354, 379, 395, 340, 341, 342, 343, 348, 356, 357,
1148 358, 403, 144, 374, 142, 364, 368, 404, 407, 144,
1149 405, 331, 409, 420, 419, 426, 427, 430, 445, 428,
1150 441, 429, 440, 435, 442, 443, 447, 331, 277, 444,
1151 446, 455, 450, 323, 133, 432, 292, 416, 0, 269,
1152 139, 87, 140, 262, 134, 256
1153 };
1154
1155 static const yytype_int16 yycheck[] =
1156 {
1157 85, 85, 85, 117, 171, 103, 364, 152, 106, 342,
1158 23, 24, 161, 95, 23, 24, 101, 23, 103, 23,
1159 102, 106, 104, 105, 38, 38, 175, 26, 62, 38,
1160 428, 29, 117, 74, 25, 23, 24, 429, 440, 73,
1161 31, 0, 65, 35, 193, 61, 29, 445, 130, 62,
1162 38, 453, 68, 62, 37, 447, 41, 42, 56, 25,
1163 73, 27, 54, 99, 73, 3, 4, 50, 426, 402,
1164 53, 70, 217, 39, 62, 116, 99, 60, 112, 113,
1165 71, 115, 96, 96, 442, 73, 99, 96, 129, 8,
1166 99, 74, 62, 99, 99, 99, 109, 82, 247, 107,
1167 109, 29, 115, 73, 25, 28, 115, 30, 96, 37,
1168 31, 99, 33, 36, 97, 98, 61, 99, 216, 99,
1169 43, 44, 45, 68, 47, 27, 49, 115, 29, 30,
1170 108, 216, 60, 215, 99, 58, 37, 39, 116, 34,
1171 222, 105, 112, 113, 99, 115, 74, 111, 69, 263,
1172 71, 46, 75, 76, 27, 25, 26, 34, 59, 60,
1173 48, 31, 99, 51, 52, 107, 39, 55, 100, 46,
1174 40, 103, 104, 74, 107, 63, 343, 108, 263, 19,
1175 20, 21, 22, 23, 108, 270, 26, 27, 108, 271,
1176 60, 108, 116, 81, 110, 108, 116, 108, 114, 116,
1177 114, 71, 72, 5, 6, 7, 114, 9, 10, 11,
1178 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1179 22, 84, 85, 86, 87, 88, 89, 90, 91, 92,
1180 93, 94, 95, 100, 101, 102, 103, 108, 77, 78,
1181 79, 80, 114, 112, 113, 359, 23, 24, 333, 333,
1182 333, 112, 113, 108, 108, 108, 338, 103, 108, 108,
1183 108, 99, 65, 23, 99, 110, 110, 110, 23, 111,
1184 64, 108, 108, 66, 359, 108, 108, 108, 83, 364,
1185 110, 110, 110, 110, 110, 110, 368, 110, 110, 110,
1186 108, 103, 111, 103, 114, 23, 23, 23, 23, 67,
1187 23, 110, 110, 23, 110, 29, 23, 23, 109, 23,
1188 424, 111, 103, 109, 111, 110, 115, 23, 108, 108,
1189 23, 23, 57, 111, 111, 111, 111, 111, 111, 111,
1190 111, 111, 417, 417, 417, 108, 108, 111, 23, 424,
1191 111, 426, 23, 32, 111, 108, 108, 66, 105, 110,
1192 116, 110, 110, 427, 108, 108, 105, 442, 217, 111,
1193 111, 111, 443, 260, 82, 417, 240, 370, -1, 203,
1194 85, 57, 85, 197, 83, 188
1195 };
1196
1197 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1198 symbol of state STATE-NUM. */
1199 static const yytype_uint8 yystos[] =
1200 {
1201 0, 3, 4, 118, 119, 0, 120, 8, 121, 122,
1202 99, 5, 6, 7, 9, 10, 11, 12, 13, 14,
1203 15, 16, 17, 18, 19, 20, 21, 22, 123, 124,
1204 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1205 135, 138, 162, 163, 170, 171, 172, 234, 236, 239,
1206 252, 107, 237, 99, 99, 99, 99, 235, 65, 99,
1207 142, 148, 240, 142, 142, 142, 142, 142, 99, 143,
1208 156, 112, 113, 141, 233, 142, 142, 107, 107, 99,
1209 238, 114, 114, 114, 110, 114, 174, 238, 29, 30,
1210 37, 59, 60, 74, 241, 108, 100, 101, 102, 103,
1211 161, 108, 108, 108, 108, 108, 108, 103, 158, 23,
1212 24, 38, 62, 73, 96, 99, 109, 115, 147, 149,
1213 164, 178, 181, 217, 221, 224, 228, 230, 231, 108,
1214 108, 108, 99, 164, 240, 23, 173, 177, 181, 217,
1215 227, 229, 231, 232, 233, 27, 39, 242, 110, 246,
1216 141, 139, 233, 141, 139, 141, 141, 139, 29, 37,
1217 60, 74, 169, 34, 46, 28, 30, 36, 43, 44,
1218 45, 47, 49, 58, 75, 76, 182, 184, 187, 189,
1219 191, 195, 198, 200, 202, 204, 207, 216, 29, 37,
1220 50, 53, 60, 74, 97, 98, 165, 147, 232, 100,
1221 103, 104, 160, 110, 147, 141, 99, 111, 23, 24,
1222 61, 68, 243, 23, 249, 108, 108, 109, 140, 147,
1223 230, 108, 108, 61, 68, 245, 246, 110, 110, 110,
1224 64, 29, 56, 199, 110, 25, 27, 39, 188, 244,
1225 110, 244, 48, 51, 52, 55, 63, 81, 211, 26,
1226 70, 203, 110, 248, 246, 66, 245, 110, 246, 110,
1227 110, 167, 160, 108, 116, 23, 150, 151, 152, 156,
1228 108, 108, 114, 175, 111, 141, 139, 140, 103, 159,
1229 83, 136, 141, 23, 225, 23, 226, 23, 201, 23,
1230 194, 67, 194, 25, 31, 33, 69, 71, 183, 193,
1231 110, 23, 212, 213, 110, 246, 41, 42, 82, 208,
1232 209, 23, 251, 29, 192, 35, 54, 196, 110, 23,
1233 168, 23, 166, 168, 109, 232, 111, 103, 157, 144,
1234 145, 233, 141, 115, 109, 110, 247, 108, 108, 111,
1235 111, 111, 111, 111, 23, 215, 23, 214, 111, 77,
1236 78, 79, 80, 197, 23, 210, 111, 111, 111, 108,
1237 116, 112, 113, 153, 108, 23, 99, 146, 108, 62,
1238 73, 176, 179, 180, 181, 218, 219, 222, 227, 23,
1239 250, 84, 85, 86, 87, 88, 89, 90, 91, 92,
1240 93, 94, 95, 137, 141, 57, 26, 40, 60, 72,
1241 185, 193, 244, 111, 111, 111, 232, 23, 154, 23,
1242 155, 145, 141, 34, 46, 205, 207, 108, 116, 111,
1243 32, 186, 190, 193, 108, 116, 108, 108, 110, 110,
1244 66, 206, 179, 232, 145, 136, 220, 225, 223, 226,
1245 110, 116, 108, 108, 111, 105, 111, 105, 210, 145,
1246 137, 225, 226, 105, 210, 111
1247 };
1248
1249 #define yyerrok (yyerrstatus = 0)
1250 #define yyclearin (yychar = YYEMPTY)
1251 #define YYEMPTY (-2)
1252 #define YYEOF 0
1253
1254 #define YYACCEPT goto yyacceptlab
1255 #define YYABORT goto yyabortlab
1256 #define YYERROR goto yyerrorlab
1257
1258
1259 /* Like YYERROR except do call yyerror. This remains here temporarily
1260 to ease the transition to the new meaning of YYERROR, for GCC.
1261 Once GCC version 2 has supplanted version 1, this can go. */
1262
1263 #define YYFAIL goto yyerrlab
1264
1265 #define YYRECOVERING() (!!yyerrstatus)
1266
1267 #define YYBACKUP(Token, Value) \
1268 do \
1269 if (yychar == YYEMPTY && yylen == 1) \
1270 { \
1271 yychar = (Token); \
1272 yylval = (Value); \
1273 yytoken = YYTRANSLATE (yychar); \
1274 YYPOPSTACK (1); \
1275 goto yybackup; \
1276 } \
1277 else \
1278 { \
1279 yyerror (&yylloc, state, YY_("syntax error: cannot back up")); \
1280 YYERROR; \
1281 } \
1282 while (YYID (0))
1283
1284
1285 #define YYTERROR 1
1286 #define YYERRCODE 256
1287
1288
1289 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1290 If N is 0, then set CURRENT to the empty location which ends
1291 the previous symbol: RHS[0] (always defined). */
1292
1293 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1294 #ifndef YYLLOC_DEFAULT
1295 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1296 do \
1297 if (YYID (N)) \
1298 { \
1299 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1300 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1301 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1302 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1303 } \
1304 else \
1305 { \
1306 (Current).first_line = (Current).last_line = \
1307 YYRHSLOC (Rhs, 0).last_line; \
1308 (Current).first_column = (Current).last_column = \
1309 YYRHSLOC (Rhs, 0).last_column; \
1310 } \
1311 while (YYID (0))
1312 #endif
1313
1314
1315 /* YY_LOCATION_PRINT -- Print the location on the stream.
1316 This macro was not mandated originally: define only if we know
1317 we won't break user code: when these are the locations we know. */
1318
1319 #ifndef YY_LOCATION_PRINT
1320 # if YYLTYPE_IS_TRIVIAL
1321 # define YY_LOCATION_PRINT(File, Loc) \
1322 fprintf (File, "%d.%d-%d.%d", \
1323 (Loc).first_line, (Loc).first_column, \
1324 (Loc).last_line, (Loc).last_column)
1325 # else
1326 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1327 # endif
1328 #endif
1329
1330
1331 /* YYLEX -- calling `yylex' with the right arguments. */
1332
1333 #ifdef YYLEX_PARAM
1334 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
1335 #else
1336 # define YYLEX yylex (&yylval, &yylloc, scanner)
1337 #endif
1338
1339 /* Enable debugging if requested. */
1340 #if YYDEBUG
1341
1342 # ifndef YYFPRINTF
1343 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1344 # define YYFPRINTF fprintf
1345 # endif
1346
1347 # define YYDPRINTF(Args) \
1348 do { \
1349 if (yydebug) \
1350 YYFPRINTF Args; \
1351 } while (YYID (0))
1352
1353 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1354 do { \
1355 if (yydebug) \
1356 { \
1357 YYFPRINTF (stderr, "%s ", Title); \
1358 yy_symbol_print (stderr, \
1359 Type, Value, Location, state); \
1360 YYFPRINTF (stderr, "\n"); \
1361 } \
1362 } while (YYID (0))
1363
1364
1365 /*--------------------------------.
1366 | Print this symbol on YYOUTPUT. |
1367 `--------------------------------*/
1368
1369 /*ARGSUSED*/
1370 #if (defined __STDC__ || defined __C99__FUNC__ \
1371 || defined __cplusplus || defined _MSC_VER)
1372 static void
1373 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct asm_parser_state *state)
1374 #else
1375 static void
1376 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, state)
1377 FILE *yyoutput;
1378 int yytype;
1379 YYSTYPE const * const yyvaluep;
1380 YYLTYPE const * const yylocationp;
1381 struct asm_parser_state *state;
1382 #endif
1383 {
1384 if (!yyvaluep)
1385 return;
1386 YYUSE (yylocationp);
1387 YYUSE (state);
1388 # ifdef YYPRINT
1389 if (yytype < YYNTOKENS)
1390 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1391 # else
1392 YYUSE (yyoutput);
1393 # endif
1394 switch (yytype)
1395 {
1396 default:
1397 break;
1398 }
1399 }
1400
1401
1402 /*--------------------------------.
1403 | Print this symbol on YYOUTPUT. |
1404 `--------------------------------*/
1405
1406 #if (defined __STDC__ || defined __C99__FUNC__ \
1407 || defined __cplusplus || defined _MSC_VER)
1408 static void
1409 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct asm_parser_state *state)
1410 #else
1411 static void
1412 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, state)
1413 FILE *yyoutput;
1414 int yytype;
1415 YYSTYPE const * const yyvaluep;
1416 YYLTYPE const * const yylocationp;
1417 struct asm_parser_state *state;
1418 #endif
1419 {
1420 if (yytype < YYNTOKENS)
1421 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1422 else
1423 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1424
1425 YY_LOCATION_PRINT (yyoutput, *yylocationp);
1426 YYFPRINTF (yyoutput, ": ");
1427 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, state);
1428 YYFPRINTF (yyoutput, ")");
1429 }
1430
1431 /*------------------------------------------------------------------.
1432 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1433 | TOP (included). |
1434 `------------------------------------------------------------------*/
1435
1436 #if (defined __STDC__ || defined __C99__FUNC__ \
1437 || defined __cplusplus || defined _MSC_VER)
1438 static void
1439 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1440 #else
1441 static void
1442 yy_stack_print (yybottom, yytop)
1443 yytype_int16 *yybottom;
1444 yytype_int16 *yytop;
1445 #endif
1446 {
1447 YYFPRINTF (stderr, "Stack now");
1448 for (; yybottom <= yytop; yybottom++)
1449 {
1450 int yybot = *yybottom;
1451 YYFPRINTF (stderr, " %d", yybot);
1452 }
1453 YYFPRINTF (stderr, "\n");
1454 }
1455
1456 # define YY_STACK_PRINT(Bottom, Top) \
1457 do { \
1458 if (yydebug) \
1459 yy_stack_print ((Bottom), (Top)); \
1460 } while (YYID (0))
1461
1462
1463 /*------------------------------------------------.
1464 | Report that the YYRULE is going to be reduced. |
1465 `------------------------------------------------*/
1466
1467 #if (defined __STDC__ || defined __C99__FUNC__ \
1468 || defined __cplusplus || defined _MSC_VER)
1469 static void
1470 yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, struct asm_parser_state *state)
1471 #else
1472 static void
1473 yy_reduce_print (yyvsp, yylsp, yyrule, state)
1474 YYSTYPE *yyvsp;
1475 YYLTYPE *yylsp;
1476 int yyrule;
1477 struct asm_parser_state *state;
1478 #endif
1479 {
1480 int yynrhs = yyr2[yyrule];
1481 int yyi;
1482 unsigned long int yylno = yyrline[yyrule];
1483 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1484 yyrule - 1, yylno);
1485 /* The symbols being reduced. */
1486 for (yyi = 0; yyi < yynrhs; yyi++)
1487 {
1488 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1489 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1490 &(yyvsp[(yyi + 1) - (yynrhs)])
1491 , &(yylsp[(yyi + 1) - (yynrhs)]) , state);
1492 YYFPRINTF (stderr, "\n");
1493 }
1494 }
1495
1496 # define YY_REDUCE_PRINT(Rule) \
1497 do { \
1498 if (yydebug) \
1499 yy_reduce_print (yyvsp, yylsp, Rule, state); \
1500 } while (YYID (0))
1501
1502 /* Nonzero means print parse trace. It is left uninitialized so that
1503 multiple parsers can coexist. */
1504 int yydebug;
1505 #else /* !YYDEBUG */
1506 # define YYDPRINTF(Args)
1507 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1508 # define YY_STACK_PRINT(Bottom, Top)
1509 # define YY_REDUCE_PRINT(Rule)
1510 #endif /* !YYDEBUG */
1511
1512
1513 /* YYINITDEPTH -- initial size of the parser's stacks. */
1514 #ifndef YYINITDEPTH
1515 # define YYINITDEPTH 200
1516 #endif
1517
1518 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1519 if the built-in stack extension method is used).
1520
1521 Do not make this value too large; the results are undefined if
1522 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1523 evaluated with infinite-precision integer arithmetic. */
1524
1525 #ifndef YYMAXDEPTH
1526 # define YYMAXDEPTH 10000
1527 #endif
1528
1529 \f
1530
1531 #if YYERROR_VERBOSE
1532
1533 # ifndef yystrlen
1534 # if defined __GLIBC__ && defined _STRING_H
1535 # define yystrlen strlen
1536 # else
1537 /* Return the length of YYSTR. */
1538 #if (defined __STDC__ || defined __C99__FUNC__ \
1539 || defined __cplusplus || defined _MSC_VER)
1540 static YYSIZE_T
1541 yystrlen (const char *yystr)
1542 #else
1543 static YYSIZE_T
1544 yystrlen (yystr)
1545 const char *yystr;
1546 #endif
1547 {
1548 YYSIZE_T yylen;
1549 for (yylen = 0; yystr[yylen]; yylen++)
1550 continue;
1551 return yylen;
1552 }
1553 # endif
1554 # endif
1555
1556 # ifndef yystpcpy
1557 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1558 # define yystpcpy stpcpy
1559 # else
1560 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1561 YYDEST. */
1562 #if (defined __STDC__ || defined __C99__FUNC__ \
1563 || defined __cplusplus || defined _MSC_VER)
1564 static char *
1565 yystpcpy (char *yydest, const char *yysrc)
1566 #else
1567 static char *
1568 yystpcpy (yydest, yysrc)
1569 char *yydest;
1570 const char *yysrc;
1571 #endif
1572 {
1573 char *yyd = yydest;
1574 const char *yys = yysrc;
1575
1576 while ((*yyd++ = *yys++) != '\0')
1577 continue;
1578
1579 return yyd - 1;
1580 }
1581 # endif
1582 # endif
1583
1584 # ifndef yytnamerr
1585 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1586 quotes and backslashes, so that it's suitable for yyerror. The
1587 heuristic is that double-quoting is unnecessary unless the string
1588 contains an apostrophe, a comma, or backslash (other than
1589 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1590 null, do not copy; instead, return the length of what the result
1591 would have been. */
1592 static YYSIZE_T
1593 yytnamerr (char *yyres, const char *yystr)
1594 {
1595 if (*yystr == '"')
1596 {
1597 YYSIZE_T yyn = 0;
1598 char const *yyp = yystr;
1599
1600 for (;;)
1601 switch (*++yyp)
1602 {
1603 case '\'':
1604 case ',':
1605 goto do_not_strip_quotes;
1606
1607 case '\\':
1608 if (*++yyp != '\\')
1609 goto do_not_strip_quotes;
1610 /* Fall through. */
1611 default:
1612 if (yyres)
1613 yyres[yyn] = *yyp;
1614 yyn++;
1615 break;
1616
1617 case '"':
1618 if (yyres)
1619 yyres[yyn] = '\0';
1620 return yyn;
1621 }
1622 do_not_strip_quotes: ;
1623 }
1624
1625 if (! yyres)
1626 return yystrlen (yystr);
1627
1628 return yystpcpy (yyres, yystr) - yyres;
1629 }
1630 # endif
1631
1632 /* Copy into YYRESULT an error message about the unexpected token
1633 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1634 including the terminating null byte. If YYRESULT is null, do not
1635 copy anything; just return the number of bytes that would be
1636 copied. As a special case, return 0 if an ordinary "syntax error"
1637 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1638 size calculation. */
1639 static YYSIZE_T
1640 yysyntax_error (char *yyresult, int yystate, int yychar)
1641 {
1642 int yyn = yypact[yystate];
1643
1644 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1645 return 0;
1646 else
1647 {
1648 int yytype = YYTRANSLATE (yychar);
1649 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1650 YYSIZE_T yysize = yysize0;
1651 YYSIZE_T yysize1;
1652 int yysize_overflow = 0;
1653 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1654 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1655 int yyx;
1656
1657 # if 0
1658 /* This is so xgettext sees the translatable formats that are
1659 constructed on the fly. */
1660 YY_("syntax error, unexpected %s");
1661 YY_("syntax error, unexpected %s, expecting %s");
1662 YY_("syntax error, unexpected %s, expecting %s or %s");
1663 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1664 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1665 # endif
1666 char *yyfmt;
1667 char const *yyf;
1668 static char const yyunexpected[] = "syntax error, unexpected %s";
1669 static char const yyexpecting[] = ", expecting %s";
1670 static char const yyor[] = " or %s";
1671 char yyformat[sizeof yyunexpected
1672 + sizeof yyexpecting - 1
1673 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1674 * (sizeof yyor - 1))];
1675 char const *yyprefix = yyexpecting;
1676
1677 /* Start YYX at -YYN if negative to avoid negative indexes in
1678 YYCHECK. */
1679 int yyxbegin = yyn < 0 ? -yyn : 0;
1680
1681 /* Stay within bounds of both yycheck and yytname. */
1682 int yychecklim = YYLAST - yyn + 1;
1683 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1684 int yycount = 1;
1685
1686 yyarg[0] = yytname[yytype];
1687 yyfmt = yystpcpy (yyformat, yyunexpected);
1688
1689 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1690 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1691 {
1692 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1693 {
1694 yycount = 1;
1695 yysize = yysize0;
1696 yyformat[sizeof yyunexpected - 1] = '\0';
1697 break;
1698 }
1699 yyarg[yycount++] = yytname[yyx];
1700 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1701 yysize_overflow |= (yysize1 < yysize);
1702 yysize = yysize1;
1703 yyfmt = yystpcpy (yyfmt, yyprefix);
1704 yyprefix = yyor;
1705 }
1706
1707 yyf = YY_(yyformat);
1708 yysize1 = yysize + yystrlen (yyf);
1709 yysize_overflow |= (yysize1 < yysize);
1710 yysize = yysize1;
1711
1712 if (yysize_overflow)
1713 return YYSIZE_MAXIMUM;
1714
1715 if (yyresult)
1716 {
1717 /* Avoid sprintf, as that infringes on the user's name space.
1718 Don't have undefined behavior even if the translation
1719 produced a string with the wrong number of "%s"s. */
1720 char *yyp = yyresult;
1721 int yyi = 0;
1722 while ((*yyp = *yyf) != '\0')
1723 {
1724 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1725 {
1726 yyp += yytnamerr (yyp, yyarg[yyi++]);
1727 yyf += 2;
1728 }
1729 else
1730 {
1731 yyp++;
1732 yyf++;
1733 }
1734 }
1735 }
1736 return yysize;
1737 }
1738 }
1739 #endif /* YYERROR_VERBOSE */
1740 \f
1741
1742 /*-----------------------------------------------.
1743 | Release the memory associated to this symbol. |
1744 `-----------------------------------------------*/
1745
1746 /*ARGSUSED*/
1747 #if (defined __STDC__ || defined __C99__FUNC__ \
1748 || defined __cplusplus || defined _MSC_VER)
1749 static void
1750 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, struct asm_parser_state *state)
1751 #else
1752 static void
1753 yydestruct (yymsg, yytype, yyvaluep, yylocationp, state)
1754 const char *yymsg;
1755 int yytype;
1756 YYSTYPE *yyvaluep;
1757 YYLTYPE *yylocationp;
1758 struct asm_parser_state *state;
1759 #endif
1760 {
1761 YYUSE (yyvaluep);
1762 YYUSE (yylocationp);
1763 YYUSE (state);
1764
1765 if (!yymsg)
1766 yymsg = "Deleting";
1767 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1768
1769 switch (yytype)
1770 {
1771
1772 default:
1773 break;
1774 }
1775 }
1776
1777 /* Prevent warnings from -Wmissing-prototypes. */
1778 #ifdef YYPARSE_PARAM
1779 #if defined __STDC__ || defined __cplusplus
1780 int yyparse (void *YYPARSE_PARAM);
1781 #else
1782 int yyparse ();
1783 #endif
1784 #else /* ! YYPARSE_PARAM */
1785 #if defined __STDC__ || defined __cplusplus
1786 int yyparse (struct asm_parser_state *state);
1787 #else
1788 int yyparse ();
1789 #endif
1790 #endif /* ! YYPARSE_PARAM */
1791
1792
1793
1794
1795
1796 /*-------------------------.
1797 | yyparse or yypush_parse. |
1798 `-------------------------*/
1799
1800 #ifdef YYPARSE_PARAM
1801 #if (defined __STDC__ || defined __C99__FUNC__ \
1802 || defined __cplusplus || defined _MSC_VER)
1803 int
1804 yyparse (void *YYPARSE_PARAM)
1805 #else
1806 int
1807 yyparse (YYPARSE_PARAM)
1808 void *YYPARSE_PARAM;
1809 #endif
1810 #else /* ! YYPARSE_PARAM */
1811 #if (defined __STDC__ || defined __C99__FUNC__ \
1812 || defined __cplusplus || defined _MSC_VER)
1813 int
1814 yyparse (struct asm_parser_state *state)
1815 #else
1816 int
1817 yyparse (state)
1818 struct asm_parser_state *state;
1819 #endif
1820 #endif
1821 {
1822 /* The lookahead symbol. */
1823 int yychar;
1824
1825 /* The semantic value of the lookahead symbol. */
1826 YYSTYPE yylval;
1827
1828 /* Location data for the lookahead symbol. */
1829 YYLTYPE yylloc;
1830
1831 /* Number of syntax errors so far. */
1832 int yynerrs;
1833
1834 int yystate;
1835 /* Number of tokens to shift before error messages enabled. */
1836 int yyerrstatus;
1837
1838 /* The stacks and their tools:
1839 `yyss': related to states.
1840 `yyvs': related to semantic values.
1841 `yyls': related to locations.
1842
1843 Refer to the stacks thru separate pointers, to allow yyoverflow
1844 to reallocate them elsewhere. */
1845
1846 /* The state stack. */
1847 yytype_int16 yyssa[YYINITDEPTH];
1848 yytype_int16 *yyss;
1849 yytype_int16 *yyssp;
1850
1851 /* The semantic value stack. */
1852 YYSTYPE yyvsa[YYINITDEPTH];
1853 YYSTYPE *yyvs;
1854 YYSTYPE *yyvsp;
1855
1856 /* The location stack. */
1857 YYLTYPE yylsa[YYINITDEPTH];
1858 YYLTYPE *yyls;
1859 YYLTYPE *yylsp;
1860
1861 /* The locations where the error started and ended. */
1862 YYLTYPE yyerror_range[2];
1863
1864 YYSIZE_T yystacksize;
1865
1866 int yyn;
1867 int yyresult;
1868 /* Lookahead token as an internal (translated) token number. */
1869 int yytoken;
1870 /* The variables used to return semantic value and location from the
1871 action routines. */
1872 YYSTYPE yyval;
1873 YYLTYPE yyloc;
1874
1875 #if YYERROR_VERBOSE
1876 /* Buffer for error messages, and its allocated size. */
1877 char yymsgbuf[128];
1878 char *yymsg = yymsgbuf;
1879 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1880 #endif
1881
1882 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1883
1884 /* The number of symbols on the RHS of the reduced rule.
1885 Keep to zero when no symbol should be popped. */
1886 int yylen = 0;
1887
1888 yytoken = 0;
1889 yyss = yyssa;
1890 yyvs = yyvsa;
1891 yyls = yylsa;
1892 yystacksize = YYINITDEPTH;
1893
1894 YYDPRINTF ((stderr, "Starting parse\n"));
1895
1896 yystate = 0;
1897 yyerrstatus = 0;
1898 yynerrs = 0;
1899 yychar = YYEMPTY; /* Cause a token to be read. */
1900
1901 /* Initialize stack pointers.
1902 Waste one element of value and location stack
1903 so that they stay on the same level as the state stack.
1904 The wasted elements are never initialized. */
1905 yyssp = yyss;
1906 yyvsp = yyvs;
1907 yylsp = yyls;
1908
1909 #if YYLTYPE_IS_TRIVIAL
1910 /* Initialize the default location before parsing starts. */
1911 yylloc.first_line = yylloc.last_line = 1;
1912 yylloc.first_column = yylloc.last_column = 1;
1913 #endif
1914
1915 goto yysetstate;
1916
1917 /*------------------------------------------------------------.
1918 | yynewstate -- Push a new state, which is found in yystate. |
1919 `------------------------------------------------------------*/
1920 yynewstate:
1921 /* In all cases, when you get here, the value and location stacks
1922 have just been pushed. So pushing a state here evens the stacks. */
1923 yyssp++;
1924
1925 yysetstate:
1926 *yyssp = yystate;
1927
1928 if (yyss + yystacksize - 1 <= yyssp)
1929 {
1930 /* Get the current used size of the three stacks, in elements. */
1931 YYSIZE_T yysize = yyssp - yyss + 1;
1932
1933 #ifdef yyoverflow
1934 {
1935 /* Give user a chance to reallocate the stack. Use copies of
1936 these so that the &'s don't force the real ones into
1937 memory. */
1938 YYSTYPE *yyvs1 = yyvs;
1939 yytype_int16 *yyss1 = yyss;
1940 YYLTYPE *yyls1 = yyls;
1941
1942 /* Each stack pointer address is followed by the size of the
1943 data in use in that stack, in bytes. This used to be a
1944 conditional around just the two extra args, but that might
1945 be undefined if yyoverflow is a macro. */
1946 yyoverflow (YY_("memory exhausted"),
1947 &yyss1, yysize * sizeof (*yyssp),
1948 &yyvs1, yysize * sizeof (*yyvsp),
1949 &yyls1, yysize * sizeof (*yylsp),
1950 &yystacksize);
1951
1952 yyls = yyls1;
1953 yyss = yyss1;
1954 yyvs = yyvs1;
1955 }
1956 #else /* no yyoverflow */
1957 # ifndef YYSTACK_RELOCATE
1958 goto yyexhaustedlab;
1959 # else
1960 /* Extend the stack our own way. */
1961 if (YYMAXDEPTH <= yystacksize)
1962 goto yyexhaustedlab;
1963 yystacksize *= 2;
1964 if (YYMAXDEPTH < yystacksize)
1965 yystacksize = YYMAXDEPTH;
1966
1967 {
1968 yytype_int16 *yyss1 = yyss;
1969 union yyalloc *yyptr =
1970 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1971 if (! yyptr)
1972 goto yyexhaustedlab;
1973 YYSTACK_RELOCATE (yyss_alloc, yyss);
1974 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1975 YYSTACK_RELOCATE (yyls_alloc, yyls);
1976 # undef YYSTACK_RELOCATE
1977 if (yyss1 != yyssa)
1978 YYSTACK_FREE (yyss1);
1979 }
1980 # endif
1981 #endif /* no yyoverflow */
1982
1983 yyssp = yyss + yysize - 1;
1984 yyvsp = yyvs + yysize - 1;
1985 yylsp = yyls + yysize - 1;
1986
1987 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1988 (unsigned long int) yystacksize));
1989
1990 if (yyss + yystacksize - 1 <= yyssp)
1991 YYABORT;
1992 }
1993
1994 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1995
1996 if (yystate == YYFINAL)
1997 YYACCEPT;
1998
1999 goto yybackup;
2000
2001 /*-----------.
2002 | yybackup. |
2003 `-----------*/
2004 yybackup:
2005
2006 /* Do appropriate processing given the current state. Read a
2007 lookahead token if we need one and don't already have one. */
2008
2009 /* First try to decide what to do without reference to lookahead token. */
2010 yyn = yypact[yystate];
2011 if (yyn == YYPACT_NINF)
2012 goto yydefault;
2013
2014 /* Not known => get a lookahead token if don't already have one. */
2015
2016 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2017 if (yychar == YYEMPTY)
2018 {
2019 YYDPRINTF ((stderr, "Reading a token: "));
2020 yychar = YYLEX;
2021 }
2022
2023 if (yychar <= YYEOF)
2024 {
2025 yychar = yytoken = YYEOF;
2026 YYDPRINTF ((stderr, "Now at end of input.\n"));
2027 }
2028 else
2029 {
2030 yytoken = YYTRANSLATE (yychar);
2031 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2032 }
2033
2034 /* If the proper action on seeing token YYTOKEN is to reduce or to
2035 detect an error, take that action. */
2036 yyn += yytoken;
2037 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2038 goto yydefault;
2039 yyn = yytable[yyn];
2040 if (yyn <= 0)
2041 {
2042 if (yyn == 0 || yyn == YYTABLE_NINF)
2043 goto yyerrlab;
2044 yyn = -yyn;
2045 goto yyreduce;
2046 }
2047
2048 /* Count tokens shifted since error; after three, turn off error
2049 status. */
2050 if (yyerrstatus)
2051 yyerrstatus--;
2052
2053 /* Shift the lookahead token. */
2054 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2055
2056 /* Discard the shifted token. */
2057 yychar = YYEMPTY;
2058
2059 yystate = yyn;
2060 *++yyvsp = yylval;
2061 *++yylsp = yylloc;
2062 goto yynewstate;
2063
2064
2065 /*-----------------------------------------------------------.
2066 | yydefault -- do the default action for the current state. |
2067 `-----------------------------------------------------------*/
2068 yydefault:
2069 yyn = yydefact[yystate];
2070 if (yyn == 0)
2071 goto yyerrlab;
2072 goto yyreduce;
2073
2074
2075 /*-----------------------------.
2076 | yyreduce -- Do a reduction. |
2077 `-----------------------------*/
2078 yyreduce:
2079 /* yyn is the number of a rule to reduce with. */
2080 yylen = yyr2[yyn];
2081
2082 /* If YYLEN is nonzero, implement the default value of the action:
2083 `$$ = $1'.
2084
2085 Otherwise, the following line sets YYVAL to garbage.
2086 This behavior is undocumented and Bison
2087 users should not rely upon it. Assigning to YYVAL
2088 unconditionally makes the parser a bit smaller, and it avoids a
2089 GCC warning that YYVAL may be used uninitialized. */
2090 yyval = yyvsp[1-yylen];
2091
2092 /* Default location. */
2093 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
2094 YY_REDUCE_PRINT (yyn);
2095 switch (yyn)
2096 {
2097 case 3:
2098
2099 /* Line 1455 of yacc.c */
2100 #line 269 "program_parse.y"
2101 {
2102 if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) {
2103 yyerror(& (yylsp[(1) - (1)]), state, "invalid fragment program header");
2104
2105 }
2106 state->mode = ARB_vertex;
2107 ;}
2108 break;
2109
2110 case 4:
2111
2112 /* Line 1455 of yacc.c */
2113 #line 277 "program_parse.y"
2114 {
2115 if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) {
2116 yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex program header");
2117 }
2118 state->mode = ARB_fragment;
2119
2120 state->option.TexRect =
2121 (state->ctx->Extensions.NV_texture_rectangle != GL_FALSE);
2122 ;}
2123 break;
2124
2125 case 7:
2126
2127 /* Line 1455 of yacc.c */
2128 #line 293 "program_parse.y"
2129 {
2130 int valid = 0;
2131
2132 if (state->mode == ARB_vertex) {
2133 valid = _mesa_ARBvp_parse_option(state, (yyvsp[(2) - (3)].string));
2134 } else if (state->mode == ARB_fragment) {
2135 valid = _mesa_ARBfp_parse_option(state, (yyvsp[(2) - (3)].string));
2136 }
2137
2138
2139 if (!valid) {
2140 const char *const err_str = (state->mode == ARB_vertex)
2141 ? "invalid ARB vertex program option"
2142 : "invalid ARB fragment program option";
2143
2144 yyerror(& (yylsp[(2) - (3)]), state, err_str);
2145 YYERROR;
2146 }
2147 ;}
2148 break;
2149
2150 case 10:
2151
2152 /* Line 1455 of yacc.c */
2153 #line 319 "program_parse.y"
2154 {
2155 if ((yyvsp[(1) - (2)].inst) != NULL) {
2156 if (state->inst_tail == NULL) {
2157 state->inst_head = (yyvsp[(1) - (2)].inst);
2158 } else {
2159 state->inst_tail->next = (yyvsp[(1) - (2)].inst);
2160 }
2161
2162 state->inst_tail = (yyvsp[(1) - (2)].inst);
2163 (yyvsp[(1) - (2)].inst)->next = NULL;
2164
2165 state->prog->NumInstructions++;
2166 }
2167 ;}
2168 break;
2169
2170 case 12:
2171
2172 /* Line 1455 of yacc.c */
2173 #line 337 "program_parse.y"
2174 {
2175 (yyval.inst) = (yyvsp[(1) - (1)].inst);
2176 state->prog->NumAluInstructions++;
2177 ;}
2178 break;
2179
2180 case 13:
2181
2182 /* Line 1455 of yacc.c */
2183 #line 342 "program_parse.y"
2184 {
2185 (yyval.inst) = (yyvsp[(1) - (1)].inst);
2186 state->prog->NumTexInstructions++;
2187 ;}
2188 break;
2189
2190 case 24:
2191
2192 /* Line 1455 of yacc.c */
2193 #line 363 "program_parse.y"
2194 {
2195 (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
2196 ;}
2197 break;
2198
2199 case 25:
2200
2201 /* Line 1455 of yacc.c */
2202 #line 369 "program_parse.y"
2203 {
2204 (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
2205 ;}
2206 break;
2207
2208 case 26:
2209
2210 /* Line 1455 of yacc.c */
2211 #line 375 "program_parse.y"
2212 {
2213 (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
2214 ;}
2215 break;
2216
2217 case 27:
2218
2219 /* Line 1455 of yacc.c */
2220 #line 381 "program_parse.y"
2221 {
2222 (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL);
2223 ;}
2224 break;
2225
2226 case 28:
2227
2228 /* Line 1455 of yacc.c */
2229 #line 388 "program_parse.y"
2230 {
2231 (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL);
2232 ;}
2233 break;
2234
2235 case 29:
2236
2237 /* Line 1455 of yacc.c */
2238 #line 395 "program_parse.y"
2239 {
2240 (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg));
2241 ;}
2242 break;
2243
2244 case 30:
2245
2246 /* Line 1455 of yacc.c */
2247 #line 401 "program_parse.y"
2248 {
2249 (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL);
2250 if ((yyval.inst) != NULL) {
2251 const GLbitfield tex_mask = (1U << (yyvsp[(6) - (8)].integer));
2252 GLbitfield shadow_tex = 0;
2253 GLbitfield target_mask = 0;
2254
2255
2256 (yyval.inst)->Base.TexSrcUnit = (yyvsp[(6) - (8)].integer);
2257
2258 if ((yyvsp[(8) - (8)].integer) < 0) {
2259 shadow_tex = tex_mask;
2260
2261 (yyval.inst)->Base.TexSrcTarget = -(yyvsp[(8) - (8)].integer);
2262 (yyval.inst)->Base.TexShadow = 1;
2263 } else {
2264 (yyval.inst)->Base.TexSrcTarget = (yyvsp[(8) - (8)].integer);
2265 }
2266
2267 target_mask = (1U << (yyval.inst)->Base.TexSrcTarget);
2268
2269 /* If this texture unit was previously accessed and that access
2270 * had a different texture target, generate an error.
2271 *
2272 * If this texture unit was previously accessed and that access
2273 * had a different shadow mode, generate an error.
2274 */
2275 if ((state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] != 0)
2276 && ((state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] != target_mask)
2277 || ((state->prog->ShadowSamplers & tex_mask)
2278 != shadow_tex))) {
2279 yyerror(& (yylsp[(8) - (8)]), state,
2280 "multiple targets used on one texture image unit");
2281 YYERROR;
2282 }
2283
2284
2285 state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] |= target_mask;
2286 state->prog->ShadowSamplers |= shadow_tex;
2287 }
2288 ;}
2289 break;
2290
2291 case 31:
2292
2293 /* Line 1455 of yacc.c */
2294 #line 445 "program_parse.y"
2295 {
2296 (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL);
2297 state->fragment.UsesKill = 1;
2298 ;}
2299 break;
2300
2301 case 32:
2302
2303 /* Line 1455 of yacc.c */
2304 #line 452 "program_parse.y"
2305 {
2306 (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (12)].temp_inst), & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg));
2307 if ((yyval.inst) != NULL) {
2308 const GLbitfield tex_mask = (1U << (yyvsp[(10) - (12)].integer));
2309 GLbitfield shadow_tex = 0;
2310 GLbitfield target_mask = 0;
2311
2312
2313 (yyval.inst)->Base.TexSrcUnit = (yyvsp[(10) - (12)].integer);
2314
2315 if ((yyvsp[(12) - (12)].integer) < 0) {
2316 shadow_tex = tex_mask;
2317
2318 (yyval.inst)->Base.TexSrcTarget = -(yyvsp[(12) - (12)].integer);
2319 (yyval.inst)->Base.TexShadow = 1;
2320 } else {
2321 (yyval.inst)->Base.TexSrcTarget = (yyvsp[(12) - (12)].integer);
2322 }
2323
2324 target_mask = (1U << (yyval.inst)->Base.TexSrcTarget);
2325
2326 /* If this texture unit was previously accessed and that access
2327 * had a different texture target, generate an error.
2328 *
2329 * If this texture unit was previously accessed and that access
2330 * had a different shadow mode, generate an error.
2331 */
2332 if ((state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] != 0)
2333 && ((state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] != target_mask)
2334 || ((state->prog->ShadowSamplers & tex_mask)
2335 != shadow_tex))) {
2336 yyerror(& (yylsp[(12) - (12)]), state,
2337 "multiple targets used on one texture image unit");
2338 YYERROR;
2339 }
2340
2341
2342 state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] |= target_mask;
2343 state->prog->ShadowSamplers |= shadow_tex;
2344 }
2345 ;}
2346 break;
2347
2348 case 33:
2349
2350 /* Line 1455 of yacc.c */
2351 #line 496 "program_parse.y"
2352 {
2353 (yyval.integer) = (yyvsp[(2) - (2)].integer);
2354 ;}
2355 break;
2356
2357 case 34:
2358
2359 /* Line 1455 of yacc.c */
2360 #line 501 "program_parse.y"
2361 { (yyval.integer) = TEXTURE_1D_INDEX; ;}
2362 break;
2363
2364 case 35:
2365
2366 /* Line 1455 of yacc.c */
2367 #line 502 "program_parse.y"
2368 { (yyval.integer) = TEXTURE_2D_INDEX; ;}
2369 break;
2370
2371 case 36:
2372
2373 /* Line 1455 of yacc.c */
2374 #line 503 "program_parse.y"
2375 { (yyval.integer) = TEXTURE_3D_INDEX; ;}
2376 break;
2377
2378 case 37:
2379
2380 /* Line 1455 of yacc.c */
2381 #line 504 "program_parse.y"
2382 { (yyval.integer) = TEXTURE_CUBE_INDEX; ;}
2383 break;
2384
2385 case 38:
2386
2387 /* Line 1455 of yacc.c */
2388 #line 505 "program_parse.y"
2389 { (yyval.integer) = TEXTURE_RECT_INDEX; ;}
2390 break;
2391
2392 case 39:
2393
2394 /* Line 1455 of yacc.c */
2395 #line 506 "program_parse.y"
2396 { (yyval.integer) = -TEXTURE_1D_INDEX; ;}
2397 break;
2398
2399 case 40:
2400
2401 /* Line 1455 of yacc.c */
2402 #line 507 "program_parse.y"
2403 { (yyval.integer) = -TEXTURE_2D_INDEX; ;}
2404 break;
2405
2406 case 41:
2407
2408 /* Line 1455 of yacc.c */
2409 #line 508 "program_parse.y"
2410 { (yyval.integer) = -TEXTURE_RECT_INDEX; ;}
2411 break;
2412
2413 case 42:
2414
2415 /* Line 1455 of yacc.c */
2416 #line 509 "program_parse.y"
2417 { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;}
2418 break;
2419
2420 case 43:
2421
2422 /* Line 1455 of yacc.c */
2423 #line 510 "program_parse.y"
2424 { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;}
2425 break;
2426
2427 case 44:
2428
2429 /* Line 1455 of yacc.c */
2430 #line 511 "program_parse.y"
2431 { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;}
2432 break;
2433
2434 case 45:
2435
2436 /* Line 1455 of yacc.c */
2437 #line 512 "program_parse.y"
2438 { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;}
2439 break;
2440
2441 case 46:
2442
2443 /* Line 1455 of yacc.c */
2444 #line 516 "program_parse.y"
2445 {
2446 /* FIXME: Is this correct? Should the extenedSwizzle be applied
2447 * FIXME: to the existing swizzle?
2448 */
2449 (yyvsp[(4) - (6)].src_reg).Base.Swizzle = (yyvsp[(6) - (6)].swiz_mask).swizzle;
2450 (yyvsp[(4) - (6)].src_reg).Base.Negate = (yyvsp[(6) - (6)].swiz_mask).mask;
2451
2452 (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), NULL, NULL);
2453 ;}
2454 break;
2455
2456 case 47:
2457
2458 /* Line 1455 of yacc.c */
2459 #line 528 "program_parse.y"
2460 {
2461 (yyval.src_reg) = (yyvsp[(2) - (2)].src_reg);
2462
2463 if ((yyvsp[(1) - (2)].negate)) {
2464 (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
2465 }
2466 ;}
2467 break;
2468
2469 case 48:
2470
2471 /* Line 1455 of yacc.c */
2472 #line 536 "program_parse.y"
2473 {
2474 (yyval.src_reg) = (yyvsp[(3) - (4)].src_reg);
2475
2476 if (!state->option.NV_fragment) {
2477 yyerror(& (yylsp[(2) - (4)]), state, "unexpected character '|'");
2478 YYERROR;
2479 }
2480
2481 if ((yyvsp[(1) - (4)].negate)) {
2482 (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
2483 }
2484
2485 (yyval.src_reg).Base.Abs = 1;
2486 ;}
2487 break;
2488
2489 case 49:
2490
2491 /* Line 1455 of yacc.c */
2492 #line 553 "program_parse.y"
2493 {
2494 (yyval.src_reg) = (yyvsp[(1) - (2)].src_reg);
2495
2496 (yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
2497 (yyvsp[(2) - (2)].swiz_mask).swizzle);
2498 ;}
2499 break;
2500
2501 case 50:
2502
2503 /* Line 1455 of yacc.c */
2504 #line 560 "program_parse.y"
2505 {
2506 struct asm_symbol temp_sym;
2507
2508 if (!state->option.NV_fragment) {
2509 yyerror(& (yylsp[(1) - (1)]), state, "expected scalar suffix");
2510 YYERROR;
2511 }
2512
2513 memset(& temp_sym, 0, sizeof(temp_sym));
2514 temp_sym.param_binding_begin = ~0;
2515 initialize_symbol_from_const(state->prog, & temp_sym, & (yyvsp[(1) - (1)].vector));
2516
2517 init_src_reg(& (yyval.src_reg));
2518 (yyval.src_reg).Base.File = PROGRAM_CONSTANT;
2519 (yyval.src_reg).Base.Index = temp_sym.param_binding_begin;
2520 ;}
2521 break;
2522
2523 case 51:
2524
2525 /* Line 1455 of yacc.c */
2526 #line 579 "program_parse.y"
2527 {
2528 (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg);
2529
2530 if ((yyvsp[(1) - (3)].negate)) {
2531 (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
2532 }
2533
2534 (yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
2535 (yyvsp[(3) - (3)].swiz_mask).swizzle);
2536 ;}
2537 break;
2538
2539 case 52:
2540
2541 /* Line 1455 of yacc.c */
2542 #line 590 "program_parse.y"
2543 {
2544 (yyval.src_reg) = (yyvsp[(3) - (5)].src_reg);
2545
2546 if (!state->option.NV_fragment) {
2547 yyerror(& (yylsp[(2) - (5)]), state, "unexpected character '|'");
2548 YYERROR;
2549 }
2550
2551 if ((yyvsp[(1) - (5)].negate)) {
2552 (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
2553 }
2554
2555 (yyval.src_reg).Base.Abs = 1;
2556 (yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
2557 (yyvsp[(4) - (5)].swiz_mask).swizzle);
2558 ;}
2559 break;
2560
2561 case 53:
2562
2563 /* Line 1455 of yacc.c */
2564 #line 610 "program_parse.y"
2565 {
2566 (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg);
2567 (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask;
2568
2569 if ((yyval.dst_reg).File == PROGRAM_OUTPUT) {
2570 /* Technically speaking, this should check that it is in
2571 * vertex program mode. However, PositionInvariant can never be
2572 * set in fragment program mode, so it is somewhat irrelevant.
2573 */
2574 if (state->option.PositionInvariant
2575 && ((yyval.dst_reg).Index == VERT_RESULT_HPOS)) {
2576 yyerror(& (yylsp[(1) - (2)]), state, "position-invariant programs cannot "
2577 "write position");
2578 YYERROR;
2579 }
2580
2581 state->prog->OutputsWritten |= (1U << (yyval.dst_reg).Index);
2582 }
2583 ;}
2584 break;
2585
2586 case 54:
2587
2588 /* Line 1455 of yacc.c */
2589 #line 632 "program_parse.y"
2590 {
2591 init_dst_reg(& (yyval.dst_reg));
2592 (yyval.dst_reg).File = PROGRAM_ADDRESS;
2593 (yyval.dst_reg).Index = 0;
2594 (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask;
2595 ;}
2596 break;
2597
2598 case 55:
2599
2600 /* Line 1455 of yacc.c */
2601 #line 641 "program_parse.y"
2602 {
2603 const unsigned xyzw_valid =
2604 ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0)
2605 | ((yyvsp[(3) - (7)].ext_swizzle).xyzw_valid << 1)
2606 | ((yyvsp[(5) - (7)].ext_swizzle).xyzw_valid << 2)
2607 | ((yyvsp[(7) - (7)].ext_swizzle).xyzw_valid << 3);
2608 const unsigned rgba_valid =
2609 ((yyvsp[(1) - (7)].ext_swizzle).rgba_valid << 0)
2610 | ((yyvsp[(3) - (7)].ext_swizzle).rgba_valid << 1)
2611 | ((yyvsp[(5) - (7)].ext_swizzle).rgba_valid << 2)
2612 | ((yyvsp[(7) - (7)].ext_swizzle).rgba_valid << 3);
2613
2614 /* All of the swizzle components have to be valid in either RGBA
2615 * or XYZW. Note that 0 and 1 are valid in both, so both masks
2616 * can have some bits set.
2617 *
2618 * We somewhat deviate from the spec here. It would be really hard
2619 * to figure out which component is the error, and there probably
2620 * isn't a lot of benefit.
2621 */
2622 if ((rgba_valid != 0x0f) && (xyzw_valid != 0x0f)) {
2623 yyerror(& (yylsp[(1) - (7)]), state, "cannot combine RGBA and XYZW swizzle "
2624 "components");
2625 YYERROR;
2626 }
2627
2628 (yyval.swiz_mask).swizzle = MAKE_SWIZZLE4((yyvsp[(1) - (7)].ext_swizzle).swz, (yyvsp[(3) - (7)].ext_swizzle).swz, (yyvsp[(5) - (7)].ext_swizzle).swz, (yyvsp[(7) - (7)].ext_swizzle).swz);
2629 (yyval.swiz_mask).mask = ((yyvsp[(1) - (7)].ext_swizzle).negate) | ((yyvsp[(3) - (7)].ext_swizzle).negate << 1) | ((yyvsp[(5) - (7)].ext_swizzle).negate << 2)
2630 | ((yyvsp[(7) - (7)].ext_swizzle).negate << 3);
2631 ;}
2632 break;
2633
2634 case 56:
2635
2636 /* Line 1455 of yacc.c */
2637 #line 674 "program_parse.y"
2638 {
2639 (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle);
2640 (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0;
2641 ;}
2642 break;
2643
2644 case 57:
2645
2646 /* Line 1455 of yacc.c */
2647 #line 681 "program_parse.y"
2648 {
2649 if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) {
2650 yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
2651 YYERROR;
2652 }
2653
2654 (yyval.ext_swizzle).swz = ((yyvsp[(1) - (1)].integer) == 0) ? SWIZZLE_ZERO : SWIZZLE_ONE;
2655
2656 /* 0 and 1 are valid for both RGBA swizzle names and XYZW
2657 * swizzle names.
2658 */
2659 (yyval.ext_swizzle).xyzw_valid = 1;
2660 (yyval.ext_swizzle).rgba_valid = 1;
2661 ;}
2662 break;
2663
2664 case 58:
2665
2666 /* Line 1455 of yacc.c */
2667 #line 696 "program_parse.y"
2668 {
2669 if (strlen((yyvsp[(1) - (1)].string)) > 1) {
2670 yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
2671 YYERROR;
2672 }
2673
2674 switch ((yyvsp[(1) - (1)].string)[0]) {
2675 case 'x':
2676 (yyval.ext_swizzle).swz = SWIZZLE_X;
2677 (yyval.ext_swizzle).xyzw_valid = 1;
2678 break;
2679 case 'y':
2680 (yyval.ext_swizzle).swz = SWIZZLE_Y;
2681 (yyval.ext_swizzle).xyzw_valid = 1;
2682 break;
2683 case 'z':
2684 (yyval.ext_swizzle).swz = SWIZZLE_Z;
2685 (yyval.ext_swizzle).xyzw_valid = 1;
2686 break;
2687 case 'w':
2688 (yyval.ext_swizzle).swz = SWIZZLE_W;
2689 (yyval.ext_swizzle).xyzw_valid = 1;
2690 break;
2691
2692 case 'r':
2693 (yyval.ext_swizzle).swz = SWIZZLE_X;
2694 (yyval.ext_swizzle).rgba_valid = 1;
2695 break;
2696 case 'g':
2697 (yyval.ext_swizzle).swz = SWIZZLE_Y;
2698 (yyval.ext_swizzle).rgba_valid = 1;
2699 break;
2700 case 'b':
2701 (yyval.ext_swizzle).swz = SWIZZLE_Z;
2702 (yyval.ext_swizzle).rgba_valid = 1;
2703 break;
2704 case 'a':
2705 (yyval.ext_swizzle).swz = SWIZZLE_W;
2706 (yyval.ext_swizzle).rgba_valid = 1;
2707 break;
2708
2709 default:
2710 yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
2711 YYERROR;
2712 break;
2713 }
2714 ;}
2715 break;
2716
2717 case 59:
2718
2719 /* Line 1455 of yacc.c */
2720 #line 746 "program_parse.y"
2721 {
2722 struct asm_symbol *const s = (struct asm_symbol *)
2723 _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
2724
2725 if (s == NULL) {
2726 yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
2727 YYERROR;
2728 } else if ((s->type != at_param) && (s->type != at_temp)
2729 && (s->type != at_attrib)) {
2730 yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
2731 YYERROR;
2732 } else if ((s->type == at_param) && s->param_is_array) {
2733 yyerror(& (yylsp[(1) - (1)]), state, "non-array access to array PARAM");
2734 YYERROR;
2735 }
2736
2737 init_src_reg(& (yyval.src_reg));
2738 switch (s->type) {
2739 case at_temp:
2740 (yyval.src_reg).Base.File = PROGRAM_TEMPORARY;
2741 (yyval.src_reg).Base.Index = s->temp_binding;
2742 break;
2743 case at_param:
2744 (yyval.src_reg).Base.File = s->param_binding_type;
2745 (yyval.src_reg).Base.Index = s->param_binding_begin;
2746 break;
2747 case at_attrib:
2748 (yyval.src_reg).Base.File = PROGRAM_INPUT;
2749 (yyval.src_reg).Base.Index = s->attrib_binding;
2750 state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index);
2751
2752 if (!validate_inputs(& (yylsp[(1) - (1)]), state)) {
2753 YYERROR;
2754 }
2755 break;
2756
2757 default:
2758 YYERROR;
2759 break;
2760 }
2761 ;}
2762 break;
2763
2764 case 60:
2765
2766 /* Line 1455 of yacc.c */
2767 #line 788 "program_parse.y"
2768 {
2769 init_src_reg(& (yyval.src_reg));
2770 (yyval.src_reg).Base.File = PROGRAM_INPUT;
2771 (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].attrib);
2772 state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index);
2773
2774 if (!validate_inputs(& (yylsp[(1) - (1)]), state)) {
2775 YYERROR;
2776 }
2777 ;}
2778 break;
2779
2780 case 61:
2781
2782 /* Line 1455 of yacc.c */
2783 #line 799 "program_parse.y"
2784 {
2785 if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr
2786 && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) {
2787 yyerror(& (yylsp[(3) - (4)]), state, "out of bounds array access");
2788 YYERROR;
2789 }
2790
2791 init_src_reg(& (yyval.src_reg));
2792 (yyval.src_reg).Base.File = (yyvsp[(1) - (4)].sym)->param_binding_type;
2793
2794 if ((yyvsp[(3) - (4)].src_reg).Base.RelAddr) {
2795 (yyvsp[(1) - (4)].sym)->param_accessed_indirectly = 1;
2796
2797 (yyval.src_reg).Base.RelAddr = 1;
2798 (yyval.src_reg).Base.Index = (yyvsp[(3) - (4)].src_reg).Base.Index;
2799 (yyval.src_reg).Symbol = (yyvsp[(1) - (4)].sym);
2800 } else {
2801 (yyval.src_reg).Base.Index = (yyvsp[(1) - (4)].sym)->param_binding_begin + (yyvsp[(3) - (4)].src_reg).Base.Index;
2802 }
2803 ;}
2804 break;
2805
2806 case 62:
2807
2808 /* Line 1455 of yacc.c */
2809 #line 820 "program_parse.y"
2810 {
2811 init_src_reg(& (yyval.src_reg));
2812 (yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL)
2813 ? (yyvsp[(1) - (1)].temp_sym).param_binding_type
2814 : PROGRAM_CONSTANT;
2815 (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].temp_sym).param_binding_begin;
2816 ;}
2817 break;
2818
2819 case 63:
2820
2821 /* Line 1455 of yacc.c */
2822 #line 830 "program_parse.y"
2823 {
2824 init_dst_reg(& (yyval.dst_reg));
2825 (yyval.dst_reg).File = PROGRAM_OUTPUT;
2826 (yyval.dst_reg).Index = (yyvsp[(1) - (1)].result);
2827 ;}
2828 break;
2829
2830 case 64:
2831
2832 /* Line 1455 of yacc.c */
2833 #line 836 "program_parse.y"
2834 {
2835 struct asm_symbol *const s = (struct asm_symbol *)
2836 _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
2837
2838 if (s == NULL) {
2839 yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
2840 YYERROR;
2841 } else if ((s->type != at_output) && (s->type != at_temp)) {
2842 yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
2843 YYERROR;
2844 }
2845
2846 init_dst_reg(& (yyval.dst_reg));
2847 switch (s->type) {
2848 case at_temp:
2849 (yyval.dst_reg).File = PROGRAM_TEMPORARY;
2850 (yyval.dst_reg).Index = s->temp_binding;
2851 break;
2852 case at_output:
2853 (yyval.dst_reg).File = PROGRAM_OUTPUT;
2854 (yyval.dst_reg).Index = s->output_binding;
2855 break;
2856 default:
2857 (yyval.dst_reg).File = s->param_binding_type;
2858 (yyval.dst_reg).Index = s->param_binding_begin;
2859 break;
2860 }
2861 ;}
2862 break;
2863
2864 case 65:
2865
2866 /* Line 1455 of yacc.c */
2867 #line 867 "program_parse.y"
2868 {
2869 struct asm_symbol *const s = (struct asm_symbol *)
2870 _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
2871
2872 if (s == NULL) {
2873 yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
2874 YYERROR;
2875 } else if ((s->type != at_param) || !s->param_is_array) {
2876 yyerror(& (yylsp[(1) - (1)]), state, "array access to non-PARAM variable");
2877 YYERROR;
2878 } else {
2879 (yyval.sym) = s;
2880 }
2881 ;}
2882 break;
2883
2884 case 68:
2885
2886 /* Line 1455 of yacc.c */
2887 #line 886 "program_parse.y"
2888 {
2889 init_src_reg(& (yyval.src_reg));
2890 (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer);
2891 ;}
2892 break;
2893
2894 case 69:
2895
2896 /* Line 1455 of yacc.c */
2897 #line 893 "program_parse.y"
2898 {
2899 /* FINISHME: Add support for multiple address registers.
2900 */
2901 /* FINISHME: Add support for 4-component address registers.
2902 */
2903 init_src_reg(& (yyval.src_reg));
2904 (yyval.src_reg).Base.RelAddr = 1;
2905 (yyval.src_reg).Base.Index = (yyvsp[(3) - (3)].integer);
2906 ;}
2907 break;
2908
2909 case 70:
2910
2911 /* Line 1455 of yacc.c */
2912 #line 904 "program_parse.y"
2913 { (yyval.integer) = 0; ;}
2914 break;
2915
2916 case 71:
2917
2918 /* Line 1455 of yacc.c */
2919 #line 905 "program_parse.y"
2920 { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;}
2921 break;
2922
2923 case 72:
2924
2925 /* Line 1455 of yacc.c */
2926 #line 906 "program_parse.y"
2927 { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;}
2928 break;
2929
2930 case 73:
2931
2932 /* Line 1455 of yacc.c */
2933 #line 910 "program_parse.y"
2934 {
2935 if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) {
2936 yyerror(& (yylsp[(1) - (1)]), state,
2937 "relative address offset too large (positive)");
2938 YYERROR;
2939 } else {
2940 (yyval.integer) = (yyvsp[(1) - (1)].integer);
2941 }
2942 ;}
2943 break;
2944
2945 case 74:
2946
2947 /* Line 1455 of yacc.c */
2948 #line 922 "program_parse.y"
2949 {
2950 if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) {
2951 yyerror(& (yylsp[(1) - (1)]), state,
2952 "relative address offset too large (negative)");
2953 YYERROR;
2954 } else {
2955 (yyval.integer) = (yyvsp[(1) - (1)].integer);
2956 }
2957 ;}
2958 break;
2959
2960 case 75:
2961
2962 /* Line 1455 of yacc.c */
2963 #line 934 "program_parse.y"
2964 {
2965 struct asm_symbol *const s = (struct asm_symbol *)
2966 _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
2967
2968 if (s == NULL) {
2969 yyerror(& (yylsp[(1) - (1)]), state, "invalid array member");
2970 YYERROR;
2971 } else if (s->type != at_address) {
2972 yyerror(& (yylsp[(1) - (1)]), state,
2973 "invalid variable for indexed array access");
2974 YYERROR;
2975 } else {
2976 (yyval.sym) = s;
2977 }
2978 ;}
2979 break;
2980
2981 case 76:
2982
2983 /* Line 1455 of yacc.c */
2984 #line 952 "program_parse.y"
2985 {
2986 if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) {
2987 yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector");
2988 YYERROR;
2989 } else {
2990 (yyval.swiz_mask) = (yyvsp[(1) - (1)].swiz_mask);
2991 }
2992 ;}
2993 break;
2994
2995 case 77:
2996
2997 /* Line 1455 of yacc.c */
2998 #line 963 "program_parse.y"
2999 {
3000 if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) {
3001 yyerror(& (yylsp[(1) - (1)]), state,
3002 "address register write mask must be \".x\"");
3003 YYERROR;
3004 } else {
3005 (yyval.swiz_mask) = (yyvsp[(1) - (1)].swiz_mask);
3006 }
3007 ;}
3008 break;
3009
3010 case 82:
3011
3012 /* Line 1455 of yacc.c */
3013 #line 979 "program_parse.y"
3014 { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;}
3015 break;
3016
3017 case 87:
3018
3019 /* Line 1455 of yacc.c */
3020 #line 983 "program_parse.y"
3021 { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;}
3022 break;
3023
3024 case 94:
3025
3026 /* Line 1455 of yacc.c */
3027 #line 995 "program_parse.y"
3028 {
3029 struct asm_symbol *const s =
3030 declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)]));
3031
3032 if (s == NULL) {
3033 YYERROR;
3034 } else {
3035 s->attrib_binding = (yyvsp[(4) - (4)].attrib);
3036 state->InputsBound |= (1U << s->attrib_binding);
3037
3038 if (!validate_inputs(& (yylsp[(4) - (4)]), state)) {
3039 YYERROR;
3040 }
3041 }
3042 ;}
3043 break;
3044
3045 case 95:
3046
3047 /* Line 1455 of yacc.c */
3048 #line 1013 "program_parse.y"
3049 {
3050 (yyval.attrib) = (yyvsp[(2) - (2)].attrib);
3051 ;}
3052 break;
3053
3054 case 96:
3055
3056 /* Line 1455 of yacc.c */
3057 #line 1017 "program_parse.y"
3058 {
3059 (yyval.attrib) = (yyvsp[(2) - (2)].attrib);
3060 ;}
3061 break;
3062
3063 case 97:
3064
3065 /* Line 1455 of yacc.c */
3066 #line 1023 "program_parse.y"
3067 {
3068 (yyval.attrib) = VERT_ATTRIB_POS;
3069 ;}
3070 break;
3071
3072 case 98:
3073
3074 /* Line 1455 of yacc.c */
3075 #line 1027 "program_parse.y"
3076 {
3077 (yyval.attrib) = VERT_ATTRIB_WEIGHT;
3078 ;}
3079 break;
3080
3081 case 99:
3082
3083 /* Line 1455 of yacc.c */
3084 #line 1031 "program_parse.y"
3085 {
3086 (yyval.attrib) = VERT_ATTRIB_NORMAL;
3087 ;}
3088 break;
3089
3090 case 100:
3091
3092 /* Line 1455 of yacc.c */
3093 #line 1035 "program_parse.y"
3094 {
3095 if (!state->ctx->Extensions.EXT_secondary_color) {
3096 yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported");
3097 YYERROR;
3098 }
3099
3100 (yyval.attrib) = VERT_ATTRIB_COLOR0 + (yyvsp[(2) - (2)].integer);
3101 ;}
3102 break;
3103
3104 case 101:
3105
3106 /* Line 1455 of yacc.c */
3107 #line 1044 "program_parse.y"
3108 {
3109 if (!state->ctx->Extensions.EXT_fog_coord) {
3110 yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported");
3111 YYERROR;
3112 }
3113
3114 (yyval.attrib) = VERT_ATTRIB_FOG;
3115 ;}
3116 break;
3117
3118 case 102:
3119
3120 /* Line 1455 of yacc.c */
3121 #line 1053 "program_parse.y"
3122 {
3123 (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer);
3124 ;}
3125 break;
3126
3127 case 103:
3128
3129 /* Line 1455 of yacc.c */
3130 #line 1057 "program_parse.y"
3131 {
3132 yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported");
3133 YYERROR;
3134 ;}
3135 break;
3136
3137 case 104:
3138
3139 /* Line 1455 of yacc.c */
3140 #line 1062 "program_parse.y"
3141 {
3142 (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer);
3143 ;}
3144 break;
3145
3146 case 105:
3147
3148 /* Line 1455 of yacc.c */
3149 #line 1068 "program_parse.y"
3150 {
3151 if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) {
3152 yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference");
3153 YYERROR;
3154 }
3155
3156 (yyval.integer) = (yyvsp[(1) - (1)].integer);
3157 ;}
3158 break;
3159
3160 case 109:
3161
3162 /* Line 1455 of yacc.c */
3163 #line 1082 "program_parse.y"
3164 {
3165 (yyval.attrib) = FRAG_ATTRIB_WPOS;
3166 ;}
3167 break;
3168
3169 case 110:
3170
3171 /* Line 1455 of yacc.c */
3172 #line 1086 "program_parse.y"
3173 {
3174 (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer);
3175 ;}
3176 break;
3177
3178 case 111:
3179
3180 /* Line 1455 of yacc.c */
3181 #line 1090 "program_parse.y"
3182 {
3183 (yyval.attrib) = FRAG_ATTRIB_FOGC;
3184 ;}
3185 break;
3186
3187 case 112:
3188
3189 /* Line 1455 of yacc.c */
3190 #line 1094 "program_parse.y"
3191 {
3192 (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer);
3193 ;}
3194 break;
3195
3196 case 115:
3197
3198 /* Line 1455 of yacc.c */
3199 #line 1102 "program_parse.y"
3200 {
3201 struct asm_symbol *const s =
3202 declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)]));
3203
3204 if (s == NULL) {
3205 YYERROR;
3206 } else {
3207 s->param_binding_type = (yyvsp[(3) - (3)].temp_sym).param_binding_type;
3208 s->param_binding_begin = (yyvsp[(3) - (3)].temp_sym).param_binding_begin;
3209 s->param_binding_length = (yyvsp[(3) - (3)].temp_sym).param_binding_length;
3210 s->param_is_array = 0;
3211 }
3212 ;}
3213 break;
3214
3215 case 116:
3216
3217 /* Line 1455 of yacc.c */
3218 #line 1118 "program_parse.y"
3219 {
3220 if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) {
3221 yyerror(& (yylsp[(4) - (6)]), state,
3222 "parameter array size and number of bindings must match");
3223 YYERROR;
3224 } else {
3225 struct asm_symbol *const s =
3226 declare_variable(state, (yyvsp[(2) - (6)].string), (yyvsp[(6) - (6)].temp_sym).type, & (yylsp[(2) - (6)]));
3227
3228 if (s == NULL) {
3229 YYERROR;
3230 } else {
3231 s->param_binding_type = (yyvsp[(6) - (6)].temp_sym).param_binding_type;
3232 s->param_binding_begin = (yyvsp[(6) - (6)].temp_sym).param_binding_begin;
3233 s->param_binding_length = (yyvsp[(6) - (6)].temp_sym).param_binding_length;
3234 s->param_is_array = 1;
3235 }
3236 }
3237 ;}
3238 break;
3239
3240 case 117:
3241
3242 /* Line 1455 of yacc.c */
3243 #line 1140 "program_parse.y"
3244 {
3245 (yyval.integer) = 0;
3246 ;}
3247 break;
3248
3249 case 118:
3250
3251 /* Line 1455 of yacc.c */
3252 #line 1144 "program_parse.y"
3253 {
3254 if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) {
3255 yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size");
3256 YYERROR;
3257 } else {
3258 (yyval.integer) = (yyvsp[(1) - (1)].integer);
3259 }
3260 ;}
3261 break;
3262
3263 case 119:
3264
3265 /* Line 1455 of yacc.c */
3266 #line 1155 "program_parse.y"
3267 {
3268 (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym);
3269 ;}
3270 break;
3271
3272 case 120:
3273
3274 /* Line 1455 of yacc.c */
3275 #line 1161 "program_parse.y"
3276 {
3277 (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym);
3278 ;}
3279 break;
3280
3281 case 122:
3282
3283 /* Line 1455 of yacc.c */
3284 #line 1168 "program_parse.y"
3285 {
3286 (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length;
3287 (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym);
3288 ;}
3289 break;
3290
3291 case 123:
3292
3293 /* Line 1455 of yacc.c */
3294 #line 1175 "program_parse.y"
3295 {
3296 memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
3297 (yyval.temp_sym).param_binding_begin = ~0;
3298 initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
3299 ;}
3300 break;
3301
3302 case 124:
3303
3304 /* Line 1455 of yacc.c */
3305 #line 1181 "program_parse.y"
3306 {
3307 memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
3308 (yyval.temp_sym).param_binding_begin = ~0;
3309 initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
3310 ;}
3311 break;
3312
3313 case 125:
3314
3315 /* Line 1455 of yacc.c */
3316 #line 1187 "program_parse.y"
3317 {
3318 memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
3319 (yyval.temp_sym).param_binding_begin = ~0;
3320 initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[(1) - (1)].vector));
3321 ;}
3322 break;
3323
3324 case 126:
3325
3326 /* Line 1455 of yacc.c */
3327 #line 1195 "program_parse.y"
3328 {
3329 memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
3330 (yyval.temp_sym).param_binding_begin = ~0;
3331 initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
3332 ;}
3333 break;
3334
3335 case 127:
3336
3337 /* Line 1455 of yacc.c */
3338 #line 1201 "program_parse.y"
3339 {
3340 memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
3341 (yyval.temp_sym).param_binding_begin = ~0;
3342 initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
3343 ;}
3344 break;
3345
3346 case 128:
3347
3348 /* Line 1455 of yacc.c */
3349 #line 1207 "program_parse.y"
3350 {
3351 memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
3352 (yyval.temp_sym).param_binding_begin = ~0;
3353 initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[(1) - (1)].vector));
3354 ;}
3355 break;
3356
3357 case 129:
3358
3359 /* Line 1455 of yacc.c */
3360 #line 1215 "program_parse.y"
3361 {
3362 memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
3363 (yyval.temp_sym).param_binding_begin = ~0;
3364 initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
3365 ;}
3366 break;
3367
3368 case 130:
3369
3370 /* Line 1455 of yacc.c */
3371 #line 1221 "program_parse.y"
3372 {
3373 memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
3374 (yyval.temp_sym).param_binding_begin = ~0;
3375 initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
3376 ;}
3377 break;
3378
3379 case 131:
3380
3381 /* Line 1455 of yacc.c */
3382 #line 1227 "program_parse.y"
3383 {
3384 memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
3385 (yyval.temp_sym).param_binding_begin = ~0;
3386 initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[(1) - (1)].vector));
3387 ;}
3388 break;
3389
3390 case 132:
3391
3392 /* Line 1455 of yacc.c */
3393 #line 1234 "program_parse.y"
3394 { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;}
3395 break;
3396
3397 case 133:
3398
3399 /* Line 1455 of yacc.c */
3400 #line 1235 "program_parse.y"
3401 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3402 break;
3403
3404 case 134:
3405
3406 /* Line 1455 of yacc.c */
3407 #line 1238 "program_parse.y"
3408 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3409 break;
3410
3411 case 135:
3412
3413 /* Line 1455 of yacc.c */
3414 #line 1239 "program_parse.y"
3415 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3416 break;
3417
3418 case 136:
3419
3420 /* Line 1455 of yacc.c */
3421 #line 1240 "program_parse.y"
3422 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3423 break;
3424
3425 case 137:
3426
3427 /* Line 1455 of yacc.c */
3428 #line 1241 "program_parse.y"
3429 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3430 break;
3431
3432 case 138:
3433
3434 /* Line 1455 of yacc.c */
3435 #line 1242 "program_parse.y"
3436 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3437 break;
3438
3439 case 139:
3440
3441 /* Line 1455 of yacc.c */
3442 #line 1243 "program_parse.y"
3443 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3444 break;
3445
3446 case 140:
3447
3448 /* Line 1455 of yacc.c */
3449 #line 1244 "program_parse.y"
3450 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3451 break;
3452
3453 case 141:
3454
3455 /* Line 1455 of yacc.c */
3456 #line 1245 "program_parse.y"
3457 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3458 break;
3459
3460 case 142:
3461
3462 /* Line 1455 of yacc.c */
3463 #line 1246 "program_parse.y"
3464 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3465 break;
3466
3467 case 143:
3468
3469 /* Line 1455 of yacc.c */
3470 #line 1247 "program_parse.y"
3471 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3472 break;
3473
3474 case 144:
3475
3476 /* Line 1455 of yacc.c */
3477 #line 1248 "program_parse.y"
3478 { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
3479 break;
3480
3481 case 145:
3482
3483 /* Line 1455 of yacc.c */
3484 #line 1252 "program_parse.y"
3485 {
3486 memset((yyval.state), 0, sizeof((yyval.state)));
3487 (yyval.state)[0] = STATE_MATERIAL;
3488 (yyval.state)[1] = (yyvsp[(2) - (3)].integer);
3489 (yyval.state)[2] = (yyvsp[(3) - (3)].integer);
3490 ;}
3491 break;
3492
3493 case 146:
3494
3495 /* Line 1455 of yacc.c */
3496 #line 1261 "program_parse.y"
3497 {
3498 (yyval.integer) = (yyvsp[(1) - (1)].integer);
3499 ;}
3500 break;
3501
3502 case 147:
3503
3504 /* Line 1455 of yacc.c */
3505 #line 1265 "program_parse.y"
3506 {
3507 (yyval.integer) = STATE_EMISSION;
3508 ;}
3509 break;
3510
3511 case 148:
3512
3513 /* Line 1455 of yacc.c */
3514 #line 1269 "program_parse.y"
3515 {
3516 (yyval.integer) = STATE_SHININESS;
3517 ;}
3518 break;
3519
3520 case 149:
3521
3522 /* Line 1455 of yacc.c */
3523 #line 1275 "program_parse.y"
3524 {
3525 memset((yyval.state), 0, sizeof((yyval.state)));
3526 (yyval.state)[0] = STATE_LIGHT;
3527 (yyval.state)[1] = (yyvsp[(3) - (5)].integer);
3528 (yyval.state)[2] = (yyvsp[(5) - (5)].integer);
3529 ;}
3530 break;
3531
3532 case 150:
3533
3534 /* Line 1455 of yacc.c */
3535 #line 1284 "program_parse.y"
3536 {
3537 (yyval.integer) = (yyvsp[(1) - (1)].integer);
3538 ;}
3539 break;
3540
3541 case 151:
3542
3543 /* Line 1455 of yacc.c */
3544 #line 1288 "program_parse.y"
3545 {
3546 (yyval.integer) = STATE_POSITION;
3547 ;}
3548 break;
3549
3550 case 152:
3551
3552 /* Line 1455 of yacc.c */
3553 #line 1292 "program_parse.y"
3554 {
3555 if (!state->ctx->Extensions.EXT_point_parameters) {
3556 yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported");
3557 YYERROR;
3558 }
3559
3560 (yyval.integer) = STATE_ATTENUATION;
3561 ;}
3562 break;
3563
3564 case 153:
3565
3566 /* Line 1455 of yacc.c */
3567 #line 1301 "program_parse.y"
3568 {
3569 (yyval.integer) = (yyvsp[(2) - (2)].integer);
3570 ;}
3571 break;
3572
3573 case 154:
3574
3575 /* Line 1455 of yacc.c */
3576 #line 1305 "program_parse.y"
3577 {
3578 (yyval.integer) = STATE_HALF_VECTOR;
3579 ;}
3580 break;
3581
3582 case 155:
3583
3584 /* Line 1455 of yacc.c */
3585 #line 1311 "program_parse.y"
3586 {
3587 (yyval.integer) = STATE_SPOT_DIRECTION;
3588 ;}
3589 break;
3590
3591 case 156:
3592
3593 /* Line 1455 of yacc.c */
3594 #line 1317 "program_parse.y"
3595 {
3596 (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0];
3597 (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1];
3598 ;}
3599 break;
3600
3601 case 157:
3602
3603 /* Line 1455 of yacc.c */
3604 #line 1324 "program_parse.y"
3605 {
3606 memset((yyval.state), 0, sizeof((yyval.state)));
3607 (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT;
3608 ;}
3609 break;
3610
3611 case 158:
3612
3613 /* Line 1455 of yacc.c */
3614 #line 1329 "program_parse.y"
3615 {
3616 memset((yyval.state), 0, sizeof((yyval.state)));
3617 (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR;
3618 (yyval.state)[1] = (yyvsp[(1) - (2)].integer);
3619 ;}
3620 break;
3621
3622 case 159:
3623
3624 /* Line 1455 of yacc.c */
3625 #line 1337 "program_parse.y"
3626 {
3627 memset((yyval.state), 0, sizeof((yyval.state)));
3628 (yyval.state)[0] = STATE_LIGHTPROD;
3629 (yyval.state)[1] = (yyvsp[(3) - (6)].integer);
3630 (yyval.state)[2] = (yyvsp[(5) - (6)].integer);
3631 (yyval.state)[3] = (yyvsp[(6) - (6)].integer);
3632 ;}
3633 break;
3634
3635 case 161:
3636
3637 /* Line 1455 of yacc.c */
3638 #line 1349 "program_parse.y"
3639 {
3640 memset((yyval.state), 0, sizeof((yyval.state)));
3641 (yyval.state)[0] = (yyvsp[(3) - (3)].integer);
3642 (yyval.state)[1] = (yyvsp[(2) - (3)].integer);
3643 ;}
3644 break;
3645
3646 case 162:
3647
3648 /* Line 1455 of yacc.c */
3649 #line 1357 "program_parse.y"
3650 {
3651 (yyval.integer) = STATE_TEXENV_COLOR;
3652 ;}
3653 break;
3654
3655 case 163:
3656
3657 /* Line 1455 of yacc.c */
3658 #line 1363 "program_parse.y"
3659 {
3660 (yyval.integer) = STATE_AMBIENT;
3661 ;}
3662 break;
3663
3664 case 164:
3665
3666 /* Line 1455 of yacc.c */
3667 #line 1367 "program_parse.y"
3668 {
3669 (yyval.integer) = STATE_DIFFUSE;
3670 ;}
3671 break;
3672
3673 case 165:
3674
3675 /* Line 1455 of yacc.c */
3676 #line 1371 "program_parse.y"
3677 {
3678 (yyval.integer) = STATE_SPECULAR;
3679 ;}
3680 break;
3681
3682 case 166:
3683
3684 /* Line 1455 of yacc.c */
3685 #line 1377 "program_parse.y"
3686 {
3687 if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) {
3688 yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector");
3689 YYERROR;
3690 }
3691
3692 (yyval.integer) = (yyvsp[(1) - (1)].integer);
3693 ;}
3694 break;
3695
3696 case 167:
3697
3698 /* Line 1455 of yacc.c */
3699 #line 1388 "program_parse.y"
3700 {
3701 memset((yyval.state), 0, sizeof((yyval.state)));
3702 (yyval.state)[0] = STATE_TEXGEN;
3703 (yyval.state)[1] = (yyvsp[(2) - (4)].integer);
3704 (yyval.state)[2] = (yyvsp[(3) - (4)].integer) + (yyvsp[(4) - (4)].integer);
3705 ;}
3706 break;
3707
3708 case 168:
3709
3710 /* Line 1455 of yacc.c */
3711 #line 1397 "program_parse.y"
3712 {
3713 (yyval.integer) = STATE_TEXGEN_EYE_S;
3714 ;}
3715 break;
3716
3717 case 169:
3718
3719 /* Line 1455 of yacc.c */
3720 #line 1401 "program_parse.y"
3721 {
3722 (yyval.integer) = STATE_TEXGEN_OBJECT_S;
3723 ;}
3724 break;
3725
3726 case 170:
3727
3728 /* Line 1455 of yacc.c */
3729 #line 1406 "program_parse.y"
3730 {
3731 (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S;
3732 ;}
3733 break;
3734
3735 case 171:
3736
3737 /* Line 1455 of yacc.c */
3738 #line 1410 "program_parse.y"
3739 {
3740 (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S;
3741 ;}
3742 break;
3743
3744 case 172:
3745
3746 /* Line 1455 of yacc.c */
3747 #line 1414 "program_parse.y"
3748 {
3749 (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S;
3750 ;}
3751 break;
3752
3753 case 173:
3754
3755 /* Line 1455 of yacc.c */
3756 #line 1418 "program_parse.y"
3757 {
3758 (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S;
3759 ;}
3760 break;
3761
3762 case 174:
3763
3764 /* Line 1455 of yacc.c */
3765 #line 1424 "program_parse.y"
3766 {
3767 memset((yyval.state), 0, sizeof((yyval.state)));
3768 (yyval.state)[0] = (yyvsp[(2) - (2)].integer);
3769 ;}
3770 break;
3771
3772 case 175:
3773
3774 /* Line 1455 of yacc.c */
3775 #line 1431 "program_parse.y"
3776 {
3777 (yyval.integer) = STATE_FOG_COLOR;
3778 ;}
3779 break;
3780
3781 case 176:
3782
3783 /* Line 1455 of yacc.c */
3784 #line 1435 "program_parse.y"
3785 {
3786 (yyval.integer) = STATE_FOG_PARAMS;
3787 ;}
3788 break;
3789
3790 case 177:
3791
3792 /* Line 1455 of yacc.c */
3793 #line 1441 "program_parse.y"
3794 {
3795 memset((yyval.state), 0, sizeof((yyval.state)));
3796 (yyval.state)[0] = STATE_CLIPPLANE;
3797 (yyval.state)[1] = (yyvsp[(3) - (5)].integer);
3798 ;}
3799 break;
3800
3801 case 178:
3802
3803 /* Line 1455 of yacc.c */
3804 #line 1449 "program_parse.y"
3805 {
3806 if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) {
3807 yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector");
3808 YYERROR;
3809 }
3810
3811 (yyval.integer) = (yyvsp[(1) - (1)].integer);
3812 ;}
3813 break;
3814
3815 case 179:
3816
3817 /* Line 1455 of yacc.c */
3818 #line 1460 "program_parse.y"
3819 {
3820 memset((yyval.state), 0, sizeof((yyval.state)));
3821 (yyval.state)[0] = (yyvsp[(2) - (2)].integer);
3822 ;}
3823 break;
3824
3825 case 180:
3826
3827 /* Line 1455 of yacc.c */
3828 #line 1467 "program_parse.y"
3829 {
3830 (yyval.integer) = STATE_POINT_SIZE;
3831 ;}
3832 break;
3833
3834 case 181:
3835
3836 /* Line 1455 of yacc.c */
3837 #line 1471 "program_parse.y"
3838 {
3839 (yyval.integer) = STATE_POINT_ATTENUATION;
3840 ;}
3841 break;
3842
3843 case 182:
3844
3845 /* Line 1455 of yacc.c */
3846 #line 1477 "program_parse.y"
3847 {
3848 (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0];
3849 (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1];
3850 (yyval.state)[2] = (yyvsp[(4) - (5)].integer);
3851 (yyval.state)[3] = (yyvsp[(4) - (5)].integer);
3852 (yyval.state)[4] = (yyvsp[(1) - (5)].state)[2];
3853 ;}
3854 break;
3855
3856 case 183:
3857
3858 /* Line 1455 of yacc.c */
3859 #line 1487 "program_parse.y"
3860 {
3861 (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0];
3862 (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1];
3863 (yyval.state)[2] = (yyvsp[(2) - (2)].state)[2];
3864 (yyval.state)[3] = (yyvsp[(2) - (2)].state)[3];
3865 (yyval.state)[4] = (yyvsp[(1) - (2)].state)[2];
3866 ;}
3867 break;
3868
3869 case 184:
3870
3871 /* Line 1455 of yacc.c */
3872 #line 1497 "program_parse.y"
3873 {
3874 (yyval.state)[2] = 0;
3875 (yyval.state)[3] = 3;
3876 ;}
3877 break;
3878
3879 case 185:
3880
3881 /* Line 1455 of yacc.c */
3882 #line 1502 "program_parse.y"
3883 {
3884 /* It seems logical that the matrix row range specifier would have
3885 * to specify a range or more than one row (i.e., $5 > $3).
3886 * However, the ARB_vertex_program spec says "a program will fail
3887 * to load if <a> is greater than <b>." This means that $3 == $5
3888 * is valid.
3889 */
3890 if ((yyvsp[(3) - (6)].integer) > (yyvsp[(5) - (6)].integer)) {
3891 yyerror(& (yylsp[(3) - (6)]), state, "invalid matrix row range");
3892 YYERROR;
3893 }
3894
3895 (yyval.state)[2] = (yyvsp[(3) - (6)].integer);
3896 (yyval.state)[3] = (yyvsp[(5) - (6)].integer);
3897 ;}
3898 break;
3899
3900 case 186:
3901
3902 /* Line 1455 of yacc.c */
3903 #line 1520 "program_parse.y"
3904 {
3905 (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0];
3906 (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1];
3907 (yyval.state)[2] = (yyvsp[(3) - (3)].integer);
3908 ;}
3909 break;
3910
3911 case 187:
3912
3913 /* Line 1455 of yacc.c */
3914 #line 1528 "program_parse.y"
3915 {
3916 (yyval.integer) = 0;
3917 ;}
3918 break;
3919
3920 case 188:
3921
3922 /* Line 1455 of yacc.c */
3923 #line 1532 "program_parse.y"
3924 {
3925 (yyval.integer) = (yyvsp[(1) - (1)].integer);
3926 ;}
3927 break;
3928
3929 case 189:
3930
3931 /* Line 1455 of yacc.c */
3932 #line 1538 "program_parse.y"
3933 {
3934 (yyval.integer) = STATE_MATRIX_INVERSE;
3935 ;}
3936 break;
3937
3938 case 190:
3939
3940 /* Line 1455 of yacc.c */
3941 #line 1542 "program_parse.y"
3942 {
3943 (yyval.integer) = STATE_MATRIX_TRANSPOSE;
3944 ;}
3945 break;
3946
3947 case 191:
3948
3949 /* Line 1455 of yacc.c */
3950 #line 1546 "program_parse.y"
3951 {
3952 (yyval.integer) = STATE_MATRIX_INVTRANS;
3953 ;}
3954 break;
3955
3956 case 192:
3957
3958 /* Line 1455 of yacc.c */
3959 #line 1552 "program_parse.y"
3960 {
3961 if ((yyvsp[(1) - (1)].integer) > 3) {
3962 yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference");
3963 YYERROR;
3964 }
3965
3966 (yyval.integer) = (yyvsp[(1) - (1)].integer);
3967 ;}
3968 break;
3969
3970 case 193:
3971
3972 /* Line 1455 of yacc.c */
3973 #line 1563 "program_parse.y"
3974 {
3975 (yyval.state)[0] = STATE_MODELVIEW_MATRIX;
3976 (yyval.state)[1] = (yyvsp[(2) - (2)].integer);
3977 ;}
3978 break;
3979
3980 case 194:
3981
3982 /* Line 1455 of yacc.c */
3983 #line 1568 "program_parse.y"
3984 {
3985 (yyval.state)[0] = STATE_PROJECTION_MATRIX;
3986 (yyval.state)[1] = 0;
3987 ;}
3988 break;
3989
3990 case 195:
3991
3992 /* Line 1455 of yacc.c */
3993 #line 1573 "program_parse.y"
3994 {
3995 (yyval.state)[0] = STATE_MVP_MATRIX;
3996 (yyval.state)[1] = 0;
3997 ;}
3998 break;
3999
4000 case 196:
4001
4002 /* Line 1455 of yacc.c */
4003 #line 1578 "program_parse.y"
4004 {
4005 (yyval.state)[0] = STATE_TEXTURE_MATRIX;
4006 (yyval.state)[1] = (yyvsp[(2) - (2)].integer);
4007 ;}
4008 break;
4009
4010 case 197:
4011
4012 /* Line 1455 of yacc.c */
4013 #line 1583 "program_parse.y"
4014 {
4015 yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported");
4016 YYERROR;
4017 ;}
4018 break;
4019
4020 case 198:
4021
4022 /* Line 1455 of yacc.c */
4023 #line 1588 "program_parse.y"
4024 {
4025 (yyval.state)[0] = STATE_PROGRAM_MATRIX;
4026 (yyval.state)[1] = (yyvsp[(3) - (4)].integer);
4027 ;}
4028 break;
4029
4030 case 199:
4031
4032 /* Line 1455 of yacc.c */
4033 #line 1595 "program_parse.y"
4034 {
4035 (yyval.integer) = 0;
4036 ;}
4037 break;
4038
4039 case 200:
4040
4041 /* Line 1455 of yacc.c */
4042 #line 1599 "program_parse.y"
4043 {
4044 (yyval.integer) = (yyvsp[(1) - (1)].integer);
4045 ;}
4046 break;
4047
4048 case 201:
4049
4050 /* Line 1455 of yacc.c */
4051 #line 1604 "program_parse.y"
4052 {
4053 /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix
4054 * zero is valid.
4055 */
4056 if ((yyvsp[(1) - (1)].integer) != 0) {
4057 yyerror(& (yylsp[(1) - (1)]), state, "invalid modelview matrix index");
4058 YYERROR;
4059 }
4060
4061 (yyval.integer) = (yyvsp[(1) - (1)].integer);
4062 ;}
4063 break;
4064
4065 case 202:
4066
4067 /* Line 1455 of yacc.c */
4068 #line 1617 "program_parse.y"
4069 {
4070 /* Since GL_ARB_matrix_palette isn't supported, just let any value
4071 * through here. The error will be generated later.
4072 */
4073 (yyval.integer) = (yyvsp[(1) - (1)].integer);
4074 ;}
4075 break;
4076
4077 case 203:
4078
4079 /* Line 1455 of yacc.c */
4080 #line 1625 "program_parse.y"
4081 {
4082 if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) {
4083 yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector");
4084 YYERROR;
4085 }
4086
4087 (yyval.integer) = (yyvsp[(1) - (1)].integer);
4088 ;}
4089 break;
4090
4091 case 204:
4092
4093 /* Line 1455 of yacc.c */
4094 #line 1636 "program_parse.y"
4095 {
4096 memset((yyval.state), 0, sizeof((yyval.state)));
4097 (yyval.state)[0] = STATE_DEPTH_RANGE;
4098 ;}
4099 break;
4100
4101 case 209:
4102
4103 /* Line 1455 of yacc.c */
4104 #line 1648 "program_parse.y"
4105 {
4106 memset((yyval.state), 0, sizeof((yyval.state)));
4107 (yyval.state)[0] = state->state_param_enum;
4108 (yyval.state)[1] = STATE_ENV;
4109 (yyval.state)[2] = (yyvsp[(4) - (5)].state)[0];
4110 (yyval.state)[3] = (yyvsp[(4) - (5)].state)[1];
4111 ;}
4112 break;
4113
4114 case 210:
4115
4116 /* Line 1455 of yacc.c */
4117 #line 1658 "program_parse.y"
4118 {
4119 (yyval.state)[0] = (yyvsp[(1) - (1)].integer);
4120 (yyval.state)[1] = (yyvsp[(1) - (1)].integer);
4121 ;}
4122 break;
4123
4124 case 211:
4125
4126 /* Line 1455 of yacc.c */
4127 #line 1663 "program_parse.y"
4128 {
4129 (yyval.state)[0] = (yyvsp[(1) - (3)].integer);
4130 (yyval.state)[1] = (yyvsp[(3) - (3)].integer);
4131 ;}
4132 break;
4133
4134 case 212:
4135
4136 /* Line 1455 of yacc.c */
4137 #line 1670 "program_parse.y"
4138 {
4139 memset((yyval.state), 0, sizeof((yyval.state)));
4140 (yyval.state)[0] = state->state_param_enum;
4141 (yyval.state)[1] = STATE_ENV;
4142 (yyval.state)[2] = (yyvsp[(4) - (5)].integer);
4143 (yyval.state)[3] = (yyvsp[(4) - (5)].integer);
4144 ;}
4145 break;
4146
4147 case 213:
4148
4149 /* Line 1455 of yacc.c */
4150 #line 1680 "program_parse.y"
4151 {
4152 memset((yyval.state), 0, sizeof((yyval.state)));
4153 (yyval.state)[0] = state->state_param_enum;
4154 (yyval.state)[1] = STATE_LOCAL;
4155 (yyval.state)[2] = (yyvsp[(4) - (5)].state)[0];
4156 (yyval.state)[3] = (yyvsp[(4) - (5)].state)[1];
4157 ;}
4158 break;
4159
4160 case 214:
4161
4162 /* Line 1455 of yacc.c */
4163 #line 1689 "program_parse.y"
4164 {
4165 (yyval.state)[0] = (yyvsp[(1) - (1)].integer);
4166 (yyval.state)[1] = (yyvsp[(1) - (1)].integer);
4167 ;}
4168 break;
4169
4170 case 215:
4171
4172 /* Line 1455 of yacc.c */
4173 #line 1694 "program_parse.y"
4174 {
4175 (yyval.state)[0] = (yyvsp[(1) - (3)].integer);
4176 (yyval.state)[1] = (yyvsp[(3) - (3)].integer);
4177 ;}
4178 break;
4179
4180 case 216:
4181
4182 /* Line 1455 of yacc.c */
4183 #line 1701 "program_parse.y"
4184 {
4185 memset((yyval.state), 0, sizeof((yyval.state)));
4186 (yyval.state)[0] = state->state_param_enum;
4187 (yyval.state)[1] = STATE_LOCAL;
4188 (yyval.state)[2] = (yyvsp[(4) - (5)].integer);
4189 (yyval.state)[3] = (yyvsp[(4) - (5)].integer);
4190 ;}
4191 break;
4192
4193 case 217:
4194
4195 /* Line 1455 of yacc.c */
4196 #line 1711 "program_parse.y"
4197 {
4198 if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) {
4199 yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference");
4200 YYERROR;
4201 }
4202 (yyval.integer) = (yyvsp[(1) - (1)].integer);
4203 ;}
4204 break;
4205
4206 case 218:
4207
4208 /* Line 1455 of yacc.c */
4209 #line 1721 "program_parse.y"
4210 {
4211 if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) {
4212 yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference");
4213 YYERROR;
4214 }
4215 (yyval.integer) = (yyvsp[(1) - (1)].integer);
4216 ;}
4217 break;
4218
4219 case 223:
4220
4221 /* Line 1455 of yacc.c */
4222 #line 1736 "program_parse.y"
4223 {
4224 (yyval.vector).count = 4;
4225 (yyval.vector).data[0] = (yyvsp[(1) - (1)].real);
4226 (yyval.vector).data[1] = (yyvsp[(1) - (1)].real);
4227 (yyval.vector).data[2] = (yyvsp[(1) - (1)].real);
4228 (yyval.vector).data[3] = (yyvsp[(1) - (1)].real);
4229 ;}
4230 break;
4231
4232 case 224:
4233
4234 /* Line 1455 of yacc.c */
4235 #line 1746 "program_parse.y"
4236 {
4237 (yyval.vector).count = 1;
4238 (yyval.vector).data[0] = (yyvsp[(1) - (1)].real);
4239 (yyval.vector).data[1] = (yyvsp[(1) - (1)].real);
4240 (yyval.vector).data[2] = (yyvsp[(1) - (1)].real);
4241 (yyval.vector).data[3] = (yyvsp[(1) - (1)].real);
4242 ;}
4243 break;
4244
4245 case 225:
4246
4247 /* Line 1455 of yacc.c */
4248 #line 1754 "program_parse.y"
4249 {
4250 (yyval.vector).count = 1;
4251 (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer);
4252 (yyval.vector).data[1] = (float) (yyvsp[(1) - (1)].integer);
4253 (yyval.vector).data[2] = (float) (yyvsp[(1) - (1)].integer);
4254 (yyval.vector).data[3] = (float) (yyvsp[(1) - (1)].integer);
4255 ;}
4256 break;
4257
4258 case 226:
4259
4260 /* Line 1455 of yacc.c */
4261 #line 1764 "program_parse.y"
4262 {
4263 (yyval.vector).count = 4;
4264 (yyval.vector).data[0] = (yyvsp[(2) - (3)].real);
4265 (yyval.vector).data[1] = 0.0f;
4266 (yyval.vector).data[2] = 0.0f;
4267 (yyval.vector).data[3] = 1.0f;
4268 ;}
4269 break;
4270
4271 case 227:
4272
4273 /* Line 1455 of yacc.c */
4274 #line 1772 "program_parse.y"
4275 {
4276 (yyval.vector).count = 4;
4277 (yyval.vector).data[0] = (yyvsp[(2) - (5)].real);
4278 (yyval.vector).data[1] = (yyvsp[(4) - (5)].real);
4279 (yyval.vector).data[2] = 0.0f;
4280 (yyval.vector).data[3] = 1.0f;
4281 ;}
4282 break;
4283
4284 case 228:
4285
4286 /* Line 1455 of yacc.c */
4287 #line 1781 "program_parse.y"
4288 {
4289 (yyval.vector).count = 4;
4290 (yyval.vector).data[0] = (yyvsp[(2) - (7)].real);
4291 (yyval.vector).data[1] = (yyvsp[(4) - (7)].real);
4292 (yyval.vector).data[2] = (yyvsp[(6) - (7)].real);
4293 (yyval.vector).data[3] = 1.0f;
4294 ;}
4295 break;
4296
4297 case 229:
4298
4299 /* Line 1455 of yacc.c */
4300 #line 1790 "program_parse.y"
4301 {
4302 (yyval.vector).count = 4;
4303 (yyval.vector).data[0] = (yyvsp[(2) - (9)].real);
4304 (yyval.vector).data[1] = (yyvsp[(4) - (9)].real);
4305 (yyval.vector).data[2] = (yyvsp[(6) - (9)].real);
4306 (yyval.vector).data[3] = (yyvsp[(8) - (9)].real);
4307 ;}
4308 break;
4309
4310 case 230:
4311
4312 /* Line 1455 of yacc.c */
4313 #line 1800 "program_parse.y"
4314 {
4315 (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real);
4316 ;}
4317 break;
4318
4319 case 231:
4320
4321 /* Line 1455 of yacc.c */
4322 #line 1804 "program_parse.y"
4323 {
4324 (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer));
4325 ;}
4326 break;
4327
4328 case 232:
4329
4330 /* Line 1455 of yacc.c */
4331 #line 1809 "program_parse.y"
4332 { (yyval.negate) = FALSE; ;}
4333 break;
4334
4335 case 233:
4336
4337 /* Line 1455 of yacc.c */
4338 #line 1810 "program_parse.y"
4339 { (yyval.negate) = TRUE; ;}
4340 break;
4341
4342 case 234:
4343
4344 /* Line 1455 of yacc.c */
4345 #line 1811 "program_parse.y"
4346 { (yyval.negate) = FALSE; ;}
4347 break;
4348
4349 case 235:
4350
4351 /* Line 1455 of yacc.c */
4352 #line 1814 "program_parse.y"
4353 { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;}
4354 break;
4355
4356 case 237:
4357
4358 /* Line 1455 of yacc.c */
4359 #line 1817 "program_parse.y"
4360 { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;}
4361 break;
4362
4363 case 239:
4364
4365 /* Line 1455 of yacc.c */
4366 #line 1821 "program_parse.y"
4367 {
4368 if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) {
4369 YYERROR;
4370 }
4371 ;}
4372 break;
4373
4374 case 240:
4375
4376 /* Line 1455 of yacc.c */
4377 #line 1827 "program_parse.y"
4378 {
4379 if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) {
4380 YYERROR;
4381 }
4382 ;}
4383 break;
4384
4385 case 241:
4386
4387 /* Line 1455 of yacc.c */
4388 #line 1835 "program_parse.y"
4389 {
4390 struct asm_symbol *const s =
4391 declare_variable(state, (yyvsp[(2) - (4)].string), at_output, & (yylsp[(2) - (4)]));
4392
4393 if (s == NULL) {
4394 YYERROR;
4395 } else {
4396 s->output_binding = (yyvsp[(4) - (4)].result);
4397 }
4398 ;}
4399 break;
4400
4401 case 242:
4402
4403 /* Line 1455 of yacc.c */
4404 #line 1848 "program_parse.y"
4405 {
4406 if (state->mode == ARB_vertex) {
4407 (yyval.result) = VERT_RESULT_HPOS;
4408 } else {
4409 yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
4410 YYERROR;
4411 }
4412 ;}
4413 break;
4414
4415 case 243:
4416
4417 /* Line 1455 of yacc.c */
4418 #line 1857 "program_parse.y"
4419 {
4420 if (state->mode == ARB_vertex) {
4421 (yyval.result) = VERT_RESULT_FOGC;
4422 } else {
4423 yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
4424 YYERROR;
4425 }
4426 ;}
4427 break;
4428
4429 case 244:
4430
4431 /* Line 1455 of yacc.c */
4432 #line 1866 "program_parse.y"
4433 {
4434 (yyval.result) = (yyvsp[(2) - (2)].result);
4435 ;}
4436 break;
4437
4438 case 245:
4439
4440 /* Line 1455 of yacc.c */
4441 #line 1870 "program_parse.y"
4442 {
4443 if (state->mode == ARB_vertex) {
4444 (yyval.result) = VERT_RESULT_PSIZ;
4445 } else {
4446 yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
4447 YYERROR;
4448 }
4449 ;}
4450 break;
4451
4452 case 246:
4453
4454 /* Line 1455 of yacc.c */
4455 #line 1879 "program_parse.y"
4456 {
4457 if (state->mode == ARB_vertex) {
4458 (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer);
4459 } else {
4460 yyerror(& (yylsp[(2) - (3)]), state, "invalid program result name");
4461 YYERROR;
4462 }
4463 ;}
4464 break;
4465
4466 case 247:
4467
4468 /* Line 1455 of yacc.c */
4469 #line 1888 "program_parse.y"
4470 {
4471 if (state->mode == ARB_fragment) {
4472 (yyval.result) = FRAG_RESULT_DEPTH;
4473 } else {
4474 yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
4475 YYERROR;
4476 }
4477 ;}
4478 break;
4479
4480 case 248:
4481
4482 /* Line 1455 of yacc.c */
4483 #line 1899 "program_parse.y"
4484 {
4485 (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer);
4486 ;}
4487 break;
4488
4489 case 249:
4490
4491 /* Line 1455 of yacc.c */
4492 #line 1905 "program_parse.y"
4493 {
4494 (yyval.integer) = (state->mode == ARB_vertex)
4495 ? VERT_RESULT_COL0
4496 : FRAG_RESULT_COLOR;
4497 ;}
4498 break;
4499
4500 case 250:
4501
4502 /* Line 1455 of yacc.c */
4503 #line 1911 "program_parse.y"
4504 {
4505 if (state->mode == ARB_vertex) {
4506 (yyval.integer) = VERT_RESULT_COL0;
4507 } else {
4508 yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
4509 YYERROR;
4510 }
4511 ;}
4512 break;
4513
4514 case 251:
4515
4516 /* Line 1455 of yacc.c */
4517 #line 1920 "program_parse.y"
4518 {
4519 if (state->mode == ARB_vertex) {
4520 (yyval.integer) = VERT_RESULT_BFC0;
4521 } else {
4522 yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
4523 YYERROR;
4524 }
4525 ;}
4526 break;
4527
4528 case 252:
4529
4530 /* Line 1455 of yacc.c */
4531 #line 1931 "program_parse.y"
4532 {
4533 (yyval.integer) = 0;
4534 ;}
4535 break;
4536
4537 case 253:
4538
4539 /* Line 1455 of yacc.c */
4540 #line 1935 "program_parse.y"
4541 {
4542 if (state->mode == ARB_vertex) {
4543 (yyval.integer) = 0;
4544 } else {
4545 yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
4546 YYERROR;
4547 }
4548 ;}
4549 break;
4550
4551 case 254:
4552
4553 /* Line 1455 of yacc.c */
4554 #line 1944 "program_parse.y"
4555 {
4556 if (state->mode == ARB_vertex) {
4557 (yyval.integer) = 1;
4558 } else {
4559 yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
4560 YYERROR;
4561 }
4562 ;}
4563 break;
4564
4565 case 255:
4566
4567 /* Line 1455 of yacc.c */
4568 #line 1954 "program_parse.y"
4569 { (yyval.integer) = 0; ;}
4570 break;
4571
4572 case 256:
4573
4574 /* Line 1455 of yacc.c */
4575 #line 1955 "program_parse.y"
4576 { (yyval.integer) = 0; ;}
4577 break;
4578
4579 case 257:
4580
4581 /* Line 1455 of yacc.c */
4582 #line 1956 "program_parse.y"
4583 { (yyval.integer) = 1; ;}
4584 break;
4585
4586 case 258:
4587
4588 /* Line 1455 of yacc.c */
4589 #line 1959 "program_parse.y"
4590 { (yyval.integer) = 0; ;}
4591 break;
4592
4593 case 259:
4594
4595 /* Line 1455 of yacc.c */
4596 #line 1960 "program_parse.y"
4597 { (yyval.integer) = 0; ;}
4598 break;
4599
4600 case 260:
4601
4602 /* Line 1455 of yacc.c */
4603 #line 1961 "program_parse.y"
4604 { (yyval.integer) = 1; ;}
4605 break;
4606
4607 case 261:
4608
4609 /* Line 1455 of yacc.c */
4610 #line 1964 "program_parse.y"
4611 { (yyval.integer) = 0; ;}
4612 break;
4613
4614 case 262:
4615
4616 /* Line 1455 of yacc.c */
4617 #line 1965 "program_parse.y"
4618 { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
4619 break;
4620
4621 case 263:
4622
4623 /* Line 1455 of yacc.c */
4624 #line 1968 "program_parse.y"
4625 { (yyval.integer) = 0; ;}
4626 break;
4627
4628 case 264:
4629
4630 /* Line 1455 of yacc.c */
4631 #line 1969 "program_parse.y"
4632 { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
4633 break;
4634
4635 case 265:
4636
4637 /* Line 1455 of yacc.c */
4638 #line 1972 "program_parse.y"
4639 { (yyval.integer) = 0; ;}
4640 break;
4641
4642 case 266:
4643
4644 /* Line 1455 of yacc.c */
4645 #line 1973 "program_parse.y"
4646 { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
4647 break;
4648
4649 case 267:
4650
4651 /* Line 1455 of yacc.c */
4652 #line 1977 "program_parse.y"
4653 {
4654 if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) {
4655 yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector");
4656 YYERROR;
4657 }
4658
4659 (yyval.integer) = (yyvsp[(1) - (1)].integer);
4660 ;}
4661 break;
4662
4663 case 268:
4664
4665 /* Line 1455 of yacc.c */
4666 #line 1988 "program_parse.y"
4667 {
4668 if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) {
4669 yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector");
4670 YYERROR;
4671 }
4672
4673 (yyval.integer) = (yyvsp[(1) - (1)].integer);
4674 ;}
4675 break;
4676
4677 case 269:
4678
4679 /* Line 1455 of yacc.c */
4680 #line 1999 "program_parse.y"
4681 {
4682 if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) {
4683 yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector");
4684 YYERROR;
4685 }
4686
4687 (yyval.integer) = (yyvsp[(1) - (1)].integer);
4688 ;}
4689 break;
4690
4691 case 270:
4692
4693 /* Line 1455 of yacc.c */
4694 #line 2010 "program_parse.y"
4695 {
4696 struct asm_symbol *exist = (struct asm_symbol *)
4697 _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string));
4698 struct asm_symbol *target = (struct asm_symbol *)
4699 _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(4) - (4)].string));
4700
4701
4702 if (exist != NULL) {
4703 yyerror(& (yylsp[(2) - (4)]), state, "redeclared identifier");
4704 YYERROR;
4705 } else if (target == NULL) {
4706 yyerror(& (yylsp[(4) - (4)]), state,
4707 "undefined variable binding in ALIAS statement");
4708 YYERROR;
4709 } else {
4710 _mesa_symbol_table_add_symbol(state->st, 0, (yyvsp[(2) - (4)].string), target);
4711 }
4712 ;}
4713 break;
4714
4715
4716
4717 /* Line 1455 of yacc.c */
4718 #line 4719 "program_parse.tab.c"
4719 default: break;
4720 }
4721 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4722
4723 YYPOPSTACK (yylen);
4724 yylen = 0;
4725 YY_STACK_PRINT (yyss, yyssp);
4726
4727 *++yyvsp = yyval;
4728 *++yylsp = yyloc;
4729
4730 /* Now `shift' the result of the reduction. Determine what state
4731 that goes to, based on the state we popped back to and the rule
4732 number reduced by. */
4733
4734 yyn = yyr1[yyn];
4735
4736 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4737 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4738 yystate = yytable[yystate];
4739 else
4740 yystate = yydefgoto[yyn - YYNTOKENS];
4741
4742 goto yynewstate;
4743
4744
4745 /*------------------------------------.
4746 | yyerrlab -- here on detecting error |
4747 `------------------------------------*/
4748 yyerrlab:
4749 /* If not already recovering from an error, report this error. */
4750 if (!yyerrstatus)
4751 {
4752 ++yynerrs;
4753 #if ! YYERROR_VERBOSE
4754 yyerror (&yylloc, state, YY_("syntax error"));
4755 #else
4756 {
4757 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4758 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4759 {
4760 YYSIZE_T yyalloc = 2 * yysize;
4761 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4762 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4763 if (yymsg != yymsgbuf)
4764 YYSTACK_FREE (yymsg);
4765 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4766 if (yymsg)
4767 yymsg_alloc = yyalloc;
4768 else
4769 {
4770 yymsg = yymsgbuf;
4771 yymsg_alloc = sizeof yymsgbuf;
4772 }
4773 }
4774
4775 if (0 < yysize && yysize <= yymsg_alloc)
4776 {
4777 (void) yysyntax_error (yymsg, yystate, yychar);
4778 yyerror (&yylloc, state, yymsg);
4779 }
4780 else
4781 {
4782 yyerror (&yylloc, state, YY_("syntax error"));
4783 if (yysize != 0)
4784 goto yyexhaustedlab;
4785 }
4786 }
4787 #endif
4788 }
4789
4790 yyerror_range[0] = yylloc;
4791
4792 if (yyerrstatus == 3)
4793 {
4794 /* If just tried and failed to reuse lookahead token after an
4795 error, discard it. */
4796
4797 if (yychar <= YYEOF)
4798 {
4799 /* Return failure if at end of input. */
4800 if (yychar == YYEOF)
4801 YYABORT;
4802 }
4803 else
4804 {
4805 yydestruct ("Error: discarding",
4806 yytoken, &yylval, &yylloc, state);
4807 yychar = YYEMPTY;
4808 }
4809 }
4810
4811 /* Else will try to reuse lookahead token after shifting the error
4812 token. */
4813 goto yyerrlab1;
4814
4815
4816 /*---------------------------------------------------.
4817 | yyerrorlab -- error raised explicitly by YYERROR. |
4818 `---------------------------------------------------*/
4819 yyerrorlab:
4820
4821 /* Pacify compilers like GCC when the user code never invokes
4822 YYERROR and the label yyerrorlab therefore never appears in user
4823 code. */
4824 if (/*CONSTCOND*/ 0)
4825 goto yyerrorlab;
4826
4827 yyerror_range[0] = yylsp[1-yylen];
4828 /* Do not reclaim the symbols of the rule which action triggered
4829 this YYERROR. */
4830 YYPOPSTACK (yylen);
4831 yylen = 0;
4832 YY_STACK_PRINT (yyss, yyssp);
4833 yystate = *yyssp;
4834 goto yyerrlab1;
4835
4836
4837 /*-------------------------------------------------------------.
4838 | yyerrlab1 -- common code for both syntax error and YYERROR. |
4839 `-------------------------------------------------------------*/
4840 yyerrlab1:
4841 yyerrstatus = 3; /* Each real token shifted decrements this. */
4842
4843 for (;;)
4844 {
4845 yyn = yypact[yystate];
4846 if (yyn != YYPACT_NINF)
4847 {
4848 yyn += YYTERROR;
4849 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4850 {
4851 yyn = yytable[yyn];
4852 if (0 < yyn)
4853 break;
4854 }
4855 }
4856
4857 /* Pop the current state because it cannot handle the error token. */
4858 if (yyssp == yyss)
4859 YYABORT;
4860
4861 yyerror_range[0] = *yylsp;
4862 yydestruct ("Error: popping",
4863 yystos[yystate], yyvsp, yylsp, state);
4864 YYPOPSTACK (1);
4865 yystate = *yyssp;
4866 YY_STACK_PRINT (yyss, yyssp);
4867 }
4868
4869 *++yyvsp = yylval;
4870
4871 yyerror_range[1] = yylloc;
4872 /* Using YYLLOC is tempting, but would change the location of
4873 the lookahead. YYLOC is available though. */
4874 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
4875 *++yylsp = yyloc;
4876
4877 /* Shift the error token. */
4878 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4879
4880 yystate = yyn;
4881 goto yynewstate;
4882
4883
4884 /*-------------------------------------.
4885 | yyacceptlab -- YYACCEPT comes here. |
4886 `-------------------------------------*/
4887 yyacceptlab:
4888 yyresult = 0;
4889 goto yyreturn;
4890
4891 /*-----------------------------------.
4892 | yyabortlab -- YYABORT comes here. |
4893 `-----------------------------------*/
4894 yyabortlab:
4895 yyresult = 1;
4896 goto yyreturn;
4897
4898 #if !defined(yyoverflow) || YYERROR_VERBOSE
4899 /*-------------------------------------------------.
4900 | yyexhaustedlab -- memory exhaustion comes here. |
4901 `-------------------------------------------------*/
4902 yyexhaustedlab:
4903 yyerror (&yylloc, state, YY_("memory exhausted"));
4904 yyresult = 2;
4905 /* Fall through. */
4906 #endif
4907
4908 yyreturn:
4909 if (yychar != YYEMPTY)
4910 yydestruct ("Cleanup: discarding lookahead",
4911 yytoken, &yylval, &yylloc, state);
4912 /* Do not reclaim the symbols of the rule which action triggered
4913 this YYABORT or YYACCEPT. */
4914 YYPOPSTACK (yylen);
4915 YY_STACK_PRINT (yyss, yyssp);
4916 while (yyssp != yyss)
4917 {
4918 yydestruct ("Cleanup: popping",
4919 yystos[*yyssp], yyvsp, yylsp, state);
4920 YYPOPSTACK (1);
4921 }
4922 #ifndef yyoverflow
4923 if (yyss != yyssa)
4924 YYSTACK_FREE (yyss);
4925 #endif
4926 #if YYERROR_VERBOSE
4927 if (yymsg != yymsgbuf)
4928 YYSTACK_FREE (yymsg);
4929 #endif
4930 /* Make sure YYID is used. */
4931 return YYID (yyresult);
4932 }
4933
4934
4935
4936 /* Line 1675 of yacc.c */
4937 #line 2030 "program_parse.y"
4938
4939
4940 void
4941 asm_instruction_set_operands(struct asm_instruction *inst,
4942 const struct prog_dst_register *dst,
4943 const struct asm_src_register *src0,
4944 const struct asm_src_register *src1,
4945 const struct asm_src_register *src2)
4946 {
4947 /* In the core ARB extensions only the KIL instruction doesn't have a
4948 * destination register.
4949 */
4950 if (dst == NULL) {
4951 init_dst_reg(& inst->Base.DstReg);
4952 } else {
4953 inst->Base.DstReg = *dst;
4954 }
4955
4956 inst->Base.SrcReg[0] = src0->Base;
4957 inst->SrcReg[0] = *src0;
4958
4959 if (src1 != NULL) {
4960 inst->Base.SrcReg[1] = src1->Base;
4961 inst->SrcReg[1] = *src1;
4962 } else {
4963 init_src_reg(& inst->SrcReg[1]);
4964 }
4965
4966 if (src2 != NULL) {
4967 inst->Base.SrcReg[2] = src2->Base;
4968 inst->SrcReg[2] = *src2;
4969 } else {
4970 init_src_reg(& inst->SrcReg[2]);
4971 }
4972 }
4973
4974
4975 struct asm_instruction *
4976 asm_instruction_ctor(gl_inst_opcode op,
4977 const struct prog_dst_register *dst,
4978 const struct asm_src_register *src0,
4979 const struct asm_src_register *src1,
4980 const struct asm_src_register *src2)
4981 {
4982 struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
4983
4984 if (inst) {
4985 _mesa_init_instructions(& inst->Base, 1);
4986 inst->Base.Opcode = op;
4987
4988 asm_instruction_set_operands(inst, dst, src0, src1, src2);
4989 }
4990
4991 return inst;
4992 }
4993
4994
4995 struct asm_instruction *
4996 asm_instruction_copy_ctor(const struct prog_instruction *base,
4997 const struct prog_dst_register *dst,
4998 const struct asm_src_register *src0,
4999 const struct asm_src_register *src1,
5000 const struct asm_src_register *src2)
5001 {
5002 struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
5003
5004 if (inst) {
5005 _mesa_init_instructions(& inst->Base, 1);
5006 inst->Base.Opcode = base->Opcode;
5007 inst->Base.SaturateMode = base->SaturateMode;
5008
5009 asm_instruction_set_operands(inst, dst, src0, src1, src2);
5010 }
5011
5012 return inst;
5013 }
5014
5015
5016 void
5017 init_dst_reg(struct prog_dst_register *r)
5018 {
5019 memset(r, 0, sizeof(*r));
5020 r->File = PROGRAM_UNDEFINED;
5021 r->WriteMask = WRITEMASK_XYZW;
5022 r->CondMask = COND_TR;
5023 r->CondSwizzle = SWIZZLE_NOOP;
5024 }
5025
5026
5027 void
5028 init_src_reg(struct asm_src_register *r)
5029 {
5030 memset(r, 0, sizeof(*r));
5031 r->Base.File = PROGRAM_UNDEFINED;
5032 r->Base.Swizzle = SWIZZLE_NOOP;
5033 r->Symbol = NULL;
5034 }
5035
5036
5037 /**
5038 * Validate the set of inputs used by a program
5039 *
5040 * Validates that legal sets of inputs are used by the program. In this case
5041 * "used" included both reading the input or binding the input to a name using
5042 * the \c ATTRIB command.
5043 *
5044 * \return
5045 * \c TRUE if the combination of inputs used is valid, \c FALSE otherwise.
5046 */
5047 int
5048 validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state)
5049 {
5050 const int inputs = state->prog->InputsRead | state->InputsBound;
5051
5052 if (((inputs & 0x0ffff) & (inputs >> 16)) != 0) {
5053 yyerror(locp, state, "illegal use of generic attribute and name attribute");
5054 return 0;
5055 }
5056
5057 return 1;
5058 }
5059
5060
5061 struct asm_symbol *
5062 declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
5063 struct YYLTYPE *locp)
5064 {
5065 struct asm_symbol *s = NULL;
5066 struct asm_symbol *exist = (struct asm_symbol *)
5067 _mesa_symbol_table_find_symbol(state->st, 0, name);
5068
5069
5070 if (exist != NULL) {
5071 yyerror(locp, state, "redeclared identifier");
5072 } else {
5073 s = calloc(1, sizeof(struct asm_symbol));
5074 s->name = name;
5075 s->type = t;
5076
5077 switch (t) {
5078 case at_temp:
5079 if (state->prog->NumTemporaries >= state->limits->MaxTemps) {
5080 yyerror(locp, state, "too many temporaries declared");
5081 free(s);
5082 return NULL;
5083 }
5084
5085 s->temp_binding = state->prog->NumTemporaries;
5086 state->prog->NumTemporaries++;
5087 break;
5088
5089 case at_address:
5090 if (state->prog->NumAddressRegs >= state->limits->MaxAddressRegs) {
5091 yyerror(locp, state, "too many address registers declared");
5092 free(s);
5093 return NULL;
5094 }
5095
5096 /* FINISHME: Add support for multiple address registers.
5097 */
5098 state->prog->NumAddressRegs++;
5099 break;
5100
5101 default:
5102 break;
5103 }
5104
5105 _mesa_symbol_table_add_symbol(state->st, 0, s->name, s);
5106 s->next = state->sym;
5107 state->sym = s;
5108 }
5109
5110 return s;
5111 }
5112
5113
5114 int add_state_reference(struct gl_program_parameter_list *param_list,
5115 const gl_state_index tokens[STATE_LENGTH])
5116 {
5117 const GLuint size = 4; /* XXX fix */
5118 char *name;
5119 GLint index;
5120
5121 name = _mesa_program_state_string(tokens);
5122 index = _mesa_add_parameter(param_list, PROGRAM_STATE_VAR, name,
5123 size, GL_NONE,
5124 NULL, (gl_state_index *) tokens, 0x0);
5125 param_list->StateFlags |= _mesa_program_state_flags(tokens);
5126
5127 /* free name string here since we duplicated it in add_parameter() */
5128 _mesa_free(name);
5129
5130 return index;
5131 }
5132
5133
5134 int
5135 initialize_symbol_from_state(struct gl_program *prog,
5136 struct asm_symbol *param_var,
5137 const gl_state_index tokens[STATE_LENGTH])
5138 {
5139 int idx = -1;
5140 gl_state_index state_tokens[STATE_LENGTH];
5141
5142
5143 memcpy(state_tokens, tokens, sizeof(state_tokens));
5144
5145 param_var->type = at_param;
5146 param_var->param_binding_type = PROGRAM_STATE_VAR;
5147
5148 /* If we are adding a STATE_MATRIX that has multiple rows, we need to
5149 * unroll it and call add_state_reference() for each row
5150 */
5151 if ((state_tokens[0] == STATE_MODELVIEW_MATRIX ||
5152 state_tokens[0] == STATE_PROJECTION_MATRIX ||
5153 state_tokens[0] == STATE_MVP_MATRIX ||
5154 state_tokens[0] == STATE_TEXTURE_MATRIX ||
5155 state_tokens[0] == STATE_PROGRAM_MATRIX)
5156 && (state_tokens[2] != state_tokens[3])) {
5157 int row;
5158 const int first_row = state_tokens[2];
5159 const int last_row = state_tokens[3];
5160
5161 for (row = first_row; row <= last_row; row++) {
5162 state_tokens[2] = state_tokens[3] = row;
5163
5164 idx = add_state_reference(prog->Parameters, state_tokens);
5165 if (param_var->param_binding_begin == ~0U)
5166 param_var->param_binding_begin = idx;
5167 param_var->param_binding_length++;
5168 }
5169 }
5170 else {
5171 idx = add_state_reference(prog->Parameters, state_tokens);
5172 if (param_var->param_binding_begin == ~0U)
5173 param_var->param_binding_begin = idx;
5174 param_var->param_binding_length++;
5175 }
5176
5177 return idx;
5178 }
5179
5180
5181 int
5182 initialize_symbol_from_param(struct gl_program *prog,
5183 struct asm_symbol *param_var,
5184 const gl_state_index tokens[STATE_LENGTH])
5185 {
5186 int idx = -1;
5187 gl_state_index state_tokens[STATE_LENGTH];
5188
5189
5190 memcpy(state_tokens, tokens, sizeof(state_tokens));
5191
5192 assert((state_tokens[0] == STATE_VERTEX_PROGRAM)
5193 || (state_tokens[0] == STATE_FRAGMENT_PROGRAM));
5194 assert((state_tokens[1] == STATE_ENV)
5195 || (state_tokens[1] == STATE_LOCAL));
5196
5197 param_var->type = at_param;
5198 param_var->param_binding_type = (state_tokens[1] == STATE_ENV)
5199 ? PROGRAM_ENV_PARAM : PROGRAM_LOCAL_PARAM;
5200
5201 /* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
5202 * we need to unroll it and call add_state_reference() for each row
5203 */
5204 if (state_tokens[2] != state_tokens[3]) {
5205 int row;
5206 const int first_row = state_tokens[2];
5207 const int last_row = state_tokens[3];
5208
5209 for (row = first_row; row <= last_row; row++) {
5210 state_tokens[2] = state_tokens[3] = row;
5211
5212 idx = add_state_reference(prog->Parameters, state_tokens);
5213 if (param_var->param_binding_begin == ~0U)
5214 param_var->param_binding_begin = idx;
5215 param_var->param_binding_length++;
5216 }
5217 }
5218 else {
5219 idx = add_state_reference(prog->Parameters, state_tokens);
5220 if (param_var->param_binding_begin == ~0U)
5221 param_var->param_binding_begin = idx;
5222 param_var->param_binding_length++;
5223 }
5224
5225 return idx;
5226 }
5227
5228
5229 int
5230 initialize_symbol_from_const(struct gl_program *prog,
5231 struct asm_symbol *param_var,
5232 const struct asm_vector *vec)
5233 {
5234 const int idx = _mesa_add_parameter(prog->Parameters, PROGRAM_CONSTANT,
5235 NULL, vec->count, GL_NONE, vec->data,
5236 NULL, 0x0);
5237
5238 param_var->type = at_param;
5239 param_var->param_binding_type = PROGRAM_CONSTANT;
5240
5241 if (param_var->param_binding_begin == ~0U)
5242 param_var->param_binding_begin = idx;
5243 param_var->param_binding_length++;
5244
5245 return idx;
5246 }
5247
5248
5249 char *
5250 make_error_string(const char *fmt, ...)
5251 {
5252 int length;
5253 char *str;
5254 va_list args;
5255
5256 va_start(args, fmt);
5257
5258 /* Call vsnprintf once to determine how large the final string is. Call it
5259 * again to do the actual formatting. from the vsnprintf manual page:
5260 *
5261 * Upon successful return, these functions return the number of
5262 * characters printed (not including the trailing '\0' used to end
5263 * output to strings).
5264 */
5265 length = 1 + vsnprintf(NULL, 0, fmt, args);
5266
5267 str = _mesa_malloc(length);
5268 if (str) {
5269 vsnprintf(str, length, fmt, args);
5270 }
5271
5272 va_end(args);
5273
5274 return str;
5275 }
5276
5277
5278 void
5279 yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
5280 {
5281 char *err_str;
5282
5283
5284 err_str = make_error_string("glProgramStringARB(%s)\n", s);
5285 if (err_str) {
5286 _mesa_error(state->ctx, GL_INVALID_OPERATION, err_str);
5287 _mesa_free(err_str);
5288 }
5289
5290 err_str = make_error_string("line %u, char %u: error: %s\n",
5291 locp->first_line, locp->first_column, s);
5292 _mesa_set_program_error(state->ctx, locp->position, err_str);
5293
5294 if (err_str) {
5295 _mesa_free(err_str);
5296 }
5297 }
5298
5299
5300 GLboolean
5301 _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
5302 GLsizei len, struct asm_parser_state *state)
5303 {
5304 struct asm_instruction *inst;
5305 unsigned i;
5306 GLubyte *strz;
5307 GLboolean result = GL_FALSE;
5308 void *temp;
5309 struct asm_symbol *sym;
5310
5311 state->ctx = ctx;
5312 state->prog->Target = target;
5313 state->prog->Parameters = _mesa_new_parameter_list();
5314
5315 /* Make a copy of the program string and force it to be NUL-terminated.
5316 */
5317 strz = (GLubyte *) _mesa_malloc(len + 1);
5318 if (strz == NULL) {
5319 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5320 return GL_FALSE;
5321 }
5322 _mesa_memcpy (strz, str, len);
5323 strz[len] = '\0';
5324
5325 state->prog->String = strz;
5326
5327 state->st = _mesa_symbol_table_ctor();
5328
5329 state->limits = (target == GL_VERTEX_PROGRAM_ARB)
5330 ? & ctx->Const.VertexProgram
5331 : & ctx->Const.FragmentProgram;
5332
5333 state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
5334 state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
5335 state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
5336 state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
5337 state->MaxLights = ctx->Const.MaxLights;
5338 state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
5339
5340 state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
5341 ? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM;
5342
5343 _mesa_set_program_error(ctx, -1, NULL);
5344
5345 _mesa_program_lexer_ctor(& state->scanner, state, (const char *) str, len);
5346 yyparse(state);
5347 _mesa_program_lexer_dtor(state->scanner);
5348
5349
5350 if (ctx->Program.ErrorPos != -1) {
5351 goto error;
5352 }
5353
5354 if (! _mesa_layout_parameters(state)) {
5355 struct YYLTYPE loc;
5356
5357 loc.first_line = 0;
5358 loc.first_column = 0;
5359 loc.position = len;
5360
5361 yyerror(& loc, state, "invalid PARAM usage");
5362 goto error;
5363 }
5364
5365
5366
5367 /* Add one instruction to store the "END" instruction.
5368 */
5369 state->prog->Instructions =
5370 _mesa_alloc_instructions(state->prog->NumInstructions + 1);
5371 inst = state->inst_head;
5372 for (i = 0; i < state->prog->NumInstructions; i++) {
5373 struct asm_instruction *const temp = inst->next;
5374
5375 state->prog->Instructions[i] = inst->Base;
5376 inst = temp;
5377 }
5378
5379 /* Finally, tag on an OPCODE_END instruction */
5380 {
5381 const GLuint numInst = state->prog->NumInstructions;
5382 _mesa_init_instructions(state->prog->Instructions + numInst, 1);
5383 state->prog->Instructions[numInst].Opcode = OPCODE_END;
5384 }
5385 state->prog->NumInstructions++;
5386
5387 state->prog->NumParameters = state->prog->Parameters->NumParameters;
5388 state->prog->NumAttributes = _mesa_bitcount(state->prog->InputsRead);
5389
5390 /*
5391 * Initialize native counts to logical counts. The device driver may
5392 * change them if program is translated into a hardware program.
5393 */
5394 state->prog->NumNativeInstructions = state->prog->NumInstructions;
5395 state->prog->NumNativeTemporaries = state->prog->NumTemporaries;
5396 state->prog->NumNativeParameters = state->prog->NumParameters;
5397 state->prog->NumNativeAttributes = state->prog->NumAttributes;
5398 state->prog->NumNativeAddressRegs = state->prog->NumAddressRegs;
5399
5400 result = GL_TRUE;
5401
5402 error:
5403 for (inst = state->inst_head; inst != NULL; inst = temp) {
5404 temp = inst->next;
5405 _mesa_free(inst);
5406 }
5407
5408 state->inst_head = NULL;
5409 state->inst_tail = NULL;
5410
5411 for (sym = state->sym; sym != NULL; sym = temp) {
5412 temp = sym->next;
5413
5414 _mesa_free((void *) sym->name);
5415 _mesa_free(sym);
5416 }
5417 state->sym = NULL;
5418
5419 _mesa_symbol_table_dtor(state->st);
5420 state->st = NULL;
5421
5422 return result;
5423 }
5424