/* A Bison parser, made by GNU Bison 3.0.4.  */

/* Bison implementation for Yacc-like parsers in C

   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.

   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */

/* C LALR(1) parser skeleton written by Richard Stallman, by
   simplifying the original so-called "semantic" parser.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

/* Identify Bison output.  */
#define YYBISON 1

/* Bison version.  */
#define YYBISON_VERSION "3.0.4"

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 1

/* Push parsers.  */
#define YYPUSH 0

/* Pull parsers.  */
#define YYPULL 1




/* Copy the first part of user declarations.  */


//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//

// This file is auto-generated by generate_parser.sh. DO NOT EDIT!

// Ignore errors in auto-generated code.
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wswitch-enum"
#elif defined(_MSC_VER)
#pragma warning(disable: 4065)
#pragma warning(disable: 4189)
#pragma warning(disable: 4505)
#pragma warning(disable: 4701)
#endif

#include "compiler/SymbolTable.h"
#include "compiler/ParseHelper.h"
#include "GLSLANG/ShaderLang.h"

#define YYENABLE_NLS 0

#define YYLEX_PARAM context->scanner



# ifndef YY_NULLPTR
#  if defined __cplusplus && 201103L <= __cplusplus
#   define YY_NULLPTR nullptr
#  else
#   define YY_NULLPTR 0
#  endif
# endif

/* Enabling verbose error messages.  */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif

/* In a future release of Bison, this section will be replaced
   by #include "glslang_tab.h".  */
#ifndef YY_YY_GENERATED_GLSLANG_TAB_H_INCLUDED
# define YY_YY_GENERATED_GLSLANG_TAB_H_INCLUDED
/* Debug traces.  */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif

/* Token type.  */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
  enum yytokentype
  {
    INVARIANT = 258,
    HIGH_PRECISION = 259,
    MEDIUM_PRECISION = 260,
    LOW_PRECISION = 261,
    PRECISION = 262,
    ATTRIBUTE = 263,
    CONST_QUAL = 264,
    BOOL_TYPE = 265,
    FLOAT_TYPE = 266,
    INT_TYPE = 267,
    BREAK = 268,
    CONTINUE = 269,
    DO = 270,
    ELSE = 271,
    FOR = 272,
    IF = 273,
    DISCARD = 274,
    RETURN = 275,
    BVEC2 = 276,
    BVEC3 = 277,
    BVEC4 = 278,
    IVEC2 = 279,
    IVEC3 = 280,
    IVEC4 = 281,
    VEC2 = 282,
    VEC3 = 283,
    VEC4 = 284,
    MATRIX2 = 285,
    MATRIX3 = 286,
    MATRIX4 = 287,
    IN_QUAL = 288,
    OUT_QUAL = 289,
    INOUT_QUAL = 290,
    UNIFORM = 291,
    VARYING = 292,
    STRUCT = 293,
    VOID_TYPE = 294,
    WHILE = 295,
    SAMPLER2D = 296,
    SAMPLERCUBE = 297,
    SAMPLER_EXTERNAL_OES = 298,
    SAMPLER2DRECT = 299,
    IDENTIFIER = 300,
    TYPE_NAME = 301,
    FLOATCONSTANT = 302,
    INTCONSTANT = 303,
    BOOLCONSTANT = 304,
    LEFT_OP = 305,
    RIGHT_OP = 306,
    INC_OP = 307,
    DEC_OP = 308,
    LE_OP = 309,
    GE_OP = 310,
    EQ_OP = 311,
    NE_OP = 312,
    AND_OP = 313,
    OR_OP = 314,
    XOR_OP = 315,
    MUL_ASSIGN = 316,
    DIV_ASSIGN = 317,
    ADD_ASSIGN = 318,
    MOD_ASSIGN = 319,
    LEFT_ASSIGN = 320,
    RIGHT_ASSIGN = 321,
    AND_ASSIGN = 322,
    XOR_ASSIGN = 323,
    OR_ASSIGN = 324,
    SUB_ASSIGN = 325,
    LEFT_PAREN = 326,
    RIGHT_PAREN = 327,
    LEFT_BRACKET = 328,
    RIGHT_BRACKET = 329,
    LEFT_BRACE = 330,
    RIGHT_BRACE = 331,
    DOT = 332,
    COMMA = 333,
    COLON = 334,
    EQUAL = 335,
    SEMICOLON = 336,
    BANG = 337,
    DASH = 338,
    TILDE = 339,
    PLUS = 340,
    STAR = 341,
    SLASH = 342,
    PERCENT = 343,
    LEFT_ANGLE = 344,
    RIGHT_ANGLE = 345,
    VERTICAL_BAR = 346,
    CARET = 347,
    AMPERSAND = 348,
    QUESTION = 349
  };
#endif

/* Value type.  */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED

union YYSTYPE
{


#define YYLTYPE TSourceLoc
#define YYLTYPE_IS_DECLARED 1
    struct {
        union {
            TString *string;
            float f;
            int i;
            bool b;
        };
        TSymbol* symbol;
    } lex;
    struct {
        TOperator op;
        union {
            TIntermNode* intermNode;
            TIntermNodePair nodePair;
            TIntermTyped* intermTypedNode;
            TIntermAggregate* intermAggregate;
        };
        union {
            TPublicType type;
            TPrecision precision;
            TQualifier qualifier;
            TFunction* function;
            TParameter param;
            TField* field;
            TFieldList* fieldList;
        };
    } interm;


};

typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif

/* Location type.  */
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE YYLTYPE;
struct YYLTYPE
{
  int first_line;
  int first_column;
  int last_line;
  int last_column;
};
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif



int yyparse (TParseContext* context);

#endif /* !YY_YY_GENERATED_GLSLANG_TAB_H_INCLUDED  */

/* Copy the second part of user declarations.  */


extern int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, void* yyscanner);
static void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason);

#define YYLLOC_DEFAULT(Current, Rhs, N)                      \
  do {                                                       \
      if (N) {                                               \
        (Current).first_file = YYRHSLOC(Rhs, 1).first_file;  \
        (Current).first_line = YYRHSLOC(Rhs, 1).first_line;  \
        (Current).last_file = YYRHSLOC(Rhs, N).last_file;    \
        (Current).last_line = YYRHSLOC(Rhs, N).last_line;    \
      }                                                      \
      else {                                                 \
        (Current).first_file = YYRHSLOC(Rhs, 0).last_file;   \
        (Current).first_line = YYRHSLOC(Rhs, 0).last_line;   \
        (Current).last_file = YYRHSLOC(Rhs, 0).last_file;    \
        (Current).last_line = YYRHSLOC(Rhs, 0).last_line;    \
      }                                                      \
  } while (0)

#define VERTEX_ONLY(S, L) {  \
    if (context->shaderType != SH_VERTEX_SHADER) {  \
        context->error(L, " supported in vertex shaders only ", S);  \
        context->recover();  \
    }  \
}

#define FRAG_ONLY(S, L) {  \
    if (context->shaderType != SH_FRAGMENT_SHADER) {  \
        context->error(L, " supported in fragment shaders only ", S);  \
        context->recover();  \
    }  \
}



#ifdef short
# undef short
#endif

#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif

#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#else
typedef signed char yytype_int8;
#endif

#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short int yytype_uint16;
#endif

#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short int yytype_int16;
#endif

#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
#  define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
#  define YYSIZE_T size_t
# elif ! defined YYSIZE_T
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# else
#  define YYSIZE_T unsigned int
# endif
#endif

#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)

#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
#  if ENABLE_NLS
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
#  endif
# endif
# ifndef YY_
#  define YY_(Msgid) Msgid
# endif
#endif

#ifndef YY_ATTRIBUTE
# if (defined __GNUC__                                               \
      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
#  define YY_ATTRIBUTE(Spec) /* empty */
# endif
#endif

#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
#endif

#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif

#if !defined _Noreturn \
     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
#  define _Noreturn __declspec (noreturn)
# else
#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif

/* Suppress unused-variable warnings by "using" E.  */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E) /* empty */
#endif

#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
    _Pragma ("GCC diagnostic push") \
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
    _Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif


#if ! defined yyoverflow || YYERROR_VERBOSE

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# ifdef YYSTACK_USE_ALLOCA
#  if YYSTACK_USE_ALLOCA
#   ifdef __GNUC__
#    define YYSTACK_ALLOC __builtin_alloca
#   elif defined __BUILTIN_VA_ARG_INCR
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
#   elif defined _AIX
#    define YYSTACK_ALLOC __alloca
#   elif defined _MSC_VER
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
#    define alloca _alloca
#   else
#    define YYSTACK_ALLOC alloca
#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
#     ifndef EXIT_SUCCESS
#      define EXIT_SUCCESS 0
#     endif
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's 'empty if-body' warning.  */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
#  ifndef YYSTACK_ALLOC_MAXIMUM
    /* The OS might guarantee only one guard page at the bottom of the stack,
       and a page size can be as small as 4096 bytes.  So we cannot safely
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
       to allow for a few compiler-allocated temporary stack slots.  */
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
#  endif
# else
#  define YYSTACK_ALLOC YYMALLOC
#  define YYSTACK_FREE YYFREE
#  ifndef YYSTACK_ALLOC_MAXIMUM
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
#  endif
#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
       && ! ((defined YYMALLOC || defined malloc) \
             && (defined YYFREE || defined free)))
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   ifndef EXIT_SUCCESS
#    define EXIT_SUCCESS 0
#   endif
#  endif
#  ifndef YYMALLOC
#   define YYMALLOC malloc
#   if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
#  ifndef YYFREE
#   define YYFREE free
#   if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */


#if (! defined yyoverflow \
     && (! defined __cplusplus \
         || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
             && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  yytype_int16 yyss_alloc;
  YYSTYPE yyvs_alloc;
  YYLTYPE yyls_alloc;
};

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
      + 2 * YYSTACK_GAP_MAXIMUM)

# define YYCOPY_NEEDED 1

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   elements in the stack, and YYPTR gives the new location of the
   stack.  Advance YYPTR to a properly aligned location for the next
   stack.  */
# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
    do                                                                  \
      {                                                                 \
        YYSIZE_T yynewbytes;                                            \
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
        Stack = &yyptr->Stack_alloc;                                    \
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / sizeof (*yyptr);                          \
      }                                                                 \
    while (0)

#endif

#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if defined __GNUC__ && 1 < __GNUC__
#   define YYCOPY(Dst, Src, Count) \
      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
#  else
#   define YYCOPY(Dst, Src, Count)              \
      do                                        \
        {                                       \
          YYSIZE_T yyi;                         \
          for (yyi = 0; yyi < (Count); yyi++)   \
            (Dst)[yyi] = (Src)[yyi];            \
        }                                       \
      while (0)
#  endif
# endif
#endif /* !YYCOPY_NEEDED */

/* YYFINAL -- State number of the termination state.  */
#define YYFINAL  74
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   1490

/* YYNTOKENS -- Number of terminals.  */
#define YYNTOKENS  95
/* YYNNTS -- Number of nonterminals.  */
#define YYNNTS  84
/* YYNRULES -- Number of rules.  */
#define YYNRULES  202
/* YYNSTATES -- Number of states.  */
#define YYNSTATES  307

/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
   by yylex, with out-of-bounds checking.  */
#define YYUNDEFTOK  2
#define YYMAXUTOK   349

#define YYTRANSLATE(YYX)                                                \
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
   as returned by yylex, without out-of-bounds checking.  */
static const yytype_uint8 yytranslate[] =
{
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
      85,    86,    87,    88,    89,    90,    91,    92,    93,    94
};

#if YYDEBUG
  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
static const yytype_uint16 yyrline[] =
{
       0,   177,   177,   178,   181,   224,   227,   240,   245,   250,
     256,   259,   262,   265,   360,   370,   383,   391,   491,   494,
     502,   505,   511,   515,   522,   528,   537,   545,   600,   610,
     613,   623,   633,   654,   655,   656,   661,   662,   670,   681,
     682,   690,   701,   705,   706,   716,   726,   736,   749,   750,
     760,   773,   777,   781,   785,   786,   799,   800,   813,   814,
     827,   828,   845,   846,   859,   860,   861,   862,   863,   867,
     870,   881,   889,   916,   921,   935,   990,   993,  1000,  1008,
    1029,  1050,  1060,  1088,  1093,  1103,  1108,  1118,  1121,  1124,
    1127,  1133,  1140,  1143,  1165,  1183,  1207,  1230,  1234,  1252,
    1260,  1292,  1312,  1333,  1342,  1365,  1368,  1374,  1382,  1390,
    1398,  1408,  1415,  1418,  1421,  1427,  1430,  1445,  1449,  1453,
    1457,  1461,  1466,  1471,  1476,  1481,  1486,  1491,  1496,  1501,
    1506,  1511,  1516,  1521,  1525,  1529,  1537,  1545,  1549,  1562,
    1562,  1576,  1576,  1585,  1588,  1604,  1637,  1641,  1647,  1654,
    1669,  1673,  1677,  1678,  1684,  1685,  1686,  1687,  1688,  1692,
    1693,  1693,  1693,  1703,  1704,  1708,  1708,  1709,  1709,  1714,
    1717,  1727,  1730,  1736,  1737,  1741,  1749,  1753,  1763,  1768,
    1785,  1785,  1790,  1790,  1797,  1797,  1805,  1808,  1814,  1817,
    1823,  1827,  1834,  1841,  1848,  1855,  1866,  1875,  1879,  1886,
    1889,  1895,  1895
};
#endif

