initial import
[vuplus_webkit] / Source / ThirdParty / ANGLE / src / compiler / glslang_tab.cpp
1 /* A Bison parser, made by GNU Bison 2.3.  */
2
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4
5    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6    Free Software Foundation, Inc.
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2, or (at your option)
11    any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor,
21    Boston, MA 02110-1301, USA.  */
22
23 /* As a special exception, you may create a larger work that contains
24    part or all of the Bison parser skeleton and distribute that work
25    under terms of your choice, so long as that work isn't itself a
26    parser generator using the skeleton or a modified version thereof
27    as a parser skeleton.  Alternatively, if you modify or redistribute
28    the parser skeleton itself, you may (at your option) remove this
29    special exception, which will cause the skeleton and the resulting
30    Bison output files to be licensed under the GNU General Public
31    License without this special exception.
32
33    This special exception was added by the Free Software Foundation in
34    version 2.2 of Bison.  */
35
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37    simplifying the original so-called "semantic" parser.  */
38
39 /* All symbols defined below should begin with yy or YY, to avoid
40    infringing on user name space.  This should be done even for local
41    variables, as they might otherwise be expanded by user macros.
42    There are some unavoidable exceptions within include files to
43    define necessary library symbols; they are noted "INFRINGES ON
44    USER NAME SPACE" below.  */
45
46 /* Identify Bison output.  */
47 #define YYBISON 1
48
49 /* Bison version.  */
50 #define YYBISON_VERSION "2.3"
51
52 /* Skeleton name.  */
53 #define YYSKELETON_NAME "yacc.c"
54
55 /* Pure parsers.  */
56 #define YYPURE 1
57
58 /* Using locations.  */
59 #define YYLSP_NEEDED 0
60
61
62
63 /* Tokens.  */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66    /* Put the tokens into the symbol table, so that GDB and other debuggers
67       know about them.  */
68    enum yytokentype {
69      INVARIANT = 258,
70      HIGH_PRECISION = 259,
71      MEDIUM_PRECISION = 260,
72      LOW_PRECISION = 261,
73      PRECISION = 262,
74      ATTRIBUTE = 263,
75      CONST_QUAL = 264,
76      BOOL_TYPE = 265,
77      FLOAT_TYPE = 266,
78      INT_TYPE = 267,
79      BREAK = 268,
80      CONTINUE = 269,
81      DO = 270,
82      ELSE = 271,
83      FOR = 272,
84      IF = 273,
85      DISCARD = 274,
86      RETURN = 275,
87      BVEC2 = 276,
88      BVEC3 = 277,
89      BVEC4 = 278,
90      IVEC2 = 279,
91      IVEC3 = 280,
92      IVEC4 = 281,
93      VEC2 = 282,
94      VEC3 = 283,
95      VEC4 = 284,
96      MATRIX2 = 285,
97      MATRIX3 = 286,
98      MATRIX4 = 287,
99      IN_QUAL = 288,
100      OUT_QUAL = 289,
101      INOUT_QUAL = 290,
102      UNIFORM = 291,
103      VARYING = 292,
104      STRUCT = 293,
105      VOID_TYPE = 294,
106      WHILE = 295,
107      SAMPLER2D = 296,
108      SAMPLERCUBE = 297,
109      IDENTIFIER = 298,
110      TYPE_NAME = 299,
111      FLOATCONSTANT = 300,
112      INTCONSTANT = 301,
113      BOOLCONSTANT = 302,
114      FIELD_SELECTION = 303,
115      LEFT_OP = 304,
116      RIGHT_OP = 305,
117      INC_OP = 306,
118      DEC_OP = 307,
119      LE_OP = 308,
120      GE_OP = 309,
121      EQ_OP = 310,
122      NE_OP = 311,
123      AND_OP = 312,
124      OR_OP = 313,
125      XOR_OP = 314,
126      MUL_ASSIGN = 315,
127      DIV_ASSIGN = 316,
128      ADD_ASSIGN = 317,
129      MOD_ASSIGN = 318,
130      LEFT_ASSIGN = 319,
131      RIGHT_ASSIGN = 320,
132      AND_ASSIGN = 321,
133      XOR_ASSIGN = 322,
134      OR_ASSIGN = 323,
135      SUB_ASSIGN = 324,
136      LEFT_PAREN = 325,
137      RIGHT_PAREN = 326,
138      LEFT_BRACKET = 327,
139      RIGHT_BRACKET = 328,
140      LEFT_BRACE = 329,
141      RIGHT_BRACE = 330,
142      DOT = 331,
143      COMMA = 332,
144      COLON = 333,
145      EQUAL = 334,
146      SEMICOLON = 335,
147      BANG = 336,
148      DASH = 337,
149      TILDE = 338,
150      PLUS = 339,
151      STAR = 340,
152      SLASH = 341,
153      PERCENT = 342,
154      LEFT_ANGLE = 343,
155      RIGHT_ANGLE = 344,
156      VERTICAL_BAR = 345,
157      CARET = 346,
158      AMPERSAND = 347,
159      QUESTION = 348
160    };
161 #endif
162 /* Tokens.  */
163 #define INVARIANT 258
164 #define HIGH_PRECISION 259
165 #define MEDIUM_PRECISION 260
166 #define LOW_PRECISION 261
167 #define PRECISION 262
168 #define ATTRIBUTE 263
169 #define CONST_QUAL 264
170 #define BOOL_TYPE 265
171 #define FLOAT_TYPE 266
172 #define INT_TYPE 267
173 #define BREAK 268
174 #define CONTINUE 269
175 #define DO 270
176 #define ELSE 271
177 #define FOR 272
178 #define IF 273
179 #define DISCARD 274
180 #define RETURN 275
181 #define BVEC2 276
182 #define BVEC3 277
183 #define BVEC4 278
184 #define IVEC2 279
185 #define IVEC3 280
186 #define IVEC4 281
187 #define VEC2 282
188 #define VEC3 283
189 #define VEC4 284
190 #define MATRIX2 285
191 #define MATRIX3 286
192 #define MATRIX4 287
193 #define IN_QUAL 288
194 #define OUT_QUAL 289
195 #define INOUT_QUAL 290
196 #define UNIFORM 291
197 #define VARYING 292
198 #define STRUCT 293
199 #define VOID_TYPE 294
200 #define WHILE 295
201 #define SAMPLER2D 296
202 #define SAMPLERCUBE 297
203 #define IDENTIFIER 298
204 #define TYPE_NAME 299
205 #define FLOATCONSTANT 300
206 #define INTCONSTANT 301
207 #define BOOLCONSTANT 302
208 #define FIELD_SELECTION 303
209 #define LEFT_OP 304
210 #define RIGHT_OP 305
211 #define INC_OP 306
212 #define DEC_OP 307
213 #define LE_OP 308
214 #define GE_OP 309
215 #define EQ_OP 310
216 #define NE_OP 311
217 #define AND_OP 312
218 #define OR_OP 313
219 #define XOR_OP 314
220 #define MUL_ASSIGN 315
221 #define DIV_ASSIGN 316
222 #define ADD_ASSIGN 317
223 #define MOD_ASSIGN 318
224 #define LEFT_ASSIGN 319
225 #define RIGHT_ASSIGN 320
226 #define AND_ASSIGN 321
227 #define XOR_ASSIGN 322
228 #define OR_ASSIGN 323
229 #define SUB_ASSIGN 324
230 #define LEFT_PAREN 325
231 #define RIGHT_PAREN 326
232 #define LEFT_BRACKET 327
233 #define RIGHT_BRACKET 328
234 #define LEFT_BRACE 329
235 #define RIGHT_BRACE 330
236 #define DOT 331
237 #define COMMA 332
238 #define COLON 333
239 #define EQUAL 334
240 #define SEMICOLON 335
241 #define BANG 336
242 #define DASH 337
243 #define TILDE 338
244 #define PLUS 339
245 #define STAR 340
246 #define SLASH 341
247 #define PERCENT 342
248 #define LEFT_ANGLE 343
249 #define RIGHT_ANGLE 344
250 #define VERTICAL_BAR 345
251 #define CARET 346
252 #define AMPERSAND 347
253 #define QUESTION 348
254
255
256
257
258 /* Copy the first part of user declarations.  */
259
260
261 //
262 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
263 // Use of this source code is governed by a BSD-style license that can be
264 // found in the LICENSE file.
265 //
266
267 // This file is auto-generated by generate_glslang_parser.sh. DO NOT EDIT!
268
269 #include "compiler/SymbolTable.h"
270 #include "compiler/ParseHelper.h"
271 #include "GLSLANG/ShaderLang.h"
272
273 #define YYLEX_PARAM context->scanner
274
275
276 /* Enabling traces.  */
277 #ifndef YYDEBUG
278 # define YYDEBUG 0
279 #endif
280
281 /* Enabling verbose error messages.  */
282 #ifdef YYERROR_VERBOSE
283 # undef YYERROR_VERBOSE
284 # define YYERROR_VERBOSE 1
285 #else
286 # define YYERROR_VERBOSE 0
287 #endif
288
289 /* Enabling the token table.  */
290 #ifndef YYTOKEN_TABLE
291 # define YYTOKEN_TABLE 0
292 #endif
293
294 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
295 typedef union YYSTYPE
296
297 {
298     struct {
299         TSourceLoc line;
300         union {
301             TString *string;
302             float f;
303             int i;
304             bool b;
305         };
306         TSymbol* symbol;
307     } lex;
308     struct {
309         TSourceLoc line;
310         TOperator op;
311         union {
312             TIntermNode* intermNode;
313             TIntermNodePair nodePair;
314             TIntermTyped* intermTypedNode;
315             TIntermAggregate* intermAggregate;
316         };
317         union {
318             TPublicType type;
319             TPrecision precision;
320             TQualifier qualifier;
321             TFunction* function;
322             TParameter param;
323             TTypeLine typeLine;
324             TTypeList* typeList;
325         };
326     } interm;
327 }
328 /* Line 193 of yacc.c.  */
329
330         YYSTYPE;
331 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
332 # define YYSTYPE_IS_DECLARED 1
333 # define YYSTYPE_IS_TRIVIAL 1
334 #endif
335
336
337
338 /* Copy the second part of user declarations.  */
339
340
341 extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
342 extern void yyerror(TParseContext* context, const char* reason);
343
344 #define FRAG_VERT_ONLY(S, L) {  \
345     if (context->shaderType != SH_FRAGMENT_SHADER &&  \
346         context->shaderType != SH_VERTEX_SHADER) {  \
347         context->error(L, " supported in vertex/fragment shaders only ", S, "", "");  \
348         context->recover();  \
349     }  \
350 }
351
352 #define VERTEX_ONLY(S, L) {  \
353     if (context->shaderType != SH_VERTEX_SHADER) {  \
354         context->error(L, " supported in vertex shaders only ", S, "", "");  \
355         context->recover();  \
356     }  \
357 }
358
359 #define FRAG_ONLY(S, L) {  \
360     if (context->shaderType != SH_FRAGMENT_SHADER) {  \
361         context->error(L, " supported in fragment shaders only ", S, "", "");  \
362         context->recover();  \
363     }  \
364 }
365
366
367 /* Line 216 of yacc.c.  */
368
369
370 #ifdef short
371 # undef short
372 #endif
373
374 #ifdef YYTYPE_UINT8
375 typedef YYTYPE_UINT8 yytype_uint8;
376 #else
377 typedef unsigned char yytype_uint8;
378 #endif
379
380 #ifdef YYTYPE_INT8
381 typedef YYTYPE_INT8 yytype_int8;
382 #elif (defined __STDC__ || defined __C99__FUNC__ \
383      || defined __cplusplus || defined _MSC_VER)
384 typedef signed char yytype_int8;
385 #else
386 typedef short int yytype_int8;
387 #endif
388
389 #ifdef YYTYPE_UINT16
390 typedef YYTYPE_UINT16 yytype_uint16;
391 #else
392 typedef unsigned short int yytype_uint16;
393 #endif
394
395 #ifdef YYTYPE_INT16
396 typedef YYTYPE_INT16 yytype_int16;
397 #else
398 typedef short int yytype_int16;
399 #endif
400
401 #ifndef YYSIZE_T
402 # ifdef __SIZE_TYPE__
403 #  define YYSIZE_T __SIZE_TYPE__
404 # elif defined size_t
405 #  define YYSIZE_T size_t
406 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
407      || defined __cplusplus || defined _MSC_VER)
408 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
409 #  define YYSIZE_T size_t
410 # else
411 #  define YYSIZE_T unsigned int
412 # endif
413 #endif
414
415 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
416
417 #ifndef YY_
418 # if defined YYENABLE_NLS && YYENABLE_NLS
419 #  if ENABLE_NLS
420 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
421 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
422 #  endif
423 # endif
424 # ifndef YY_
425 #  define YY_(msgid) msgid
426 # endif
427 #endif
428
429 /* Suppress unused-variable warnings by "using" E.  */
430 #if ! defined lint || defined __GNUC__
431 # define YYUSE(e) ((void) (e))
432 #else
433 # define YYUSE(e) /* empty */
434 #endif
435
436 /* Identity function, used to suppress warnings about constant conditions.  */
437 #ifndef lint
438 # define YYID(n) (n)
439 #else
440 #if (defined __STDC__ || defined __C99__FUNC__ \
441      || defined __cplusplus || defined _MSC_VER)
442 static int
443 YYID (int i)
444 #else
445 static int
446 YYID (i)
447     int i;
448 #endif
449 {
450   return i;
451 }
452 #endif
453
454 #if ! defined yyoverflow || YYERROR_VERBOSE
455
456 /* The parser invokes alloca or malloc; define the necessary symbols.  */
457
458 # ifdef YYSTACK_USE_ALLOCA
459 #  if YYSTACK_USE_ALLOCA
460 #   ifdef __GNUC__
461 #    define YYSTACK_ALLOC __builtin_alloca
462 #   elif defined __BUILTIN_VA_ARG_INCR
463 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
464 #   elif defined _AIX
465 #    define YYSTACK_ALLOC __alloca
466 #   elif defined _MSC_VER
467 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
468 #    define alloca _alloca
469 #   else
470 #    define YYSTACK_ALLOC alloca
471 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
472      || defined __cplusplus || defined _MSC_VER)
473 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
474 #     ifndef _STDLIB_H
475 #      define _STDLIB_H 1
476 #     endif
477 #    endif
478 #   endif
479 #  endif
480 # endif
481
482 # ifdef YYSTACK_ALLOC
483    /* Pacify GCC's `empty if-body' warning.  */
484 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
485 #  ifndef YYSTACK_ALLOC_MAXIMUM
486     /* The OS might guarantee only one guard page at the bottom of the stack,
487        and a page size can be as small as 4096 bytes.  So we cannot safely
488        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
489        to allow for a few compiler-allocated temporary stack slots.  */
490 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
491 #  endif
492 # else
493 #  define YYSTACK_ALLOC YYMALLOC
494 #  define YYSTACK_FREE YYFREE
495 #  ifndef YYSTACK_ALLOC_MAXIMUM
496 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
497 #  endif
498 #  if (defined __cplusplus && ! defined _STDLIB_H \
499        && ! ((defined YYMALLOC || defined malloc) \
500              && (defined YYFREE || defined free)))
501 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
502 #   ifndef _STDLIB_H
503 #    define _STDLIB_H 1
504 #   endif
505 #  endif
506 #  ifndef YYMALLOC
507 #   define YYMALLOC malloc
508 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
509      || defined __cplusplus || defined _MSC_VER)
510 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
511 #   endif
512 #  endif
513 #  ifndef YYFREE
514 #   define YYFREE free
515 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
516      || defined __cplusplus || defined _MSC_VER)
517 void free (void *); /* INFRINGES ON USER NAME SPACE */
518 #   endif
519 #  endif
520 # endif
521 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
522
523
524 #if (! defined yyoverflow \
525      && (! defined __cplusplus \
526          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
527
528 /* A type that is properly aligned for any stack member.  */
529 union yyalloc
530 {
531   yytype_int16 yyss;
532   YYSTYPE yyvs;
533   };
534
535 /* The size of the maximum gap between one aligned stack and the next.  */
536 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
537
538 /* The size of an array large to enough to hold all stacks, each with
539    N elements.  */
540 # define YYSTACK_BYTES(N) \
541      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
542       + YYSTACK_GAP_MAXIMUM)
543
544 /* Copy COUNT objects from FROM to TO.  The source and destination do
545    not overlap.  */
546 # ifndef YYCOPY
547 #  if defined __GNUC__ && 1 < __GNUC__
548 #   define YYCOPY(To, From, Count) \
549       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
550 #  else
551 #   define YYCOPY(To, From, Count)              \
552       do                                        \
553         {                                       \
554           YYSIZE_T yyi;                         \
555           for (yyi = 0; yyi < (Count); yyi++)   \
556             (To)[yyi] = (From)[yyi];            \
557         }                                       \
558       while (YYID (0))
559 #  endif
560 # endif
561
562 /* Relocate STACK from its old location to the new one.  The
563    local variables YYSIZE and YYSTACKSIZE give the old and new number of
564    elements in the stack, and YYPTR gives the new location of the
565    stack.  Advance YYPTR to a properly aligned location for the next
566    stack.  */
567 # define YYSTACK_RELOCATE(Stack)                                        \
568     do                                                                  \
569       {                                                                 \
570         YYSIZE_T yynewbytes;                                            \
571         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
572         Stack = &yyptr->Stack;                                          \
573         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
574         yyptr += yynewbytes / sizeof (*yyptr);                          \
575       }                                                                 \
576     while (YYID (0))
577
578 #endif
579
580 /* YYFINAL -- State number of the termination state.  */
581 #define YYFINAL  69
582 /* YYLAST -- Last index in YYTABLE.  */
583 #define YYLAST   1362
584
585 /* YYNTOKENS -- Number of terminals.  */
586 #define YYNTOKENS  94
587 /* YYNNTS -- Number of nonterminals.  */
588 #define YYNNTS  78
589 /* YYNRULES -- Number of rules.  */
590 #define YYNRULES  193
591 /* YYNRULES -- Number of states.  */
592 #define YYNSTATES  296
593
594 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
595 #define YYUNDEFTOK  2
596 #define YYMAXUTOK   348
597
598 #define YYTRANSLATE(YYX)                                                \
599   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
600
601 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
602 static const yytype_uint8 yytranslate[] =
603 {
604        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
605        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
606        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
607        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
608        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
609        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
610        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
611        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
612        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
613        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
614        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
615        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
616        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
617        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
618        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
619        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
620        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
621        2,     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,     2,     2,     2,     2,     2,     2,     2,
626        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
627        2,     2,     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,     1,     2,     3,     4,
630        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
631       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
632       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
633       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
634       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
635       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
636       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
637       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
638       85,    86,    87,    88,    89,    90,    91,    92,    93
639 };
640
641 #if YYDEBUG
642 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
643    YYRHS.  */
644 static const yytype_uint16 yyprhs[] =
645 {
646        0,     0,     3,     5,     7,     9,    11,    13,    17,    19,
647       24,    26,    30,    33,    36,    38,    40,    42,    46,    49,
648       52,    55,    57,    60,    64,    67,    69,    71,    73,    75,
649       78,    81,    84,    86,    88,    90,    92,    96,   100,   102,
650      106,   110,   112,   114,   118,   122,   126,   130,   132,   136,
651      140,   142,   144,   146,   148,   152,   154,   158,   160,   164,
652      166,   172,   174,   178,   180,   182,   184,   186,   188,   190,
653      194,   196,   199,   202,   207,   210,   212,   214,   217,   221,
654      225,   228,   234,   238,   241,   245,   248,   249,   251,   253,
655      255,   257,   259,   263,   269,   276,   282,   284,   287,   292,
656      298,   303,   306,   308,   311,   313,   315,   317,   320,   322,
657      324,   327,   329,   331,   333,   335,   340,   342,   344,   346,
658      348,   350,   352,   354,   356,   358,   360,   362,   364,   366,
659      368,   370,   372,   374,   376,   378,   380,   386,   391,   393,
660      396,   400,   402,   406,   408,   413,   415,   417,   419,   421,
661      423,   425,   427,   429,   431,   434,   435,   436,   442,   444,
662      446,   449,   453,   455,   458,   460,   463,   469,   473,   475,
663      477,   482,   483,   490,   491,   500,   501,   509,   511,   513,
664      515,   516,   519,   523,   526,   529,   532,   536,   539,   541,
665      544,   546,   548,   549
666 };
667
668 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
669 static const yytype_int16 yyrhs[] =
670 {
671      168,     0,    -1,    43,    -1,    95,    -1,    46,    -1,    45,
672       -1,    47,    -1,    70,   122,    71,    -1,    96,    -1,    97,
673       72,    98,    73,    -1,    99,    -1,    97,    76,    48,    -1,
674       97,    51,    -1,    97,    52,    -1,   122,    -1,   100,    -1,
675      101,    -1,    97,    76,   101,    -1,   103,    71,    -1,   102,
676       71,    -1,   104,    39,    -1,   104,    -1,   104,   120,    -1,
677      103,    77,   120,    -1,   105,    70,    -1,   140,    -1,    43,
678       -1,    48,    -1,    97,    -1,    51,   106,    -1,    52,   106,
679       -1,   107,   106,    -1,    84,    -1,    82,    -1,    81,    -1,
680      106,    -1,   108,    85,   106,    -1,   108,    86,   106,    -1,
681      108,    -1,   109,    84,   108,    -1,   109,    82,   108,    -1,
682      109,    -1,   110,    -1,   111,    88,   110,    -1,   111,    89,
683      110,    -1,   111,    53,   110,    -1,   111,    54,   110,    -1,
684      111,    -1,   112,    55,   111,    -1,   112,    56,   111,    -1,
685      112,    -1,   113,    -1,   114,    -1,   115,    -1,   116,    57,
686      115,    -1,   116,    -1,   117,    59,   116,    -1,   117,    -1,
687      118,    58,   117,    -1,   118,    -1,   118,    93,   122,    78,
688      120,    -1,   119,    -1,   106,   121,   120,    -1,    79,    -1,
689       60,    -1,    61,    -1,    62,    -1,    69,    -1,   120,    -1,
690      122,    77,   120,    -1,   119,    -1,   125,    80,    -1,   133,
691       80,    -1,     7,   138,   139,    80,    -1,   126,    71,    -1,
692      128,    -1,   127,    -1,   128,   130,    -1,   127,    77,   130,
693       -1,   135,    43,    70,    -1,   137,    43,    -1,   137,    43,
694       72,   123,    73,    -1,   136,   131,   129,    -1,   131,   129,
695       -1,   136,   131,   132,    -1,   131,   132,    -1,    -1,    33,
696       -1,    34,    -1,    35,    -1,   137,    -1,   134,    -1,   133,
697       77,    43,    -1,   133,    77,    43,    72,    73,    -1,   133,
698       77,    43,    72,   123,    73,    -1,   133,    77,    43,    79,
699      146,    -1,   135,    -1,   135,    43,    -1,   135,    43,    72,
700       73,    -1,   135,    43,    72,   123,    73,    -1,   135,    43,
701       79,   146,    -1,     3,    43,    -1,   137,    -1,   136,   137,
702       -1,     9,    -1,     8,    -1,    37,    -1,     3,    37,    -1,
703       36,    -1,   139,    -1,   138,   139,    -1,     4,    -1,     5,
704       -1,     6,    -1,   140,    -1,   140,    72,   123,    73,    -1,
705       39,    -1,    11,    -1,    12,    -1,    10,    -1,    27,    -1,
706       28,    -1,    29,    -1,    21,    -1,    22,    -1,    23,    -1,
707       24,    -1,    25,    -1,    26,    -1,    30,    -1,    31,    -1,
708       32,    -1,    41,    -1,    42,    -1,   141,    -1,    44,    -1,
709       38,    43,    74,   142,    75,    -1,    38,    74,   142,    75,
710       -1,   143,    -1,   142,   143,    -1,   137,   144,    80,    -1,
711      145,    -1,   144,    77,   145,    -1,    43,    -1,    43,    72,
712      123,    73,    -1,   120,    -1,   124,    -1,   150,    -1,   149,
713       -1,   147,    -1,   156,    -1,   157,    -1,   160,    -1,   167,
714       -1,    74,    75,    -1,    -1,    -1,    74,   151,   155,   152,
715       75,    -1,   154,    -1,   149,    -1,    74,    75,    -1,    74,
716      155,    75,    -1,   148,    -1,   155,   148,    -1,    80,    -1,
717      122,    80,    -1,    18,    70,   122,    71,   158,    -1,   148,
718       16,   148,    -1,   148,    -1,   122,    -1,   135,    43,    79,
719      146,    -1,    -1,    40,    70,   161,   159,    71,   153,    -1,
720       -1,    15,   162,   148,    40,    70,   122,    71,    80,    -1,
721       -1,    17,    70,   163,   164,   166,    71,   153,    -1,   156,
722       -1,   147,    -1,   159,    -1,    -1,   165,    80,    -1,   165,
723       80,   122,    -1,    14,    80,    -1,    13,    80,    -1,    20,
724       80,    -1,    20,   122,    80,    -1,    19,    80,    -1,   169,
725       -1,   168,   169,    -1,   170,    -1,   124,    -1,    -1,   125,
726      171,   154,    -1
727 };
728
729 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
730 static const yytype_uint16 yyrline[] =
731 {
732        0,   153,   153,   188,   191,   204,   209,   214,   220,   223,
733      296,   299,   408,   418,   431,   439,   538,   541,   549,   553,
734      560,   564,   571,   577,   586,   594,   649,   656,   666,   669,
735      679,   689,   710,   711,   712,   717,   718,   727,   739,   740,
736      748,   759,   763,   764,   774,   784,   794,   807,   808,   818,
737      831,   835,   839,   843,   844,   857,   858,   871,   872,   885,
738      886,   903,   904,   917,   918,   919,   920,   921,   925,   928,
739      939,   947,   972,   977,   984,  1020,  1023,  1030,  1038,  1059,
740     1078,  1089,  1118,  1123,  1133,  1138,  1148,  1151,  1154,  1157,
741     1163,  1170,  1173,  1189,  1207,  1231,  1254,  1258,  1276,  1284,
742     1316,  1336,  1412,  1421,  1444,  1447,  1453,  1461,  1469,  1477,
743     1487,  1494,  1497,  1500,  1506,  1509,  1524,  1528,  1532,  1536,
744     1545,  1550,  1555,  1560,  1565,  1570,  1575,  1580,  1585,  1590,
745     1596,  1602,  1608,  1613,  1618,  1623,  1636,  1649,  1657,  1660,
746     1675,  1707,  1711,  1717,  1725,  1741,  1745,  1749,  1750,  1756,
747     1757,  1758,  1759,  1760,  1764,  1765,  1765,  1765,  1775,  1776,
748     1781,  1784,  1794,  1797,  1803,  1804,  1808,  1816,  1820,  1830,
749     1835,  1852,  1852,  1857,  1857,  1864,  1864,  1872,  1875,  1881,
750     1884,  1890,  1894,  1901,  1908,  1915,  1922,  1933,  1942,  1946,
751     1953,  1956,  1962,  1962
752 };
753 #endif
754
755 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
756 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
757    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
758 static const char *const yytname[] =
759 {
760   "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
761   "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
762   "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
763   "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
764   "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
765   "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
766   "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
767   "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT",
768   "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP",
769   "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP",
770   "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN",
771   "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN",
772   "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET",
773   "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON",
774   "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH",
775   "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET",
776   "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
777   "primary_expression", "postfix_expression", "integer_expression",
778   "function_call", "function_call_or_method", "function_call_generic",
779   "function_call_header_no_parameters",
780   "function_call_header_with_parameters", "function_call_header",
781   "function_identifier", "unary_expression", "unary_operator",
782   "multiplicative_expression", "additive_expression", "shift_expression",
783   "relational_expression", "equality_expression", "and_expression",
784   "exclusive_or_expression", "inclusive_or_expression",
785   "logical_and_expression", "logical_xor_expression",
786   "logical_or_expression", "conditional_expression",
787   "assignment_expression", "assignment_operator", "expression",
788   "constant_expression", "declaration", "function_prototype",
789   "function_declarator", "function_header_with_parameters",
790   "function_header", "parameter_declarator", "parameter_declaration",
791   "parameter_qualifier", "parameter_type_specifier",
792   "init_declarator_list", "single_declaration", "fully_specified_type",
793   "type_qualifier", "type_specifier", "precision_qualifier",
794   "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
795   "struct_declaration_list", "struct_declaration",
796   "struct_declarator_list", "struct_declarator", "initializer",
797   "declaration_statement", "statement", "simple_statement",
798   "compound_statement", "@1", "@2", "statement_no_new_scope",
799   "compound_statement_no_new_scope", "statement_list",
800   "expression_statement", "selection_statement",
801   "selection_rest_statement", "condition", "iteration_statement", "@3",
802   "@4", "@5", "for_init_statement", "conditionopt", "for_rest_statement",
803   "jump_statement", "translation_unit", "external_declaration",
804   "function_definition", "@6", 0
805 };
806 #endif
807
808 # ifdef YYPRINT
809 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
810    token YYLEX-NUM.  */
811 static const yytype_uint16 yytoknum[] =
812 {
813        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
814      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
815      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
816      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
817      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
818      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
819      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
820      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
821      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
822      345,   346,   347,   348
823 };
824 # endif
825
826 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
827 static const yytype_uint8 yyr1[] =
828 {
829        0,    94,    95,    96,    96,    96,    96,    96,    97,    97,
830       97,    97,    97,    97,    98,    99,   100,   100,   101,   101,
831      102,   102,   103,   103,   104,   105,   105,   105,   106,   106,
832      106,   106,   107,   107,   107,   108,   108,   108,   109,   109,
833      109,   110,   111,   111,   111,   111,   111,   112,   112,   112,
834      113,   114,   115,   116,   116,   117,   117,   118,   118,   119,
835      119,   120,   120,   121,   121,   121,   121,   121,   122,   122,
836      123,   124,   124,   124,   125,   126,   126,   127,   127,   128,
837      129,   129,   130,   130,   130,   130,   131,   131,   131,   131,
838      132,   133,   133,   133,   133,   133,   134,   134,   134,   134,
839      134,   134,   135,   135,   136,   136,   136,   136,   136,   137,
840      137,   138,   138,   138,   139,   139,   140,   140,   140,   140,
841      140,   140,   140,   140,   140,   140,   140,   140,   140,   140,
842      140,   140,   140,   140,   140,   140,   141,   141,   142,   142,
843      143,   144,   144,   145,   145,   146,   147,   148,   148,   149,
844      149,   149,   149,   149,   150,   151,   152,   150,   153,   153,
845      154,   154,   155,   155,   156,   156,   157,   158,   158,   159,
846      159,   161,   160,   162,   160,   163,   160,   164,   164,   165,
847      165,   166,   166,   167,   167,   167,   167,   167,   168,   168,
848      169,   169,   171,   170
849 };
850
851 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
852 static const yytype_uint8 yyr2[] =
853 {
854        0,     2,     1,     1,     1,     1,     1,     3,     1,     4,
855        1,     3,     2,     2,     1,     1,     1,     3,     2,     2,
856        2,     1,     2,     3,     2,     1,     1,     1,     1,     2,
857        2,     2,     1,     1,     1,     1,     3,     3,     1,     3,
858        3,     1,     1,     3,     3,     3,     3,     1,     3,     3,
859        1,     1,     1,     1,     3,     1,     3,     1,     3,     1,
860        5,     1,     3,     1,     1,     1,     1,     1,     1,     3,
861        1,     2,     2,     4,     2,     1,     1,     2,     3,     3,
862        2,     5,     3,     2,     3,     2,     0,     1,     1,     1,
863        1,     1,     3,     5,     6,     5,     1,     2,     4,     5,
864        4,     2,     1,     2,     1,     1,     1,     2,     1,     1,
865        2,     1,     1,     1,     1,     4,     1,     1,     1,     1,
866        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
867        1,     1,     1,     1,     1,     1,     5,     4,     1,     2,
868        3,     1,     3,     1,     4,     1,     1,     1,     1,     1,
869        1,     1,     1,     1,     2,     0,     0,     5,     1,     1,
870        2,     3,     1,     2,     1,     2,     5,     3,     1,     1,
871        4,     0,     6,     0,     8,     0,     7,     1,     1,     1,
872        0,     2,     3,     2,     2,     2,     3,     2,     1,     2,
873        1,     1,     0,     3
874 };
875
876 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
877    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
878    means the default is an error.  */
879 static const yytype_uint8 yydefact[] =
880 {
881        0,     0,   111,   112,   113,     0,   105,   104,   119,   117,
882      118,   123,   124,   125,   126,   127,   128,   120,   121,   122,
883      129,   130,   131,   108,   106,     0,   116,   132,   133,   135,
884      191,   192,     0,    76,    86,     0,    91,    96,     0,   102,
885        0,   109,   114,   134,     0,   188,   190,   107,   101,     0,
886        0,     0,    71,     0,    74,    86,     0,    87,    88,    89,
887       77,     0,    86,     0,    72,    97,   103,   110,     0,     1,
888      189,     0,     0,     0,     0,   138,     0,   193,    78,    83,
889       85,    90,     0,    92,    79,     0,     0,     2,     5,     4,
890        6,    27,     0,     0,     0,    34,    33,    32,     3,     8,
891       28,    10,    15,    16,     0,     0,    21,     0,    35,     0,
892       38,    41,    42,    47,    50,    51,    52,    53,    55,    57,
893       59,    70,     0,    25,    73,     0,   143,     0,   141,   137,
894      139,     0,     0,   173,     0,     0,     0,     0,     0,   155,
895      160,   164,    35,    61,    68,     0,   146,     0,   114,   149,
896      162,   148,   147,     0,   150,   151,   152,   153,    80,    82,
897       84,     0,     0,    98,     0,   145,   100,    29,    30,     0,
898       12,    13,     0,     0,    19,    18,     0,    20,    22,    24,
899       31,     0,     0,     0,     0,     0,     0,     0,     0,     0,
900        0,     0,     0,     0,     0,   115,   136,     0,     0,   140,
901      184,   183,     0,   175,     0,   187,   185,     0,   171,   154,
902        0,    64,    65,    66,    67,    63,     0,     0,   165,   161,
903      163,     0,    93,     0,    95,    99,     7,     0,    14,    26,
904       11,    17,    23,    36,    37,    40,    39,    45,    46,    43,
905       44,    48,    49,    54,    56,    58,     0,     0,   142,     0,
906        0,     0,   186,     0,   156,    62,    69,     0,    94,     9,
907        0,   144,     0,   178,   177,   180,     0,   169,     0,     0,
908        0,    81,    60,     0,   179,     0,     0,   168,   166,     0,
909        0,   157,     0,   181,     0,     0,     0,   159,   172,   158,
910        0,   182,   176,   167,   170,   174
911 };
912
913 /* YYDEFGOTO[NTERM-NUM].  */
914 static const yytype_int16 yydefgoto[] =
915 {
916       -1,    98,    99,   100,   227,   101,   102,   103,   104,   105,
917      106,   107,   142,   109,   110,   111,   112,   113,   114,   115,
918      116,   117,   118,   119,   120,   143,   144,   216,   145,   122,
919      146,   147,    32,    33,    34,    79,    60,    61,    80,    35,
920       36,    37,    38,    39,    40,    41,   123,    43,    74,    75,
921      127,   128,   166,   149,   150,   151,   152,   210,   270,   288,
922      289,   153,   154,   155,   278,   269,   156,   253,   202,   250,
923      265,   275,   276,   157,    44,    45,    46,    53
924 };
925
926 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
927    STATE-NUM.  */
928 #define YYPACT_NINF -250
929 static const yytype_int16 yypact[] =
930 {
931     1218,   -13,  -250,  -250,  -250,   137,  -250,  -250,  -250,  -250,
932     -250,  -250,  -250,  -250,  -250,  -250,  -250,  -250,  -250,  -250,
933     -250,  -250,  -250,  -250,  -250,   -28,  -250,  -250,  -250,  -250,
934     -250,   -55,   -38,    -4,    33,   -20,  -250,    44,  1259,  -250,
935     1318,  -250,    18,  -250,  1176,  -250,  -250,  -250,  -250,  1318,
936      -22,  1259,  -250,    29,  -250,    85,    73,  -250,  -250,  -250,
937     -250,  1259,   113,    70,  -250,    13,  -250,  -250,   949,  -250,
938     -250,    49,  1259,    90,  1080,  -250,   283,  -250,  -250,  -250,
939     -250,   101,  1259,   -56,  -250,   757,   949,    80,  -250,  -250,
940     -250,  -250,   949,   949,   949,  -250,  -250,  -250,  -250,  -250,
941      -33,  -250,  -250,  -250,    81,   -15,  1013,    92,  -250,   949,
942       52,   -75,  -250,   -25,    40,  -250,  -250,  -250,   106,   105,
943      -46,  -250,    93,  -250,  -250,  1121,    95,     9,  -250,  -250,
944     -250,    88,    89,  -250,   100,   102,    91,   821,   104,   103,
945     -250,  -250,    66,  -250,  -250,    20,  -250,   -55,    79,  -250,
946     -250,  -250,  -250,   365,  -250,  -250,  -250,  -250,   107,  -250,
947     -250,   885,   949,  -250,   109,  -250,  -250,  -250,  -250,    -6,
948     -250,  -250,   949,  1283,  -250,  -250,   949,   110,  -250,  -250,
949     -250,   949,   949,   949,   949,   949,   949,   949,   949,   949,
950      949,   949,   949,   949,   949,  -250,  -250,   949,    90,  -250,
951     -250,  -250,   447,  -250,   949,  -250,  -250,    34,  -250,  -250,
952      447,  -250,  -250,  -250,  -250,  -250,   949,   949,  -250,  -250,
953     -250,   949,  -250,   111,  -250,  -250,  -250,   112,    99,  -250,
954      116,  -250,  -250,  -250,  -250,    52,    52,  -250,  -250,  -250,
955     -250,   -25,   -25,  -250,   106,   105,    77,   114,  -250,   125,
956      611,     4,  -250,   693,   447,  -250,  -250,   115,  -250,  -250,
957      949,  -250,   119,  -250,  -250,   693,   447,    99,   134,   122,
958      108,  -250,  -250,   949,  -250,   117,   123,   174,  -250,   120,
959      529,  -250,     7,   949,   529,   447,   949,  -250,  -250,  -250,
960      118,    99,  -250,  -250,  -250,  -250
961 };
962
963 /* YYPGOTO[NTERM-NUM].  */
964 static const yytype_int16 yypgoto[] =
965 {
966     -250,  -250,  -250,  -250,  -250,  -250,  -250,    22,  -250,  -250,
967     -250,  -250,    31,  -250,   -27,  -250,   -79,   -30,  -250,  -250,
968     -250,     5,     8,    12,  -250,   -63,   -85,  -250,   -92,   -82,
969       10,    11,  -250,  -250,  -250,   121,   149,   144,   126,  -250,
970     -250,  -233,   -21,   -24,   202,   -23,     0,  -250,   139,   -66,
971     -250,    27,  -156,   -41,  -149,  -249,  -250,  -250,  -250,   -58,
972      176,    17,   -19,  -250,  -250,   -35,  -250,  -250,  -250,  -250,
973     -250,  -250,  -250,  -250,  -250,   188,  -250,  -250
974 };
975
976 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
977    positive, shift that token.  If negative, reduce the rule which
978    number is the opposite.  If zero, do what YYDEFACT says.
979    If YYTABLE_NINF, syntax error.  */
980 #define YYTABLE_NINF -117
981 static const yytype_int16 yytable[] =
982 {
983       42,   165,   169,   164,   220,   121,   224,   183,   130,   184,
984       30,    31,   193,    62,    66,    50,   161,    67,   170,   171,
985      268,   178,   121,   162,    47,    52,    71,    73,   185,   186,
986       48,   287,   268,    54,    62,   287,    56,    81,    42,   172,
987       42,     6,     7,   173,    42,   207,    51,   194,    73,    42,
988       73,    42,    72,   249,    30,    31,   175,    63,    81,   130,
989       64,    42,   176,   187,   188,   226,    57,    58,    59,    23,
990       24,   217,    42,    55,    42,   266,   148,   165,   290,   223,
991      228,   217,    42,    84,   217,    85,   198,    65,    56,   199,
992       68,   232,    86,     6,     7,   189,   190,   217,   121,   108,
993      218,    73,   246,    76,   -75,   220,   237,   238,   239,   240,
994       47,   217,   251,    83,   252,   247,   108,   277,    57,    58,
995       59,    23,    24,   167,   168,    42,   211,   212,   213,   124,
996      294,   255,   256,   126,   121,   214,   293,   181,   182,   257,
997      180,     2,     3,     4,   158,   215,    57,    58,    59,   -25,
998      -26,    68,   174,   148,   217,   260,   235,   236,   121,   241,
999      242,   267,   179,   191,   192,   262,   195,   197,   200,   201,
1000      203,   205,   204,   267,   208,   272,   217,   279,   209,   221,
1001     -116,   282,   225,   281,   258,   259,   -27,   261,   271,   273,
1002      285,   291,   108,   280,   284,   231,   243,   283,   295,   286,
1003      244,   165,   148,   159,    78,   245,    82,    49,   160,   263,
1004      148,   125,   233,   234,   108,   108,   108,   108,   108,   108,
1005      108,   108,   108,   108,   108,   248,   292,   254,   108,    77,
1006      274,   264,    70,     0,     0,     0,     0,     0,     0,     0,
1007        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1008      148,     0,   108,   148,   148,     0,     0,     0,     0,     0,
1009        0,     0,     0,     0,     0,   148,   148,     0,     0,     0,
1010        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1011      148,     0,     0,     0,   148,   148,     1,     2,     3,     4,
1012        5,     6,     7,     8,     9,    10,   131,   132,   133,     0,
1013      134,   135,   136,   137,    11,    12,    13,    14,    15,    16,
1014       17,    18,    19,    20,    21,    22,     0,     0,     0,    23,
1015       24,    25,    26,   138,    27,    28,    87,    29,    88,    89,
1016       90,    91,     0,     0,    92,    93,     0,     0,     0,     0,
1017        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1018        0,     0,     0,    94,     0,     0,     0,   139,   140,     0,
1019        0,     0,     0,   141,    95,    96,     0,    97,     1,     2,
1020        3,     4,     5,     6,     7,     8,     9,    10,   131,   132,
1021      133,     0,   134,   135,   136,   137,    11,    12,    13,    14,
1022       15,    16,    17,    18,    19,    20,    21,    22,     0,     0,
1023        0,    23,    24,    25,    26,   138,    27,    28,    87,    29,
1024       88,    89,    90,    91,     0,     0,    92,    93,     0,     0,
1025        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1026        0,     0,     0,     0,     0,    94,     0,     0,     0,   139,
1027      219,     0,     0,     0,     0,   141,    95,    96,     0,    97,
1028        1,     2,     3,     4,     5,     6,     7,     8,     9,    10,
1029      131,   132,   133,     0,   134,   135,   136,   137,    11,    12,
1030       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
1031        0,     0,     0,    23,    24,    25,    26,   138,    27,    28,
1032       87,    29,    88,    89,    90,    91,     0,     0,    92,    93,
1033        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1034        0,     0,     0,     0,     0,     0,     0,    94,     0,     0,
1035        0,   139,     0,     0,     0,     0,     0,   141,    95,    96,
1036        0,    97,     1,     2,     3,     4,     5,     6,     7,     8,
1037        9,    10,   131,   132,   133,     0,   134,   135,   136,   137,
1038       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
1039       21,    22,     0,     0,     0,    23,    24,    25,    26,   138,
1040       27,    28,    87,    29,    88,    89,    90,    91,     0,     0,
1041       92,    93,     0,     0,     0,     0,     0,     0,     0,     0,
1042        0,     0,     0,     0,     0,     0,     0,     0,     0,    94,
1043        0,     0,     0,    76,     0,     0,     0,     0,     0,   141,
1044       95,    96,     0,    97,     1,     2,     3,     4,     5,     6,
1045        7,     8,     9,    10,     0,     0,     0,     0,     0,     0,
1046        0,     0,    11,    12,    13,    14,    15,    16,    17,    18,
1047       19,    20,    21,    22,     0,     0,     0,    23,    24,    25,
1048       26,     0,    27,    28,    87,    29,    88,    89,    90,    91,
1049        0,     0,    92,    93,     0,     0,     0,     0,     0,     0,
1050        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1051        0,    94,     0,     0,     0,     0,     0,     0,     0,     0,
1052        0,   141,    95,    96,     0,    97,    56,     2,     3,     4,
1053        0,     6,     7,     8,     9,    10,     0,     0,     0,     0,
1054        0,     0,     0,     0,    11,    12,    13,    14,    15,    16,
1055       17,    18,    19,    20,    21,    22,     0,     0,     0,    23,
1056       24,    25,    26,     0,    27,    28,    87,    29,    88,    89,
1057       90,    91,     0,     0,    92,    93,     0,     0,     0,     0,
1058        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1059        0,     0,     0,    94,     0,     0,     0,     8,     9,    10,
1060        0,     0,     0,     0,    95,    96,     0,    97,    11,    12,
1061       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
1062        0,     0,     0,     0,     0,    25,    26,     0,    27,    28,
1063       87,    29,    88,    89,    90,    91,     0,     0,    92,    93,
1064        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1065        0,     0,     0,     0,     0,     0,     0,    94,     0,     0,
1066      163,     8,     9,    10,     0,     0,     0,     0,    95,    96,
1067        0,    97,    11,    12,    13,    14,    15,    16,    17,    18,
1068       19,    20,    21,    22,     0,     0,     0,     0,     0,    25,
1069       26,     0,    27,    28,    87,    29,    88,    89,    90,    91,
1070        0,     0,    92,    93,     0,     0,     0,     0,     0,     0,
1071        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1072        0,    94,     0,     0,     0,     8,     9,    10,     0,     0,
1073        0,   206,    95,    96,     0,    97,    11,    12,    13,    14,
1074       15,    16,    17,    18,    19,    20,    21,    22,     0,     0,
1075        0,     0,     0,    25,    26,     0,    27,    28,    87,    29,
1076       88,    89,    90,    91,     0,     0,    92,    93,     0,     0,
1077        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1078        0,     0,     0,     0,     0,    94,     0,     0,   222,     8,
1079        9,    10,     0,     0,     0,     0,    95,    96,     0,    97,
1080       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
1081       21,    22,     0,     0,     0,     0,     0,    25,    26,     0,
1082       27,    28,    87,    29,    88,    89,    90,    91,     0,     0,
1083       92,    93,     0,     0,     0,     0,     0,     0,     0,     0,
1084        0,     0,     0,     0,     0,     0,     0,     0,     0,    94,
1085        0,     0,     0,     8,     9,    10,     0,     0,     0,     0,
1086       95,    96,     0,    97,    11,    12,    13,    14,    15,    16,
1087       17,    18,    19,    20,    21,    22,     0,     0,     0,     0,
1088        0,    25,   177,     0,    27,    28,    87,    29,    88,    89,
1089       90,    91,     0,     0,    92,    93,     0,     0,     0,     0,
1090        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1091        0,     0,     0,    94,     2,     3,     4,     0,     0,     0,
1092        8,     9,    10,     0,    95,    96,     0,    97,     0,     0,
1093        0,    11,    12,    13,    14,    15,    16,    17,    18,    19,
1094       20,    21,    22,     0,     0,     0,     0,     0,    25,    26,
1095        0,    27,    28,     0,    29,     2,     3,     4,     0,     0,
1096        0,     8,     9,    10,     0,     0,     0,     0,     0,     0,
1097        0,     0,    11,    12,    13,    14,    15,    16,    17,    18,
1098       19,    20,    21,    22,     0,   129,     0,     0,     0,    25,
1099       26,     0,    27,    28,     0,    29,     0,     0,     0,     0,
1100        0,     0,     0,     0,     0,     0,    69,     0,     0,     1,
1101        2,     3,     4,     5,     6,     7,     8,     9,    10,     0,
1102        0,     0,     0,     0,     0,     0,   196,    11,    12,    13,
1103       14,    15,    16,    17,    18,    19,    20,    21,    22,     0,
1104        0,     0,    23,    24,    25,    26,     0,    27,    28,     0,
1105       29,     1,     2,     3,     4,     5,     6,     7,     8,     9,
1106       10,     0,     0,     0,     0,     0,     0,     0,     0,    11,
1107       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
1108       22,     0,     0,     0,    23,    24,    25,    26,     0,    27,
1109       28,     0,    29,     2,     3,     4,     0,     0,     0,     8,
1110        9,    10,     0,     0,     0,     0,     0,     0,     0,     0,
1111       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
1112       21,    22,     0,     8,     9,    10,     0,    25,    26,     0,
1113       27,    28,     0,    29,    11,    12,    13,    14,    15,    16,
1114       17,    18,    19,    20,    21,    22,     0,     0,     0,     0,
1115        0,    25,    26,     0,    27,    28,   229,    29,     8,     9,
1116       10,   230,     0,     0,     0,     0,     0,     0,     0,    11,
1117       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
1118       22,     0,     0,     0,     0,     0,    25,    26,     0,    27,
1119       28,     0,    29
1120 };
1121
1122 static const yytype_int16 yycheck[] =
1123 {
1124        0,    86,    94,    85,   153,    68,   162,    82,    74,    84,
1125        0,     0,    58,    34,    38,    43,    72,    40,    51,    52,
1126      253,   106,    85,    79,    37,    80,    49,    51,    53,    54,
1127       43,   280,   265,    71,    55,   284,     3,    61,    38,    72,
1128       40,     8,     9,    76,    44,   137,    74,    93,    72,    49,
1129       74,    51,    74,   202,    44,    44,    71,    77,    82,   125,
1130       80,    61,    77,    88,    89,    71,    33,    34,    35,    36,
1131       37,    77,    72,    77,    74,    71,    76,   162,    71,   161,
1132      172,    77,    82,    70,    77,    72,    77,    43,     3,    80,
1133       72,   176,    79,     8,     9,    55,    56,    77,   161,    68,
1134       80,   125,   194,    74,    71,   254,   185,   186,   187,   188,
1135       37,    77,   204,    43,    80,   197,    85,   266,    33,    34,
1136       35,    36,    37,    92,    93,   125,    60,    61,    62,    80,
1137      286,   216,   217,    43,   197,    69,   285,    85,    86,   221,
1138      109,     4,     5,     6,    43,    79,    33,    34,    35,    70,
1139       70,    72,    71,   153,    77,    78,   183,   184,   221,   189,
1140      190,   253,    70,    57,    59,    40,    73,    72,    80,    80,
1141       70,    80,    70,   265,    70,   260,    77,    43,    75,    72,
1142       70,   273,    73,    75,    73,    73,    70,    73,    73,    70,
1143       16,   283,   161,    71,    71,   173,   191,    80,    80,    79,
1144      192,   286,   202,    82,    55,   193,    62,     5,    82,   250,
1145      210,    72,   181,   182,   183,   184,   185,   186,   187,   188,
1146      189,   190,   191,   192,   193,   198,   284,   210,   197,    53,
1147      265,   250,    44,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1148       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1149      250,    -1,   221,   253,   254,    -1,    -1,    -1,    -1,    -1,
1150       -1,    -1,    -1,    -1,    -1,   265,   266,    -1,    -1,    -1,
1151       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1152      280,    -1,    -1,    -1,   284,   285,     3,     4,     5,     6,
1153        7,     8,     9,    10,    11,    12,    13,    14,    15,    -1,
1154       17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
1155       27,    28,    29,    30,    31,    32,    -1,    -1,    -1,    36,
1156       37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
1157       47,    48,    -1,    -1,    51,    52,    -1,    -1,    -1,    -1,
1158       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1159       -1,    -1,    -1,    70,    -1,    -1,    -1,    74,    75,    -1,
1160       -1,    -1,    -1,    80,    81,    82,    -1,    84,     3,     4,
1161        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
1162       15,    -1,    17,    18,    19,    20,    21,    22,    23,    24,
1163       25,    26,    27,    28,    29,    30,    31,    32,    -1,    -1,
1164       -1,    36,    37,    38,    39,    40,    41,    42,    43,    44,
1165       45,    46,    47,    48,    -1,    -1,    51,    52,    -1,    -1,
1166       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1167       -1,    -1,    -1,    -1,    -1,    70,    -1,    -1,    -1,    74,
1168       75,    -1,    -1,    -1,    -1,    80,    81,    82,    -1,    84,
1169        3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
1170       13,    14,    15,    -1,    17,    18,    19,    20,    21,    22,
1171       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
1172       -1,    -1,    -1,    36,    37,    38,    39,    40,    41,    42,
1173       43,    44,    45,    46,    47,    48,    -1,    -1,    51,    52,
1174       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1175       -1,    -1,    -1,    -1,    -1,    -1,    -1,    70,    -1,    -1,
1176       -1,    74,    -1,    -1,    -1,    -1,    -1,    80,    81,    82,
1177       -1,    84,     3,     4,     5,     6,     7,     8,     9,    10,
1178       11,    12,    13,    14,    15,    -1,    17,    18,    19,    20,
1179       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
1180       31,    32,    -1,    -1,    -1,    36,    37,    38,    39,    40,
1181       41,    42,    43,    44,    45,    46,    47,    48,    -1,    -1,
1182       51,    52,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1183       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    70,
1184       -1,    -1,    -1,    74,    -1,    -1,    -1,    -1,    -1,    80,
1185       81,    82,    -1,    84,     3,     4,     5,     6,     7,     8,
1186        9,    10,    11,    12,    -1,    -1,    -1,    -1,    -1,    -1,
1187       -1,    -1,    21,    22,    23,    24,    25,    26,    27,    28,
1188       29,    30,    31,    32,    -1,    -1,    -1,    36,    37,    38,
1189       39,    -1,    41,    42,    43,    44,    45,    46,    47,    48,
1190       -1,    -1,    51,    52,    -1,    -1,    -1,    -1,    -1,    -1,
1191       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1192       -1,    70,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1193       -1,    80,    81,    82,    -1,    84,     3,     4,     5,     6,
1194       -1,     8,     9,    10,    11,    12,    -1,    -1,    -1,    -1,
1195       -1,    -1,    -1,    -1,    21,    22,    23,    24,    25,    26,
1196       27,    28,    29,    30,    31,    32,    -1,    -1,    -1,    36,
1197       37,    38,    39,    -1,    41,    42,    43,    44,    45,    46,
1198       47,    48,    -1,    -1,    51,    52,    -1,    -1,    -1,    -1,
1199       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1200       -1,    -1,    -1,    70,    -1,    -1,    -1,    10,    11,    12,
1201       -1,    -1,    -1,    -1,    81,    82,    -1,    84,    21,    22,
1202       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
1203       -1,    -1,    -1,    -1,    -1,    38,    39,    -1,    41,    42,
1204       43,    44,    45,    46,    47,    48,    -1,    -1,    51,    52,
1205       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1206       -1,    -1,    -1,    -1,    -1,    -1,    -1,    70,    -1,    -1,
1207       73,    10,    11,    12,    -1,    -1,    -1,    -1,    81,    82,
1208       -1,    84,    21,    22,    23,    24,    25,    26,    27,    28,
1209       29,    30,    31,    32,    -1,    -1,    -1,    -1,    -1,    38,
1210       39,    -1,    41,    42,    43,    44,    45,    46,    47,    48,
1211       -1,    -1,    51,    52,    -1,    -1,    -1,    -1,    -1,    -1,
1212       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1213       -1,    70,    -1,    -1,    -1,    10,    11,    12,    -1,    -1,
1214       -1,    80,    81,    82,    -1,    84,    21,    22,    23,    24,
1215       25,    26,    27,    28,    29,    30,    31,    32,    -1,    -1,
1216       -1,    -1,    -1,    38,    39,    -1,    41,    42,    43,    44,
1217       45,    46,    47,    48,    -1,    -1,    51,    52,    -1,    -1,
1218       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1219       -1,    -1,    -1,    -1,    -1,    70,    -1,    -1,    73,    10,
1220       11,    12,    -1,    -1,    -1,    -1,    81,    82,    -1,    84,
1221       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
1222       31,    32,    -1,    -1,    -1,    -1,    -1,    38,    39,    -1,
1223       41,    42,    43,    44,    45,    46,    47,    48,    -1,    -1,
1224       51,    52,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1225       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    70,
1226       -1,    -1,    -1,    10,    11,    12,    -1,    -1,    -1,    -1,
1227       81,    82,    -1,    84,    21,    22,    23,    24,    25,    26,
1228       27,    28,    29,    30,    31,    32,    -1,    -1,    -1,    -1,
1229       -1,    38,    39,    -1,    41,    42,    43,    44,    45,    46,
1230       47,    48,    -1,    -1,    51,    52,    -1,    -1,    -1,    -1,
1231       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1232       -1,    -1,    -1,    70,     4,     5,     6,    -1,    -1,    -1,
1233       10,    11,    12,    -1,    81,    82,    -1,    84,    -1,    -1,
1234       -1,    21,    22,    23,    24,    25,    26,    27,    28,    29,
1235       30,    31,    32,    -1,    -1,    -1,    -1,    -1,    38,    39,
1236       -1,    41,    42,    -1,    44,     4,     5,     6,    -1,    -1,
1237       -1,    10,    11,    12,    -1,    -1,    -1,    -1,    -1,    -1,
1238       -1,    -1,    21,    22,    23,    24,    25,    26,    27,    28,
1239       29,    30,    31,    32,    -1,    75,    -1,    -1,    -1,    38,
1240       39,    -1,    41,    42,    -1,    44,    -1,    -1,    -1,    -1,
1241       -1,    -1,    -1,    -1,    -1,    -1,     0,    -1,    -1,     3,
1242        4,     5,     6,     7,     8,     9,    10,    11,    12,    -1,
1243       -1,    -1,    -1,    -1,    -1,    -1,    75,    21,    22,    23,
1244       24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
1245       -1,    -1,    36,    37,    38,    39,    -1,    41,    42,    -1,
1246       44,     3,     4,     5,     6,     7,     8,     9,    10,    11,
1247       12,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    21,
1248       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
1249       32,    -1,    -1,    -1,    36,    37,    38,    39,    -1,    41,
1250       42,    -1,    44,     4,     5,     6,    -1,    -1,    -1,    10,
1251       11,    12,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1252       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
1253       31,    32,    -1,    10,    11,    12,    -1,    38,    39,    -1,
1254       41,    42,    -1,    44,    21,    22,    23,    24,    25,    26,
1255       27,    28,    29,    30,    31,    32,    -1,    -1,    -1,    -1,
1256       -1,    38,    39,    -1,    41,    42,    43,    44,    10,    11,
1257       12,    48,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    21,
1258       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
1259       32,    -1,    -1,    -1,    -1,    -1,    38,    39,    -1,    41,
1260       42,    -1,    44
1261 };
1262
1263 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1264    symbol of state STATE-NUM.  */
1265 static const yytype_uint8 yystos[] =
1266 {
1267        0,     3,     4,     5,     6,     7,     8,     9,    10,    11,
1268       12,    21,    22,    23,    24,    25,    26,    27,    28,    29,
1269       30,    31,    32,    36,    37,    38,    39,    41,    42,    44,
1270      124,   125,   126,   127,   128,   133,   134,   135,   136,   137,
1271      138,   139,   140,   141,   168,   169,   170,    37,    43,   138,
1272       43,    74,    80,   171,    71,    77,     3,    33,    34,    35,
1273      130,   131,   136,    77,    80,    43,   137,   139,    72,     0,
1274      169,   139,    74,   137,   142,   143,    74,   154,   130,   129,
1275      132,   137,   131,    43,    70,    72,    79,    43,    45,    46,
1276       47,    48,    51,    52,    70,    81,    82,    84,    95,    96,
1277       97,    99,   100,   101,   102,   103,   104,   105,   106,   107,
1278      108,   109,   110,   111,   112,   113,   114,   115,   116,   117,
1279      118,   119,   123,   140,    80,   142,    43,   144,   145,    75,
1280      143,    13,    14,    15,    17,    18,    19,    20,    40,    74,
1281       75,    80,   106,   119,   120,   122,   124,   125,   140,   147,
1282      148,   149,   150,   155,   156,   157,   160,   167,    43,   129,
1283      132,    72,    79,    73,   123,   120,   146,   106,   106,   122,
1284       51,    52,    72,    76,    71,    71,    77,    39,   120,    70,
1285      106,    85,    86,    82,    84,    53,    54,    88,    89,    55,
1286       56,    57,    59,    58,    93,    73,    75,    72,    77,    80,
1287       80,    80,   162,    70,    70,    80,    80,   122,    70,    75,
1288      151,    60,    61,    62,    69,    79,   121,    77,    80,    75,
1289      148,    72,    73,   123,   146,    73,    71,    98,   122,    43,
1290       48,   101,   120,   106,   106,   108,   108,   110,   110,   110,
1291      110,   111,   111,   115,   116,   117,   122,   123,   145,   148,
1292      163,   122,    80,   161,   155,   120,   120,   123,    73,    73,
1293       78,    73,    40,   147,   156,   164,    71,   122,   135,   159,
1294      152,    73,   120,    70,   159,   165,   166,   148,   158,    43,
1295       71,    75,   122,    80,    71,    16,    79,   149,   153,   154,
1296       71,   122,   153,   148,   146,    80
1297 };
1298
1299 #define yyerrok         (yyerrstatus = 0)
1300 #define yyclearin       (yychar = YYEMPTY)
1301 #define YYEMPTY         (-2)
1302 #define YYEOF           0
1303
1304 #define YYACCEPT        goto yyacceptlab
1305 #define YYABORT         goto yyabortlab
1306 #define YYERROR         goto yyerrorlab
1307
1308
1309 /* Like YYERROR except do call yyerror.  This remains here temporarily
1310    to ease the transition to the new meaning of YYERROR, for GCC.
1311    Once GCC version 2 has supplanted version 1, this can go.  */
1312
1313 #define YYFAIL          goto yyerrlab
1314
1315 #define YYRECOVERING()  (!!yyerrstatus)
1316
1317 #define YYBACKUP(Token, Value)                                  \
1318 do                                                              \
1319   if (yychar == YYEMPTY && yylen == 1)                          \
1320     {                                                           \
1321       yychar = (Token);                                         \
1322       yylval = (Value);                                         \
1323       yytoken = YYTRANSLATE (yychar);                           \
1324       YYPOPSTACK (1);                                           \
1325       goto yybackup;                                            \
1326     }                                                           \
1327   else                                                          \
1328     {                                                           \
1329       yyerror (context, YY_("syntax error: cannot back up")); \
1330       YYERROR;                                                  \
1331     }                                                           \
1332 while (YYID (0))
1333
1334
1335 #define YYTERROR        1
1336 #define YYERRCODE       256
1337
1338
1339 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1340    If N is 0, then set CURRENT to the empty location which ends
1341    the previous symbol: RHS[0] (always defined).  */
1342
1343 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1344 #ifndef YYLLOC_DEFAULT
1345 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
1346     do                                                                  \
1347       if (YYID (N))                                                    \
1348         {                                                               \
1349           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
1350           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
1351           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
1352           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
1353         }                                                               \
1354       else                                                              \
1355         {                                                               \
1356           (Current).first_line   = (Current).last_line   =              \
1357             YYRHSLOC (Rhs, 0).last_line;                                \
1358           (Current).first_column = (Current).last_column =              \
1359             YYRHSLOC (Rhs, 0).last_column;                              \
1360         }                                                               \
1361     while (YYID (0))
1362 #endif
1363
1364
1365 /* YY_LOCATION_PRINT -- Print the location on the stream.
1366    This macro was not mandated originally: define only if we know
1367    we won't break user code: when these are the locations we know.  */
1368
1369 #ifndef YY_LOCATION_PRINT
1370 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1371 #  define YY_LOCATION_PRINT(File, Loc)                  \
1372      fprintf (File, "%d.%d-%d.%d",                      \
1373               (Loc).first_line, (Loc).first_column,     \
1374               (Loc).last_line,  (Loc).last_column)
1375 # else
1376 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1377 # endif
1378 #endif
1379
1380
1381 /* YYLEX -- calling `yylex' with the right arguments.  */
1382
1383 #ifdef YYLEX_PARAM
1384 # define YYLEX yylex (&yylval, YYLEX_PARAM)
1385 #else
1386 # define YYLEX yylex (&yylval)
1387 #endif
1388
1389 /* Enable debugging if requested.  */
1390 #if YYDEBUG
1391
1392 # ifndef YYFPRINTF
1393 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1394 #  define YYFPRINTF fprintf
1395 # endif
1396
1397 # define YYDPRINTF(Args)                        \
1398 do {                                            \
1399   if (yydebug)                                  \
1400     YYFPRINTF Args;                             \
1401 } while (YYID (0))
1402
1403 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
1404 do {                                                                      \
1405   if (yydebug)                                                            \
1406     {                                                                     \
1407       YYFPRINTF (stderr, "%s ", Title);                                   \
1408       yy_symbol_print (stderr,                                            \
1409                   Type, Value, context); \
1410       YYFPRINTF (stderr, "\n");                                           \
1411     }                                                                     \
1412 } while (YYID (0))
1413
1414
1415 /*--------------------------------.
1416 | Print this symbol on YYOUTPUT.  |
1417 `--------------------------------*/
1418
1419 /*ARGSUSED*/
1420 #if (defined __STDC__ || defined __C99__FUNC__ \
1421      || defined __cplusplus || defined _MSC_VER)
1422 static void
1423 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1424 #else
1425 static void
1426 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1427     FILE *yyoutput;
1428     int yytype;
1429     YYSTYPE const * const yyvaluep;
1430     TParseContext* context;
1431 #endif
1432 {
1433   if (!yyvaluep)
1434     return;
1435   YYUSE (context);
1436 # ifdef YYPRINT
1437   if (yytype < YYNTOKENS)
1438     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1439 # else
1440   YYUSE (yyoutput);
1441 # endif
1442   switch (yytype)
1443     {
1444       default:
1445         break;
1446     }
1447 }
1448
1449
1450 /*--------------------------------.
1451 | Print this symbol on YYOUTPUT.  |
1452 `--------------------------------*/
1453
1454 #if (defined __STDC__ || defined __C99__FUNC__ \
1455      || defined __cplusplus || defined _MSC_VER)
1456 static void
1457 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1458 #else
1459 static void
1460 yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1461     FILE *yyoutput;
1462     int yytype;
1463     YYSTYPE const * const yyvaluep;
1464     TParseContext* context;
1465 #endif
1466 {
1467   if (yytype < YYNTOKENS)
1468     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1469   else
1470     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1471
1472   yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1473   YYFPRINTF (yyoutput, ")");
1474 }
1475
1476 /*------------------------------------------------------------------.
1477 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1478 | TOP (included).                                                   |
1479 `------------------------------------------------------------------*/
1480
1481 #if (defined __STDC__ || defined __C99__FUNC__ \
1482      || defined __cplusplus || defined _MSC_VER)
1483 static void
1484 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1485 #else
1486 static void
1487 yy_stack_print (bottom, top)
1488     yytype_int16 *bottom;
1489     yytype_int16 *top;
1490 #endif
1491 {
1492   YYFPRINTF (stderr, "Stack now");
1493   for (; bottom <= top; ++bottom)
1494     YYFPRINTF (stderr, " %d", *bottom);
1495   YYFPRINTF (stderr, "\n");
1496 }
1497
1498 # define YY_STACK_PRINT(Bottom, Top)                            \
1499 do {                                                            \
1500   if (yydebug)                                                  \
1501     yy_stack_print ((Bottom), (Top));                           \
1502 } while (YYID (0))
1503
1504
1505 /*------------------------------------------------.
1506 | Report that the YYRULE is going to be reduced.  |
1507 `------------------------------------------------*/
1508
1509 #if (defined __STDC__ || defined __C99__FUNC__ \
1510      || defined __cplusplus || defined _MSC_VER)
1511 static void
1512 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1513 #else
1514 static void
1515 yy_reduce_print (yyvsp, yyrule, context)
1516     YYSTYPE *yyvsp;
1517     int yyrule;
1518     TParseContext* context;
1519 #endif
1520 {
1521   int yynrhs = yyr2[yyrule];
1522   int yyi;
1523   unsigned long int yylno = yyrline[yyrule];
1524   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1525              yyrule - 1, yylno);
1526   /* The symbols being reduced.  */
1527   for (yyi = 0; yyi < yynrhs; yyi++)
1528     {
1529       fprintf (stderr, "   $%d = ", yyi + 1);
1530       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1531                        &(yyvsp[(yyi + 1) - (yynrhs)])
1532                                        , context);
1533       fprintf (stderr, "\n");
1534     }
1535 }
1536
1537 # define YY_REDUCE_PRINT(Rule)          \
1538 do {                                    \
1539   if (yydebug)                          \
1540     yy_reduce_print (yyvsp, Rule, context); \
1541 } while (YYID (0))
1542
1543 /* Nonzero means print parse trace.  It is left uninitialized so that
1544    multiple parsers can coexist.  */
1545 int yydebug;
1546 #else /* !YYDEBUG */
1547 # define YYDPRINTF(Args)
1548 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1549 # define YY_STACK_PRINT(Bottom, Top)
1550 # define YY_REDUCE_PRINT(Rule)
1551 #endif /* !YYDEBUG */
1552
1553
1554 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1555 #ifndef YYINITDEPTH
1556 # define YYINITDEPTH 200
1557 #endif
1558
1559 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1560    if the built-in stack extension method is used).
1561
1562    Do not make this value too large; the results are undefined if
1563    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1564    evaluated with infinite-precision integer arithmetic.  */
1565
1566 #ifndef YYMAXDEPTH
1567 # define YYMAXDEPTH 10000
1568 #endif
1569
1570 \f
1571
1572 #if YYERROR_VERBOSE
1573
1574 # ifndef yystrlen
1575 #  if defined __GLIBC__ && defined _STRING_H
1576 #   define yystrlen strlen
1577 #  else
1578 /* Return the length of YYSTR.  */
1579 #if (defined __STDC__ || defined __C99__FUNC__ \
1580      || defined __cplusplus || defined _MSC_VER)
1581 static YYSIZE_T
1582 yystrlen (const char *yystr)
1583 #else
1584 static YYSIZE_T
1585 yystrlen (yystr)
1586     const char *yystr;
1587 #endif
1588 {
1589   YYSIZE_T yylen;
1590   for (yylen = 0; yystr[yylen]; yylen++)
1591     continue;
1592   return yylen;
1593 }
1594 #  endif
1595 # endif
1596
1597 # ifndef yystpcpy
1598 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1599 #   define yystpcpy stpcpy
1600 #  else
1601 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1602    YYDEST.  */
1603 #if (defined __STDC__ || defined __C99__FUNC__ \
1604      || defined __cplusplus || defined _MSC_VER)
1605 static char *
1606 yystpcpy (char *yydest, const char *yysrc)
1607 #else
1608 static char *
1609 yystpcpy (yydest, yysrc)
1610     char *yydest;
1611     const char *yysrc;
1612 #endif
1613 {
1614   char *yyd = yydest;
1615   const char *yys = yysrc;
1616
1617   while ((*yyd++ = *yys++) != '\0')
1618     continue;
1619
1620   return yyd - 1;
1621 }
1622 #  endif
1623 # endif
1624
1625 # ifndef yytnamerr
1626 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1627    quotes and backslashes, so that it's suitable for yyerror.  The
1628    heuristic is that double-quoting is unnecessary unless the string
1629    contains an apostrophe, a comma, or backslash (other than
1630    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1631    null, do not copy; instead, return the length of what the result
1632    would have been.  */
1633 static YYSIZE_T
1634 yytnamerr (char *yyres, const char *yystr)
1635 {
1636   if (*yystr == '"')
1637     {
1638       YYSIZE_T yyn = 0;
1639       char const *yyp = yystr;
1640
1641       for (;;)
1642         switch (*++yyp)
1643           {
1644           case '\'':
1645           case ',':
1646             goto do_not_strip_quotes;
1647
1648           case '\\':
1649             if (*++yyp != '\\')
1650               goto do_not_strip_quotes;
1651             /* Fall through.  */
1652           default:
1653             if (yyres)
1654               yyres[yyn] = *yyp;
1655             yyn++;
1656             break;
1657
1658           case '"':
1659             if (yyres)
1660               yyres[yyn] = '\0';
1661             return yyn;
1662           }
1663     do_not_strip_quotes: ;
1664     }
1665
1666   if (! yyres)
1667     return yystrlen (yystr);
1668
1669   return yystpcpy (yyres, yystr) - yyres;
1670 }
1671 # endif
1672
1673 /* Copy into YYRESULT an error message about the unexpected token
1674    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
1675    including the terminating null byte.  If YYRESULT is null, do not
1676    copy anything; just return the number of bytes that would be
1677    copied.  As a special case, return 0 if an ordinary "syntax error"
1678    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
1679    size calculation.  */
1680 static YYSIZE_T
1681 yysyntax_error (char *yyresult, int yystate, int yychar)
1682 {
1683   int yyn = yypact[yystate];
1684
1685   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1686     return 0;
1687   else
1688     {
1689       int yytype = YYTRANSLATE (yychar);
1690       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1691       YYSIZE_T yysize = yysize0;
1692       YYSIZE_T yysize1;
1693       int yysize_overflow = 0;
1694       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1695       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1696       int yyx;
1697
1698 # if 0
1699       /* This is so xgettext sees the translatable formats that are
1700          constructed on the fly.  */
1701       YY_("syntax error, unexpected %s");
1702       YY_("syntax error, unexpected %s, expecting %s");
1703       YY_("syntax error, unexpected %s, expecting %s or %s");
1704       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1705       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1706 # endif
1707       char *yyfmt;
1708       char const *yyf;
1709       static char const yyunexpected[] = "syntax error, unexpected %s";
1710       static char const yyexpecting[] = ", expecting %s";
1711       static char const yyor[] = " or %s";
1712       char yyformat[sizeof yyunexpected
1713                     + sizeof yyexpecting - 1
1714                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1715                        * (sizeof yyor - 1))];
1716       char const *yyprefix = yyexpecting;
1717
1718       /* Start YYX at -YYN if negative to avoid negative indexes in
1719          YYCHECK.  */
1720       int yyxbegin = yyn < 0 ? -yyn : 0;
1721
1722       /* Stay within bounds of both yycheck and yytname.  */
1723       int yychecklim = YYLAST - yyn + 1;
1724       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1725       int yycount = 1;
1726
1727       yyarg[0] = yytname[yytype];
1728       yyfmt = yystpcpy (yyformat, yyunexpected);
1729
1730       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1731         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1732           {
1733             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1734               {
1735                 yycount = 1;
1736                 yysize = yysize0;
1737                 yyformat[sizeof yyunexpected - 1] = '\0';
1738                 break;
1739               }
1740             yyarg[yycount++] = yytname[yyx];
1741             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1742             yysize_overflow |= (yysize1 < yysize);
1743             yysize = yysize1;
1744             yyfmt = yystpcpy (yyfmt, yyprefix);
1745             yyprefix = yyor;
1746           }
1747
1748       yyf = YY_(yyformat);
1749       yysize1 = yysize + yystrlen (yyf);
1750       yysize_overflow |= (yysize1 < yysize);
1751       yysize = yysize1;
1752
1753       if (yysize_overflow)
1754         return YYSIZE_MAXIMUM;
1755
1756       if (yyresult)
1757         {
1758           /* Avoid sprintf, as that infringes on the user's name space.
1759              Don't have undefined behavior even if the translation
1760              produced a string with the wrong number of "%s"s.  */
1761           char *yyp = yyresult;
1762           int yyi = 0;
1763           while ((*yyp = *yyf) != '\0')
1764             {
1765               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1766                 {
1767                   yyp += yytnamerr (yyp, yyarg[yyi++]);
1768                   yyf += 2;
1769                 }
1770               else
1771                 {
1772                   yyp++;
1773                   yyf++;
1774                 }
1775             }
1776         }
1777       return yysize;
1778     }
1779 }
1780 #endif /* YYERROR_VERBOSE */
1781 \f
1782
1783 /*-----------------------------------------------.
1784 | Release the memory associated to this symbol.  |
1785 `-----------------------------------------------*/
1786
1787 /*ARGSUSED*/
1788 #if (defined __STDC__ || defined __C99__FUNC__ \
1789      || defined __cplusplus || defined _MSC_VER)
1790 static void
1791 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1792 #else
1793 static void
1794 yydestruct (yymsg, yytype, yyvaluep, context)
1795     const char *yymsg;
1796     int yytype;
1797     YYSTYPE *yyvaluep;
1798     TParseContext* context;
1799 #endif
1800 {
1801   YYUSE (yyvaluep);
1802   YYUSE (context);
1803
1804   if (!yymsg)
1805     yymsg = "Deleting";
1806   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1807
1808   switch (yytype)
1809     {
1810
1811       default:
1812         break;
1813     }
1814 }
1815 \f
1816
1817 /* Prevent warnings from -Wmissing-prototypes.  */
1818
1819 #ifdef YYPARSE_PARAM
1820 #if defined __STDC__ || defined __cplusplus
1821 int yyparse (void *YYPARSE_PARAM);
1822 #else
1823 int yyparse ();
1824 #endif
1825 #else /* ! YYPARSE_PARAM */
1826 #if defined __STDC__ || defined __cplusplus
1827 int yyparse (TParseContext* context);
1828 #else
1829 int yyparse ();
1830 #endif
1831 #endif /* ! YYPARSE_PARAM */
1832
1833
1834
1835
1836
1837
1838 /*----------.
1839 | yyparse.  |
1840 `----------*/
1841
1842 #ifdef YYPARSE_PARAM
1843 #if (defined __STDC__ || defined __C99__FUNC__ \
1844      || defined __cplusplus || defined _MSC_VER)
1845 int
1846 yyparse (void *YYPARSE_PARAM)
1847 #else
1848 int
1849 yyparse (YYPARSE_PARAM)
1850     void *YYPARSE_PARAM;
1851 #endif
1852 #else /* ! YYPARSE_PARAM */
1853 #if (defined __STDC__ || defined __C99__FUNC__ \
1854      || defined __cplusplus || defined _MSC_VER)
1855 int
1856 yyparse (TParseContext* context)
1857 #else
1858 int
1859 yyparse (context)
1860     TParseContext* context;
1861 #endif
1862 #endif
1863 {
1864   /* The look-ahead symbol.  */
1865 int yychar;
1866
1867 /* The semantic value of the look-ahead symbol.  */
1868 YYSTYPE yylval;
1869
1870 /* Number of syntax errors so far.  */
1871 int yynerrs;
1872
1873   int yystate;
1874   int yyn;
1875   int yyresult;
1876   /* Number of tokens to shift before error messages enabled.  */
1877   int yyerrstatus;
1878   /* Look-ahead token as an internal (translated) token number.  */
1879   int yytoken = 0;
1880 #if YYERROR_VERBOSE
1881   /* Buffer for error messages, and its allocated size.  */
1882   char yymsgbuf[128];
1883   char *yymsg = yymsgbuf;
1884   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1885 #endif
1886
1887   /* Three stacks and their tools:
1888      `yyss': related to states,
1889      `yyvs': related to semantic values,
1890      `yyls': related to locations.
1891
1892      Refer to the stacks thru separate pointers, to allow yyoverflow
1893      to reallocate them elsewhere.  */
1894
1895   /* The state stack.  */
1896   yytype_int16 yyssa[YYINITDEPTH];
1897   yytype_int16 *yyss = yyssa;
1898   yytype_int16 *yyssp;
1899
1900   /* The semantic value stack.  */
1901   YYSTYPE yyvsa[YYINITDEPTH];
1902   YYSTYPE *yyvs = yyvsa;
1903   YYSTYPE *yyvsp;
1904
1905
1906
1907 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1908
1909   YYSIZE_T yystacksize = YYINITDEPTH;
1910
1911   /* The variables used to return semantic value and location from the
1912      action routines.  */
1913   YYSTYPE yyval;
1914
1915
1916   /* The number of symbols on the RHS of the reduced rule.
1917      Keep to zero when no symbol should be popped.  */
1918   int yylen = 0;
1919
1920   YYDPRINTF ((stderr, "Starting parse\n"));
1921
1922   yystate = 0;
1923   yyerrstatus = 0;
1924   yynerrs = 0;
1925   yychar = YYEMPTY;             /* Cause a token to be read.  */
1926
1927   /* Initialize stack pointers.
1928      Waste one element of value and location stack
1929      so that they stay on the same level as the state stack.
1930      The wasted elements are never initialized.  */
1931
1932   yyssp = yyss;
1933   yyvsp = yyvs;
1934
1935   goto yysetstate;
1936
1937 /*------------------------------------------------------------.
1938 | yynewstate -- Push a new state, which is found in yystate.  |
1939 `------------------------------------------------------------*/
1940  yynewstate:
1941   /* In all cases, when you get here, the value and location stacks
1942      have just been pushed.  So pushing a state here evens the stacks.  */
1943   yyssp++;
1944
1945  yysetstate:
1946   *yyssp = yystate;
1947
1948   if (yyss + yystacksize - 1 <= yyssp)
1949     {
1950       /* Get the current used size of the three stacks, in elements.  */
1951       YYSIZE_T yysize = yyssp - yyss + 1;
1952
1953 #ifdef yyoverflow
1954       {
1955         /* Give user a chance to reallocate the stack.  Use copies of
1956            these so that the &'s don't force the real ones into
1957            memory.  */
1958         YYSTYPE *yyvs1 = yyvs;
1959         yytype_int16 *yyss1 = yyss;
1960
1961
1962         /* Each stack pointer address is followed by the size of the
1963            data in use in that stack, in bytes.  This used to be a
1964            conditional around just the two extra args, but that might
1965            be undefined if yyoverflow is a macro.  */
1966         yyoverflow (YY_("memory exhausted"),
1967                     &yyss1, yysize * sizeof (*yyssp),
1968                     &yyvs1, yysize * sizeof (*yyvsp),
1969
1970                     &yystacksize);
1971
1972         yyss = yyss1;
1973         yyvs = yyvs1;
1974       }
1975 #else /* no yyoverflow */
1976 # ifndef YYSTACK_RELOCATE
1977       goto yyexhaustedlab;
1978 # else
1979       /* Extend the stack our own way.  */
1980       if (YYMAXDEPTH <= yystacksize)
1981         goto yyexhaustedlab;
1982       yystacksize *= 2;
1983       if (YYMAXDEPTH < yystacksize)
1984         yystacksize = YYMAXDEPTH;
1985
1986       {
1987         yytype_int16 *yyss1 = yyss;
1988         union yyalloc *yyptr =
1989           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1990         if (! yyptr)
1991           goto yyexhaustedlab;
1992         YYSTACK_RELOCATE (yyss);
1993         YYSTACK_RELOCATE (yyvs);
1994
1995 #  undef YYSTACK_RELOCATE
1996         if (yyss1 != yyssa)
1997           YYSTACK_FREE (yyss1);
1998       }
1999 # endif
2000 #endif /* no yyoverflow */
2001
2002       yyssp = yyss + yysize - 1;
2003       yyvsp = yyvs + yysize - 1;
2004
2005
2006       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2007                   (unsigned long int) yystacksize));
2008
2009       if (yyss + yystacksize - 1 <= yyssp)
2010         YYABORT;
2011     }
2012
2013   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2014
2015   goto yybackup;
2016
2017 /*-----------.
2018 | yybackup.  |
2019 `-----------*/
2020 yybackup:
2021
2022   /* Do appropriate processing given the current state.  Read a
2023      look-ahead token if we need one and don't already have one.  */
2024
2025   /* First try to decide what to do without reference to look-ahead token.  */
2026   yyn = yypact[yystate];
2027   if (yyn == YYPACT_NINF)
2028     goto yydefault;
2029
2030   /* Not known => get a look-ahead token if don't already have one.  */
2031
2032   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
2033   if (yychar == YYEMPTY)
2034     {
2035       YYDPRINTF ((stderr, "Reading a token: "));
2036       yychar = YYLEX;
2037     }
2038
2039   if (yychar <= YYEOF)
2040     {
2041       yychar = yytoken = YYEOF;
2042       YYDPRINTF ((stderr, "Now at end of input.\n"));
2043     }
2044   else
2045     {
2046       yytoken = YYTRANSLATE (yychar);
2047       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2048     }
2049
2050   /* If the proper action on seeing token YYTOKEN is to reduce or to
2051      detect an error, take that action.  */
2052   yyn += yytoken;
2053   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2054     goto yydefault;
2055   yyn = yytable[yyn];
2056   if (yyn <= 0)
2057     {
2058       if (yyn == 0 || yyn == YYTABLE_NINF)
2059         goto yyerrlab;
2060       yyn = -yyn;
2061       goto yyreduce;
2062     }
2063
2064   if (yyn == YYFINAL)
2065     YYACCEPT;
2066
2067   /* Count tokens shifted since error; after three, turn off error
2068      status.  */
2069   if (yyerrstatus)
2070     yyerrstatus--;
2071
2072   /* Shift the look-ahead token.  */
2073   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2074
2075   /* Discard the shifted token unless it is eof.  */
2076   if (yychar != YYEOF)
2077     yychar = YYEMPTY;
2078
2079   yystate = yyn;
2080   *++yyvsp = yylval;
2081
2082   goto yynewstate;
2083
2084
2085 /*-----------------------------------------------------------.
2086 | yydefault -- do the default action for the current state.  |
2087 `-----------------------------------------------------------*/
2088 yydefault:
2089   yyn = yydefact[yystate];
2090   if (yyn == 0)
2091     goto yyerrlab;
2092   goto yyreduce;
2093
2094
2095 /*-----------------------------.
2096 | yyreduce -- Do a reduction.  |
2097 `-----------------------------*/
2098 yyreduce:
2099   /* yyn is the number of a rule to reduce with.  */
2100   yylen = yyr2[yyn];
2101
2102   /* If YYLEN is nonzero, implement the default value of the action:
2103      `$$ = $1'.
2104
2105      Otherwise, the following line sets YYVAL to garbage.
2106      This behavior is undocumented and Bison
2107      users should not rely upon it.  Assigning to YYVAL
2108      unconditionally makes the parser a bit smaller, and it avoids a
2109      GCC warning that YYVAL may be used uninitialized.  */
2110   yyval = yyvsp[1-yylen];
2111
2112
2113   YY_REDUCE_PRINT (yyn);
2114   switch (yyn)
2115     {
2116         case 2:
2117
2118     {
2119         // The symbol table search was done in the lexical phase
2120         const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2121         const TVariable* variable;
2122         if (symbol == 0) {
2123             context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2124             context->recover();
2125             TType type(EbtFloat, EbpUndefined);
2126             TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2127             context->symbolTable.insert(*fakeVariable);
2128             variable = fakeVariable;
2129         } else {
2130             // This identifier can only be a variable type symbol
2131             if (! symbol->isVariable()) {
2132                 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2133                 context->recover();
2134             }
2135             variable = static_cast<const TVariable*>(symbol);
2136         }
2137
2138         // don't delete $1.string, it's used by error recovery, and the pool
2139         // pop will reclaim the memory
2140
2141         if (variable->getType().getQualifier() == EvqConst ) {
2142             ConstantUnion* constArray = variable->getConstPointer();
2143             TType t(variable->getType());
2144             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2145         } else
2146             (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2147                                                      variable->getName(),
2148                                                      variable->getType(), (yyvsp[(1) - (1)].lex).line);
2149     ;}
2150     break;
2151
2152   case 3:
2153
2154     {
2155         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2156     ;}
2157     break;
2158
2159   case 4:
2160
2161     {
2162         //
2163         // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2164         // check for overflow for constants
2165         //
2166         if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2167             context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2168             context->recover();
2169         }
2170         ConstantUnion *unionArray = new ConstantUnion[1];
2171         unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2172         (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2173     ;}
2174     break;
2175
2176   case 5:
2177
2178     {
2179         ConstantUnion *unionArray = new ConstantUnion[1];
2180         unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2181         (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2182     ;}
2183     break;
2184
2185   case 6:
2186
2187     {
2188         ConstantUnion *unionArray = new ConstantUnion[1];
2189         unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2190         (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2191     ;}
2192     break;
2193
2194   case 7:
2195
2196     {
2197         (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
2198     ;}
2199     break;
2200
2201   case 8:
2202
2203     {
2204         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2205     ;}
2206     break;
2207
2208   case 9:
2209
2210     {
2211         if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2212             if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2213                 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", (yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode()->getSymbol().c_str(), "");
2214             else
2215                 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2216             context->recover();
2217         }
2218         if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2219             if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2220                 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2221             } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {  // constant folding for vectors
2222                 TVectorFields fields;
2223                 fields.num = 1;
2224                 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2225                 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2226             } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2227                 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2228             }
2229         } else {
2230             if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2231                 if (((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() || (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getNominalSize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) {
2232                     context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2233                     context->recover();
2234                 } else {
2235                     if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2236                         if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2237                             if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2238                                 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, (yyvsp[(2) - (4)].lex).line))
2239                                     context->recover();
2240                             } else {
2241                                 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2242                                     context->recover();
2243                             }
2244                         } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2245                             context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2246                             context->recover();
2247                         }
2248                     }
2249                     (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2250                 }
2251             } else {
2252                 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2253                     context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2254                     context->recover();
2255                 }
2256
2257                 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2258             }
2259         }
2260         if ((yyval.interm.intermTypedNode) == 0) {
2261             ConstantUnion *unionArray = new ConstantUnion[1];
2262             unionArray->setFConst(0.0f);
2263             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2264         } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2265             if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2266                 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2267             else
2268                 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize(), (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()));
2269
2270             if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2271                 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2272         } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2273             (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2274         else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2275             (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2276         else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2277             (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2278         else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2279             (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2280         else
2281             (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
2282     ;}
2283     break;
2284
2285   case 10:
2286
2287     {
2288         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2289     ;}
2290     break;
2291
2292   case 11:
2293
2294     {
2295         if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2296             context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2297             context->recover();
2298         }
2299
2300         if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2301             TVectorFields fields;
2302             if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2303                 fields.num = 1;
2304                 fields.offsets[0] = 0;
2305                 context->recover();
2306             }
2307
2308             if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2309                 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2310                 if ((yyval.interm.intermTypedNode) == 0) {
2311                     context->recover();
2312                     (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2313                 }
2314                 else
2315                     (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
2316             } else {
2317                 if (fields.num == 1) {
2318                     ConstantUnion *unionArray = new ConstantUnion[1];
2319                     unionArray->setIConst(fields.offsets[0]);
2320                     TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2321                     (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2322                     (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2323                 } else {
2324                     TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2325                     TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2326                     (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2327                     (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2328                 }
2329             }
2330         } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2331             TMatrixFields fields;
2332             if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2333                 fields.wholeRow = false;
2334                 fields.wholeCol = false;
2335                 fields.row = 0;
2336                 fields.col = 0;
2337                 context->recover();
2338             }
2339
2340             if (fields.wholeRow || fields.wholeCol) {
2341                 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2342                 context->recover();
2343                 ConstantUnion *unionArray = new ConstantUnion[1];
2344                 unionArray->setIConst(0);
2345                 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2346                 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2347                 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2348             } else {
2349                 ConstantUnion *unionArray = new ConstantUnion[1];
2350                 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2351                 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2352                 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2353                 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2354             }
2355         } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2356             bool fieldFound = false;
2357             const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2358             if (fields == 0) {
2359                 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2360                 context->recover();
2361                 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2362             } else {
2363                 unsigned int i;
2364                 for (i = 0; i < fields->size(); ++i) {
2365                     if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2366                         fieldFound = true;
2367                         break;
2368                     }
2369                 }
2370                 if (fieldFound) {
2371                     if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2372                         (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2373                         if ((yyval.interm.intermTypedNode) == 0) {
2374                             context->recover();
2375                             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2376                         }
2377                         else {
2378                             (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2379                             // change the qualifier of the return type, not of the structure field
2380                             // as the structure definition is shared between various structures.
2381                             (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2382                         }
2383                     } else {
2384                         ConstantUnion *unionArray = new ConstantUnion[1];
2385                         unionArray->setIConst(i);
2386                         TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2387                         (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2388                         (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2389                     }
2390                 } else {
2391                     context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2392                     context->recover();
2393                     (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2394                 }
2395             }
2396         } else {
2397             context->error((yyvsp[(2) - (3)].lex).line, " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2398             context->recover();
2399             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2400         }
2401         // don't delete $3.string, it's from the pool
2402     ;}
2403     break;
2404
2405   case 12:
2406
2407     {
2408         if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2409             context->recover();
2410         (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2411         if ((yyval.interm.intermTypedNode) == 0) {
2412             context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2413             context->recover();
2414             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2415         }
2416     ;}
2417     break;
2418
2419   case 13:
2420
2421     {
2422         if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2423             context->recover();
2424         (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2425         if ((yyval.interm.intermTypedNode) == 0) {
2426             context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2427             context->recover();
2428             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2429         }
2430     ;}
2431     break;
2432
2433   case 14:
2434
2435     {
2436         if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2437             context->recover();
2438         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2439     ;}
2440     break;
2441
2442   case 15:
2443
2444     {
2445         TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2446         TOperator op = fnCall->getBuiltInOp();
2447
2448         if (op != EOpNull)
2449         {
2450             //
2451             // Then this should be a constructor.
2452             // Don't go through the symbol table for constructors.
2453             // Their parameters will be verified algorithmically.
2454             //
2455             TType type(EbtVoid, EbpUndefined);  // use this to get the type back
2456             if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2457                 (yyval.interm.intermTypedNode) = 0;
2458             } else {
2459                 //
2460                 // It's a constructor, of type 'type'.
2461                 //
2462                 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2463             }
2464
2465             if ((yyval.interm.intermTypedNode) == 0) {
2466                 context->recover();
2467                 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2468             }
2469             (yyval.interm.intermTypedNode)->setType(type);
2470         } else {
2471             //
2472             // Not a constructor.  Find it in the symbol table.
2473             //
2474             const TFunction* fnCandidate;
2475             bool builtIn;
2476             fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2477             if (fnCandidate) {
2478                 //
2479                 // A declared function.
2480                 //
2481                 if (builtIn && !fnCandidate->getExtension().empty() &&
2482                     context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2483                     context->recover();
2484                 }
2485                 op = fnCandidate->getBuiltInOp();
2486                 if (builtIn && op != EOpNull) {
2487                     //
2488                     // A function call mapped to a built-in operation.
2489                     //
2490                     if (fnCandidate->getParamCount() == 1) {
2491                         //
2492                         // Treat it like a built-in unary operator.
2493                         //
2494                         (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2495                         if ((yyval.interm.intermTypedNode) == 0)  {
2496                             context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2497                                 "built in unary operator function.  Type: %s",
2498                                 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2499                             YYERROR;
2500                         }
2501                     } else {
2502                         (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2503                     }
2504                 } else {
2505                     // This is a real function call
2506
2507                     (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2508                     (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2509
2510                     // this is how we know whether the given function is a builtIn function or a user defined function
2511                     // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2512                     // if builtIn == true, it's definitely a builtIn function with EOpNull
2513                     if (!builtIn)
2514                         (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2515                     (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2516
2517                     TQualifier qual;
2518                     for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2519                         qual = fnCandidate->getParam(i).type->getQualifier();
2520                         if (qual == EvqOut || qual == EvqInOut) {
2521                             if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2522                                 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2523                                 context->recover();
2524                             }
2525                         }
2526                     }
2527                 }
2528                 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2529             } else {
2530                 // error message was put out by PaFindFunction()
2531                 // Put on a dummy node for error recovery
2532                 ConstantUnion *unionArray = new ConstantUnion[1];
2533                 unionArray->setFConst(0.0f);
2534                 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2535                 context->recover();
2536             }
2537         }
2538         delete fnCall;
2539     ;}
2540     break;
2541
2542   case 16:
2543
2544     {
2545         (yyval.interm) = (yyvsp[(1) - (1)].interm);
2546     ;}
2547     break;
2548
2549   case 17:
2550
2551     {
2552         context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2553         context->recover();
2554         (yyval.interm) = (yyvsp[(3) - (3)].interm);
2555     ;}
2556     break;
2557
2558   case 18:
2559
2560     {
2561         (yyval.interm) = (yyvsp[(1) - (2)].interm);
2562         (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2563     ;}
2564     break;
2565
2566   case 19:
2567
2568     {
2569         (yyval.interm) = (yyvsp[(1) - (2)].interm);
2570         (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2571     ;}
2572     break;
2573
2574   case 20:
2575
2576     {
2577         (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2578         (yyval.interm).intermNode = 0;
2579     ;}
2580     break;
2581
2582   case 21:
2583
2584     {
2585         (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2586         (yyval.interm).intermNode = 0;
2587     ;}
2588     break;
2589
2590   case 22:
2591
2592     {
2593         TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2594         (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2595         (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2596         (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
2597     ;}
2598     break;
2599
2600   case 23:
2601
2602     {
2603         TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2604         (yyvsp[(1) - (3)].interm).function->addParameter(param);
2605         (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2606         (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2607     ;}
2608     break;
2609
2610   case 24:
2611
2612     {
2613         (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
2614     ;}
2615     break;
2616
2617   case 25:
2618
2619     {
2620         //
2621         // Constructor
2622         //
2623         TOperator op = EOpNull;
2624         if ((yyvsp[(1) - (1)].interm.type).userDef) {
2625             op = EOpConstructStruct;
2626         } else {
2627             switch ((yyvsp[(1) - (1)].interm.type).type) {
2628             case EbtFloat:
2629                 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2630                     switch((yyvsp[(1) - (1)].interm.type).size) {
2631                     case 2:                                     op = EOpConstructMat2;  break;
2632                     case 3:                                     op = EOpConstructMat3;  break;
2633                     case 4:                                     op = EOpConstructMat4;  break;
2634                     }
2635                 } else {
2636                     switch((yyvsp[(1) - (1)].interm.type).size) {
2637                     case 1:                                     op = EOpConstructFloat; break;
2638                     case 2:                                     op = EOpConstructVec2;  break;
2639                     case 3:                                     op = EOpConstructVec3;  break;
2640                     case 4:                                     op = EOpConstructVec4;  break;
2641                     }
2642                 }
2643                 break;
2644             case EbtInt:
2645                 switch((yyvsp[(1) - (1)].interm.type).size) {
2646                 case 1:                                         op = EOpConstructInt;   break;
2647                 case 2:       FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2648                 case 3:       FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2649                 case 4:       FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2650                 }
2651                 break;
2652             case EbtBool:
2653                 switch((yyvsp[(1) - (1)].interm.type).size) {
2654                 case 1:                                         op = EOpConstructBool;  break;
2655                 case 2:       FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2656                 case 3:       FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2657                 case 4:       FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2658                 }
2659                 break;
2660             default: break;
2661             }
2662             if (op == EOpNull) {
2663                 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2664                 context->recover();
2665                 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2666                 op = EOpConstructFloat;
2667             }
2668         }
2669         TString tempString;
2670         TType type((yyvsp[(1) - (1)].interm.type));
2671         TFunction *function = new TFunction(&tempString, type, op);
2672         (yyval.interm.function) = function;
2673     ;}
2674     break;
2675
2676   case 26:
2677
2678     {
2679         if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2680             context->recover();
2681         TType type(EbtVoid, EbpUndefined);
2682         TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2683         (yyval.interm.function) = function;
2684     ;}
2685     break;
2686
2687   case 27:
2688
2689     {
2690         if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2691             context->recover();
2692         TType type(EbtVoid, EbpUndefined);
2693         TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2694         (yyval.interm.function) = function;
2695     ;}
2696     break;
2697
2698   case 28:
2699
2700     {
2701         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2702     ;}
2703     break;
2704
2705   case 29:
2706
2707     {
2708         if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2709             context->recover();
2710         (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2711         if ((yyval.interm.intermTypedNode) == 0) {
2712             context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2713             context->recover();
2714             (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2715         }
2716     ;}
2717     break;
2718
2719   case 30:
2720
2721     {
2722         if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2723             context->recover();
2724         (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2725         if ((yyval.interm.intermTypedNode) == 0) {
2726             context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2727             context->recover();
2728             (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2729         }
2730     ;}
2731     break;
2732
2733   case 31:
2734
2735     {
2736         if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2737             (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2738             if ((yyval.interm.intermTypedNode) == 0) {
2739                 const char* errorOp = "";
2740                 switch((yyvsp[(1) - (2)].interm).op) {
2741                 case EOpNegative:   errorOp = "-"; break;
2742                 case EOpLogicalNot: errorOp = "!"; break;
2743                 default: break;
2744                 }
2745                 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2746                 context->recover();
2747                 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2748             }
2749         } else
2750             (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2751     ;}
2752     break;
2753
2754   case 32:
2755
2756     { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; ;}
2757     break;
2758
2759   case 33:
2760
2761     { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; ;}
2762     break;
2763
2764   case 34:
2765
2766     { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; ;}
2767     break;
2768
2769   case 35:
2770
2771     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2772     break;
2773
2774   case 36:
2775
2776     {
2777         FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2778         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2779         if ((yyval.interm.intermTypedNode) == 0) {
2780             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2781             context->recover();
2782             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2783         }
2784     ;}
2785     break;
2786
2787   case 37:
2788
2789     {
2790         FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2791         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2792         if ((yyval.interm.intermTypedNode) == 0) {
2793             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2794             context->recover();
2795             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2796         }
2797     ;}
2798     break;
2799
2800   case 38:
2801
2802     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2803     break;
2804
2805   case 39:
2806
2807     {
2808         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2809         if ((yyval.interm.intermTypedNode) == 0) {
2810             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2811             context->recover();
2812             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2813         }
2814     ;}
2815     break;
2816
2817   case 40:
2818
2819     {
2820         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2821         if ((yyval.interm.intermTypedNode) == 0) {
2822             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2823             context->recover();
2824             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2825         }
2826     ;}
2827     break;
2828
2829   case 41:
2830
2831     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2832     break;
2833
2834   case 42:
2835
2836     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2837     break;
2838
2839   case 43:
2840
2841     {
2842         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2843         if ((yyval.interm.intermTypedNode) == 0) {
2844             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2845             context->recover();
2846             ConstantUnion *unionArray = new ConstantUnion[1];
2847             unionArray->setBConst(false);
2848             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2849         }
2850     ;}
2851     break;
2852
2853   case 44:
2854
2855     {
2856         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2857         if ((yyval.interm.intermTypedNode) == 0) {
2858             context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2859             context->recover();
2860             ConstantUnion *unionArray = new ConstantUnion[1];
2861             unionArray->setBConst(false);
2862             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2863         }
2864     ;}
2865     break;
2866
2867   case 45:
2868
2869     {
2870         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2871         if ((yyval.interm.intermTypedNode) == 0) {
2872             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2873             context->recover();
2874             ConstantUnion *unionArray = new ConstantUnion[1];
2875             unionArray->setBConst(false);
2876             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2877         }
2878     ;}
2879     break;
2880
2881   case 46:
2882
2883     {
2884         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2885         if ((yyval.interm.intermTypedNode) == 0) {
2886             context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2887             context->recover();
2888             ConstantUnion *unionArray = new ConstantUnion[1];
2889             unionArray->setBConst(false);
2890             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2891         }
2892     ;}
2893     break;
2894
2895   case 47:
2896
2897     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2898     break;
2899
2900   case 48:
2901
2902     {
2903         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2904         if ((yyval.interm.intermTypedNode) == 0) {
2905             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2906             context->recover();
2907             ConstantUnion *unionArray = new ConstantUnion[1];
2908             unionArray->setBConst(false);
2909             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2910         }
2911     ;}
2912     break;
2913
2914   case 49:
2915
2916     {
2917         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2918         if ((yyval.interm.intermTypedNode) == 0) {
2919             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2920             context->recover();
2921             ConstantUnion *unionArray = new ConstantUnion[1];
2922             unionArray->setBConst(false);
2923             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2924         }
2925     ;}
2926     break;
2927
2928   case 50:
2929
2930     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2931     break;
2932
2933   case 51:
2934
2935     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2936     break;
2937
2938   case 52:
2939
2940     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2941     break;
2942
2943   case 53:
2944
2945     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2946     break;
2947
2948   case 54:
2949
2950     {
2951         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2952         if ((yyval.interm.intermTypedNode) == 0) {
2953             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2954             context->recover();
2955             ConstantUnion *unionArray = new ConstantUnion[1];
2956             unionArray->setBConst(false);
2957             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2958         }
2959     ;}
2960     break;
2961
2962   case 55:
2963
2964     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2965     break;
2966
2967   case 56:
2968
2969     {
2970         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2971         if ((yyval.interm.intermTypedNode) == 0) {
2972             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2973             context->recover();
2974             ConstantUnion *unionArray = new ConstantUnion[1];
2975             unionArray->setBConst(false);
2976             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2977         }
2978     ;}
2979     break;
2980
2981   case 57:
2982
2983     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2984     break;
2985
2986   case 58:
2987
2988     {
2989         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2990         if ((yyval.interm.intermTypedNode) == 0) {
2991             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2992             context->recover();
2993             ConstantUnion *unionArray = new ConstantUnion[1];
2994             unionArray->setBConst(false);
2995             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2996         }
2997     ;}
2998     break;
2999
3000   case 59:
3001
3002     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
3003     break;
3004
3005   case 60:
3006
3007     {
3008        if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3009             context->recover();
3010
3011         (yyval.interm.intermTypedNode) = context->intermediate.addSelection((yyvsp[(1) - (5)].interm.intermTypedNode), (yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.intermTypedNode), (yyvsp[(2) - (5)].lex).line);
3012         if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3013             (yyval.interm.intermTypedNode) = 0;
3014
3015         if ((yyval.interm.intermTypedNode) == 0) {
3016             context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3017             context->recover();
3018             (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3019         }
3020     ;}
3021     break;
3022
3023   case 61:
3024
3025     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
3026     break;
3027
3028   case 62:
3029
3030     {
3031         if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3032             context->recover();
3033         (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].interm).line);
3034         if ((yyval.interm.intermTypedNode) == 0) {
3035             context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3036             context->recover();
3037             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3038         }
3039     ;}
3040     break;
3041
3042   case 63:
3043
3044     {                                    (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; ;}
3045     break;
3046
3047   case 64:
3048
3049     { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line);     (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; ;}
3050     break;
3051
3052   case 65:
3053
3054     { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line);     (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; ;}
3055     break;
3056
3057   case 66:
3058
3059     {                                    (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; ;}
3060     break;
3061
3062   case 67:
3063
3064     {                                    (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; ;}
3065     break;
3066
3067   case 68:
3068
3069     {
3070         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3071     ;}
3072     break;
3073
3074   case 69:
3075
3076     {
3077         (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3078         if ((yyval.interm.intermTypedNode) == 0) {
3079             context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3080             context->recover();
3081             (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3082         }
3083     ;}
3084     break;
3085
3086   case 70:
3087
3088     {
3089         if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3090             context->recover();
3091         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3092     ;}
3093     break;
3094
3095   case 71:
3096
3097     {
3098         TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3099         
3100         TIntermAggregate *prototype = new TIntermAggregate;
3101         prototype->setType(function.getReturnType());
3102         prototype->setName(function.getName());
3103         
3104         for (int i = 0; i < function.getParamCount(); i++)
3105         {
3106             const TParameter &param = function.getParam(i);
3107             if (param.name != 0)
3108             {
3109                 TVariable *variable = new TVariable(param.name, *param.type);
3110                 
3111                 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3112             }
3113             else
3114             {
3115                 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3116             }
3117         }
3118         
3119         prototype->setOp(EOpPrototype);
3120         (yyval.interm.intermNode) = prototype;
3121     ;}
3122     break;
3123
3124   case 72:
3125
3126     {
3127         if ((yyvsp[(1) - (2)].interm).intermAggregate)
3128             (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3129         (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
3130     ;}
3131     break;
3132
3133   case 73:
3134
3135     {
3136         context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3137         (yyval.interm.intermNode) = 0;
3138     ;}
3139     break;
3140
3141   case 74:
3142
3143     {
3144         //
3145         // Multiple declarations of the same function are allowed.
3146         //
3147         // If this is a definition, the definition production code will check for redefinitions
3148         // (we don't know at this point if it's a definition or not).
3149         //
3150         // Redeclarations are allowed.  But, return types and parameter qualifiers must match.
3151         //
3152         TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3153         if (prevDec) {
3154             if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3155                 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3156                 context->recover();
3157             }
3158             for (int i = 0; i < prevDec->getParamCount(); ++i) {
3159                 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3160                     context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3161                     context->recover();
3162                 }
3163             }
3164         }
3165
3166         //
3167         // If this is a redeclaration, it could also be a definition,
3168         // in which case, we want to use the variable names from this one, and not the one that's
3169         // being redeclared.  So, pass back up this declaration, not the one in the symbol table.
3170         //
3171         (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3172         (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3173
3174         context->symbolTable.insert(*(yyval.interm).function);
3175     ;}
3176     break;
3177
3178   case 75:
3179
3180     {
3181         (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3182     ;}
3183     break;
3184
3185   case 76:
3186
3187     {
3188         (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3189     ;}
3190     break;
3191
3192   case 77:
3193
3194     {
3195         // Add the parameter
3196         (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3197         if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3198             (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3199         else
3200             delete (yyvsp[(2) - (2)].interm).param.type;
3201     ;}
3202     break;
3203
3204   case 78:
3205
3206     {
3207         //
3208         // Only first parameter of one-parameter functions can be void
3209         // The check for named parameters not being void is done in parameter_declarator
3210         //
3211         if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3212             //
3213             // This parameter > first is void
3214             //
3215             context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3216             context->recover();
3217             delete (yyvsp[(3) - (3)].interm).param.type;
3218         } else {
3219             // Add the parameter
3220             (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3221             (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3222         }
3223     ;}
3224     break;
3225
3226   case 79:
3227
3228     {
3229         if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3230             context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3231             context->recover();
3232         }
3233         // make sure a sampler is not involved as well...
3234         if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3235             context->recover();
3236
3237         // Add the function as a prototype after parsing it (we do not support recursion)
3238         TFunction *function;
3239         TType type((yyvsp[(1) - (3)].interm.type));
3240         function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3241         (yyval.interm.function) = function;
3242     ;}
3243     break;
3244
3245   case 80:
3246
3247     {
3248         if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3249             context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3250             context->recover();
3251         }
3252         if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3253             context->recover();
3254         TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3255         (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3256         (yyval.interm).param = param;
3257     ;}
3258     break;
3259
3260   case 81:
3261
3262     {
3263         // Check that we can make an array out of this type
3264         if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3265             context->recover();
3266
3267         if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3268             context->recover();
3269
3270         int size;
3271         if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3272             context->recover();
3273         (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3274
3275         TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3276         TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3277         (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3278         (yyval.interm).param = param;
3279     ;}
3280     break;
3281
3282   case 82:
3283
3284     {
3285         (yyval.interm) = (yyvsp[(3) - (3)].interm);
3286         if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3287             context->recover();
3288     ;}
3289     break;
3290
3291   case 83:
3292
3293     {
3294         (yyval.interm) = (yyvsp[(2) - (2)].interm);
3295         if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3296             context->recover();
3297         if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3298             context->recover();
3299     ;}
3300     break;
3301
3302   case 84:
3303
3304     {
3305         (yyval.interm) = (yyvsp[(3) - (3)].interm);
3306         if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3307             context->recover();
3308     ;}
3309     break;
3310
3311   case 85:
3312
3313     {
3314         (yyval.interm) = (yyvsp[(2) - (2)].interm);
3315         if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3316             context->recover();
3317         if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3318             context->recover();
3319     ;}
3320     break;
3321
3322   case 86:
3323
3324     {
3325         (yyval.interm.qualifier) = EvqIn;
3326     ;}
3327     break;
3328
3329   case 87:
3330
3331     {
3332         (yyval.interm.qualifier) = EvqIn;
3333     ;}
3334     break;
3335
3336   case 88:
3337
3338     {
3339         (yyval.interm.qualifier) = EvqOut;
3340     ;}
3341     break;
3342
3343   case 89:
3344
3345     {
3346         (yyval.interm.qualifier) = EvqInOut;
3347     ;}
3348     break;
3349
3350   case 90:
3351
3352     {
3353         TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3354         (yyval.interm).param = param;
3355     ;}
3356     break;
3357
3358   case 91:
3359
3360     {
3361         (yyval.interm) = (yyvsp[(1) - (1)].interm);
3362     ;}
3363     break;
3364
3365   case 92:
3366
3367     {
3368         TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3369         (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
3370         
3371         if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3372             context->recover();
3373
3374         if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3375             context->recover();
3376
3377         TVariable* variable = 0;
3378         if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
3379             context->recover();
3380         if (symbol && variable)
3381             symbol->setId(variable->getUniqueId());
3382     ;}
3383     break;
3384
3385   case 93:
3386
3387     {
3388         if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3389             context->recover();
3390
3391         if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3392             context->recover();
3393
3394         (yyval.interm) = (yyvsp[(1) - (5)].interm);
3395
3396         if (context->arrayTypeErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type) || context->arrayQualifierErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3397             context->recover();
3398         else {
3399             (yyvsp[(1) - (5)].interm).type.setArray(true);
3400             TVariable* variable;
3401             if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3402                 context->recover();
3403         }
3404     ;}
3405     break;
3406
3407   case 94:
3408
3409     {
3410         if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3411             context->recover();
3412
3413         if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3414             context->recover();
3415
3416         (yyval.interm) = (yyvsp[(1) - (6)].interm);
3417
3418         if (context->arrayTypeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type) || context->arrayQualifierErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3419             context->recover();
3420         else {
3421             int size;
3422             if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3423                 context->recover();
3424             (yyvsp[(1) - (6)].interm).type.setArray(true, size);
3425             TVariable* variable = 0;
3426             if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3427                 context->recover();
3428             TType type = TType((yyvsp[(1) - (6)].interm).type);
3429             type.setArraySize(size);
3430             (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *(yyvsp[(3) - (6)].lex).string, type, (yyvsp[(3) - (6)].lex).line), (yyvsp[(3) - (6)].lex).line);
3431         }
3432     ;}
3433     break;
3434
3435   case 95:
3436
3437     {
3438         if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3439             context->recover();
3440
3441         (yyval.interm) = (yyvsp[(1) - (5)].interm);
3442
3443         TIntermNode* intermNode;
3444         if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3445             //
3446             // build the intermediate representation
3447             //
3448             if (intermNode)
3449         (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3450             else
3451                 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3452         } else {
3453             context->recover();
3454             (yyval.interm).intermAggregate = 0;
3455         }
3456     ;}
3457     break;
3458
3459   case 96:
3460
3461     {
3462         (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3463         (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType((yyvsp[(1) - (1)].interm.type)), (yyvsp[(1) - (1)].interm.type).line), (yyvsp[(1) - (1)].interm.type).line);
3464     ;}
3465     break;
3466
3467   case 97:
3468
3469     {
3470         TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3471         (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3472         
3473         if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3474             context->recover();
3475
3476         if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3477             context->recover();
3478             
3479             (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3480
3481         TVariable* variable = 0;
3482         if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
3483             context->recover();
3484         if (variable && symbol)
3485             symbol->setId(variable->getUniqueId());
3486     ;}
3487     break;
3488
3489   case 98:
3490
3491     {
3492         context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3493         context->recover();
3494
3495         TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3496         (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
3497         (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3498     ;}
3499     break;
3500
3501   case 99:
3502
3503     {
3504         TType type = TType((yyvsp[(1) - (5)].interm.type));
3505         int size;
3506         if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3507             context->recover();
3508         type.setArraySize(size);
3509         TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3510         (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
3511         
3512         if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3513             context->recover();
3514
3515         if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3516             context->recover();
3517
3518         (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3519
3520         if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)) || context->arrayQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3521             context->recover();
3522         else {
3523             int size;
3524             if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3525                 context->recover();
3526
3527             (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3528             TVariable* variable = 0;
3529             if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3530                 context->recover();
3531             if (variable && symbol)
3532                 symbol->setId(variable->getUniqueId());
3533         }
3534     ;}
3535     break;
3536
3537   case 100:
3538
3539     {
3540         if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3541             context->recover();
3542
3543         (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3544
3545         TIntermNode* intermNode;
3546         if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3547         //
3548         // Build intermediate representation
3549         //
3550             if(intermNode)
3551                 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3552             else
3553                 (yyval.interm).intermAggregate = 0;
3554         } else {
3555             context->recover();
3556             (yyval.interm).intermAggregate = 0;
3557         }
3558     ;}
3559     break;
3560
3561   case 101:
3562
3563     {
3564         VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
3565         (yyval.interm).qualifier = EvqInvariantVaryingOut;
3566         (yyval.interm).intermAggregate = 0;
3567     ;}
3568     break;
3569
3570   case 102:
3571
3572     {
3573         (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3574
3575         if ((yyvsp[(1) - (1)].interm.type).array) {
3576             context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3577             context->recover();
3578             (yyvsp[(1) - (1)].interm.type).setArray(false);
3579         }
3580     ;}
3581     break;
3582
3583   case 103:
3584
3585     {
3586         if ((yyvsp[(2) - (2)].interm.type).array) {
3587             context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3588             context->recover();
3589             (yyvsp[(2) - (2)].interm.type).setArray(false);
3590         }
3591
3592         if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3593             ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3594             context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3595             context->recover();
3596         }
3597         if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3598             ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3599             context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3600             context->recover();
3601         }
3602         (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3603         (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
3604     ;}
3605     break;
3606
3607   case 104:
3608
3609     {
3610         (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
3611     ;}
3612     break;
3613
3614   case 105:
3615
3616     {
3617         VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3618         if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3619             context->recover();
3620         (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
3621     ;}
3622     break;
3623
3624   case 106:
3625
3626     {
3627         if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3628             context->recover();
3629         if (context->shaderType == SH_VERTEX_SHADER)
3630             (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3631         else
3632             (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
3633     ;}
3634     break;
3635
3636   case 107:
3637
3638     {
3639         if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3640             context->recover();
3641         if (context->shaderType == SH_VERTEX_SHADER)
3642             (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3643         else
3644             (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
3645     ;}
3646     break;
3647
3648   case 108:
3649
3650     {
3651         if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3652             context->recover();
3653         (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
3654     ;}
3655     break;
3656
3657   case 109:
3658
3659     {
3660         (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3661
3662         if ((yyval.interm.type).precision == EbpUndefined) {
3663             (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3664             if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3665                 context->recover();
3666             }
3667         }
3668     ;}
3669     break;
3670
3671   case 110:
3672
3673     {
3674         (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3675         (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
3676     ;}
3677     break;
3678
3679   case 111:
3680
3681     {
3682         (yyval.interm.precision) = EbpHigh;
3683     ;}
3684     break;
3685
3686   case 112:
3687
3688     {
3689         (yyval.interm.precision) = EbpMedium;
3690     ;}
3691     break;
3692
3693   case 113:
3694
3695     {
3696         (yyval.interm.precision) = EbpLow;
3697     ;}
3698     break;
3699
3700   case 114:
3701
3702     {
3703         (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3704     ;}
3705     break;
3706
3707   case 115:
3708
3709     {
3710         (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3711
3712         if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3713             context->recover();
3714         else {
3715             int size;
3716             if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3717                 context->recover();
3718             (yyval.interm.type).setArray(true, size);
3719         }
3720     ;}
3721     break;
3722
3723   case 116:
3724
3725     {
3726         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3727         (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
3728     ;}
3729     break;
3730
3731   case 117:
3732
3733     {
3734         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3735         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3736     ;}
3737     break;
3738
3739   case 118:
3740
3741     {
3742         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3743         (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3744     ;}
3745     break;
3746
3747   case 119:
3748
3749     {
3750         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3751         (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3752     ;}
3753     break;
3754
3755   case 120:
3756
3757     {
3758         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3759         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3760         (yyval.interm.type).setAggregate(2);
3761     ;}
3762     break;
3763
3764   case 121:
3765
3766     {
3767         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3768         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3769         (yyval.interm.type).setAggregate(3);
3770     ;}
3771     break;
3772
3773   case 122:
3774
3775     {
3776         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3777         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3778         (yyval.interm.type).setAggregate(4);
3779     ;}
3780     break;
3781
3782   case 123:
3783
3784     {
3785         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3786         (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3787         (yyval.interm.type).setAggregate(2);
3788     ;}
3789     break;
3790
3791   case 124:
3792
3793     {
3794         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3795         (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3796         (yyval.interm.type).setAggregate(3);
3797     ;}
3798     break;
3799
3800   case 125:
3801
3802     {
3803         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3804         (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3805         (yyval.interm.type).setAggregate(4);
3806     ;}
3807     break;
3808
3809   case 126:
3810
3811     {
3812         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3813         (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3814         (yyval.interm.type).setAggregate(2);
3815     ;}
3816     break;
3817
3818   case 127:
3819
3820     {
3821         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3822         (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3823         (yyval.interm.type).setAggregate(3);
3824     ;}
3825     break;
3826
3827   case 128:
3828
3829     {
3830         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3831         (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3832         (yyval.interm.type).setAggregate(4);
3833     ;}
3834     break;
3835
3836   case 129:
3837
3838     {
3839         FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3840         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3841         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3842         (yyval.interm.type).setAggregate(2, true);
3843     ;}
3844     break;
3845
3846   case 130:
3847
3848     {
3849         FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3850         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3851         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3852         (yyval.interm.type).setAggregate(3, true);
3853     ;}
3854     break;
3855
3856   case 131:
3857
3858     {
3859         FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3860         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3861         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3862         (yyval.interm.type).setAggregate(4, true);
3863     ;}
3864     break;
3865
3866   case 132:
3867
3868     {
3869         FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3870         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3871         (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
3872     ;}
3873     break;
3874
3875   case 133:
3876
3877     {
3878         FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3879         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3880         (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
3881     ;}
3882     break;
3883
3884   case 134:
3885
3886     {
3887         FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3888         (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3889         (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3890     ;}
3891     break;
3892
3893   case 135:
3894
3895     {
3896         //
3897         // This is for user defined type names.  The lexical phase looked up the
3898         // type.
3899         //
3900         TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3901         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3902         (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3903         (yyval.interm.type).userDef = &structure;
3904     ;}
3905     break;
3906
3907   case 136:
3908
3909     {
3910         if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3911             context->recover();
3912
3913         TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), *(yyvsp[(2) - (5)].lex).string);
3914         TVariable* userTypeDef = new TVariable((yyvsp[(2) - (5)].lex).string, *structure, true);
3915         if (! context->symbolTable.insert(*userTypeDef)) {
3916             context->error((yyvsp[(2) - (5)].lex).line, "redefinition", (yyvsp[(2) - (5)].lex).string->c_str(), "struct");
3917             context->recover();
3918         }
3919         (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3920         (yyval.interm.type).userDef = structure;
3921     ;}
3922     break;
3923
3924   case 137:
3925
3926     {
3927         TType* structure = new TType((yyvsp[(3) - (4)].interm.typeList), TString(""));
3928         (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (4)].lex).line);
3929         (yyval.interm.type).userDef = structure;
3930     ;}
3931     break;
3932
3933   case 138:
3934
3935     {
3936         (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
3937     ;}
3938     break;
3939
3940   case 139:
3941
3942     {
3943         (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3944         for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3945             for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3946                 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3947                     context->error((*(yyvsp[(2) - (2)].interm.typeList))[i].line, "duplicate field name in structure:", "struct", (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName().c_str());
3948                     context->recover();
3949                 }
3950             }
3951             (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3952         }
3953     ;}
3954     break;
3955
3956   case 140:
3957
3958     {
3959         (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3960
3961         if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3962             context->recover();
3963         }
3964         for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3965             //
3966             // Careful not to replace already known aspects of type, like array-ness
3967             //
3968             TType* type = (*(yyval.interm.typeList))[i].type;
3969             type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3970             type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3971             type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
3972             type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
3973
3974             // don't allow arrays of arrays
3975             if (type->isArray()) {
3976                 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3977                     context->recover();
3978             }
3979             if ((yyvsp[(1) - (3)].interm.type).array)
3980                 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
3981             if ((yyvsp[(1) - (3)].interm.type).userDef) {
3982                 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
3983                 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
3984             }
3985         }
3986     ;}
3987     break;
3988
3989   case 141:
3990
3991     {
3992         (yyval.interm.typeList) = NewPoolTTypeList();
3993         (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
3994     ;}
3995     break;
3996
3997   case 142:
3998
3999     {
4000         (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
4001     ;}
4002     break;
4003
4004   case 143:
4005
4006     {
4007         if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4008             context->recover();
4009
4010         (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4011         (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4012         (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
4013     ;}
4014     break;
4015
4016   case 144:
4017
4018     {
4019         if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4020             context->recover();
4021
4022         (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4023         (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4024         (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4025
4026         int size;
4027         if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4028             context->recover();
4029         (yyval.interm.typeLine).type->setArraySize(size);
4030     ;}
4031     break;
4032
4033   case 145:
4034
4035     { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
4036     break;
4037
4038   case 146:
4039
4040     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4041     break;
4042
4043   case 147:
4044
4045     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); ;}
4046     break;
4047
4048   case 148:
4049
4050     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4051     break;
4052
4053   case 149:
4054
4055     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4056     break;
4057
4058   case 150:
4059
4060     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4061     break;
4062
4063   case 151:
4064
4065     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4066     break;
4067
4068   case 152:
4069
4070     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4071     break;
4072
4073   case 153:
4074
4075     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4076     break;
4077
4078   case 154:
4079
4080     { (yyval.interm.intermAggregate) = 0; ;}
4081     break;
4082
4083   case 155:
4084
4085     { context->symbolTable.push(); ;}
4086     break;
4087
4088   case 156:
4089
4090     { context->symbolTable.pop(); ;}
4091     break;
4092
4093   case 157:
4094
4095     {
4096         if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
4097             (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
4098             (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4099         }
4100         (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
4101     ;}
4102     break;
4103
4104   case 158:
4105
4106     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4107     break;
4108
4109   case 159:
4110
4111     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4112     break;
4113
4114   case 160:
4115
4116     {
4117         (yyval.interm.intermNode) = 0;
4118     ;}
4119     break;
4120
4121   case 161:
4122
4123     {
4124         if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
4125             (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
4126             (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4127         }
4128         (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
4129     ;}
4130     break;
4131
4132   case 162:
4133
4134     {
4135         (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4136     ;}
4137     break;
4138
4139   case 163:
4140
4141     {
4142         (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4143     ;}
4144     break;
4145
4146   case 164:
4147
4148     { (yyval.interm.intermNode) = 0; ;}
4149     break;
4150
4151   case 165:
4152
4153     { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); ;}
4154     break;
4155
4156   case 166:
4157
4158     {
4159         if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4160             context->recover();
4161         (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4162     ;}
4163     break;
4164
4165   case 167:
4166
4167     {
4168         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4169         (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4170     ;}
4171     break;
4172
4173   case 168:
4174
4175     {
4176         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4177         (yyval.interm.nodePair).node2 = 0;
4178     ;}
4179     break;
4180
4181   case 169:
4182
4183     {
4184         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4185         if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4186             context->recover();
4187     ;}
4188     break;
4189
4190   case 170:
4191
4192     {
4193         TIntermNode* intermNode;
4194         if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4195             context->recover();
4196         if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4197             context->recover();
4198
4199         if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4200             (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4201         else {
4202             context->recover();
4203             (yyval.interm.intermTypedNode) = 0;
4204         }
4205     ;}
4206     break;
4207
4208   case 171:
4209
4210     { context->symbolTable.push(); ++context->loopNestingLevel; ;}
4211     break;
4212
4213   case 172:
4214
4215     {
4216         context->symbolTable.pop();
4217         (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
4218         --context->loopNestingLevel;
4219     ;}
4220     break;
4221
4222   case 173:
4223
4224     { ++context->loopNestingLevel; ;}
4225     break;
4226
4227   case 174:
4228
4229     {
4230         if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4231             context->recover();
4232
4233         (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
4234         --context->loopNestingLevel;
4235     ;}
4236     break;
4237
4238   case 175:
4239
4240     { context->symbolTable.push(); ++context->loopNestingLevel; ;}
4241     break;
4242
4243   case 176:
4244
4245     {
4246         context->symbolTable.pop();
4247         (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopFor, (yyvsp[(4) - (7)].interm.intermNode), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node1), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node2), (yyvsp[(7) - (7)].interm.intermNode), (yyvsp[(1) - (7)].lex).line);
4248         --context->loopNestingLevel;
4249     ;}
4250     break;
4251
4252   case 177:
4253
4254     {
4255         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4256     ;}
4257     break;
4258
4259   case 178:
4260
4261     {
4262         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4263     ;}
4264     break;
4265
4266   case 179:
4267
4268     {
4269         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4270     ;}
4271     break;
4272
4273   case 180:
4274
4275     {
4276         (yyval.interm.intermTypedNode) = 0;
4277     ;}
4278     break;
4279
4280   case 181:
4281
4282     {
4283         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4284         (yyval.interm.nodePair).node2 = 0;
4285     ;}
4286     break;
4287
4288   case 182:
4289
4290     {
4291         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4292         (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4293     ;}
4294     break;
4295
4296   case 183:
4297
4298     {
4299         if (context->loopNestingLevel <= 0) {
4300             context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4301             context->recover();
4302         }
4303         (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
4304     ;}
4305     break;
4306
4307   case 184:
4308
4309     {
4310         if (context->loopNestingLevel <= 0) {
4311             context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4312             context->recover();
4313         }
4314         (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
4315     ;}
4316     break;
4317
4318   case 185:
4319
4320     {
4321         (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4322         if (context->currentFunctionType->getBasicType() != EbtVoid) {
4323             context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4324             context->recover();
4325         }
4326     ;}
4327     break;
4328
4329   case 186:
4330
4331     {
4332         (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4333         context->functionReturnsValue = true;
4334         if (context->currentFunctionType->getBasicType() == EbtVoid) {
4335             context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4336             context->recover();
4337         } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4338             context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4339             context->recover();
4340         }
4341     ;}
4342     break;
4343
4344   case 187:
4345
4346     {
4347         FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4348         (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4349     ;}
4350     break;
4351
4352   case 188:
4353
4354     {
4355         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4356         context->treeRoot = (yyval.interm.intermNode);
4357     ;}
4358     break;
4359
4360   case 189:
4361
4362     {
4363         (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4364         context->treeRoot = (yyval.interm.intermNode);
4365     ;}
4366     break;
4367
4368   case 190:
4369
4370     {
4371         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4372     ;}
4373     break;
4374
4375   case 191:
4376
4377     {
4378         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4379     ;}
4380     break;
4381
4382   case 192:
4383
4384     {
4385         TFunction* function = (yyvsp[(1) - (1)].interm).function;
4386         TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4387         //
4388         // Note:  'prevDec' could be 'function' if this is the first time we've seen function
4389         // as it would have just been put in the symbol table.  Otherwise, we're looking up
4390         // an earlier occurance.
4391         //
4392         if (prevDec->isDefined()) {
4393             //
4394             // Then this function already has a body.
4395             //
4396             context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4397             context->recover();
4398         }
4399         prevDec->setDefined();
4400
4401         //
4402         // Raise error message if main function takes any parameters or return anything other than void
4403         //
4404         if (function->getName() == "main") {
4405             if (function->getParamCount() > 0) {
4406                 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4407                 context->recover();
4408             }
4409             if (function->getReturnType().getBasicType() != EbtVoid) {
4410                 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4411                 context->recover();
4412             }
4413         }
4414
4415         //
4416         // New symbol table scope for body of function plus its arguments
4417         //
4418         context->symbolTable.push();
4419
4420         //
4421         // Remember the return type for later checking for RETURN statements.
4422         //
4423         context->currentFunctionType = &(prevDec->getReturnType());
4424         context->functionReturnsValue = false;
4425
4426         //
4427         // Insert parameters into the symbol table.
4428         // If the parameter has no name, it's not an error, just don't insert it
4429         // (could be used for unused args).
4430         //
4431         // Also, accumulate the list of parameters into the HIL, so lower level code
4432         // knows where to find parameters.
4433         //
4434         TIntermAggregate* paramNodes = new TIntermAggregate;
4435         for (int i = 0; i < function->getParamCount(); i++) {
4436             const TParameter& param = function->getParam(i);
4437             if (param.name != 0) {
4438                 TVariable *variable = new TVariable(param.name, *param.type);
4439                 //
4440                 // Insert the parameters with name in the symbol table.
4441                 //
4442                 if (! context->symbolTable.insert(*variable)) {
4443                     context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4444                     context->recover();
4445                     delete variable;
4446                 }
4447
4448                 //
4449                 // Add the parameter to the HIL
4450                 //
4451                 paramNodes = context->intermediate.growAggregate(
4452                                                paramNodes,
4453                                                context->intermediate.addSymbol(variable->getUniqueId(),
4454                                                                        variable->getName(),
4455                                                                        variable->getType(), (yyvsp[(1) - (1)].interm).line),
4456                                                (yyvsp[(1) - (1)].interm).line);
4457             } else {
4458                 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4459             }
4460         }
4461         context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4462         (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4463         context->loopNestingLevel = 0;
4464     ;}
4465     break;
4466
4467   case 193:
4468
4469     {
4470         //?? Check that all paths return a value if return type != void ?
4471         //   May be best done as post process phase on intermediate code
4472         if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4473             context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4474             context->recover();
4475         }
4476         context->symbolTable.pop();
4477         (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4478         context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4479         (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4480         (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4481
4482         // store the pragma information for debug and optimize and other vendor specific
4483         // information. This information can be queried from the parse tree
4484         (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4485         (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4486         (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
4487
4488         if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4489             (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
4490     ;}
4491     break;
4492
4493
4494 /* Line 1267 of yacc.c.  */
4495
4496       default: break;
4497     }
4498   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4499
4500   YYPOPSTACK (yylen);
4501   yylen = 0;
4502   YY_STACK_PRINT (yyss, yyssp);
4503
4504   *++yyvsp = yyval;
4505
4506
4507   /* Now `shift' the result of the reduction.  Determine what state
4508      that goes to, based on the state we popped back to and the rule
4509      number reduced by.  */
4510
4511   yyn = yyr1[yyn];
4512
4513   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4514   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4515     yystate = yytable[yystate];
4516   else
4517     yystate = yydefgoto[yyn - YYNTOKENS];
4518
4519   goto yynewstate;
4520
4521
4522 /*------------------------------------.
4523 | yyerrlab -- here on detecting error |
4524 `------------------------------------*/
4525 yyerrlab:
4526   /* If not already recovering from an error, report this error.  */
4527   if (!yyerrstatus)
4528     {
4529       ++yynerrs;
4530 #if ! YYERROR_VERBOSE
4531       yyerror (context, YY_("syntax error"));
4532 #else
4533       {
4534         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4535         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4536           {
4537             YYSIZE_T yyalloc = 2 * yysize;
4538             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4539               yyalloc = YYSTACK_ALLOC_MAXIMUM;
4540             if (yymsg != yymsgbuf)
4541               YYSTACK_FREE (yymsg);
4542             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4543             if (yymsg)
4544               yymsg_alloc = yyalloc;
4545             else
4546               {
4547                 yymsg = yymsgbuf;
4548                 yymsg_alloc = sizeof yymsgbuf;
4549               }
4550           }
4551
4552         if (0 < yysize && yysize <= yymsg_alloc)
4553           {
4554             (void) yysyntax_error (yymsg, yystate, yychar);
4555             yyerror (context, yymsg);
4556           }
4557         else
4558           {
4559             yyerror (context, YY_("syntax error"));
4560             if (yysize != 0)
4561               goto yyexhaustedlab;
4562           }
4563       }
4564 #endif
4565     }
4566
4567
4568
4569   if (yyerrstatus == 3)
4570     {
4571       /* If just tried and failed to reuse look-ahead token after an
4572          error, discard it.  */
4573
4574       if (yychar <= YYEOF)
4575         {
4576           /* Return failure if at end of input.  */
4577           if (yychar == YYEOF)
4578             YYABORT;
4579         }
4580       else
4581         {
4582           yydestruct ("Error: discarding",
4583                       yytoken, &yylval, context);
4584           yychar = YYEMPTY;
4585         }
4586     }
4587
4588   /* Else will try to reuse look-ahead token after shifting the error
4589      token.  */
4590   goto yyerrlab1;
4591
4592
4593 /*---------------------------------------------------.
4594 | yyerrorlab -- error raised explicitly by YYERROR.  |
4595 `---------------------------------------------------*/
4596 yyerrorlab:
4597
4598   /* Pacify compilers like GCC when the user code never invokes
4599      YYERROR and the label yyerrorlab therefore never appears in user
4600      code.  */
4601   if (/*CONSTCOND*/ 0)
4602      goto yyerrorlab;
4603
4604   /* Do not reclaim the symbols of the rule which action triggered
4605      this YYERROR.  */
4606   YYPOPSTACK (yylen);
4607   yylen = 0;
4608   YY_STACK_PRINT (yyss, yyssp);
4609   yystate = *yyssp;
4610   goto yyerrlab1;
4611
4612
4613 /*-------------------------------------------------------------.
4614 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
4615 `-------------------------------------------------------------*/
4616 yyerrlab1:
4617   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
4618
4619   for (;;)
4620     {
4621       yyn = yypact[yystate];
4622       if (yyn != YYPACT_NINF)
4623         {
4624           yyn += YYTERROR;
4625           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4626             {
4627               yyn = yytable[yyn];
4628               if (0 < yyn)
4629                 break;
4630             }
4631         }
4632
4633       /* Pop the current state because it cannot handle the error token.  */
4634       if (yyssp == yyss)
4635         YYABORT;
4636
4637
4638       yydestruct ("Error: popping",
4639                   yystos[yystate], yyvsp, context);
4640       YYPOPSTACK (1);
4641       yystate = *yyssp;
4642       YY_STACK_PRINT (yyss, yyssp);
4643     }
4644
4645   if (yyn == YYFINAL)
4646     YYACCEPT;
4647
4648   *++yyvsp = yylval;
4649
4650
4651   /* Shift the error token.  */
4652   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4653
4654   yystate = yyn;
4655   goto yynewstate;
4656
4657
4658 /*-------------------------------------.
4659 | yyacceptlab -- YYACCEPT comes here.  |
4660 `-------------------------------------*/
4661 yyacceptlab:
4662   yyresult = 0;
4663   goto yyreturn;
4664
4665 /*-----------------------------------.
4666 | yyabortlab -- YYABORT comes here.  |
4667 `-----------------------------------*/
4668 yyabortlab:
4669   yyresult = 1;
4670   goto yyreturn;
4671
4672 #ifndef yyoverflow
4673 /*-------------------------------------------------.
4674 | yyexhaustedlab -- memory exhaustion comes here.  |
4675 `-------------------------------------------------*/
4676 yyexhaustedlab:
4677   yyerror (context, YY_("memory exhausted"));
4678   yyresult = 2;
4679   /* Fall through.  */
4680 #endif
4681
4682 yyreturn:
4683   if (yychar != YYEOF && yychar != YYEMPTY)
4684      yydestruct ("Cleanup: discarding lookahead",
4685                  yytoken, &yylval, context);
4686   /* Do not reclaim the symbols of the rule which action triggered
4687      this YYABORT or YYACCEPT.  */
4688   YYPOPSTACK (yylen);
4689   YY_STACK_PRINT (yyss, yyssp);
4690   while (yyssp != yyss)
4691     {
4692       yydestruct ("Cleanup: popping",
4693                   yystos[*yyssp], yyvsp, context);
4694       YYPOPSTACK (1);
4695     }
4696 #ifndef yyoverflow
4697   if (yyss != yyssa)
4698     YYSTACK_FREE (yyss);
4699 #endif
4700 #if YYERROR_VERBOSE
4701   if (yymsg != yymsgbuf)
4702     YYSTACK_FREE (yymsg);
4703 #endif
4704   /* Make sure YYID is used.  */
4705   return YYID (yyresult);
4706 }
4707
4708
4709
4710
4711
4712 int glslang_parse(TParseContext* context) {
4713     return yyparse(context);
4714 }
4715
4716