#if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
static const char *const yytname[] =
{
  "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
  "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
  "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
  "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
  "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
  "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
  "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
  "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
  "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "LEFT_OP", "RIGHT_OP",
  "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP",
  "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN",
  "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN",
  "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET",
  "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON",
  "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH",
  "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET",
  "AMPERSAND", "QUESTION", "$accept", "identifier", "variable_identifier",
  "primary_expression", "postfix_expression", "integer_expression",
  "function_call", "function_call_or_method", "function_call_generic",
  "function_call_header_no_parameters",
  "function_call_header_with_parameters", "function_call_header",
  "function_identifier", "unary_expression", "unary_operator",
  "multiplicative_expression", "additive_expression", "shift_expression",
  "relational_expression", "equality_expression", "and_expression",
  "exclusive_or_expression", "inclusive_or_expression",
  "logical_and_expression", "logical_xor_expression",
  "logical_or_expression", "conditional_expression",
  "assignment_expression", "assignment_operator", "expression",
  "constant_expression", "declaration", "function_prototype",
  "function_declarator", "function_header_with_parameters",
  "function_header", "parameter_declarator", "parameter_declaration",
  "parameter_qualifier", "parameter_type_specifier",
  "init_declarator_list", "single_declaration", "fully_specified_type",
  "type_qualifier", "type_specifier", "precision_qualifier",
  "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
  "$@1", "$@2", "struct_declaration_list", "struct_declaration",
  "struct_declarator_list", "struct_declarator", "initializer",
  "declaration_statement", "statement", "simple_statement",
  "compound_statement", "$@3", "$@4", "statement_no_new_scope",
  "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
  "statement_list", "expression_statement", "selection_statement",
  "selection_rest_statement", "condition", "iteration_statement", "$@7",
  "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
  "jump_statement", "translation_unit", "external_declaration",
  "function_definition", "$@10", YY_NULLPTR
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
   (internal) symbol number NUM (which must be that of a token).  */
static const yytype_uint16 yytoknum[] =
{
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
     325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
     335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
     345,   346,   347,   348,   349
};
# endif

#define YYPACT_NINF -261

#define yypact_value_is_default(Yystate) \
  (!!((Yystate) == (-261)))

#define YYTABLE_NINF -166

#define yytable_value_is_error(Yytable_value) \
  0

  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
     STATE-NUM.  */
static const yytype_int16 yypact[] =
{
    1327,   -20,  -261,  -261,  -261,   113,  -261,  -261,  -261,  -261,
    -261,  -261,  -261,  -261,  -261,  -261,  -261,  -261,  -261,  -261,
    -261,  -261,  -261,  -261,  -261,   -19,  -261,  -261,  -261,  -261,
    -261,  -261,  -261,   -61,   -40,   -28,    75,    -7,  -261,    24,
    1370,  -261,  1444,  -261,   -11,  -261,  1283,  -261,  -261,  -261,
    -261,  1444,  -261,  -261,  -261,     6,  -261,    54,  -261,    88,
      62,  -261,  -261,  -261,  -261,  1370,    59,    91,  -261,    36,
     -50,  -261,  -261,  1051,  -261,  -261,    63,  1370,  -261,   293,
    -261,  -261,  -261,  -261,    91,  1370,   -12,  -261,   856,  1051,
      77,  -261,  -261,  -261,  1051,  1051,  1051,  -261,  -261,  -261,
    -261,  -261,   -14,  -261,  -261,  -261,    84,   -44,  1116,    95,
    -261,  1051,    53,     3,  -261,   -36,    89,  -261,  -261,  -261,
     104,   107,   -45,  -261,    96,  -261,  -261,    91,  1184,  -261,
    1370,    92,    93,  -261,    98,   101,    94,   921,   105,   102,
    -261,  -261,    72,  -261,  -261,     9,  -261,   -61,    42,  -261,
    -261,  -261,  -261,   376,  -261,  -261,  -261,  -261,   106,  -261,
    -261,   986,  1051,  -261,   103,  -261,  -261,  -261,  -261,   -41,
    -261,  -261,  1051,  1407,  -261,  -261,  1051,   110,  -261,  -261,
    -261,  1051,  1051,  1051,  1051,  1051,  1051,  1051,  1051,  1051,
    1051,  1051,  1051,  1051,  1051,  -261,   109,    23,  -261,  -261,
    -261,  1227,  -261,  -261,   111,  -261,  1051,  -261,  -261,    25,
    -261,  -261,   459,  -261,  -261,  -261,  -261,  -261,  1051,  1051,
    -261,  -261,  -261,  1051,  -261,   114,  -261,  -261,  -261,   115,
     112,    77,   116,  -261,  -261,  -261,  -261,  -261,    53,    53,
    -261,  -261,  -261,  -261,   -36,   -36,  -261,   104,   107,    76,
    1051,    91,  -261,  -261,   145,    54,   625,   708,    -6,  -261,
     791,   459,  -261,  -261,   117,  -261,  -261,  1051,   120,  -261,
     124,  -261,  -261,  -261,  -261,   791,   111,   112,    91,   125,
     122,  -261,  -261,  -261,  1051,  -261,   118,   128,   180,  -261,
     126,   542,  -261,    -5,  1051,   542,   111,  1051,  -261,  -261,
    -261,   123,   112,  -261,  -261,  -261,  -261
};

  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
     Performed when YYTABLE does not specify something else to do.  Zero
     means the default is an error.  */
static const yytype_uint8 yydefact[] =
{
       0,     0,   112,   113,   114,     0,   106,   105,   120,   118,
     119,   124,   125,   126,   127,   128,   129,   121,   122,   123,
     130,   131,   132,   109,   107,     0,   117,   133,   134,   135,
     136,   138,   200,   201,     0,    77,    87,     0,    92,    97,
       0,   103,     0,   110,   115,   137,     0,   197,   199,   108,
     102,     0,     2,     3,   141,     0,    72,     0,    75,    87,
       0,    88,    89,    90,    78,     0,    87,     0,    73,     2,
      98,   104,   111,     0,     1,   198,     0,     0,   139,     0,
     202,    79,    84,    86,    91,     0,    93,    80,     0,     0,
       4,     7,     6,     8,     0,     0,     0,    35,    34,    33,
       5,    10,    29,    12,    17,    18,     0,     0,    23,     0,
      36,     0,    39,    42,    43,    48,    51,    52,    53,    54,
      56,    58,    60,    71,     0,    27,    74,     0,     0,   143,
       0,     0,     0,   182,     0,     0,     0,     0,     0,   160,
     169,   173,    36,    62,    69,     0,   151,     0,   115,   154,
     171,   153,   152,     0,   155,   156,   157,   158,    81,    83,
      85,     0,     0,    99,     0,   150,   101,    30,    31,     0,
      14,    15,     0,     0,    21,    20,     0,    22,    24,    26,
      32,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,   116,   148,     0,   146,   142,
     144,     0,   193,   192,   167,   184,     0,   196,   194,     0,
     180,   159,     0,    65,    66,    67,    68,    64,     0,     0,
     174,   170,   172,     0,    94,     0,    96,   100,     9,     0,
      16,     2,     3,    13,    19,    25,    37,    38,    41,    40,
      46,    47,    44,    45,    49,    50,    55,    57,    59,     0,
       0,     0,   145,   140,     0,     0,     0,     0,     0,   195,
       0,   161,    63,    70,     0,    95,    11,     0,     0,   147,
       0,   166,   168,   187,   186,   189,   167,   178,     0,     0,
       0,    82,    61,   149,     0,   188,     0,     0,   177,   175,
       0,     0,   162,     0,   190,     0,   167,     0,   164,   181,
     163,     0,   191,   185,   176,   179,   183
};

  /* YYPGOTO[NTERM-NUM].  */
static const yytype_int16 yypgoto[] =
{
    -261,   -24,  -261,  -261,  -261,  -261,  -261,  -261,    34,  -261,
    -261,  -261,  -261,    32,  -261,   -33,  -261,   -27,   -26,  -261,
    -261,  -261,    14,    16,    18,  -261,   -66,   -87,  -261,   -92,
     -85,    11,    12,  -261,  -261,  -261,   141,   150,   161,   143,
    -261,  -261,  -231,     5,   -30,   224,   -18,     0,  -261,  -261,
    -261,   100,  -119,  -261,   -17,  -156,   -25,  -145,  -243,  -261,
    -261,  -261,   -64,  -260,  -261,  -261,   -52,    21,   -22,  -261,
    -261,   -39,  -261,  -261,  -261,  -261,  -261,  -261,  -261,  -261,
    -261,   191,  -261,  -261
};

  /* YYDEFGOTO[NTERM-NUM].  */
static const yytype_int16 yydefgoto[] =
{
      -1,   196,   100,   101,   102,   229,   103,   104,   105,   106,
     107,   108,   109,   142,   111,   112,   113,   114,   115,   116,
     117,   118,   119,   120,   121,   122,   143,   144,   218,   145,
     124,   146,   147,    34,    35,    36,    82,    64,    65,    83,
      37,    38,    39,    40,    41,    42,    43,   125,    45,   130,
      77,   128,   129,   197,   198,   166,   149,   150,   151,   152,
     212,   280,   299,   254,   255,   256,   300,   153,   154,   155,
     289,   279,   156,   260,   204,   257,   275,   286,   287,   157,
      46,    47,    48,    57
};

  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
     positive, shift that token.  If negative, reduce the rule whose
     number is the opposite.  If YYTABLE_NINF, syntax error.  */
static const yytype_int16 yytable[] =
{
      44,    55,   165,   164,   169,    80,   226,   123,   222,   200,
      71,    32,    33,   272,   193,    70,   288,    49,   185,   186,
      56,   178,   123,    88,    72,    50,    52,    53,   175,   278,
      89,   228,    58,    76,   176,    84,   304,   219,   170,   171,
      44,    66,    44,    86,   278,   209,    44,   127,   298,   194,
      59,    44,   298,   187,   188,    84,    54,    32,    33,   172,
     158,   161,    73,   173,    66,    44,   276,   301,   162,    69,
      53,    67,   219,   219,    68,   165,   225,    44,    60,   148,
     230,    78,   200,     6,     7,    44,   183,   219,   184,   235,
     220,    60,    61,    62,    63,   123,     6,     7,   127,    49,
     127,   251,   249,   219,   252,   110,   259,    87,    61,    62,
      63,    23,    24,   -27,   258,    73,   222,     2,     3,     4,
     110,    61,    62,    63,    23,    24,   167,   168,    44,    79,
      44,   262,   263,   213,   214,   215,    52,    53,   264,   181,
     182,   305,   216,   180,   126,   189,   190,   -76,   -28,   233,
     238,   239,   217,   148,   219,   267,   174,   123,   240,   241,
     242,   243,   191,   244,   245,   268,   179,   192,   277,   205,
     195,   127,   206,   202,   203,   207,   210,   227,   211,   223,
     282,  -117,   250,   277,   123,   270,  -165,  -138,   265,   266,
     219,   281,   293,   110,   283,   284,   296,   291,   292,   294,
     295,    44,   302,   271,   306,   246,   297,   234,   247,    81,
     165,   248,   148,   236,   237,   110,   110,   110,   110,   110,
     110,   110,   110,   110,   110,   110,   159,    85,   160,    51,
     201,   303,   273,   261,   269,   274,   285,    75,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,   290,   110,   148,   148,     0,     0,
     148,   148,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,   148,     0,     0,     0,     0,
       0,     0,   110,     0,     0,     0,     0,     0,     0,     0,
       0,   148,     0,     0,     0,   148,     1,     2,     3,     4,
       5,     6,     7,     8,     9,    10,   131,   132,   133,     0,
     134,   135,   136,   137,    11,    12,    13,    14,    15,    16,
      17,    18,    19,    20,    21,    22,     0,     0,     0,    23,
      24,    25,    26,   138,    27,    28,    29,    30,    90,    31,
      91,    92,    93,     0,     0,    94,    95,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,    96,     0,     0,     0,   139,   140,
       0,     0,     0,     0,   141,    97,    98,     0,    99,     1,
       2,     3,     4,     5,     6,     7,     8,     9,    10,   131,
     132,   133,     0,   134,   135,   136,   137,    11,    12,    13,
      14,    15,    16,    17,    18,    19,    20,    21,    22,     0,
       0,     0,    23,    24,    25,    26,   138,    27,    28,    29,
      30,    90,    31,    91,    92,    93,     0,     0,    94,    95,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,    96,     0,     0,
       0,   139,   221,     0,     0,     0,     0,   141,    97,    98,
       0,    99,     1,     2,     3,     4,     5,     6,     7,     8,
       9,    10,   131,   132,   133,     0,   134,   135,   136,   137,
      11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
      21,    22,     0,     0,     0,    23,    24,    25,    26,   138,
      27,    28,    29,    30,    90,    31,    91,    92,    93,     0,
       0,    94,    95,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      96,     0,     0,     0,   139,     0,     0,     0,     0,     0,
     141,    97,    98,     0,    99,     1,     2,     3,     4,     5,
       6,     7,     8,     9,    10,   131,   132,   133,     0,   134,
     135,   136,   137,    11,    12,    13,    14,    15,    16,    17,
      18,    19,    20,    21,    22,     0,     0,     0,    23,    24,
      25,    26,   138,    27,    28,    29,    30,    90,    31,    91,
      92,    93,     0,     0,    94,    95,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,    96,     0,     0,     0,    79,     0,     0,
       0,     0,     0,   141,    97,    98,     0,    99,     1,     2,
       3,     4,     5,     6,     7,     8,     9,    10,   131,   132,
     133,     0,   134,   135,   136,   137,    11,    12,    13,    14,
      15,    16,    17,    18,    19,    20,    21,    22,     0,     0,
       0,    23,    24,    25,    26,   138,    27,    28,    29,    30,
      90,    31,    91,    92,    93,     0,     0,    94,    95,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,    96,     0,     0,     0,
       0,     0,     0,     0,     0,     0,   141,    97,    98,     0,
      99,     1,     2,     3,     4,     5,     6,     7,     8,     9,
      10,     0,     0,     0,     0,     0,     0,     0,     0,    11,
      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
      22,     0,     0,     0,    23,    24,    25,    26,     0,    27,
      28,    29,    30,    90,    31,    91,    92,    93,     0,     0,
      94,    95,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,    96,
       0,     0,     0,     0,     0,     0,     0,     0,     0,   141,
      97,    98,     0,    99,    60,     2,     3,     4,     0,     6,
       7,     8,     9,    10,     0,     0,     0,     0,     0,     0,
       0,     0,    11,    12,    13,    14,    15,    16,    17,    18,
      19,    20,    21,    22,     0,     0,     0,    23,    24,    25,
      26,     0,    27,    28,    29,    30,    90,    31,    91,    92,
      93,     0,     0,    94,    95,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,    96,     0,     0,     0,     8,     9,    10,     0,
       0,     0,     0,    97,    98,     0,    99,    11,    12,    13,
      14,    15,    16,    17,    18,    19,    20,    21,    22,     0,
       0,     0,     0,     0,    25,    26,     0,    27,    28,    29,
      30,    90,    31,    91,    92,    93,     0,     0,    94,    95,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,    96,     0,     0,
     163,     8,     9,    10,     0,     0,     0,     0,    97,    98,
       0,    99,    11,    12,    13,    14,    15,    16,    17,    18,
      19,    20,    21,    22,     0,     0,     0,     0,     0,    25,
      26,     0,    27,    28,    29,    30,    90,    31,    91,    92,
      93,     0,     0,    94,    95,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,    96,     0,     0,     0,     8,     9,    10,     0,
       0,     0,   208,    97,    98,     0,    99,    11,    12,    13,
      14,    15,    16,    17,    18,    19,    20,    21,    22,     0,
       0,     0,     0,     0,    25,    26,     0,    27,    28,    29,
      30,    90,    31,    91,    92,    93,     0,     0,    94,    95,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,    96,     0,     0,
     224,     8,     9,    10,     0,     0,     0,     0,    97,    98,
       0,    99,    11,    12,    13,    14,    15,    16,    17,    18,
      19,    20,    21,    22,     0,     0,     0,     0,     0,    25,
      26,     0,    27,    28,    29,    30,    90,    31,    91,    92,
      93,     0,     0,    94,    95,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,    96,     0,     0,     0,     8,     9,    10,     0,
       0,     0,     0,    97,    98,     0,    99,    11,    12,    13,
      14,    15,    16,    17,    18,    19,    20,    21,    22,     0,
       0,     0,     0,     0,    25,   177,     0,    27,    28,    29,
      30,    90,    31,    91,    92,    93,     0,     0,    94,    95,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,    96,     2,     3,
       4,     0,     0,     0,     8,     9,    10,     0,    97,    98,
       0,    99,     0,     0,     0,    11,    12,    13,    14,    15,
      16,    17,    18,    19,    20,    21,    22,     0,     0,     0,
       0,     0,    25,    26,     0,    27,    28,    29,    30,     0,
      31,     2,     3,     4,     0,     0,     0,     8,     9,    10,
       0,     0,     0,     0,     0,     0,     0,     0,    11,    12,
      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
     199,     0,     0,     0,     0,    25,    26,     0,    27,    28,
      29,    30,     0,    31,     0,     0,     0,     0,     0,     0,
       0,     0,     0,    74,     0,     0,     1,     2,     3,     4,
       5,     6,     7,     8,     9,    10,     0,     0,     0,     0,
       0,     0,     0,   253,    11,    12,    13,    14,    15,    16,
      17,    18,    19,    20,    21,    22,     0,     0,     0,    23,
      24,    25,    26,     0,    27,    28,    29,    30,     0,    31,
       1,     2,     3,     4,     5,     6,     7,     8,     9,    10,
       0,     0,     0,     0,     0,     0,     0,     0,    11,    12,
      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
       0,     0,     0,    23,    24,    25,    26,     0,    27,    28,
      29,    30,     0,    31,     2,     3,     4,     0,     0,     0,
       8,     9,    10,     0,     0,     0,     0,     0,     0,     0,
       0,    11,    12,    13,    14,    15,    16,    17,    18,    19,
      20,    21,    22,     0,     0,     0,     0,     0,    25,    26,
       0,    27,    28,    29,    30,     0,    31,     8,     9,    10,
       0,     0,     0,     0,     0,     0,     0,     0,    11,    12,
      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
       0,     0,     0,     0,     0,    25,    26,     0,    27,    28,
      29,    30,   231,   232,     8,     9,    10,     0,     0,     0,
       0,     0,     0,     0,     0,    11,    12,    13,    14,    15,
      16,    17,    18,    19,    20,    21,    22,     0,     0,     0,
       0,     0,    25,    26,     0,    27,    28,    29,    30,     0,
      31
};

static const yytype_int16 yycheck[] =
{
       0,    25,    89,    88,    96,    57,   162,    73,   153,   128,
      40,     0,     0,   256,    59,    39,   276,    37,    54,    55,
      81,   108,    88,    73,    42,    45,    45,    46,    72,   260,
      80,    72,    72,    51,    78,    65,   296,    78,    52,    53,
      40,    36,    42,    67,   275,   137,    46,    77,   291,    94,
      78,    51,   295,    89,    90,    85,    75,    46,    46,    73,
      84,    73,    73,    77,    59,    65,    72,    72,    80,    45,
      46,    78,    78,    78,    81,   162,   161,    77,     3,    79,
     172,    75,   201,     8,     9,    85,    83,    78,    85,   176,
      81,     3,    33,    34,    35,   161,     8,     9,   128,    37,
     130,    78,   194,    78,    81,    73,    81,    71,    33,    34,
      35,    36,    37,    71,   206,    73,   261,     4,     5,     6,
      88,    33,    34,    35,    36,    37,    94,    95,   128,    75,
     130,   218,   219,    61,    62,    63,    45,    46,   223,    86,
      87,   297,    70,   111,    81,    56,    57,    72,    71,   173,
     183,   184,    80,   153,    78,    79,    72,   223,   185,   186,
     187,   188,    58,   189,   190,   250,    71,    60,   260,    71,
      74,   201,    71,    81,    81,    81,    71,    74,    76,    73,
     267,    71,    73,   275,   250,    40,    75,    71,    74,    74,
      78,    74,   284,   161,    74,    71,    16,    72,    76,    81,
      72,   201,   294,   255,    81,   191,    80,   173,   192,    59,
     297,   193,   212,   181,   182,   183,   184,   185,   186,   187,
     188,   189,   190,   191,   192,   193,    85,    66,    85,     5,
     130,   295,   257,   212,   251,   257,   275,    46,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,   278,   223,   256,   257,    -1,    -1,
     260,   261,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,   275,    -1,    -1,    -1,    -1,
      -1,    -1,   250,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,   291,    -1,    -1,    -1,   295,     3,     4,     5,     6,
       7,     8,     9,    10,    11,    12,    13,    14,    15,    -1,
      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
      27,    28,    29,    30,    31,    32,    -1,    -1,    -1,    36,
      37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
      47,    48,    49,    -1,    -1,    52,    53,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    71,    -1,    -1,    -1,    75,    76,
      -1,    -1,    -1,    -1,    81,    82,    83,    -1,    85,     3,
       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
      14,    15,    -1,    17,    18,    19,    20,    21,    22,    23,
      24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
      -1,    -1,    36,    37,    38,    39,    40,    41,    42,    43,
      44,    45,    46,    47,    48,    49,    -1,    -1,    52,    53,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    71,    -1,    -1,
      -1,    75,    76,    -1,    -1,    -1,    -1,    81,    82,    83,
      -1,    85,     3,     4,     5,     6,     7,     8,     9,    10,
      11,    12,    13,    14,    15,    -1,    17,    18,    19,    20,
      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
      31,    32,    -1,    -1,    -1,    36,    37,    38,    39,    40,
      41,    42,    43,    44,    45,    46,    47,    48,    49,    -1,
      -1,    52,    53,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      71,    -1,    -1,    -1,    75,    -1,    -1,    -1,    -1,    -1,
      81,    82,    83,    -1,    85,     3,     4,     5,     6,     7,
       8,     9,    10,    11,    12,    13,    14,    15,    -1,    17,
      18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
      28,    29,    30,    31,    32,    -1,    -1,    -1,    36,    37,
      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
      48,    49,    -1,    -1,    52,    53,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    71,    -1,    -1,    -1,    75,    -1,    -1,
      -1,    -1,    -1,    81,    82,    83,    -1,    85,     3,     4,
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      15,    -1,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    31,    32,    -1,    -1,
      -1,    36,    37,    38,    39,    40,    41,    42,    43,    44,
      45,    46,    47,    48,    49,    -1,    -1,    52,    53,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    71,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    81,    82,    83,    -1,
      85,     3,     4,     5,     6,     7,     8,     9,    10,    11,
      12,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    21,
      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
      32,    -1,    -1,    -1,    36,    37,    38,    39,    -1,    41,
      42,    43,    44,    45,    46,    47,    48,    49,    -1,    -1,
      52,    53,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    71,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    81,
      82,    83,    -1,    85,     3,     4,     5,     6,    -1,     8,
       9,    10,    11,    12,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    21,    22,    23,    24,    25,    26,    27,    28,
      29,    30,    31,    32,    -1,    -1,    -1,    36,    37,    38,
      39,    -1,    41,    42,    43,    44,    45,    46,    47,    48,
      49,    -1,    -1,    52,    53,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    71,    -1,    -1,    -1,    10,    11,    12,    -1,
      -1,    -1,    -1,    82,    83,    -1,    85,    21,    22,    23,
      24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
      -1,    -1,    -1,    -1,    38,    39,    -1,    41,    42,    43,
      44,    45,    46,    47,    48,    49,    -1,    -1,    52,    53,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    71,    -1,    -1,
      74,    10,    11,    12,    -1,    -1,    -1,    -1,    82,    83,
      -1,    85,    21,    22,    23,    24,    25,    26,    27,    28,
      29,    30,    31,    32,    -1,    -1,    -1,    -1,    -1,    38,
      39,    -1,    41,    42,    43,    44,    45,    46,    47,    48,
      49,    -1,    -1,    52,    53,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    71,    -1,    -1,    -1,    10,    11,    12,    -1,
      -1,    -1,    81,    82,    83,    -1,    85,    21,    22,    23,
      24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
      -1,    -1,    -1,    -1,    38,    39,    -1,    41,    42,    43,
      44,    45,    46,    47,    48,    49,    -1,    -1,    52,    53,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    71,    -1,    -1,
      74,    10,    11,    12,    -1,    -1,    -1,    -1,    82,    83,
      -1,    85,    21,    22,    23,    24,    25,    26,    27,    28,
      29,    30,    31,    32,    -1,    -1,    -1,    -1,    -1,    38,
      39,    -1,    41,    42,    43,    44,    45,    46,    47,    48,
      49,    -1,    -1,    52,    53,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    71,    -1,    -1,    -1,    10,    11,    12,    -1,
      -1,    -1,    -1,    82,    83,    -1,    85,    21,    22,    23,
      24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
      -1,    -1,    -1,    -1,    38,    39,    -1,    41,    42,    43,
      44,    45,    46,    47,    48,    49,    -1,    -1,    52,    53,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    71,     4,     5,
       6,    -1,    -1,    -1,    10,    11,    12,    -1,    82,    83,
      -1,    85,    -1,    -1,    -1,    21,    22,    23,    24,    25,
      26,    27,    28,    29,    30,    31,    32,    -1,    -1,    -1,
      -1,    -1,    38,    39,    -1,    41,    42,    43,    44,    -1,
      46,     4,     5,     6,    -1,    -1,    -1,    10,    11,    12,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    21,    22,
      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
      76,    -1,    -1,    -1,    -1,    38,    39,    -1,    41,    42,
      43,    44,    -1,    46,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,     0,    -1,    -1,     3,     4,     5,     6,
       7,     8,     9,    10,    11,    12,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    76,    21,    22,    23,    24,    25,    26,
      27,    28,    29,    30,    31,    32,    -1,    -1,    -1,    36,
      37,    38,    39,    -1,    41,    42,    43,    44,    -1,    46,
       3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    21,    22,
      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
      -1,    -1,    -1,    36,    37,    38,    39,    -1,    41,    42,
      43,    44,    -1,    46,     4,     5,     6,    -1,    -1,    -1,
      10,    11,    12,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    21,    22,    23,    24,    25,    26,    27,    28,    29,
      30,    31,    32,    -1,    -1,    -1,    -1,    -1,    38,    39,
      -1,    41,    42,    43,    44,    -1,    46,    10,    11,    12,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    21,    22,
      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
      -1,    -1,    -1,    -1,    -1,    38,    39,    -1,    41,    42,
      43,    44,    45,    46,    10,    11,    12,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    21,    22,    23,    24,    25,
      26,    27,    28,    29,    30,    31,    32,    -1,    -1,    -1,
      -1,    -1,    38,    39,    -1,    41,    42,    43,    44,    -1,
      46
};

  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
     symbol of state STATE-NUM.  */
static const yytype_uint8 yystos[] =
{
       0,     3,     4,     5,     6,     7,     8,     9,    10,    11,
      12,    21,    22,    23,    24,    25,    26,    27,    28,    29,
      30,    31,    32,    36,    37,    38,    39,    41,    42,    43,
      44,    46,   126,   127,   128,   129,   130,   135,   136,   137,
     138,   139,   140,   141,   142,   143,   175,   176,   177,    37,
      45,   140,    45,    46,    75,    96,    81,   178,    72,    78,
       3,    33,    34,    35,   132,   133,   138,    78,    81,    45,
      96,   139,   141,    73,     0,   176,   141,   145,    75,    75,
     161,   132,   131,   134,   139,   133,    96,    71,    73,    80,
      45,    47,    48,    49,    52,    53,    71,    82,    83,    85,
      97,    98,    99,   101,   102,   103,   104,   105,   106,   107,
     108,   109,   110,   111,   112,   113,   114,   115,   116,   117,
     118,   119,   120,   121,   125,   142,    81,   139,   146,   147,
     144,    13,    14,    15,    17,    18,    19,    20,    40,    75,
      76,    81,   108,   121,   122,   124,   126,   127,   142,   151,
     152,   153,   154,   162,   163,   164,   167,   174,    96,   131,
     134,    73,    80,    74,   125,   122,   150,   108,   108,   124,
      52,    53,    73,    77,    72,    72,    78,    39,   122,    71,
     108,    86,    87,    83,    85,    54,    55,    89,    90,    56,
      57,    58,    60,    59,    94,    74,    96,   148,   149,    76,
     147,   146,    81,    81,   169,    71,    71,    81,    81,   124,
      71,    76,   155,    61,    62,    63,    70,    80,   123,    78,
      81,    76,   152,    73,    74,   125,   150,    74,    72,   100,
     124,    45,    46,    96,   103,   122,   108,   108,   110,   110,
     112,   112,   112,   112,   113,   113,   117,   118,   119,   124,
      73,    78,    81,    76,   158,   159,   160,   170,   124,    81,
     168,   162,   122,   122,   125,    74,    74,    79,   125,   149,
      40,   161,   153,   151,   163,   171,    72,   124,   137,   166,
     156,    74,   122,    74,    71,   166,   172,   173,   158,   165,
      96,    72,    76,   124,    81,    72,    16,    80,   153,   157,
     161,    72,   124,   157,   158,   150,    81
};

  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const yytype_uint8 yyr1[] =
{
       0,    95,    96,    96,    97,    98,    98,    98,    98,    98,
      99,    99,    99,    99,    99,    99,   100,   101,   102,   102,
     103,   103,   104,   104,   105,   105,   106,   107,   107,   108,
     108,   108,   108,   109,   109,   109,   110,   110,   110,   111,
     111,   111,   112,   113,   113,   113,   113,   113,   114,   114,
     114,   115,   116,   117,   118,   118,   119,   119,   120,   120,
     121,   121,   122,   122,   123,   123,   123,   123,   123,   124,
     124,   125,   126,   126,   126,   127,   128,   128,   129,   129,
     130,   131,   131,   132,   132,   132,   132,   133,   133,   133,
     133,   134,   135,   135,   135,   135,   135,   136,   136,   136,
     136,   136,   136,   137,   137,   138,   138,   138,   138,   138,
     139,   139,   140,   140,   140,   141,   141,   142,   142,   142,
     142,   142,   142,   142,   142,   142,   142,   142,   142,   142,
     142,   142,   142,   142,   142,   142,   142,   142,   142,   144,
     143,   145,   143,   146,   146,   147,   148,   148,   149,   149,
     150,   151,   152,   152,   153,   153,   153,   153,   153,   154,
     155,   156,   154,   157,   157,   159,   158,   160,   158,   161,
     161,   162,   162,   163,   163,   164,   165,   165,   166,   166,
     168,   167,   169,   167,   170,   167,   171,   171,   172,   172,
     173,   173,   174,   174,   174,   174,   174,   175,   175,   176,
     176,   178,   177
};

  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
static const yytype_uint8 yyr2[] =
{
       0,     2,     1,     1,     1,     1,     1,     1,     1,     3,
       1,     4,     1,     3,     2,     2,     1,     1,     1,     3,
       2,     2,     2,     1,     2,     3,     2,     1,     1,     1,
       2,     2,     2,     1,     1,     1,     1,     3,     3,     1,
       3,     3,     1,     1,     3,     3,     3,     3,     1,     3,
       3,     1,     1,     1,     1,     3,     1,     3,     1,     3,
       1,     5,     1,     3,     1,     1,     1,     1,     1,     1,
       3,     1,     2,     2,     4,     2,     1,     1,     2,     3,
       3,     2,     5,     3,     2,     3,     2,     0,     1,     1,
       1,     1,     1,     3,     5,     6,     5,     1,     2,     4,
       5,     4,     2,     1,     2,     1,     1,     1,     2,     1,
       1,     2,     1,     1,     1,     1,     4,     1,     1,     1,
       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
       1,     1,     1,     1,     1,     1,     1,     1,     1,     0,
       6,     0,     5,     1,     2,     3,     1,     3,     1,     4,
       1,     1,     1,     1,     1,     1,     1,     1,     1,     2,
       0,     0,     5,     1,     1,     0,     2,     0,     2,     2,
       3,     1,     2,     1,     2,     5,     3,     1,     1,     4,
       0,     6,     0,     8,     0,     7,     1,     1,     1,     0,
       2,     3,     2,     2,     2,     3,     2,     1,     2,     1,
       1,     0,     3
};


#define yyerrok         (yyerrstatus = 0)
#define yyclearin       (yychar = YYEMPTY)
#define YYEMPTY         (-2)
#define YYEOF           0

#define YYACCEPT        goto yyacceptlab
#define YYABORT         goto yyabortlab
#define YYERROR         goto yyerrorlab


#define YYRECOVERING()  (!!yyerrstatus)

#define YYBACKUP(Token, Value)                                  \
do                                                              \
  if (yychar == YYEMPTY)                                        \
    {                                                           \
      yychar = (Token);                                         \
      yylval = (Value);                                         \
      YYPOPSTACK (yylen);                                       \
      yystate = *yyssp;                                         \
      goto yybackup;                                            \
    }                                                           \
  else                                                          \
    {                                                           \
      yyerror (&yylloc, context, YY_("syntax error: cannot back up")); \
      YYERROR;                                                  \
    }                                                           \
while (0)

/* Error token number */
#define YYTERROR        1
#define YYERRCODE       256


/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
   If N is 0, then set CURRENT to the empty location which ends
   the previous symbol: RHS[0] (always defined).  */

#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
    do                                                                  \
      if (N)                                                            \
        {                                                               \
          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
        }                                                               \
      else                                                              \
        {                                                               \
          (Current).first_line   = (Current).last_line   =              \
            YYRHSLOC (Rhs, 0).last_line;                                \
          (Current).first_column = (Current).last_column =              \
            YYRHSLOC (Rhs, 0).last_column;                              \
        }                                                               \
    while (0)
#endif

#define YYRHSLOC(Rhs, K) ((Rhs)[K])


/* Enable debugging if requested.  */
#if YYDEBUG

# ifndef YYFPRINTF
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)                        \
do {                                            \
  if (yydebug)                                  \
    YYFPRINTF Args;                             \
} while (0)


/* YY_LOCATION_PRINT -- Print the location on the stream.
   This macro was not mandated originally: define only if we know
   we won't break user code: when these are the locations we know.  */

#ifndef YY_LOCATION_PRINT
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL

/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */

YY_ATTRIBUTE_UNUSED
static unsigned
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
{
  unsigned res = 0;
  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
  if (0 <= yylocp->first_line)
    {
      res += YYFPRINTF (yyo, "%d", yylocp->first_line);
      if (0 <= yylocp->first_column)
        res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
    }
  if (0 <= yylocp->last_line)
    {
      if (yylocp->first_line < yylocp->last_line)
        {
          res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
          if (0 <= end_col)
            res += YYFPRINTF (yyo, ".%d", end_col);
        }
      else if (0 <= end_col && yylocp->first_column < end_col)
        res += YYFPRINTF (yyo, "-%d", end_col);
    }
  return res;
 }

#  define YY_LOCATION_PRINT(File, Loc)          \
  yy_location_print_ (File, &(Loc))

# else
#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
#endif


# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
do {                                                                      \
  if (yydebug)                                                            \
    {                                                                     \
      YYFPRINTF (stderr, "%s ", Title);                                   \
      yy_symbol_print (stderr,                                            \
                  Type, Value, Location, context); \
      YYFPRINTF (stderr, "\n");                                           \
    }                                                                     \
} while (0)


/*----------------------------------------.
| Print this symbol's value on YYOUTPUT.  |
`----------------------------------------*/

static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context)
{
  FILE *yyo = yyoutput;
  YYUSE (yyo);
  YYUSE (yylocationp);
  YYUSE (context);
  if (!yyvaluep)
    return;
# ifdef YYPRINT
  if (yytype < YYNTOKENS)
    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
  YYUSE (yytype);
}


/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context)
{
  YYFPRINTF (yyoutput, "%s %s (",
             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);

  YY_LOCATION_PRINT (yyoutput, *yylocationp);
  YYFPRINTF (yyoutput, ": ");
  yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context);
  YYFPRINTF (yyoutput, ")");
}

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included).                                                   |
`------------------------------------------------------------------*/

static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
{
  YYFPRINTF (stderr, "Stack now");
  for (; yybottom <= yytop; yybottom++)
    {
      int yybot = *yybottom;
      YYFPRINTF (stderr, " %d", yybot);
    }
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)                            \
do {                                                            \
  if (yydebug)                                                  \
    yy_stack_print ((Bottom), (Top));                           \
} while (0)


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

static void
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, TParseContext* context)
{
  unsigned long int yylno = yyrline[yyrule];
  int yynrhs = yyr2[yyrule];
  int yyi;
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
             yyrule - 1, yylno);
  /* The symbols being reduced.  */
  for (yyi = 0; yyi < yynrhs; yyi++)
    {
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
      yy_symbol_print (stderr,
                       yystos[yyssp[yyi + 1 - yynrhs]],
                       &(yyvsp[(yyi + 1) - (yynrhs)])
                       , &(yylsp[(yyi + 1) - (yynrhs)])                       , context);
      YYFPRINTF (stderr, "\n");
    }
}

# define YY_REDUCE_PRINT(Rule)          \
do {                                    \
  if (yydebug)                          \
    yy_reduce_print (yyssp, yyvsp, yylsp, Rule, context); \
} while (0)

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */


/* YYINITDEPTH -- initial size of the parser's stacks.  */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif

/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
   if the built-in stack extension method is used).

   Do not make this value too large; the results are undefined if
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif


#if YYERROR_VERBOSE

# ifndef yystrlen
#  if defined __GLIBC__ && defined _STRING_H
#   define yystrlen strlen
#  else
/* Return the length of YYSTR.  */
static YYSIZE_T
yystrlen (const char *yystr)
{
  YYSIZE_T yylen;
  for (yylen = 0; yystr[yylen]; yylen++)
    continue;
  return yylen;
}
#  endif
# endif

# ifndef yystpcpy
#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
#   define yystpcpy stpcpy
#  else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
static char *
yystpcpy (char *yydest, const char *yysrc)
{
  char *yyd = yydest;
  const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
#  endif
# endif

# ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
   quotes and backslashes, so that it's suitable for yyerror.  The
   heuristic is that double-quoting is unnecessary unless the string
   contains an apostrophe, a comma, or backslash (other than
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
   null, do not copy; instead, return the length of what the result
   would have been.  */
static YYSIZE_T
yytnamerr (char *yyres, const char *yystr)
{
  if (*yystr == '"')
    {
      YYSIZE_T yyn = 0;
      char const *yyp = yystr;

      for (;;)
        switch (*++yyp)
          {
          case '\'':
          case ',':
            goto do_not_strip_quotes;

          case '\\':
            if (*++yyp != '\\')
              goto do_not_strip_quotes;
            /* Fall through.  */
          default:
            if (yyres)
              yyres[yyn] = *yyp;
            yyn++;
            break;

          case '"':
            if (yyres)
              yyres[yyn] = '\0';
            return yyn;
          }
    do_not_strip_quotes: ;
    }

  if (! yyres)
    return yystrlen (yystr);

  return yystpcpy (yyres, yystr) - yyres;
}
# endif

/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
   about the unexpected token YYTOKEN for the state stack whose top is
   YYSSP.

   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
   not large enough to hold the message.  In that case, also set
   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
   required number of bytes is too large to store.  */
static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                yytype_int16 *yyssp, int yytoken)
{
  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
  YYSIZE_T yysize = yysize0;
  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  /* Internationalized format string. */
  const char *yyformat = YY_NULLPTR;
  /* Arguments of yyformat. */
  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  /* Number of reported tokens (one for the "unexpected", one per
     "expected"). */
  int yycount = 0;

  /* There are many possibilities here to consider:
     - If this state is a consistent state with a default action, then
       the only way this function was invoked is if the default action
       is an error action.  In that case, don't check for expected
       tokens because there are none.
     - The only way there can be no lookahead present (in yychar) is if
       this state is a consistent state with a default action.  Thus,
       detecting the absence of a lookahead is sufficient to determine
       that there is no unexpected or expected token to report.  In that
       case, just report a simple "syntax error".
     - Don't assume there isn't a lookahead just because this state is a
       consistent state with a default action.  There might have been a
       previous inconsistent state, consistent state with a non-default
       action, or user semantic action that manipulated yychar.
     - Of course, the expected token list depends on states to have
       correct lookahead information, and it depends on the parser not
       to perform extra reductions after fetching a lookahead from the
       scanner and before detecting a syntax error.  Thus, state merging
       (from LALR or IELR) and default reductions corrupt the expected
       token list.  However, the list is correct for canonical LR with
       one exception: it will still contain any token that will not be
       accepted due to an error action in a later state.
  */
  if (yytoken != YYEMPTY)
    {
      int yyn = yypact[*yyssp];
      yyarg[yycount++] = yytname[yytoken];
      if (!yypact_value_is_default (yyn))
        {
          /* Start YYX at -YYN if negative to avoid negative indexes in
             YYCHECK.  In other words, skip the first -YYN actions for
             this state because they are default actions.  */
          int yyxbegin = yyn < 0 ? -yyn : 0;
          /* Stay within bounds of both yycheck and yytname.  */
          int yychecklim = YYLAST - yyn + 1;
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
          int yyx;

          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
                && !yytable_value_is_error (yytable[yyx + yyn]))
              {
                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
                  {
                    yycount = 1;
                    yysize = yysize0;
                    break;
                  }
                yyarg[yycount++] = yytname[yyx];
                {
                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
                  if (! (yysize <= yysize1
                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
                    return 2;
                  yysize = yysize1;
                }
              }
        }
    }

  switch (yycount)
    {
# define YYCASE_(N, S)                      \
      case N:                               \
        yyformat = S;                       \
      break
      YYCASE_(0, YY_("syntax error"));
      YYCASE_(1, YY_("syntax error, unexpected %s"));
      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
    }

  {
    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
      return 2;
    yysize = yysize1;
  }

  if (*yymsg_alloc < yysize)
    {
      *yymsg_alloc = 2 * yysize;
      if (! (yysize <= *yymsg_alloc
             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
      return 1;
    }

  /* Avoid sprintf, as that infringes on the user's name space.
     Don't have undefined behavior even if the translation
     produced a string with the wrong number of "%s"s.  */
  {
    char *yyp = *yymsg;
    int yyi = 0;
    while ((*yyp = *yyformat) != '\0')
      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
        {
          yyp += yytnamerr (yyp, yyarg[yyi++]);
          yyformat += 2;
        }
      else
        {
          yyp++;
          yyformat++;
        }
  }
  return 0;
}
#endif /* YYERROR_VERBOSE */

/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, TParseContext* context)
{
  YYUSE (yyvaluep);
  YYUSE (yylocationp);
  YYUSE (context);
  if (!yymsg)
    yymsg = "Deleting";
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);

  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  YYUSE (yytype);
  YY_IGNORE_MAYBE_UNINITIALIZED_END
}




/*----------.
| yyparse.  |
`----------*/

int
yyparse (TParseContext* context)
{
/* The lookahead symbol.  */
int yychar;


/* The semantic value of the lookahead symbol.  */
/* Default value used for initialization, for pacifying older GCCs
   or non-GCC compilers.  */
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);

/* Location data for the lookahead symbol.  */
static YYLTYPE yyloc_default
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
  = { 1, 1, 1, 1 }
# endif
;
YYLTYPE yylloc = yyloc_default;

    /* Number of syntax errors so far.  */
    int yynerrs;

    int yystate;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus;

    /* The stacks and their tools:
       'yyss': related to states.
       'yyvs': related to semantic values.
       'yyls': related to locations.

       Refer to the stacks through separate pointers, to allow yyoverflow
       to reallocate them elsewhere.  */

    /* The state stack.  */
    yytype_int16 yyssa[YYINITDEPTH];
    yytype_int16 *yyss;
    yytype_int16 *yyssp;

    /* The semantic value stack.  */
    YYSTYPE yyvsa[YYINITDEPTH];
    YYSTYPE *yyvs;
    YYSTYPE *yyvsp;

    /* The location stack.  */
    YYLTYPE yylsa[YYINITDEPTH];
    YYLTYPE *yyls;
    YYLTYPE *yylsp;

    /* The locations where the error started and ended.  */
    YYLTYPE yyerror_range[3];

    YYSIZE_T yystacksize;

  int yyn;
  int yyresult;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken = 0;
  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;
  YYLTYPE yyloc;

#if YYERROR_VERBOSE
  /* Buffer for error messages, and its allocated size.  */
  char yymsgbuf[128];
  char *yymsg = yymsgbuf;
  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif

#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))

  /* The number of symbols on the RHS of the reduced rule.
     Keep to zero when no symbol should be popped.  */
  int yylen = 0;

  yyssp = yyss = yyssa;
  yyvsp = yyvs = yyvsa;
  yylsp = yyls = yylsa;
  yystacksize = YYINITDEPTH;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY; /* Cause a token to be read.  */
  yylsp[0] = yylloc;
  goto yysetstate;

/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
 yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed.  So pushing a state here evens the stacks.  */
  yyssp++;

 yysetstate:
  *yyssp = yystate;

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
        /* Give user a chance to reallocate the stack.  Use copies of
           these so that the &'s don't force the real ones into
           memory.  */
        YYSTYPE *yyvs1 = yyvs;
        yytype_int16 *yyss1 = yyss;
        YYLTYPE *yyls1 = yyls;

        /* Each stack pointer address is followed by the size of the
           data in use in that stack, in bytes.  This used to be a
           conditional around just the two extra args, but that might
           be undefined if yyoverflow is a macro.  */
        yyoverflow (YY_("memory exhausted"),
                    &yyss1, yysize * sizeof (*yyssp),
                    &yyvs1, yysize * sizeof (*yyvsp),
                    &yyls1, yysize * sizeof (*yylsp),
                    &yystacksize);

        yyls = yyls1;
        yyss = yyss1;
        yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyexhaustedlab;
# else
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
        goto yyexhaustedlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
        yystacksize = YYMAXDEPTH;

      {
        yytype_int16 *yyss1 = yyss;
        union yyalloc *yyptr =
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
        if (! yyptr)
          goto yyexhaustedlab;
        YYSTACK_RELOCATE (yyss_alloc, yyss);
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
        YYSTACK_RELOCATE (yyls_alloc, yyls);
#  undef YYSTACK_RELOCATE
        if (yyss1 != yyssa)
          YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;
      yylsp = yyls + yysize - 1;

      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
                  (unsigned long int) yystacksize));

      if (yyss + yystacksize - 1 <= yyssp)
        YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  if (yystate == YYFINAL)
    YYACCEPT;

  goto yybackup;

/*-----------.
| yybackup.  |
`-----------*/
yybackup:

  /* Do appropriate processing given the current state.  Read a
     lookahead token if we need one and don't already have one.  */

  /* First try to decide what to do without reference to lookahead token.  */
  yyn = yypact[yystate];
  if (yypact_value_is_default (yyn))
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = yylex (&yylval, &yylloc, YYLEX_PARAM);
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yytable_value_is_error (yyn))
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  /* Shift the lookahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);

  /* Discard the shifted token.  */
  yychar = YYEMPTY;

  yystate = yyn;
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END
  *++yylsp = yylloc;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     '$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];

  /* Default location.  */
  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 4:

    {
        // The symbol table search was done in the lexical phase
        const TSymbol* symbol = (yyvsp[0].lex).symbol;
        const TVariable* variable;
        if (symbol == 0) {
            context->error((yylsp[0]), "undeclared identifier", (yyvsp[0].lex).string->c_str());
            context->recover();
            TType type(EbtFloat, EbpUndefined);
            TVariable* fakeVariable = new TVariable((yyvsp[0].lex).string, type);
            context->symbolTable.insert(*fakeVariable);
            variable = fakeVariable;
        } else {
            // This identifier can only be a variable type symbol
            if (! symbol->isVariable()) {
                context->error((yylsp[0]), "variable expected", (yyvsp[0].lex).string->c_str());
                context->recover();
            }
            
            variable = static_cast<const TVariable*>(symbol);

            if (context->symbolTable.findBuiltIn(variable->getName()) &&
                !variable->getExtension().empty() &&
                context->extensionErrorCheck((yylsp[0]), variable->getExtension())) {
                context->recover();
            }
        }

        // don't delete $1.string, it's used by error recovery, and the pool
        // pop will reclaim the memory

        if (variable->getType().getQualifier() == EvqConst ) {
            ConstantUnion* constArray = variable->getConstPointer();
            TType t(variable->getType());
            (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yylsp[0]));
        } else
            (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
                                                 variable->getName(),
                                                 variable->getType(),
                                                 (yylsp[0]));
    }

    break;

  case 5:

    {
        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
    }

    break;

  case 6:

    {
        //
        // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
        // check for overflow for constants
        //
        if (abs((yyvsp[0].lex).i) >= (1 << 16)) {
            context->error((yylsp[0]), " integer constant overflow", "");
            context->recover();
        }
        ConstantUnion *unionArray = new ConstantUnion[1];
        unionArray->setIConst((yyvsp[0].lex).i);
        (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[0]));
    }

    break;

  case 7:

    {
        ConstantUnion *unionArray = new ConstantUnion[1];
        unionArray->setFConst((yyvsp[0].lex).f);
        (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[0]));
    }

    break;

  case 8:

    {
        ConstantUnion *unionArray = new ConstantUnion[1];
        unionArray->setBConst((yyvsp[0].lex).b);
        (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[0]));
    }

    break;

  case 9:

    {
        (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode);
    }

    break;

  case 10:

    {
        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
    }

    break;

  case 11:

    {
        (yyval.interm.intermTypedNode) = context->addIndexExpression((yyvsp[-3].interm.intermTypedNode), (yylsp[-2]), (yyvsp[-1].interm.intermTypedNode));
    }

    break;

  case 12:

    {
        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
    }

    break;

  case 13:

    {
        if ((yyvsp[-2].interm.intermTypedNode)->isArray()) {
            context->error((yylsp[0]), "cannot apply dot operator to an array", ".");
            context->recover();
        }

        if ((yyvsp[-2].interm.intermTypedNode)->isVector()) {
            TVectorFields fields;
            if (! context->parseVectorFields(*(yyvsp[0].lex).string, (yyvsp[-2].interm.intermTypedNode)->getNominalSize(), fields, (yylsp[0]))) {
                fields.num = 1;
                fields.offsets[0] = 0;
                context->recover();
            }

            if ((yyvsp[-2].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
                (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[-2].interm.intermTypedNode), (yylsp[0]));
                if ((yyval.interm.intermTypedNode) == 0) {
                    context->recover();
                    (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode);
                }
                else
                    (yyval.interm.intermTypedNode)->setType(TType((yyvsp[-2].interm.intermTypedNode)->getBasicType(), (yyvsp[-2].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[0].lex).string).size()));
            } else {
                TString vectorString = *(yyvsp[0].lex).string;
                TIntermTyped* index = context->intermediate.addSwizzle(fields, (yylsp[0]));
                (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[-2].interm.intermTypedNode), index, (yylsp[-1]));
                (yyval.interm.intermTypedNode)->setType(TType((yyvsp[-2].interm.intermTypedNode)->getBasicType(), (yyvsp[-2].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
            }
        } else if ((yyvsp[-2].interm.intermTypedNode)->isMatrix()) {
            TMatrixFields fields;
            if (! context->parseMatrixFields(*(yyvsp[0].lex).string, (yyvsp[-2].interm.intermTypedNode)->getNominalSize(), fields, (yylsp[0]))) {
                fields.wholeRow = false;
                fields.wholeCol = false;
                fields.row = 0;
                fields.col = 0;
                context->recover();
            }

            if (fields.wholeRow || fields.wholeCol) {
                context->error((yylsp[-1]), " non-scalar fields not implemented yet", ".");
                context->recover();
                ConstantUnion *unionArray = new ConstantUnion[1];
                unionArray->setIConst(0);
                TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[0]));
                (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[-2].interm.intermTypedNode), index, (yylsp[-1]));
                (yyval.interm.intermTypedNode)->setType(TType((yyvsp[-2].interm.intermTypedNode)->getBasicType(), (yyvsp[-2].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[-2].interm.intermTypedNode)->getNominalSize()));
            } else {
                ConstantUnion *unionArray = new ConstantUnion[1];
                unionArray->setIConst(fields.col * (yyvsp[-2].interm.intermTypedNode)->getNominalSize() + fields.row);
                TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[0]));
                (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[-2].interm.intermTypedNode), index, (yylsp[-1]));
                (yyval.interm.intermTypedNode)->setType(TType((yyvsp[-2].interm.intermTypedNode)->getBasicType(), (yyvsp[-2].interm.intermTypedNode)->getPrecision()));
            }
        } else if ((yyvsp[-2].interm.intermTypedNode)->getBasicType() == EbtStruct) {
            bool fieldFound = false;
            const TFieldList& fields = (yyvsp[-2].interm.intermTypedNode)->getType().getStruct()->fields();
            unsigned int i;
            for (i = 0; i < fields.size(); ++i) {
                if (fields[i]->name() == *(yyvsp[0].lex).string) {
                    fieldFound = true;
                    break;
                }
            }
            if (fieldFound) {
                if ((yyvsp[-2].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
                    (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[0].lex).string, (yyvsp[-2].interm.intermTypedNode), (yylsp[-1]));
                    if ((yyval.interm.intermTypedNode) == 0) {
                        context->recover();
                        (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode);
                    }
                    else {
                        (yyval.interm.intermTypedNode)->setType(*fields[i]->type());
                        // change the qualifier of the return type, not of the structure field
                        // as the structure definition is shared between various structures.
                        (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
                    }
                } else {
                    ConstantUnion *unionArray = new ConstantUnion[1];
                    unionArray->setIConst(i);
                    TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *fields[i]->type(), (yylsp[0]));
                    (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[-2].interm.intermTypedNode), index, (yylsp[-1]));
                    (yyval.interm.intermTypedNode)->setType(*fields[i]->type());
                }
            } else {
                context->error((yylsp[-1]), " no such field in structure", (yyvsp[0].lex).string->c_str());
                context->recover();
                (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode);
            }
        } else {
            context->error((yylsp[-1]), " field selection requires structure, vector, or matrix on left hand side", (yyvsp[0].lex).string->c_str());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode);
        }
        // don't delete $3.string, it's from the pool
    }

    break;

  case 14:

    {
        if (context->lValueErrorCheck((yylsp[0]), "++", (yyvsp[-1].interm.intermTypedNode)))
            context->recover();
        (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[-1].interm.intermTypedNode), (yylsp[0]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->unaryOpError((yylsp[0]), "++", (yyvsp[-1].interm.intermTypedNode)->getCompleteString());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode);
        }
    }

    break;

  case 15:

    {
        if (context->lValueErrorCheck((yylsp[0]), "--", (yyvsp[-1].interm.intermTypedNode)))
            context->recover();
        (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[-1].interm.intermTypedNode), (yylsp[0]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->unaryOpError((yylsp[0]), "--", (yyvsp[-1].interm.intermTypedNode)->getCompleteString());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode);
        }
    }

    break;

  case 16:

    {
        if (context->integerErrorCheck((yyvsp[0].interm.intermTypedNode), "[]"))
            context->recover();
        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
    }

    break;

  case 17:

    {
        TFunction* fnCall = (yyvsp[0].interm).function;
        TOperator op = fnCall->getBuiltInOp();

        if (op != EOpNull)
        {
            //
            // Then this should be a constructor.
            // Don't go through the symbol table for constructors.
            // Their parameters will be verified algorithmically.
            //
            TType type(EbtVoid, EbpUndefined);  // use this to get the type back
            if (context->constructorErrorCheck((yylsp[0]), (yyvsp[0].interm).intermNode, *fnCall, op, &type)) {
                (yyval.interm.intermTypedNode) = 0;
            } else {
                //
                // It's a constructor, of type 'type'.
                //
                (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[0].interm).intermNode, &type, op, fnCall, (yylsp[0]));
            }

            if ((yyval.interm.intermTypedNode) == 0) {
                context->recover();
                (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yylsp[0]));
            }
            (yyval.interm.intermTypedNode)->setType(type);
        } else {
            //
            // Not a constructor.  Find it in the symbol table.
            //
            const TFunction* fnCandidate;
            bool builtIn;
            fnCandidate = context->findFunction((yylsp[0]), fnCall, &builtIn);
            if (fnCandidate) {
                //
                // A declared function.
                //
                if (builtIn && !fnCandidate->getExtension().empty() &&
                    context->extensionErrorCheck((yylsp[0]), fnCandidate->getExtension())) {
                    context->recover();
                }
                op = fnCandidate->getBuiltInOp();
                if (builtIn && op != EOpNull) {
                    //
                    // A function call mapped to a built-in operation.
                    //
                    if (fnCandidate->getParamCount() == 1) {
                        //
                        // Treat it like a built-in unary operator.
                        //
                        (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[0].interm).intermNode, (yylsp[0]), context->symbolTable);
                        if ((yyval.interm.intermTypedNode) == 0)  {
                            std::stringstream extraInfoStream;
                            extraInfoStream << "built in unary operator function.  Type: " << static_cast<TIntermTyped*>((yyvsp[0].interm).intermNode)->getCompleteString();
                            std::string extraInfo = extraInfoStream.str();
                            context->error((yyvsp[0].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
                            YYERROR;
                        }
                    } else {
                        (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[0].interm).intermAggregate, op, (yylsp[0]));
                    }
                } else {
                    // This is a real function call

                    (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[0].interm).intermAggregate, EOpFunctionCall, (yylsp[0]));
                    (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());

                    // this is how we know whether the given function is a builtIn function or a user defined function
                    // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
                    // if builtIn == true, it's definitely a builtIn function with EOpNull
                    if (!builtIn)
                        (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
                    (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());

                    TQualifier qual;
                    for (size_t i = 0; i < fnCandidate->getParamCount(); ++i) {
                        qual = fnCandidate->getParam(i).type->getQualifier();
                        if (qual == EvqOut || qual == EvqInOut) {
                            if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
                                context->error((yyvsp[0].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error");
                                context->recover();
                            }
                        }
                    }
                }
                (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
            } else {
                // error message was put out by PaFindFunction()
                // Put on a dummy node for error recovery
                ConstantUnion *unionArray = new ConstantUnion[1];
                unionArray->setFConst(0.0f);
                (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[0]));
                context->recover();
            }
        }
        delete fnCall;
    }

    break;

  case 18:

    {
        (yyval.interm) = (yyvsp[0].interm);
    }

    break;

  case 19:

    {
        context->error((yylsp[0]), "methods are not supported", "");
        context->recover();
        (yyval.interm) = (yyvsp[0].interm);
    }

    break;

  case 20:

    {
        (yyval.interm) = (yyvsp[-1].interm);
    }

    break;

  case 21:

    {
        (yyval.interm) = (yyvsp[-1].interm);
    }

    break;

  case 22:

    {
        (yyval.interm).function = (yyvsp[-1].interm.function);
        (yyval.interm).intermNode = 0;
    }

    break;

  case 23:

    {
        (yyval.interm).function = (yyvsp[0].interm.function);
        (yyval.interm).intermNode = 0;
    }

    break;

  case 24:

    {
        TParameter param = { 0, new TType((yyvsp[0].interm.intermTypedNode)->getType()) };
        (yyvsp[-1].interm.function)->addParameter(param);
        (yyval.interm).function = (yyvsp[-1].interm.function);
        (yyval.interm).intermNode = (yyvsp[0].interm.intermTypedNode);
    }

    break;

  case 25:

    {
        TParameter param = { 0, new TType((yyvsp[0].interm.intermTypedNode)->getType()) };
        (yyvsp[-2].interm).function->addParameter(param);
        (yyval.interm).function = (yyvsp[-2].interm).function;
        (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[-2].interm).intermNode, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
    }

    break;

  case 26:

    {
        (yyval.interm.function) = (yyvsp[-1].interm.function);
    }

    break;

  case 27:

    {
        //
        // Constructor
        //
        TOperator op = EOpNull;
        if ((yyvsp[0].interm.type).userDef) {
            op = EOpConstructStruct;
        } else {
            switch ((yyvsp[0].interm.type).type) {
            case EbtFloat:
                if ((yyvsp[0].interm.type).matrix) {
                    switch((yyvsp[0].interm.type).size) {
                    case 2: op = EOpConstructMat2;  break;
                    case 3: op = EOpConstructMat3;  break;
                    case 4: op = EOpConstructMat4;  break;
                    }
                } else {
                    switch((yyvsp[0].interm.type).size) {
                    case 1: op = EOpConstructFloat; break;
                    case 2: op = EOpConstructVec2;  break;
                    case 3: op = EOpConstructVec3;  break;
                    case 4: op = EOpConstructVec4;  break;
                    }
                }
                break;
            case EbtInt:
                switch((yyvsp[0].interm.type).size) {
                case 1: op = EOpConstructInt;   break;
                case 2: op = EOpConstructIVec2; break;
                case 3: op = EOpConstructIVec3; break;
                case 4: op = EOpConstructIVec4; break;
                }
                break;
            case EbtBool:
                switch((yyvsp[0].interm.type).size) {
                case 1: op = EOpConstructBool;  break;
                case 2: op = EOpConstructBVec2; break;
                case 3: op = EOpConstructBVec3; break;
                case 4: op = EOpConstructBVec4; break;
                }
                break;
            default: break;
            }
            if (op == EOpNull) {
                context->error((yylsp[0]), "cannot construct this type", getBasicString((yyvsp[0].interm.type).type));
                context->recover();
                (yyvsp[0].interm.type).type = EbtFloat;
                op = EOpConstructFloat;
            }
        }
        TString tempString;
        TType type((yyvsp[0].interm.type));
        TFunction *function = new TFunction(&tempString, type, op);
        (yyval.interm.function) = function;
    }

    break;

  case 28:

    {
        if (context->reservedErrorCheck((yylsp[0]), *(yyvsp[0].lex).string))
            context->recover();
        TType type(EbtVoid, EbpUndefined);
        TFunction *function = new TFunction((yyvsp[0].lex).string, type);
        (yyval.interm.function) = function;
    }

    break;

  case 29:

    {
        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
    }

    break;

  case 30:

    {
        if (context->lValueErrorCheck((yylsp[-1]), "++", (yyvsp[0].interm.intermTypedNode)))
            context->recover();
        (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->unaryOpError((yylsp[-1]), "++", (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
        }
    }

    break;

  case 31:

    {
        if (context->lValueErrorCheck((yylsp[-1]), "--", (yyvsp[0].interm.intermTypedNode)))
            context->recover();
        (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->unaryOpError((yylsp[-1]), "--", (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
        }
    }

    break;

  case 32:

    {
        if ((yyvsp[-1].interm).op != EOpNull) {
            (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[-1].interm).op, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
            if ((yyval.interm.intermTypedNode) == 0) {
                const char* errorOp = "";
                switch((yyvsp[-1].interm).op) {
                case EOpNegative:   errorOp = "-"; break;
                case EOpLogicalNot: errorOp = "!"; break;
                default: break;
                }
                context->unaryOpError((yylsp[-1]), errorOp, (yyvsp[0].interm.intermTypedNode)->getCompleteString());
                context->recover();
                (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
            }
        } else
            (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
    }

    break;

  case 33:

    { (yyval.interm).op = EOpNull; }

    break;

  case 34:

    { (yyval.interm).op = EOpNegative; }

    break;

  case 35:

    { (yyval.interm).op = EOpLogicalNot; }

    break;

  case 36:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 37:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), "*", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode);
        }
    }

    break;

  case 38:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), "/", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode);
        }
    }

    break;

  case 39:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 40:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), "+", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode);
        }
    }

    break;

  case 41:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), "-", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode);
        }
    }

    break;

  case 42:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 43:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 44:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), "<", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            ConstantUnion *unionArray = new ConstantUnion[1];
            unionArray->setBConst(false);
            (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[-1]));
        }
    }

    break;

  case 45:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), ">", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            ConstantUnion *unionArray = new ConstantUnion[1];
            unionArray->setBConst(false);
            (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[-1]));
        }
    }

    break;

  case 46:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), "<=", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            ConstantUnion *unionArray = new ConstantUnion[1];
            unionArray->setBConst(false);
            (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[-1]));
        }
    }

    break;

  case 47:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), ">=", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            ConstantUnion *unionArray = new ConstantUnion[1];
            unionArray->setBConst(false);
            (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[-1]));
        }
    }

    break;

  case 48:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 49:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), "==", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            ConstantUnion *unionArray = new ConstantUnion[1];
            unionArray->setBConst(false);
            (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[-1]));
        }
    }

    break;

  case 50:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), "!=", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            ConstantUnion *unionArray = new ConstantUnion[1];
            unionArray->setBConst(false);
            (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[-1]));
        }
    }

    break;

  case 51:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 52:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 53:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 54:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 55:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), "&&", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            ConstantUnion *unionArray = new ConstantUnion[1];
            unionArray->setBConst(false);
            (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[-1]));
        }
    }

    break;

  case 56:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 57:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), "^^", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            ConstantUnion *unionArray = new ConstantUnion[1];
            unionArray->setBConst(false);
            (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[-1]));
        }
    }

    break;

  case 58:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 59:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]), context->symbolTable);
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), "||", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            ConstantUnion *unionArray = new ConstantUnion[1];
            unionArray->setBConst(false);
            (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[-1]));
        }
    }

    break;

  case 60:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 61:

    {
       if (context->boolErrorCheck((yylsp[-3]), (yyvsp[-4].interm.intermTypedNode)))
            context->recover();

        (yyval.interm.intermTypedNode) = context->intermediate.addSelection((yyvsp[-4].interm.intermTypedNode), (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-3]));
        if ((yyvsp[-2].interm.intermTypedNode)->getType() != (yyvsp[0].interm.intermTypedNode)->getType())
            (yyval.interm.intermTypedNode) = 0;

        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-3]), ":", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
        }
    }

    break;

  case 62:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 63:

    {
        if (context->lValueErrorCheck((yylsp[-1]), "assign", (yyvsp[-2].interm.intermTypedNode)))
            context->recover();
        (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[-1].interm).op, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
        if ((yyval.interm.intermTypedNode) == 0) {
            context->assignError((yylsp[-1]), "assign", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode);
        }
    }

    break;

  case 64:

    { (yyval.interm).op = EOpAssign; }

    break;

  case 65:

    { (yyval.interm).op = EOpMulAssign; }

    break;

  case 66:

    { (yyval.interm).op = EOpDivAssign; }

    break;

  case 67:

    { (yyval.interm).op = EOpAddAssign; }

    break;

  case 68:

    { (yyval.interm).op = EOpSubAssign; }

    break;

  case 69:

    {
        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
    }

    break;

  case 70:

    {
        (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
        if ((yyval.interm.intermTypedNode) == 0) {
            context->binaryOpError((yylsp[-1]), ",", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
            context->recover();
            (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
        }
    }

    break;

  case 71:

    {
        if (context->constErrorCheck((yyvsp[0].interm.intermTypedNode)))
            context->recover();
        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
    }

    break;

  case 72:

    {
        TFunction &function = *((yyvsp[-1].interm).function);
        
        TIntermAggregate *prototype = new TIntermAggregate;
        prototype->setType(function.getReturnType());
        prototype->setName(function.getName());
        
        for (size_t i = 0; i < function.getParamCount(); i++)
        {
            const TParameter &param = function.getParam(i);
            if (param.name != 0)
            {
                TVariable variable(param.name, *param.type);
                
                prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), (yylsp[-1])), (yylsp[-1]));
            }
            else
            {
                prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yylsp[-1])), (yylsp[-1]));
            }
        }
        
        prototype->setOp(EOpPrototype);
        (yyval.interm.intermNode) = prototype;

        context->symbolTable.pop();
    }

    break;

  case 73:

    {
        if ((yyvsp[-1].interm).intermAggregate)
            (yyvsp[-1].interm).intermAggregate->setOp(EOpDeclaration);
        (yyval.interm.intermNode) = (yyvsp[-1].interm).intermAggregate;
    }

    break;

  case 74:

    {
        if (((yyvsp[-2].interm.precision) == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
            context->error((yylsp[-3]), "precision is not supported in fragment shader", "highp");
            context->recover();
        }
        if (!context->symbolTable.setDefaultPrecision( (yyvsp[-1].interm.type), (yyvsp[-2].interm.precision) )) {
            context->error((yylsp[-3]), "illegal type argument for default precision qualifier", getBasicString((yyvsp[-1].interm.type).type));
            context->recover();
        }
        (yyval.interm.intermNode) = 0;
    }

    break;

  case 75:

    {
        //
        // Multiple declarations of the same function are allowed.
        //
        // If this is a definition, the definition production code will check for redefinitions
        // (we don't know at this point if it's a definition or not).
        //
        // Redeclarations are allowed.  But, return types and parameter qualifiers must match.
        //
        TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[-1].interm.function)->getMangledName()));
        if (prevDec) {
            if (prevDec->getReturnType() != (yyvsp[-1].interm.function)->getReturnType()) {
                context->error((yylsp[0]), "overloaded functions must have the same return type", (yyvsp[-1].interm.function)->getReturnType().getBasicString());
                context->recover();
            }
            for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
                if (prevDec->getParam(i).type->getQualifier() != (yyvsp[-1].interm.function)->getParam(i).type->getQualifier()) {
                    context->error((yylsp[0]), "overloaded functions must have the same parameter qualifiers", (yyvsp[-1].interm.function)->getParam(i).type->getQualifierString());
                    context->recover();
                }
            }
        }

        //
        // Check for previously declared variables using the same name.
        //
        TSymbol *prevSym = context->symbolTable.find((yyvsp[-1].interm.function)->getName());
        if (prevSym)
        {
            if (!prevSym->isFunction())
            {
                context->error((yylsp[0]), "redefinition", (yyvsp[-1].interm.function)->getName().c_str(), "function");
                context->recover();
            }
        }
        else
        {
            // Insert the unmangled name to detect potential future redefinition as a variable.
            context->symbolTable.getOuterLevel()->insert((yyvsp[-1].interm.function)->getName(), *(yyvsp[-1].interm.function));
        }

        //
        // If this is a redeclaration, it could also be a definition,
        // in which case, we want to use the variable names from this one, and not the one that's
        // being redeclared.  So, pass back up this declaration, not the one in the symbol table.
        //
        (yyval.interm).function = (yyvsp[-1].interm.function);

        // We're at the inner scope level of the function's arguments and body statement.
        // Add the function prototype to the surrounding scope instead.
        context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
    }

    break;

  case 76:

    {
        (yyval.interm.function) = (yyvsp[0].interm.function);
    }

    break;

  case 77:

    {
        (yyval.interm.function) = (yyvsp[0].interm.function);
    }

    break;

  case 78:

    {
        // Add the parameter
        (yyval.interm.function) = (yyvsp[-1].interm.function);
        if ((yyvsp[0].interm).param.type->getBasicType() != EbtVoid)
            (yyvsp[-1].interm.function)->addParameter((yyvsp[0].interm).param);
        else
            delete (yyvsp[0].interm).param.type;
    }

    break;

  case 79:

    {
        //
        // Only first parameter of one-parameter functions can be void
        // The check for named parameters not being void is done in parameter_declarator
        //
        if ((yyvsp[0].interm).param.type->getBasicType() == EbtVoid) {
            //
            // This parameter > first is void
            //
            context->error((yylsp[-1]), "cannot be an argument type except for '(void)'", "void");
            context->recover();
            delete (yyvsp[0].interm).param.type;
        } else {
            // Add the parameter
            (yyval.interm.function) = (yyvsp[-2].interm.function);
            (yyvsp[-2].interm.function)->addParameter((yyvsp[0].interm).param);
        }
    }

    break;

  case 80:

    {
        if ((yyvsp[-2].interm.type).qualifier != EvqGlobal && (yyvsp[-2].interm.type).qualifier != EvqTemporary) {
            context->error((yylsp[-1]), "no qualifiers allowed for function return", getQualifierString((yyvsp[-2].interm.type).qualifier));
            context->recover();
        }
        // make sure a sampler is not involved as well...
        if (context->structQualifierErrorCheck((yylsp[-1]), (yyvsp[-2].interm.type)))
            context->recover();

        // Add the function as a prototype after parsing it (we do not support recursion)
        TFunction *function;
        TType type((yyvsp[-2].interm.type));
        function = new TFunction((yyvsp[-1].lex).string, type);
        (yyval.interm.function) = function;
        
        context->symbolTable.push();
    }

    break;

  case 81:

    {
        if ((yyvsp[-1].interm.type).type == EbtVoid) {
            context->error((yylsp[0]), "illegal use of type 'void'", (yyvsp[0].lex).string->c_str());
            context->recover();
        }
        if (context->reservedErrorCheck((yylsp[0]), *(yyvsp[0].lex).string))
            context->recover();
        TParameter param = {(yyvsp[0].lex).string, new TType((yyvsp[-1].interm.type))};
        (yyval.interm).param = param;
    }

    break;

  case 82:

    {
        // Check that we can make an array out of this type
        if (context->arrayTypeErrorCheck((yylsp[-2]), (yyvsp[-4].interm.type)))
            context->recover();

        if (context->reservedErrorCheck((yylsp[-3]), *(yyvsp[-3].lex).string))
            context->recover();

        int size;
        if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
            context->recover();
        (yyvsp[-4].interm.type).setArray(true, size);

        TType* type = new TType((yyvsp[-4].interm.type));
        TParameter param = { (yyvsp[-3].lex).string, type };
        (yyval.interm).param = param;
    }

    break;

  case 83:

    {
        (yyval.interm) = (yyvsp[0].interm);
        if (context->paramErrorCheck((yylsp[0]), (yyvsp[-2].interm.type).qualifier, (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
            context->recover();
    }

    break;

  case 84:

    {
        (yyval.interm) = (yyvsp[0].interm);
        if (context->parameterSamplerErrorCheck((yylsp[0]), (yyvsp[-1].interm.qualifier), *(yyvsp[0].interm).param.type))
            context->recover();
        if (context->paramErrorCheck((yylsp[0]), EvqTemporary, (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
            context->recover();
    }

    break;

  case 85:

    {
        (yyval.interm) = (yyvsp[0].interm);
        if (context->paramErrorCheck((yylsp[0]), (yyvsp[-2].interm.type).qualifier, (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
            context->recover();
    }

    break;

  case 86:

    {
        (yyval.interm) = (yyvsp[0].interm);
        if (context->parameterSamplerErrorCheck((yylsp[0]), (yyvsp[-1].interm.qualifier), *(yyvsp[0].interm).param.type))
            context->recover();
        if (context->paramErrorCheck((yylsp[0]), EvqTemporary, (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
            context->recover();
    }

    break;

  case 87:

    {
        (yyval.interm.qualifier) = EvqIn;
    }

    break;

  case 88:

    {
        (yyval.interm.qualifier) = EvqIn;
    }

    break;

  case 89:

    {
        (yyval.interm.qualifier) = EvqOut;
    }

    break;

  case 90:

    {
        (yyval.interm.qualifier) = EvqInOut;
    }

    break;

  case 91:

    {
        TParameter param = { 0, new TType((yyvsp[0].interm.type)) };
        (yyval.interm).param = param;
    }

    break;

  case 92:

    {
        (yyval.interm) = (yyvsp[0].interm);
    }

    break;

  case 93:

    {
        if ((yyvsp[-2].interm).type.type == EbtInvariant && !(yyvsp[0].lex).symbol)
        {
            context->error((yylsp[0]), "undeclared identifier declared as invariant", (yyvsp[0].lex).string->c_str());
            context->recover();
        }

        TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[0].lex).string, TType((yyvsp[-2].interm).type), (yylsp[0]));
        (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[-2].interm).intermNode, symbol, (yylsp[0]));
        
        if (context->structQualifierErrorCheck((yylsp[0]), (yyval.interm).type))
            context->recover();

        if (context->nonInitConstErrorCheck((yylsp[0]), *(yyvsp[0].lex).string, (yyval.interm).type, false))
            context->recover();

        TVariable* variable = 0;
        if (context->nonInitErrorCheck((yylsp[0]), *(yyvsp[0].lex).string, (yyval.interm).type, variable))
            context->recover();
        if (symbol && variable)
            symbol->setId(variable->getUniqueId());
    }

    break;

  case 94:

    {
        if (context->structQualifierErrorCheck((yylsp[-2]), (yyvsp[-4].interm).type))
            context->recover();

        if (context->nonInitConstErrorCheck((yylsp[-2]), *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, true))
            context->recover();

        (yyval.interm) = (yyvsp[-4].interm);

        if (context->arrayTypeErrorCheck((yylsp[-1]), (yyvsp[-4].interm).type) || context->arrayQualifierErrorCheck((yylsp[-1]), (yyvsp[-4].interm).type))
            context->recover();
        else {
            (yyvsp[-4].interm).type.setArray(true);
            TVariable* variable;
            if (context->arrayErrorCheck((yylsp[-1]), *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, variable))
                context->recover();
        }
    }

    break;

  case 95:

    {
        if (context->structQualifierErrorCheck((yylsp[-3]), (yyvsp[-5].interm).type))
            context->recover();

        if (context->nonInitConstErrorCheck((yylsp[-3]), *(yyvsp[-3].lex).string, (yyvsp[-5].interm).type, true))
            context->recover();

        (yyval.interm) = (yyvsp[-5].interm);

        if (context->arrayTypeErrorCheck((yylsp[-2]), (yyvsp[-5].interm).type) || context->arrayQualifierErrorCheck((yylsp[-2]), (yyvsp[-5].interm).type))
            context->recover();
        else {
            int size;
            if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
                context->recover();
            (yyvsp[-5].interm).type.setArray(true, size);
            TVariable* variable = 0;
            if (context->arrayErrorCheck((yylsp[-2]), *(yyvsp[-3].lex).string, (yyvsp[-5].interm).type, variable))
                context->recover();
            TType type = TType((yyvsp[-5].interm).type);
            type.setArraySize(size);
            (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[-5].interm).intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *(yyvsp[-3].lex).string, type, (yylsp[-3])), (yylsp[-3]));
        }
    }

    break;

  case 96:

    {
        if (context->structQualifierErrorCheck((yylsp[-2]), (yyvsp[-4].interm).type))
            context->recover();

        (yyval.interm) = (yyvsp[-4].interm);

        TIntermNode* intermNode;
        if (!context->executeInitializer((yylsp[-2]), *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, (yyvsp[0].interm.intermTypedNode), intermNode)) {
            //
            // build the intermediate representation
            //
            if (intermNode)
        (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[-4].interm).intermNode, intermNode, (yylsp[-1]));
            else
                (yyval.interm).intermAggregate = (yyvsp[-4].interm).intermAggregate;
        } else {
            context->recover();
            (yyval.interm).intermAggregate = 0;
        }
    }

    break;

  case 97:

    {
        (yyval.interm).type = (yyvsp[0].interm.type);
        (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType((yyvsp[0].interm.type)), (yylsp[0])), (yylsp[0]));
    }

    break;

  case 98:

    {
        TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[0].lex).string, TType((yyvsp[-1].interm.type)), (yylsp[0]));
        (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[0]));
        
        if (context->structQualifierErrorCheck((yylsp[0]), (yyval.interm).type))
            context->recover();

        if (context->nonInitConstErrorCheck((yylsp[0]), *(yyvsp[0].lex).string, (yyval.interm).type, false))
            context->recover();
            
            (yyval.interm).type = (yyvsp[-1].interm.type);

        TVariable* variable = 0;
        if (context->nonInitErrorCheck((yylsp[0]), *(yyvsp[0].lex).string, (yyval.interm).type, variable))
            context->recover();
        if (variable && symbol)
            symbol->setId(variable->getUniqueId());
    }

    break;

  case 99:

    {
        context->error((yylsp[-2]), "unsized array declarations not supported", (yyvsp[-2].lex).string->c_str());
        context->recover();

        TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[-2].lex).string, TType((yyvsp[-3].interm.type)), (yylsp[-2]));
        (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[-2]));
        (yyval.interm).type = (yyvsp[-3].interm.type);
    }

    break;

  case 100:

    {
        TType type = TType((yyvsp[-4].interm.type));
        int size;
        if (context->arraySizeErrorCheck((yylsp[-3]), (yyvsp[-1].interm.intermTypedNode), size))
            context->recover();
        type.setArraySize(size);
        TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[-3].lex).string, type, (yylsp[-3]));
        (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[-3]));
        
        if (context->structQualifierErrorCheck((yylsp[-3]), (yyvsp[-4].interm.type)))
            context->recover();

        if (context->nonInitConstErrorCheck((yylsp[-3]), *(yyvsp[-3].lex).string, (yyvsp[-4].interm.type), true))
            context->recover();

        (yyval.interm).type = (yyvsp[-4].interm.type);

        if (context->arrayTypeErrorCheck((yylsp[-2]), (yyvsp[-4].interm.type)) || context->arrayQualifierErrorCheck((yylsp[-2]), (yyvsp[-4].interm.type)))
            context->recover();
        else {
            int size;
            if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
                context->recover();

            (yyvsp[-4].interm.type).setArray(true, size);
            TVariable* variable = 0;
            if (context->arrayErrorCheck((yylsp[-2]), *(yyvsp[-3].lex).string, (yyvsp[-4].interm.type), variable))
                context->recover();
            if (variable && symbol)
                symbol->setId(variable->getUniqueId());
        }
    }

    break;

  case 101:

    {
        if (context->structQualifierErrorCheck((yylsp[-2]), (yyvsp[-3].interm.type)))
            context->recover();

        (yyval.interm).type = (yyvsp[-3].interm.type);

        TIntermNode* intermNode;
        if (!context->executeInitializer((yylsp[-2]), *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), (yyvsp[0].interm.intermTypedNode), intermNode)) {
        //
        // Build intermediate representation
        //
            if(intermNode)
                (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yylsp[-1]));
            else
                (yyval.interm).intermAggregate = 0;
        } else {
            context->recover();
            (yyval.interm).intermAggregate = 0;
        }
    }

    break;

  case 102:

    {
        VERTEX_ONLY("invariant declaration", (yylsp[-1]));
        if (context->globalErrorCheck((yylsp[-1]), context->symbolTable.atGlobalLevel(), "invariant varying"))
            context->recover();
        (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yylsp[0]));
        if (!(yyvsp[0].lex).symbol)
        {
            context->error((yylsp[0]), "undeclared identifier declared as invariant", (yyvsp[0].lex).string->c_str());
            context->recover();
            
            (yyval.interm).intermAggregate = 0;
        }
        else
        {
            TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[0].lex).string, TType((yyval.interm).type), (yylsp[0]));
            (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[0]));
        }
    }

    break;

  case 103:

    {
        (yyval.interm.type) = (yyvsp[0].interm.type);

        if ((yyvsp[0].interm.type).array) {
            context->error((yylsp[0]), "not supported", "first-class array");
            context->recover();
            (yyvsp[0].interm.type).setArray(false);
        }
    }

    break;

  case 104:

    {
        if ((yyvsp[0].interm.type).array) {
            context->error((yylsp[0]), "not supported", "first-class array");
            context->recover();
            (yyvsp[0].interm.type).setArray(false);
        }

        if ((yyvsp[-1].interm.type).qualifier == EvqAttribute &&
            ((yyvsp[0].interm.type).type == EbtBool || (yyvsp[0].interm.type).type == EbtInt)) {
            context->error((yylsp[0]), "cannot be bool or int", getQualifierString((yyvsp[-1].interm.type).qualifier));
            context->recover();
        }
        if (((yyvsp[-1].interm.type).qualifier == EvqVaryingIn || (yyvsp[-1].interm.type).qualifier == EvqVaryingOut) &&
            ((yyvsp[0].interm.type).type == EbtBool || (yyvsp[0].interm.type).type == EbtInt)) {
            context->error((yylsp[0]), "cannot be bool or int", getQualifierString((yyvsp[-1].interm.type).qualifier));
            context->recover();
        }
        (yyval.interm.type) = (yyvsp[0].interm.type);
        (yyval.interm.type).qualifier = (yyvsp[-1].interm.type).qualifier;
    }

    break;

  case 105:

    {
        (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yylsp[0]));
    }

    break;

  case 106:

    {
        VERTEX_ONLY("attribute", (yylsp[0]));
        if (context->globalErrorCheck((yylsp[0]), context->symbolTable.atGlobalLevel(), "attribute"))
            context->recover();
        (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yylsp[0]));
    }

    break;

  case 107:

    {
        if (context->globalErrorCheck((yylsp[0]), context->symbolTable.atGlobalLevel(), "varying"))
            context->recover();
        if (context->shaderType == SH_VERTEX_SHADER)
            (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yylsp[0]));
        else
            (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yylsp[0]));
    }

    break;

  case 108:

    {
        if (context->globalErrorCheck((yylsp[-1]), context->symbolTable.atGlobalLevel(), "invariant varying"))
            context->recover();
        if (context->shaderType == SH_VERTEX_SHADER)
            (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yylsp[-1]));
        else
            (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yylsp[-1]));
    }

    break;

  case 109:

    {
        if (context->globalErrorCheck((yylsp[0]), context->symbolTable.atGlobalLevel(), "uniform"))
            context->recover();
        (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yylsp[0]));
    }

    break;

  case 110:

    {
        (yyval.interm.type) = (yyvsp[0].interm.type);

        if ((yyval.interm.type).precision == EbpUndefined) {
            (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[0].interm.type).type);
            if (context->precisionErrorCheck((yylsp[0]), (yyval.interm.type).precision, (yyvsp[0].interm.type).type)) {
                context->recover();
            }
        }
    }

    break;

  case 111:

    {
        (yyval.interm.type) = (yyvsp[0].interm.type);
        (yyval.interm.type).precision = (yyvsp[-1].interm.precision);
    }

    break;

  case 112:

    {
        (yyval.interm.precision) = EbpHigh;
    }

    break;

  case 113:

    {
        (yyval.interm.precision) = EbpMedium;
    }

    break;

  case 114:

    {
        (yyval.interm.precision) = EbpLow;
    }

    break;

  case 115:

    {
        (yyval.interm.type) = (yyvsp[0].interm.type);
    }

    break;

  case 116:

    {
        (yyval.interm.type) = (yyvsp[-3].interm.type);

        if (context->arrayTypeErrorCheck((yylsp[-2]), (yyvsp[-3].interm.type)))
            context->recover();
        else {
            int size;
            if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
                context->recover();
            (yyval.interm.type).setArray(true, size);
        }
    }

    break;

  case 117:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[0]));
    }

    break;

  case 118:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
    }

    break;

  case 119:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
    }

    break;

  case 120:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
    }

    break;

  case 121:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(2);
    }

    break;

  case 122:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(3);
    }

    break;

  case 123:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(4);
    }

    break;

  case 124:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(2);
    }

    break;

  case 125:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(3);
    }

    break;

  case 126:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(4);
    }

    break;

  case 127:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(2);
    }

    break;

  case 128:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(3);
    }

    break;

  case 129:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(4);
    }

    break;

  case 130:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(2, true);
    }

    break;

  case 131:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(3, true);
    }

    break;

  case 132:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
        (yyval.interm.type).setAggregate(4, true);
    }

    break;

  case 133:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtSampler2D, qual, (yylsp[0]));
    }

    break;

  case 134:

    {
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yylsp[0]));
    }

    break;

  case 135:

    {
        if (!context->supportsExtension("GL_OES_EGL_image_external")) {
            context->error((yylsp[0]), "unsupported type", "samplerExternalOES");
            context->recover();
        }
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yylsp[0]));
    }

    break;

  case 136:

    {
        if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
            context->error((yylsp[0]), "unsupported type", "sampler2DRect");
            context->recover();
        }
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yylsp[0]));
    }

    break;

  case 137:

    {
        (yyval.interm.type) = (yyvsp[0].interm.type);
        (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
    }

    break;

  case 138:

    {
        //
        // This is for user defined type names.  The lexical phase looked up the
        // type.
        //
        TType& structure = static_cast<TVariable*>((yyvsp[0].lex).symbol)->getType();
        TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
        (yyval.interm.type).setBasic(EbtStruct, qual, (yylsp[0]));
        (yyval.interm.type).userDef = &structure;
    }

    break;

  case 139:

    { if (context->enterStructDeclaration((yylsp[-1]), *(yyvsp[-1].lex).string)) context->recover(); }

    break;

  case 140:

    {
        if (context->reservedErrorCheck((yylsp[-4]), *(yyvsp[-4].lex).string))
            context->recover();

        TType* structure = new TType(new TStructure((yyvsp[-4].lex).string, (yyvsp[-1].interm.fieldList)));
        TVariable* userTypeDef = new TVariable((yyvsp[-4].lex).string, *structure, true);
        if (! context->symbolTable.insert(*userTypeDef)) {
            context->error((yylsp[-4]), "redefinition", (yyvsp[-4].lex).string->c_str(), "struct");
            context->recover();
        }
        (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yylsp[-5]));
        (yyval.interm.type).userDef = structure;
        context->exitStructDeclaration();
    }

    break;

  case 141:

    { if (context->enterStructDeclaration((yylsp[0]), *(yyvsp[0].lex).string)) context->recover(); }

    break;

  case 142:

    {
        TType* structure = new TType(new TStructure(NewPoolTString(""), (yyvsp[-1].interm.fieldList)));
        (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yylsp[-4]));
        (yyval.interm.type).userDef = structure;
        context->exitStructDeclaration();
    }

    break;

  case 143:

    {
        (yyval.interm.fieldList) = (yyvsp[0].interm.fieldList);
    }

    break;

  case 144:

    {
        (yyval.interm.fieldList) = (yyvsp[-1].interm.fieldList);
        for (size_t i = 0; i < (yyvsp[0].interm.fieldList)->size(); ++i) {
            TField* field = (*(yyvsp[0].interm.fieldList))[i];
            for (size_t j = 0; j < (yyval.interm.fieldList)->size(); ++j) {
                if ((*(yyval.interm.fieldList))[j]->name() == field->name()) {
                    context->error((yylsp[0]), "duplicate field name in structure:", "struct", field->name().c_str());
                    context->recover();
                }
            }
            (yyval.interm.fieldList)->push_back(field);
        }
    }

    break;

  case 145:

    {
        (yyval.interm.fieldList) = (yyvsp[-1].interm.fieldList);

        if (context->voidErrorCheck((yylsp[-2]), (*(yyvsp[-1].interm.fieldList))[0]->name(), (yyvsp[-2].interm.type))) {
            context->recover();
        }
        for (unsigned int i = 0; i < (yyval.interm.fieldList)->size(); ++i) {
            //
            // Careful not to replace already known aspects of type, like array-ness
            //
            TType* type = (*(yyval.interm.fieldList))[i]->type();
            type->setBasicType((yyvsp[-2].interm.type).type);
            type->setNominalSize((yyvsp[-2].interm.type).size);
            type->setMatrix((yyvsp[-2].interm.type).matrix);
            type->setPrecision((yyvsp[-2].interm.type).precision);

            // don't allow arrays of arrays
            if (type->isArray()) {
                if (context->arrayTypeErrorCheck((yylsp[-2]), (yyvsp[-2].interm.type)))
                    context->recover();
            }
            if ((yyvsp[-2].interm.type).array)
                type->setArraySize((yyvsp[-2].interm.type).arraySize);
            if ((yyvsp[-2].interm.type).userDef)
                type->setStruct((yyvsp[-2].interm.type).userDef->getStruct());

            if (context->structNestingErrorCheck((yylsp[-2]), *(*(yyval.interm.fieldList))[i]))
                context->recover();
        }
    }

    break;

  case 146:

    {
        (yyval.interm.fieldList) = NewPoolTFieldList();
        (yyval.interm.fieldList)->push_back((yyvsp[0].interm.field));
    }

    break;

  case 147:

    {
        (yyval.interm.fieldList)->push_back((yyvsp[0].interm.field));
    }

    break;

  case 148:

    {
        if (context->reservedErrorCheck((yylsp[0]), *(yyvsp[0].lex).string))
            context->recover();

        TType* type = new TType(EbtVoid, EbpUndefined);
        (yyval.interm.field) = new TField(type, (yyvsp[0].lex).string);
    }

    break;

  case 149:

    {
        if (context->reservedErrorCheck((yylsp[-3]), *(yyvsp[-3].lex).string))
            context->recover();

        TType* type = new TType(EbtVoid, EbpUndefined);
        int size = 0;
        if (context->arraySizeErrorCheck((yylsp[-1]), (yyvsp[-1].interm.intermTypedNode), size))
            context->recover();
        type->setArraySize(size);

        (yyval.interm.field) = new TField(type, (yyvsp[-3].lex).string);
    }

    break;

  case 150:

    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }

    break;

  case 151:

    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }

    break;

  case 152:

    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermAggregate); }

    break;

  case 153:

    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }

    break;

  case 154:

    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }

    break;

  case 155:

    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }

    break;

  case 156:

    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }

    break;

  case 157:

    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }

    break;

  case 158:

    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }

    break;

  case 159:

    { (yyval.interm.intermAggregate) = 0; }

    break;

  case 160:

    { context->symbolTable.push(); }

    break;

  case 161:

    { context->symbolTable.pop(); }

    break;

  case 162:

    {
        if ((yyvsp[-2].interm.intermAggregate) != 0) {
            (yyvsp[-2].interm.intermAggregate)->setOp(EOpSequence);
            (yyvsp[-2].interm.intermAggregate)->setLine((yyloc));
        }
        (yyval.interm.intermAggregate) = (yyvsp[-2].interm.intermAggregate);
    }

    break;

  case 163:

    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }

    break;

  case 164:

    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }

    break;

  case 165:

    { context->symbolTable.push(); }

    break;

  case 166:

    { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }

    break;

  case 167:

    { context->symbolTable.push(); }

    break;

  case 168:

    { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }

    break;

  case 169:

    {
        (yyval.interm.intermNode) = 0;
    }

    break;

  case 170:

    {
        if ((yyvsp[-1].interm.intermAggregate)) {
            (yyvsp[-1].interm.intermAggregate)->setOp(EOpSequence);
            (yyvsp[-1].interm.intermAggregate)->setLine((yyloc));
        }
        (yyval.interm.intermNode) = (yyvsp[-1].interm.intermAggregate);
    }

    break;

  case 171:

    {
        (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[0].interm.intermNode), (yyloc));
    }

    break;

  case 172:

    {
        (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[-1].interm.intermAggregate), (yyvsp[0].interm.intermNode), (yyloc));
    }

    break;

  case 173:

    { (yyval.interm.intermNode) = 0; }

    break;

  case 174:

    { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[-1].interm.intermTypedNode)); }

    break;

  case 175:

    {
        if (context->boolErrorCheck((yylsp[-4]), (yyvsp[-2].interm.intermTypedNode)))
            context->recover();
        (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.nodePair), (yylsp[-4]));
    }

    break;

  case 176:

    {
        (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode);
        (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode);
    }

    break;

  case 177:

    {
        (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode);
        (yyval.interm.nodePair).node2 = 0;
    }

    break;

  case 178:

    {
        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
        if (context->boolErrorCheck((yyvsp[0].interm.intermTypedNode)->getLine(), (yyvsp[0].interm.intermTypedNode)))
            context->recover();
    }

    break;

  case 179:

    {
        TIntermNode* intermNode;
        if (context->structQualifierErrorCheck((yylsp[-2]), (yyvsp[-3].interm.type)))
            context->recover();
        if (context->boolErrorCheck((yylsp[-2]), (yyvsp[-3].interm.type)))
            context->recover();

        if (!context->executeInitializer((yylsp[-2]), *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), (yyvsp[0].interm.intermTypedNode), intermNode))
            (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
        else {
            context->recover();
            (yyval.interm.intermTypedNode) = 0;
        }
    }

    break;

  case 180:

    { context->symbolTable.push(); ++context->loopNestingLevel; }

    break;

  case 181:

    {
        context->symbolTable.pop();
        (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[-2].interm.intermTypedNode), 0, (yyvsp[0].interm.intermNode), (yylsp[-5]));
        --context->loopNestingLevel;
    }

    break;

  case 182:

    { ++context->loopNestingLevel; }

    break;

  case 183:

    {
        if (context->boolErrorCheck((yylsp[0]), (yyvsp[-2].interm.intermTypedNode)))
            context->recover();

        (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[-2].interm.intermTypedNode), 0, (yyvsp[-5].interm.intermNode), (yylsp[-4]));
        --context->loopNestingLevel;
    }

    break;

  case 184:

    { context->symbolTable.push(); ++context->loopNestingLevel; }

    break;

  case 185:

    {
        context->symbolTable.pop();
        (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopFor, (yyvsp[-3].interm.intermNode), reinterpret_cast<TIntermTyped*>((yyvsp[-2].interm.nodePair).node1), reinterpret_cast<TIntermTyped*>((yyvsp[-2].interm.nodePair).node2), (yyvsp[0].interm.intermNode), (yylsp[-6]));
        --context->loopNestingLevel;
    }

    break;

  case 186:

    {
        (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
    }

    break;

  case 187:

    {
        (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
    }

    break;

  case 188:

    {
        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
    }

    break;

  case 189:

    {
        (yyval.interm.intermTypedNode) = 0;
    }

    break;

  case 190:

    {
        (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode);
        (yyval.interm.nodePair).node2 = 0;
    }

    break;

  case 191:

    {
        (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermTypedNode);
        (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode);
    }

    break;

  case 192:

    {
        if (context->loopNestingLevel <= 0) {
            context->error((yylsp[-1]), "continue statement only allowed in loops", "");
            context->recover();
        }
        (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yylsp[-1]));
    }

    break;

  case 193:

    {
        if (context->loopNestingLevel <= 0) {
            context->error((yylsp[-1]), "break statement only allowed in loops", "");
            context->recover();
        }
        (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yylsp[-1]));
    }

    break;

  case 194:

    {
        (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yylsp[-1]));
        if (context->currentFunctionType->getBasicType() != EbtVoid) {
            context->error((yylsp[-1]), "non-void function must return a value", "return");
            context->recover();
        }
    }

    break;

  case 195:

    {
        (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[-1].interm.intermTypedNode), (yylsp[-2]));
        context->functionReturnsValue = true;
        if (context->currentFunctionType->getBasicType() == EbtVoid) {
            context->error((yylsp[-2]), "void function cannot return a value", "return");
            context->recover();
        } else if (*(context->currentFunctionType) != (yyvsp[-1].interm.intermTypedNode)->getType()) {
            context->error((yylsp[-2]), "function return is not matching type:", "return");
            context->recover();
        }
    }

    break;

  case 196:

    {
        FRAG_ONLY("discard", (yylsp[-1]));
        (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yylsp[-1]));
    }

    break;

  case 197:

    {
        (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
        context->treeRoot = (yyval.interm.intermNode);
    }

    break;

  case 198:

    {
        (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode), (yyloc));
        context->treeRoot = (yyval.interm.intermNode);
    }

    break;

  case 199:

    {
        (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
    }

    break;

  case 200:

    {
        (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
    }

    break;

  case 201:

    {
        TFunction* function = (yyvsp[0].interm).function;
        
        const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
        
        if (builtIn)
        {
            context->error((yylsp[0]), "built-in functions cannot be redefined", function->getName().c_str());
            context->recover();
        }
        
        TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
        //
        // Note:  'prevDec' could be 'function' if this is the first time we've seen function
        // as it would have just been put in the symbol table.  Otherwise, we're looking up
        // an earlier occurance.
        //
        if (prevDec->isDefined()) {
            //
            // Then this function already has a body.
            //
            context->error((yylsp[0]), "function already has a body", function->getName().c_str());
            context->recover();
        }
        prevDec->setDefined();

        //
        // Raise error message if main function takes any parameters or return anything other than void
        //
        if (function->getName() == "main") {
            if (function->getParamCount() > 0) {
                context->error((yylsp[0]), "function cannot take any parameter(s)", function->getName().c_str());
                context->recover();
            }
            if (function->getReturnType().getBasicType() != EbtVoid) {
                context->error((yylsp[0]), "", function->getReturnType().getBasicString(), "main function cannot return a value");
                context->recover();
            }
        }

        //
        // Remember the return type for later checking for RETURN statements.
        //
        context->currentFunctionType = &(prevDec->getReturnType());
        context->functionReturnsValue = false;

        //
        // Insert parameters into the symbol table.
        // If the parameter has no name, it's not an error, just don't insert it
        // (could be used for unused args).
        //
        // Also, accumulate the list of parameters into the HIL, so lower level code
        // knows where to find parameters.
        //
        TIntermAggregate* paramNodes = new TIntermAggregate;
        for (size_t i = 0; i < function->getParamCount(); i++) {
            const TParameter& param = function->getParam(i);
            if (param.name != 0) {
                TVariable *variable = new TVariable(param.name, *param.type);
                //
                // Insert the parameters with name in the symbol table.
                //
                if (! context->symbolTable.insert(*variable)) {
                    context->error((yylsp[0]), "redefinition", variable->getName().c_str());
                    context->recover();
                    delete variable;
                }

                //
                // Add the parameter to the HIL
                //
                paramNodes = context->intermediate.growAggregate(
                                               paramNodes,
                                               context->intermediate.addSymbol(variable->getUniqueId(),
                                                                               variable->getName(),
                                                                               variable->getType(),
                                                                               (yylsp[0])),
                                               (yylsp[0]));
            } else {
                paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yylsp[0])), (yylsp[0]));
            }
        }
        context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yylsp[0]));
        (yyvsp[0].interm).intermAggregate = paramNodes;
        context->loopNestingLevel = 0;
    }

    break;

  case 202:

    {
        //?? Check that all paths return a value if return type != void ?
        //   May be best done as post process phase on intermediate code
        if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
            context->error((yylsp[-2]), "function does not return a value:", "", (yyvsp[-2].interm).function->getName().c_str());
            context->recover();
        }
        
        (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[-2].interm).intermAggregate, (yyvsp[0].interm.intermNode), (yyloc));
        context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yylsp[-2]));
        (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[-2].interm).function->getMangledName().c_str());
        (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[-2].interm).function->getReturnType());

        // store the pragma information for debug and optimize and other vendor specific
        // information. This information can be queried from the parse tree
        (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
        (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);

        context->symbolTable.pop();
    }

    break;



      default: break;
    }
  /* User semantic actions sometimes alter yychar, and that requires
     that yytoken be updated with the new translation.  We take the
     approach of translating immediately before every use of yytoken.
     One alternative is translating here after every semantic action,
     but that translation would be missed if the semantic action invokes
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
     incorrect destructor might then be invoked immediately.  In the
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
     to an incorrect destructor call or verbose syntax error message
     before the lookahead is translated.  */
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);

  *++yyvsp = yyval;
  *++yylsp = yyloc;

  /* Now 'shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*--------------------------------------.
| yyerrlab -- here on detecting error.  |
`--------------------------------------*/
yyerrlab:
  /* Make sure we have latest lookahead translation.  See comments at
     user semantic actions for why this is necessary.  */
  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);

  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if ! YYERROR_VERBOSE
      yyerror (&yylloc, context, YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
                                        yyssp, yytoken)
      {
        char const *yymsgp = YY_("syntax error");
        int yysyntax_error_status;
        yysyntax_error_status = YYSYNTAX_ERROR;
        if (yysyntax_error_status == 0)
          yymsgp = yymsg;
        else if (yysyntax_error_status == 1)
          {
            if (yymsg != yymsgbuf)
              YYSTACK_FREE (yymsg);
            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
            if (!yymsg)
              {
                yymsg = yymsgbuf;
                yymsg_alloc = sizeof yymsgbuf;
                yysyntax_error_status = 2;
              }
            else
              {
                yysyntax_error_status = YYSYNTAX_ERROR;
                yymsgp = yymsg;
              }
          }
        yyerror (&yylloc, context, yymsgp);
        if (yysyntax_error_status == 2)
          goto yyexhaustedlab;
      }
# undef YYSYNTAX_ERROR
#endif
    }

  yyerror_range[1] = yylloc;

  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
         error, discard it.  */

      if (yychar <= YYEOF)
        {
          /* Return failure if at end of input.  */
          if (yychar == YYEOF)
            YYABORT;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval, &yylloc, context);
          yychar = YYEMPTY;
        }
    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:

  /* Pacify compilers like GCC when the user code never invokes
     YYERROR and the label yyerrorlab therefore never appears in user
     code.  */
  if (/*CONSTCOND*/ 0)
     goto yyerrorlab;

  yyerror_range[1] = yylsp[1-yylen];
  /* Do not reclaim the symbols of the rule whose action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (!yypact_value_is_default (yyn))
        {
          yyn += YYTERROR;
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
        YYABORT;

      yyerror_range[1] = *yylsp;
      yydestruct ("Error: popping",
                  yystos[yystate], yyvsp, yylsp, context);
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END

  yyerror_range[2] = yylloc;
  /* Using YYLLOC is tempting, but would change the location of
     the lookahead.  YYLOC is available though.  */
  YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
  *++yylsp = yyloc;

  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);

  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here.  |
`-------------------------------------------------*/
yyexhaustedlab:
  yyerror (&yylloc, context, YY_("memory exhausted"));
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
  if (yychar != YYEMPTY)
    {
      /* Make sure we have latest lookahead translation.  See comments at
         user semantic actions for why this is necessary.  */
      yytoken = YYTRANSLATE (yychar);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval, &yylloc, context);
    }
  /* Do not reclaim the symbols of the rule whose action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
                  yystos[*yyssp], yyvsp, yylsp, context);
      YYPOPSTACK (1);
    }
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
  if (yymsg != yymsgbuf)
    YYSTACK_FREE (yymsg);
#endif
  return yyresult;
}



void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason) {
    context->error(*yylloc, reason, "");
    context->recover();
}

int glslang_parse(TParseContext* context) {
    return yyparse(context);
}
