| |
| /* A Bison parser, made by GNU Bison 2.4.1. */ |
| |
| /* Skeleton implementation for Bison's Yacc-like parsers in C |
| |
| Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 |
| 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 "2.4.1" |
| |
| /* Skeleton name. */ |
| #define YYSKELETON_NAME "yacc.c" |
| |
| /* Pure parsers. */ |
| #define YYPURE 1 |
| |
| /* Push parsers. */ |
| #define YYPUSH 0 |
| |
| /* Pull parsers. */ |
| #define YYPULL 1 |
| |
| /* Using locations. */ |
| #define YYLSP_NEEDED 0 |
| |
| |
| |
| /* Copy the first part of user declarations. */ |
| |
| |
| // |
| // Copyright (c) 2002-2013 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 "SymbolTable.h" |
| #include "ParseHelper.h" |
| |
| #define YYENABLE_NLS 0 |
| #define YYLTYPE_IS_TRIVIAL 1 |
| |
| #define YYLEX_PARAM context->scanner |
| |
| |
| |
| /* Enabling traces. */ |
| #ifndef YYDEBUG |
| # define YYDEBUG 0 |
| #endif |
| |
| /* Enabling verbose error messages. */ |
| #ifdef YYERROR_VERBOSE |
| # undef YYERROR_VERBOSE |
| # define YYERROR_VERBOSE 1 |
| #else |
| # define YYERROR_VERBOSE 0 |
| #endif |
| |
| /* Enabling the token table. */ |
| #ifndef YYTOKEN_TABLE |
| # define YYTOKEN_TABLE 0 |
| #endif |
| |
| |
| /* Tokens. */ |
| #ifndef YYTOKENTYPE |
| # define YYTOKENTYPE |
| /* Put the tokens into the symbol table, so that GDB and other debuggers |
| know about them. */ |
| 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, |
| UINT_TYPE = 268, |
| BREAK = 269, |
| CONTINUE = 270, |
| DO = 271, |
| ELSE = 272, |
| FOR = 273, |
| IF = 274, |
| DISCARD = 275, |
| RETURN = 276, |
| SWITCH = 277, |
| CASE = 278, |
| DEFAULT = 279, |
| BVEC2 = 280, |
| BVEC3 = 281, |
| BVEC4 = 282, |
| IVEC2 = 283, |
| IVEC3 = 284, |
| IVEC4 = 285, |
| VEC2 = 286, |
| VEC3 = 287, |
| VEC4 = 288, |
| UVEC2 = 289, |
| UVEC3 = 290, |
| UVEC4 = 291, |
| MATRIX2 = 292, |
| MATRIX3 = 293, |
| MATRIX4 = 294, |
| IN_QUAL = 295, |
| OUT_QUAL = 296, |
| INOUT_QUAL = 297, |
| UNIFORM = 298, |
| VARYING = 299, |
| CENTROID = 300, |
| FLAT = 301, |
| SMOOTH = 302, |
| STRUCT = 303, |
| VOID_TYPE = 304, |
| WHILE = 305, |
| SAMPLER2D = 306, |
| SAMPLERCUBE = 307, |
| SAMPLER_EXTERNAL_OES = 308, |
| SAMPLER2DRECT = 309, |
| SAMPLER3D = 310, |
| SAMPLER3DRECT = 311, |
| SAMPLER2DSHADOW = 312, |
| LAYOUT = 313, |
| IDENTIFIER = 314, |
| TYPE_NAME = 315, |
| FLOATCONSTANT = 316, |
| INTCONSTANT = 317, |
| UINTCONSTANT = 318, |
| BOOLCONSTANT = 319, |
| FIELD_SELECTION = 320, |
| LEFT_OP = 321, |
| RIGHT_OP = 322, |
| INC_OP = 323, |
| DEC_OP = 324, |
| LE_OP = 325, |
| GE_OP = 326, |
| EQ_OP = 327, |
| NE_OP = 328, |
| AND_OP = 329, |
| OR_OP = 330, |
| XOR_OP = 331, |
| MUL_ASSIGN = 332, |
| DIV_ASSIGN = 333, |
| ADD_ASSIGN = 334, |
| MOD_ASSIGN = 335, |
| LEFT_ASSIGN = 336, |
| RIGHT_ASSIGN = 337, |
| AND_ASSIGN = 338, |
| XOR_ASSIGN = 339, |
| OR_ASSIGN = 340, |
| SUB_ASSIGN = 341, |
| LEFT_PAREN = 342, |
| RIGHT_PAREN = 343, |
| LEFT_BRACKET = 344, |
| RIGHT_BRACKET = 345, |
| LEFT_BRACE = 346, |
| RIGHT_BRACE = 347, |
| DOT = 348, |
| COMMA = 349, |
| COLON = 350, |
| EQUAL = 351, |
| SEMICOLON = 352, |
| BANG = 353, |
| DASH = 354, |
| TILDE = 355, |
| PLUS = 356, |
| STAR = 357, |
| SLASH = 358, |
| PERCENT = 359, |
| LEFT_ANGLE = 360, |
| RIGHT_ANGLE = 361, |
| VERTICAL_BAR = 362, |
| CARET = 363, |
| AMPERSAND = 364, |
| QUESTION = 365 |
| }; |
| #endif |
| |
| |
| |
| #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| typedef union YYSTYPE |
| { |
| |
| |
| struct { |
| TSourceLoc line; |
| union { |
| TString *string; |
| float f; |
| int i; |
| unsigned int u; |
| bool b; |
| }; |
| TSymbol* symbol; |
| } lex; |
| struct { |
| TSourceLoc line; |
| TOperator op; |
| union { |
| TIntermNode* intermNode; |
| TIntermNodePair nodePair; |
| TIntermTyped* intermTypedNode; |
| TIntermAggregate* intermAggregate; |
| }; |
| union { |
| TPublicType type; |
| TPrecision precision; |
| TLayoutQualifier layoutQualifier; |
| TQualifier qualifier; |
| TFunction* function; |
| TParameter param; |
| TTypeLine typeLine; |
| TTypeList* typeList; |
| }; |
| } interm; |
| |
| |
| |
| } YYSTYPE; |
| # define YYSTYPE_IS_TRIVIAL 1 |
| # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| # define YYSTYPE_IS_DECLARED 1 |
| #endif |
| |
| |
| /* Copy the second part of user declarations. */ |
| |
| |
| extern int yylex(YYSTYPE* yylval_param, void* yyscanner); |
| extern void yyerror(TParseContext* context, const char* reason); |
| |
| #define FRAG_VERT_ONLY(S, L) { \ |
| if (context->shaderType != GL_FRAGMENT_SHADER && \ |
| context->shaderType != GL_VERTEX_SHADER) { \ |
| context->error(L, " supported in vertex/fragment shaders only ", S); \ |
| context->recover(); \ |
| } \ |
| } |
| |
| #define VERTEX_ONLY(S, L) { \ |
| if (context->shaderType != GL_VERTEX_SHADER) { \ |
| context->error(L, " supported in vertex shaders only ", S); \ |
| context->recover(); \ |
| } \ |
| } |
| |
| #define FRAG_ONLY(S, L) { \ |
| if (context->shaderType != GL_FRAGMENT_SHADER) { \ |
| context->error(L, " supported in fragment shaders only ", S); \ |
| context->recover(); \ |
| } \ |
| } |
| |
| #define ES2_ONLY(S, L) { \ |
| if (context->shaderVersion != 100) { \ |
| context->error(L, " supported in GLSL ES 1.00 only ", S); \ |
| context->recover(); \ |
| } \ |
| } |
| |
| #define ES3_ONLY(S, L) { \ |
| if (context->shaderVersion != 300) { \ |
| context->error(L, " supported in GLSL ES 3.00 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; |
| #elif (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| typedef signed char yytype_int8; |
| #else |
| typedef short int 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 && (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| # 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 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 |
| |
| /* Suppress unused-variable warnings by "using" E. */ |
| #if ! defined lint || defined __GNUC__ |
| # define YYUSE(e) ((void) (e)) |
| #else |
| # define YYUSE(e) /* empty */ |
| #endif |
| |
| /* Identity function, used to suppress warnings about constant conditions. */ |
| #ifndef lint |
| # define YYID(n) (n) |
| #else |
| #if (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| static int |
| YYID (int yyi) |
| #else |
| static int |
| YYID (yyi) |
| int yyi; |
| #endif |
| { |
| return yyi; |
| } |
| #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 _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| # ifndef _STDLIB_H |
| # define _STDLIB_H 1 |
| # endif |
| # endif |
| # endif |
| # endif |
| # endif |
| |
| # ifdef YYSTACK_ALLOC |
| /* Pacify GCC's `empty if-body' warning. */ |
| # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (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 _STDLIB_H \ |
| && ! ((defined YYMALLOC || defined malloc) \ |
| && (defined YYFREE || defined free))) |
| # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| # ifndef _STDLIB_H |
| # define _STDLIB_H 1 |
| # endif |
| # endif |
| # ifndef YYMALLOC |
| # define YYMALLOC malloc |
| # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| # endif |
| # endif |
| # ifndef YYFREE |
| # define YYFREE free |
| # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| # endif |
| # endif |
| # endif |
| #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
| |
| |
| #if (! defined yyoverflow \ |
| && (! defined __cplusplus \ |
| || (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; |
| }; |
| |
| /* 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)) \ |
| + YYSTACK_GAP_MAXIMUM) |
| |
| /* Copy COUNT objects from FROM to TO. The source and destination do |
| not overlap. */ |
| # ifndef YYCOPY |
| # if defined __GNUC__ && 1 < __GNUC__ |
| # define YYCOPY(To, From, Count) \ |
| __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| # else |
| # define YYCOPY(To, From, Count) \ |
| do \ |
| { \ |
| YYSIZE_T yyi; \ |
| for (yyi = 0; yyi < (Count); yyi++) \ |
| (To)[yyi] = (From)[yyi]; \ |
| } \ |
| while (YYID (0)) |
| # endif |
| # endif |
| |
| /* 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 (YYID (0)) |
| |
| #endif |
| |
| /* YYFINAL -- State number of the termination state. */ |
| #define YYFINAL 85 |
| /* YYLAST -- Last index in YYTABLE. */ |
| #define YYLAST 1675 |
| |
| /* YYNTOKENS -- Number of terminals. */ |
| #define YYNTOKENS 111 |
| /* YYNNTS -- Number of nonterminals. */ |
| #define YYNNTS 88 |
| /* YYNRULES -- Number of rules. */ |
| #define YYNRULES 220 |
| /* YYNRULES -- Number of states. */ |
| #define YYNSTATES 329 |
| |
| /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| #define YYUNDEFTOK 2 |
| #define YYMAXUTOK 365 |
| |
| #define YYTRANSLATE(YYX) \ |
| ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| |
| /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 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, |
| 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 105, 106, 107, 108, 109, 110 |
| }; |
| |
| #if YYDEBUG |
| /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| YYRHS. */ |
| static const yytype_uint16 yyprhs[] = |
| { |
| 0, 0, 3, 5, 7, 9, 11, 13, 15, 19, |
| 21, 26, 28, 32, 35, 38, 40, 42, 44, 48, |
| 51, 54, 57, 59, 62, 66, 69, 71, 73, 75, |
| 77, 80, 83, 86, 88, 90, 92, 94, 98, 102, |
| 104, 108, 112, 114, 116, 120, 124, 128, 132, 134, |
| 138, 142, 144, 146, 148, 150, 154, 156, 160, 162, |
| 166, 168, 174, 176, 180, 182, 184, 186, 188, 190, |
| 192, 196, 198, 201, 204, 209, 212, 214, 216, 219, |
| 223, 227, 230, 236, 240, 243, 247, 250, 251, 253, |
| 255, 257, 259, 261, 265, 271, 278, 284, 286, 289, |
| 294, 300, 305, 308, 310, 313, 315, 317, 319, 322, |
| 324, 326, 329, 331, 333, 335, 338, 341, 343, 345, |
| 348, 350, 352, 354, 359, 361, 365, 367, 371, 375, |
| 377, 382, 384, 386, 388, 390, 392, 394, 396, 398, |
| 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, |
| 420, 422, 424, 426, 428, 430, 432, 434, 435, 442, |
| 443, 449, 451, 454, 458, 460, 464, 466, 471, 473, |
| 475, 477, 479, 481, 483, 485, 487, 489, 492, 493, |
| 494, 500, 502, 504, 505, 508, 509, 512, 515, 519, |
| 521, 524, 526, 529, 535, 539, 541, 543, 548, 549, |
| 556, 557, 566, 567, 575, 577, 579, 581, 582, 585, |
| 589, 592, 595, 598, 602, 605, 607, 610, 612, 614, |
| 615 |
| }; |
| |
| /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| static const yytype_int16 yyrhs[] = |
| { |
| 195, 0, -1, 59, -1, 112, -1, 62, -1, 63, |
| -1, 61, -1, 64, -1, 87, 139, 88, -1, 113, |
| -1, 114, 89, 115, 90, -1, 116, -1, 114, 93, |
| 65, -1, 114, 68, -1, 114, 69, -1, 139, -1, |
| 117, -1, 118, -1, 114, 93, 118, -1, 120, 88, |
| -1, 119, 88, -1, 121, 49, -1, 121, -1, 121, |
| 137, -1, 120, 94, 137, -1, 122, 87, -1, 162, |
| -1, 59, -1, 65, -1, 114, -1, 68, 123, -1, |
| 69, 123, -1, 124, 123, -1, 101, -1, 99, -1, |
| 98, -1, 123, -1, 125, 102, 123, -1, 125, 103, |
| 123, -1, 125, -1, 126, 101, 125, -1, 126, 99, |
| 125, -1, 126, -1, 127, -1, 128, 105, 127, -1, |
| 128, 106, 127, -1, 128, 70, 127, -1, 128, 71, |
| 127, -1, 128, -1, 129, 72, 128, -1, 129, 73, |
| 128, -1, 129, -1, 130, -1, 131, -1, 132, -1, |
| 133, 74, 132, -1, 133, -1, 134, 76, 133, -1, |
| 134, -1, 135, 75, 134, -1, 135, -1, 135, 110, |
| 139, 95, 137, -1, 136, -1, 123, 138, 137, -1, |
| 96, -1, 77, -1, 78, -1, 79, -1, 86, -1, |
| 137, -1, 139, 94, 137, -1, 136, -1, 142, 97, |
| -1, 150, 97, -1, 7, 157, 161, 97, -1, 143, |
| 88, -1, 145, -1, 144, -1, 145, 147, -1, 144, |
| 94, 147, -1, 152, 59, 87, -1, 156, 59, -1, |
| 156, 59, 89, 140, 90, -1, 153, 148, 146, -1, |
| 148, 146, -1, 153, 148, 149, -1, 148, 149, -1, |
| -1, 40, -1, 41, -1, 42, -1, 156, -1, 151, |
| -1, 150, 94, 59, -1, 150, 94, 59, 89, 90, |
| -1, 150, 94, 59, 89, 140, 90, -1, 150, 94, |
| 59, 96, 170, -1, 152, -1, 152, 59, -1, 152, |
| 59, 89, 90, -1, 152, 59, 89, 140, 90, -1, |
| 152, 59, 96, 170, -1, 3, 59, -1, 156, -1, |
| 154, 156, -1, 9, -1, 8, -1, 44, -1, 3, |
| 44, -1, 155, -1, 158, -1, 158, 155, -1, 9, |
| -1, 40, -1, 41, -1, 45, 40, -1, 45, 41, |
| -1, 43, -1, 161, -1, 157, 161, -1, 4, -1, |
| 5, -1, 6, -1, 58, 87, 159, 88, -1, 160, |
| -1, 159, 94, 160, -1, 59, -1, 59, 96, 62, |
| -1, 59, 96, 63, -1, 162, -1, 162, 89, 140, |
| 90, -1, 49, -1, 11, -1, 12, -1, 13, -1, |
| 10, -1, 31, -1, 32, -1, 33, -1, 25, -1, |
| 26, -1, 27, -1, 28, -1, 29, -1, 30, -1, |
| 34, -1, 35, -1, 36, -1, 37, -1, 38, -1, |
| 39, -1, 51, -1, 52, -1, 53, -1, 55, -1, |
| 163, -1, 60, -1, -1, 48, 59, 91, 164, 166, |
| 92, -1, -1, 48, 91, 165, 166, 92, -1, 167, |
| -1, 166, 167, -1, 156, 168, 97, -1, 169, -1, |
| 168, 94, 169, -1, 59, -1, 59, 89, 140, 90, |
| -1, 137, -1, 141, -1, 174, -1, 173, -1, 171, |
| -1, 183, -1, 184, -1, 187, -1, 194, -1, 91, |
| 92, -1, -1, -1, 91, 175, 182, 176, 92, -1, |
| 181, -1, 173, -1, -1, 179, 181, -1, -1, 180, |
| 173, -1, 91, 92, -1, 91, 182, 92, -1, 172, |
| -1, 182, 172, -1, 97, -1, 139, 97, -1, 19, |
| 87, 139, 88, 185, -1, 178, 17, 178, -1, 178, |
| -1, 139, -1, 152, 59, 96, 170, -1, -1, 50, |
| 87, 188, 186, 88, 177, -1, -1, 16, 189, 178, |
| 50, 87, 139, 88, 97, -1, -1, 18, 87, 190, |
| 191, 193, 88, 177, -1, 183, -1, 171, -1, 186, |
| -1, -1, 192, 97, -1, 192, 97, 139, -1, 15, |
| 97, -1, 14, 97, -1, 21, 97, -1, 21, 139, |
| 97, -1, 20, 97, -1, 196, -1, 195, 196, -1, |
| 197, -1, 141, -1, -1, 142, 198, 181, -1 |
| }; |
| |
| /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| static const yytype_uint16 yyrline[] = |
| { |
| 0, 187, 187, 222, 225, 230, 235, 240, 245, 251, |
| 254, 333, 336, 437, 447, 460, 468, 568, 571, 579, |
| 583, 590, 594, 601, 607, 616, 624, 679, 686, 696, |
| 699, 709, 719, 740, 741, 742, 747, 748, 757, 769, |
| 770, 778, 789, 793, 794, 804, 814, 824, 837, 838, |
| 848, 861, 865, 869, 873, 874, 887, 888, 901, 902, |
| 915, 916, 933, 934, 947, 948, 949, 950, 951, 955, |
| 958, 969, 977, 1004, 1009, 1019, 1057, 1060, 1067, 1075, |
| 1096, 1117, 1128, 1157, 1162, 1172, 1177, 1187, 1190, 1193, |
| 1196, 1202, 1209, 1212, 1234, 1252, 1276, 1299, 1303, 1321, |
| 1329, 1361, 1381, 1469, 1478, 1501, 1507, 1514, 1523, 1532, |
| 1535, 1539, 1546, 1550, 1555, 1560, 1566, 1572, 1581, 1591, |
| 1598, 1601, 1604, 1610, 1617, 1620, 1626, 1629, 1632, 1638, |
| 1641, 1656, 1660, 1664, 1668, 1672, 1676, 1681, 1686, 1691, |
| 1696, 1701, 1706, 1711, 1716, 1721, 1726, 1731, 1736, 1742, |
| 1748, 1754, 1759, 1764, 1773, 1778, 1783, 1796, 1796, 1810, |
| 1810, 1819, 1822, 1837, 1869, 1873, 1879, 1887, 1903, 1907, |
| 1911, 1912, 1918, 1919, 1920, 1921, 1922, 1926, 1927, 1927, |
| 1927, 1937, 1938, 1942, 1942, 1943, 1943, 1948, 1951, 1961, |
| 1964, 1970, 1971, 1975, 1983, 1987, 1997, 2002, 2019, 2019, |
| 2024, 2024, 2031, 2031, 2039, 2042, 2048, 2051, 2057, 2061, |
| 2068, 2075, 2082, 2089, 2100, 2109, 2113, 2120, 2123, 2129, |
| 2129 |
| }; |
| #endif |
| |
| #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| /* 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", "UINT_TYPE", |
| "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", |
| "SWITCH", "CASE", "DEFAULT", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3", |
| "IVEC4", "VEC2", "VEC3", "VEC4", "UVEC2", "UVEC3", "UVEC4", "MATRIX2", |
| "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM", |
| "VARYING", "CENTROID", "FLAT", "SMOOTH", "STRUCT", "VOID_TYPE", "WHILE", |
| "SAMPLER2D", "SAMPLERCUBE", "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", |
| "SAMPLER3D", "SAMPLER3DRECT", "SAMPLER2DSHADOW", "LAYOUT", "IDENTIFIER", |
| "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT", "UINTCONSTANT", |
| "BOOLCONSTANT", "FIELD_SELECTION", "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", "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", |
| "parameter_type_qualifier", "type_qualifier", "storage_qualifier", |
| "type_specifier", "precision_qualifier", "layout_qualifier", |
| "layout_qualifier_id_list", "layout_qualifier_id", |
| "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", 0 |
| }; |
| #endif |
| |
| # ifdef YYPRINT |
| /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| token YYLEX-NUM. */ |
| 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, 350, 351, 352, 353, 354, |
| 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 365 |
| }; |
| # endif |
| |
| /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| static const yytype_uint8 yyr1[] = |
| { |
| 0, 111, 112, 113, 113, 113, 113, 113, 113, 114, |
| 114, 114, 114, 114, 114, 115, 116, 117, 117, 118, |
| 118, 119, 119, 120, 120, 121, 122, 122, 122, 123, |
| 123, 123, 123, 124, 124, 124, 125, 125, 125, 126, |
| 126, 126, 127, 128, 128, 128, 128, 128, 129, 129, |
| 129, 130, 131, 132, 133, 133, 134, 134, 135, 135, |
| 136, 136, 137, 137, 138, 138, 138, 138, 138, 139, |
| 139, 140, 141, 141, 141, 142, 143, 143, 144, 144, |
| 145, 146, 146, 147, 147, 147, 147, 148, 148, 148, |
| 148, 149, 150, 150, 150, 150, 150, 151, 151, 151, |
| 151, 151, 151, 152, 152, 153, 154, 154, 154, 154, |
| 154, 154, 155, 155, 155, 155, 155, 155, 156, 156, |
| 157, 157, 157, 158, 159, 159, 160, 160, 160, 161, |
| 161, 162, 162, 162, 162, 162, 162, 162, 162, 162, |
| 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, |
| 162, 162, 162, 162, 162, 162, 162, 164, 163, 165, |
| 163, 166, 166, 167, 168, 168, 169, 169, 170, 171, |
| 172, 172, 173, 173, 173, 173, 173, 174, 175, 176, |
| 174, 177, 177, 179, 178, 180, 178, 181, 181, 182, |
| 182, 183, 183, 184, 185, 185, 186, 186, 188, 187, |
| 189, 187, 190, 187, 191, 191, 192, 192, 193, 193, |
| 194, 194, 194, 194, 194, 195, 195, 196, 196, 198, |
| 197 |
| }; |
| |
| /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| static const yytype_uint8 yyr2[] = |
| { |
| 0, 2, 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, 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, 2, 2, 1, 1, 2, |
| 1, 1, 1, 4, 1, 3, 1, 3, 3, 1, |
| 4, 1, 1, 1, 1, 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 |
| }; |
| |
| /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| means the default is an error. */ |
| static const yytype_uint8 yydefact[] = |
| { |
| 0, 0, 120, 121, 122, 0, 106, 112, 135, 132, |
| 133, 134, 139, 140, 141, 142, 143, 144, 136, 137, |
| 138, 145, 146, 147, 148, 149, 150, 113, 114, 117, |
| 107, 0, 0, 131, 151, 152, 153, 154, 0, 156, |
| 218, 219, 0, 77, 87, 0, 92, 97, 0, 109, |
| 103, 0, 110, 118, 129, 155, 0, 215, 217, 108, |
| 102, 0, 115, 116, 0, 159, 0, 72, 0, 75, |
| 87, 105, 88, 89, 90, 78, 0, 87, 0, 73, |
| 98, 104, 119, 111, 0, 1, 216, 0, 157, 0, |
| 126, 0, 124, 0, 220, 79, 84, 86, 91, 0, |
| 93, 80, 0, 0, 2, 6, 4, 5, 7, 28, |
| 0, 0, 0, 35, 34, 33, 3, 9, 29, 11, |
| 16, 17, 0, 0, 22, 0, 36, 0, 39, 42, |
| 43, 48, 51, 52, 53, 54, 56, 58, 60, 71, |
| 0, 26, 74, 0, 0, 0, 161, 0, 123, 0, |
| 0, 0, 200, 0, 0, 0, 0, 0, 178, 187, |
| 191, 36, 62, 69, 0, 169, 0, 129, 172, 189, |
| 171, 170, 0, 173, 174, 175, 176, 81, 83, 85, |
| 0, 0, 99, 0, 168, 101, 30, 31, 0, 13, |
| 14, 0, 0, 20, 19, 0, 21, 23, 25, 32, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 130, 0, 166, 0, 164, 160, |
| 162, 127, 128, 125, 211, 210, 185, 202, 0, 214, |
| 212, 0, 198, 177, 0, 65, 66, 67, 68, 64, |
| 0, 0, 192, 188, 190, 0, 94, 0, 96, 100, |
| 8, 0, 15, 27, 12, 18, 24, 37, 38, 41, |
| 40, 46, 47, 44, 45, 49, 50, 55, 57, 59, |
| 0, 158, 0, 0, 163, 0, 0, 0, 0, 0, |
| 213, 0, 179, 63, 70, 0, 95, 10, 0, 0, |
| 165, 0, 184, 186, 205, 204, 207, 185, 0, 196, |
| 0, 0, 0, 82, 61, 167, 0, 206, 0, 0, |
| 195, 193, 0, 0, 180, 0, 208, 0, 185, 0, |
| 182, 199, 181, 0, 209, 203, 194, 197, 201 |
| }; |
| |
| /* YYDEFGOTO[NTERM-NUM]. */ |
| static const yytype_int16 yydefgoto[] = |
| { |
| -1, 116, 117, 118, 251, 119, 120, 121, 122, 123, |
| 124, 125, 161, 127, 128, 129, 130, 131, 132, 133, |
| 134, 135, 136, 137, 138, 162, 163, 240, 164, 140, |
| 165, 166, 42, 43, 44, 96, 75, 76, 97, 45, |
| 46, 47, 77, 48, 49, 50, 51, 52, 91, 92, |
| 53, 141, 55, 143, 89, 145, 146, 217, 218, 185, |
| 168, 169, 170, 171, 234, 302, 321, 275, 276, 277, |
| 322, 172, 173, 174, 311, 301, 175, 281, 226, 278, |
| 296, 308, 309, 176, 56, 57, 58, 68 |
| }; |
| |
| /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| STATE-NUM. */ |
| #define YYPACT_NINF -282 |
| static const yytype_int16 yypact[] = |
| { |
| 1461, -26, -282, -282, -282, 67, -282, -282, -282, -282, |
| -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, |
| -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, |
| -282, 76, -44, -282, -282, -282, -282, -282, 1, -282, |
| -282, -5, 7, -32, -2, -39, -282, 50, 1518, -282, |
| -282, 1615, 34, -282, 14, -282, 1403, -282, -282, -282, |
| -282, 1615, -282, -282, 51, -282, 85, -282, 73, -282, |
| 56, -282, -282, -282, -282, -282, 1518, 113, 88, -282, |
| 15, -282, -282, -282, 1127, -282, -282, 71, -282, 1518, |
| 75, -62, -282, 315, -282, -282, -282, -282, 110, 1518, |
| -68, -282, 211, 1127, 87, -282, -282, -282, -282, -282, |
| 1127, 1127, 1127, -282, -282, -282, -282, -282, -23, -282, |
| -282, -282, 89, -25, 1205, 91, -282, 1127, 21, -70, |
| -282, -46, 84, -282, -282, -282, 102, 103, -61, -282, |
| 92, -282, -282, 1518, 122, 1283, -282, 96, -282, 85, |
| 86, 94, -282, 97, 98, 99, 968, 101, 106, -282, |
| -282, 5, -282, -282, -7, -282, -5, -45, -282, -282, |
| -282, -282, 414, -282, -282, -282, -282, 100, -282, -282, |
| 1046, 1127, -282, 104, -282, -282, -282, -282, 18, -282, |
| -282, 1127, 1564, -282, -282, 1127, 108, -282, -282, -282, |
| 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, |
| 1127, 1127, 1127, 1127, -282, 1335, 112, 24, -282, -282, |
| -282, -282, -282, -282, -282, -282, 95, -282, 1127, -282, |
| -282, 44, -282, -282, 513, -282, -282, -282, -282, -282, |
| 1127, 1127, -282, -282, -282, 1127, -282, 109, -282, -282, |
| -282, 114, 111, -282, 115, -282, -282, -282, -282, 21, |
| 21, -282, -282, -282, -282, -46, -46, -282, 102, 103, |
| 66, -282, 1127, 122, -282, 143, 73, 711, 810, 25, |
| -282, 890, 513, -282, -282, 116, -282, -282, 1127, 117, |
| -282, 121, -282, -282, -282, -282, 890, 95, 159, 111, |
| 152, 124, 125, -282, -282, -282, 1127, -282, 119, 126, |
| 196, -282, 123, 612, -282, 26, 1127, 612, 95, 1127, |
| -282, -282, -282, 128, 111, -282, -282, -282, -282 |
| }; |
| |
| /* YYPGOTO[NTERM-NUM]. */ |
| static const yytype_int16 yypgoto[] = |
| { |
| -282, -282, -282, -282, -282, -282, -282, 28, -282, -282, |
| -282, -282, -75, -282, -40, -282, -55, -42, -282, -282, |
| -282, 16, 17, 19, -282, -80, -101, -282, -106, -99, |
| 11, 12, -282, -282, -282, 130, 157, 153, 133, -282, |
| -282, -262, -282, -282, 181, -35, 230, -282, -282, 105, |
| -31, 0, -282, -282, -282, 118, -137, -282, -22, -171, |
| -21, -167, -260, -282, -282, -282, -65, -281, -282, -282, |
| -67, 22, -20, -282, -282, -43, -282, -282, -282, -282, |
| -282, -282, -282, -282, -282, 199, -282, -282 |
| }; |
| |
| /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| positive, shift that token. If negative, reduce the rule which |
| number is the opposite. If zero, do what YYDEFACT says. |
| If YYTABLE_NINF, syntax error. */ |
| #define YYTABLE_NINF -184 |
| static const yytype_int16 yytable[] = |
| { |
| 54, 94, 184, 183, 139, 244, 188, 71, 220, 126, |
| 248, 40, 41, 81, 212, 64, 310, 293, 59, 300, |
| 82, 180, 139, 197, 204, 205, 148, 126, 181, 202, |
| 87, 203, 149, 60, 300, 186, 187, 326, 72, 73, |
| 74, 98, -26, 7, 84, 189, 190, 65, 54, 213, |
| 231, 54, 199, 320, 144, 78, 54, 320, 79, 206, |
| 207, 54, 70, 194, 98, 71, 191, 40, 41, 195, |
| 192, 2, 3, 4, 27, 28, 54, 29, 220, 31, |
| 184, 247, 235, 236, 237, 252, -76, 241, 66, 54, |
| 242, 238, 67, 167, 256, 69, 72, 73, 74, 54, |
| 139, 239, 101, 84, 102, 126, 250, 270, 144, 80, |
| 144, 103, 241, 297, 323, 244, 62, 63, 273, 241, |
| 241, 274, 279, 200, 201, 257, 258, 126, 126, 126, |
| 126, 126, 126, 126, 126, 126, 126, 126, 241, 283, |
| 284, 280, 88, 54, 90, 54, 285, 100, 327, 261, |
| 262, 263, 264, 72, 73, 74, 208, 209, 221, 222, |
| 241, 288, 259, 260, 93, 139, 265, 266, 142, 177, |
| 126, 147, 167, 289, -27, 299, 210, 193, 198, 211, |
| 144, 216, 214, 224, 227, 228, -183, 304, 232, 245, |
| 299, 225, 139, 291, 249, -131, 229, 126, 233, 286, |
| 315, 272, -28, 59, 287, 241, 303, 305, 306, 292, |
| 324, 312, 313, 318, 317, 54, 316, 314, 184, 319, |
| 255, 8, 9, 10, 11, 328, 267, 95, 268, 178, |
| 99, 269, 179, 83, 167, 61, 12, 13, 14, 15, |
| 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, |
| 26, 290, 325, 307, 223, 86, 282, 294, 295, 32, |
| 33, 215, 34, 35, 36, 0, 37, 0, 0, 0, |
| 104, 39, 105, 106, 107, 108, 109, 167, 167, 110, |
| 111, 167, 167, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 167, 0, 112, 0, |
| 0, 182, 0, 0, 0, 0, 0, 0, 0, 113, |
| 114, 0, 115, 167, 0, 0, 0, 167, 1, 2, |
| 3, 4, 5, 6, 7, 8, 9, 10, 11, 150, |
| 151, 152, 0, 153, 154, 155, 156, 0, 0, 0, |
| 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
| 22, 23, 24, 25, 26, 27, 28, 0, 29, 30, |
| 31, 0, 0, 32, 33, 157, 34, 35, 36, 0, |
| 37, 0, 0, 38, 104, 39, 105, 106, 107, 108, |
| 109, 0, 0, 110, 111, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 112, 0, 0, 0, 158, 159, 0, 0, |
| 0, 0, 160, 113, 114, 0, 115, 1, 2, 3, |
| 4, 5, 6, 7, 8, 9, 10, 11, 150, 151, |
| 152, 0, 153, 154, 155, 156, 0, 0, 0, 12, |
| 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
| 23, 24, 25, 26, 27, 28, 0, 29, 30, 31, |
| 0, 0, 32, 33, 157, 34, 35, 36, 0, 37, |
| 0, 0, 38, 104, 39, 105, 106, 107, 108, 109, |
| 0, 0, 110, 111, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 0, 112, 0, 0, 0, 158, 243, 0, 0, 0, |
| 0, 160, 113, 114, 0, 115, 1, 2, 3, 4, |
| 5, 6, 7, 8, 9, 10, 11, 150, 151, 152, |
| 0, 153, 154, 155, 156, 0, 0, 0, 12, 13, |
| 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, |
| 24, 25, 26, 27, 28, 0, 29, 30, 31, 0, |
| 0, 32, 33, 157, 34, 35, 36, 0, 37, 0, |
| 0, 38, 104, 39, 105, 106, 107, 108, 109, 0, |
| 0, 110, 111, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 112, 0, 0, 0, 158, 0, 0, 0, 0, 0, |
| 160, 113, 114, 0, 115, 1, 2, 3, 4, 5, |
| 6, 7, 8, 9, 10, 11, 150, 151, 152, 0, |
| 153, 154, 155, 156, 0, 0, 0, 12, 13, 14, |
| 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 25, 26, 27, 28, 0, 29, 30, 31, 0, 0, |
| 32, 33, 157, 34, 35, 36, 0, 37, 0, 0, |
| 38, 104, 39, 105, 106, 107, 108, 109, 0, 0, |
| 110, 111, 0, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, |
| 0, 0, 0, 93, 0, 0, 0, 0, 0, 160, |
| 113, 114, 0, 115, 1, 2, 3, 4, 5, 6, |
| 7, 8, 9, 10, 11, 150, 151, 152, 0, 153, |
| 154, 155, 156, 0, 0, 0, 12, 13, 14, 15, |
| 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, |
| 26, 27, 28, 0, 29, 30, 31, 0, 0, 32, |
| 33, 157, 34, 35, 36, 0, 37, 0, 0, 38, |
| 104, 39, 105, 106, 107, 108, 109, 0, 0, 110, |
| 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 112, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 160, 113, |
| 114, 0, 115, 1, 2, 3, 4, 5, 6, 7, |
| 8, 9, 10, 11, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 12, 13, 14, 15, 16, |
| 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
| 27, 28, 0, 29, 30, 31, 0, 0, 32, 33, |
| 0, 34, 35, 36, 0, 37, 0, 0, 38, 104, |
| 39, 105, 106, 107, 108, 109, 0, 0, 110, 111, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 298, 2, 3, 4, 112, 6, 7, |
| 8, 9, 10, 11, 0, 0, 0, 160, 113, 114, |
| 0, 115, 0, 0, 0, 12, 13, 14, 15, 16, |
| 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
| 27, 28, 0, 29, 30, 31, 0, 0, 32, 33, |
| 0, 34, 35, 36, 0, 37, 0, 0, 38, 104, |
| 39, 105, 106, 107, 108, 109, 0, 0, 110, 111, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 112, 8, 9, |
| 10, 11, 0, 0, 0, 0, 0, 0, 113, 114, |
| 0, 115, 0, 12, 13, 14, 15, 16, 17, 18, |
| 19, 20, 21, 22, 23, 24, 25, 26, 0, 0, |
| 0, 0, 0, 0, 0, 0, 32, 33, 0, 34, |
| 35, 36, 0, 37, 0, 0, 0, 104, 39, 105, |
| 106, 107, 108, 109, 0, 0, 110, 111, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 112, 8, 9, 10, 11, |
| 0, 0, 0, 0, 0, 230, 113, 114, 0, 115, |
| 0, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
| 21, 22, 23, 24, 25, 26, 0, 0, 0, 0, |
| 0, 0, 0, 0, 32, 33, 0, 34, 35, 36, |
| 0, 37, 0, 0, 0, 104, 39, 105, 106, 107, |
| 108, 109, 0, 0, 110, 111, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 112, 0, 0, 246, 8, 9, 10, |
| 11, 0, 0, 0, 113, 114, 0, 115, 0, 0, |
| 0, 0, 12, 13, 14, 15, 16, 17, 18, 19, |
| 20, 21, 22, 23, 24, 25, 26, 0, 0, 0, |
| 0, 0, 0, 0, 0, 32, 33, 0, 34, 35, |
| 36, 0, 37, 0, 0, 0, 104, 39, 105, 106, |
| 107, 108, 109, 0, 0, 110, 111, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 112, 8, 9, 10, 11, 0, |
| 0, 0, 0, 0, 0, 113, 114, 0, 115, 0, |
| 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
| 22, 23, 24, 25, 26, 0, 0, 0, 0, 0, |
| 0, 0, 0, 32, 196, 0, 34, 35, 36, 0, |
| 37, 0, 0, 0, 104, 39, 105, 106, 107, 108, |
| 109, 0, 0, 110, 111, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, |
| 0, 0, 112, 8, 9, 10, 11, 0, 0, 0, |
| 0, 0, 0, 113, 114, 0, 115, 0, 12, 13, |
| 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, |
| 24, 25, 26, 0, 0, 0, 0, 0, 0, 0, |
| 0, 32, 33, 0, 34, 35, 36, 0, 37, 2, |
| 3, 4, 0, 39, 0, 8, 9, 10, 11, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
| 22, 23, 24, 25, 26, 219, 0, 0, 0, 0, |
| 0, 0, 0, 32, 33, 0, 34, 35, 36, 0, |
| 37, 0, 0, 0, 0, 39, 0, 0, 0, 0, |
| 0, 0, 0, 85, 0, 0, 1, 2, 3, 4, |
| 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 271, 12, 13, |
| 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, |
| 24, 25, 26, 27, 28, 0, 29, 30, 31, 0, |
| 0, 32, 33, 0, 34, 35, 36, 0, 37, 0, |
| 0, 38, 0, 39, 1, 2, 3, 4, 5, 6, |
| 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 12, 13, 14, 15, |
| 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, |
| 26, 27, 28, 0, 29, 30, 31, 0, 0, 32, |
| 33, 0, 34, 35, 36, 0, 37, 0, 0, 38, |
| 0, 39, 2, 3, 4, 0, 0, 0, 8, 9, |
| 10, 11, 0, 0, 0, 0, 0, 0, 0, 0, |
| 0, 0, 0, 12, 13, 14, 15, 16, 17, 18, |
| 19, 20, 21, 22, 23, 24, 25, 26, 0, 0, |
| 0, 0, 0, 0, 0, 0, 32, 33, 0, 34, |
| 35, 36, 0, 37, 8, 9, 10, 11, 39, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, |
| 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
| 23, 24, 25, 26, 0, 0, 0, 0, 0, 0, |
| 0, 0, 32, 33, 0, 34, 35, 36, 0, 37, |
| 0, 0, 0, 253, 39, 8, 9, 10, 11, 254, |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
| 22, 23, 24, 25, 26, 0, 0, 0, 0, 0, |
| 0, 0, 0, 32, 33, 0, 34, 35, 36, 0, |
| 37, 0, 0, 0, 0, 39 |
| }; |
| |
| static const yytype_int16 yycheck[] = |
| { |
| 0, 68, 103, 102, 84, 172, 112, 9, 145, 84, |
| 181, 0, 0, 48, 75, 59, 297, 277, 44, 281, |
| 51, 89, 102, 124, 70, 71, 88, 102, 96, 99, |
| 61, 101, 94, 59, 296, 110, 111, 318, 40, 41, |
| 42, 76, 87, 9, 89, 68, 69, 91, 48, 110, |
| 156, 51, 127, 313, 89, 94, 56, 317, 97, 105, |
| 106, 61, 94, 88, 99, 9, 89, 56, 56, 94, |
| 93, 4, 5, 6, 40, 41, 76, 43, 215, 45, |
| 181, 180, 77, 78, 79, 191, 88, 94, 87, 89, |
| 97, 86, 97, 93, 195, 88, 40, 41, 42, 99, |
| 180, 96, 87, 89, 89, 180, 88, 213, 143, 59, |
| 145, 96, 94, 88, 88, 282, 40, 41, 94, 94, |
| 94, 97, 228, 102, 103, 200, 201, 202, 203, 204, |
| 205, 206, 207, 208, 209, 210, 211, 212, 94, 240, |
| 241, 97, 91, 143, 59, 145, 245, 59, 319, 204, |
| 205, 206, 207, 40, 41, 42, 72, 73, 62, 63, |
| 94, 95, 202, 203, 91, 245, 208, 209, 97, 59, |
| 245, 96, 172, 272, 87, 281, 74, 88, 87, 76, |
| 215, 59, 90, 97, 87, 87, 91, 288, 87, 89, |
| 296, 97, 272, 50, 90, 87, 97, 272, 92, 90, |
| 306, 89, 87, 44, 90, 94, 90, 90, 87, 276, |
| 316, 59, 88, 17, 88, 215, 97, 92, 319, 96, |
| 192, 10, 11, 12, 13, 97, 210, 70, 211, 99, |
| 77, 212, 99, 52, 234, 5, 25, 26, 27, 28, |
| 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
| 39, 273, 317, 296, 149, 56, 234, 278, 278, 48, |
| 49, 143, 51, 52, 53, -1, 55, -1, -1, -1, |
| 59, 60, 61, 62, 63, 64, 65, 277, 278, 68, |
| 69, 281, 282, -1, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, 296, -1, 87, -1, |
| -1, 90, -1, -1, -1, -1, -1, -1, -1, 98, |
| 99, -1, 101, 313, -1, -1, -1, 317, 3, 4, |
| 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 15, 16, -1, 18, 19, 20, 21, -1, -1, -1, |
| 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 35, 36, 37, 38, 39, 40, 41, -1, 43, 44, |
| 45, -1, -1, 48, 49, 50, 51, 52, 53, -1, |
| 55, -1, -1, 58, 59, 60, 61, 62, 63, 64, |
| 65, -1, -1, 68, 69, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| -1, -1, 87, -1, -1, -1, 91, 92, -1, -1, |
| -1, -1, 97, 98, 99, -1, 101, 3, 4, 5, |
| 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
| 16, -1, 18, 19, 20, 21, -1, -1, -1, 25, |
| 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, |
| 36, 37, 38, 39, 40, 41, -1, 43, 44, 45, |
| -1, -1, 48, 49, 50, 51, 52, 53, -1, 55, |
| -1, -1, 58, 59, 60, 61, 62, 63, 64, 65, |
| -1, -1, 68, 69, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| -1, 87, -1, -1, -1, 91, 92, -1, -1, -1, |
| -1, 97, 98, 99, -1, 101, 3, 4, 5, 6, |
| 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| -1, 18, 19, 20, 21, -1, -1, -1, 25, 26, |
| 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, |
| 37, 38, 39, 40, 41, -1, 43, 44, 45, -1, |
| -1, 48, 49, 50, 51, 52, 53, -1, 55, -1, |
| -1, 58, 59, 60, 61, 62, 63, 64, 65, -1, |
| -1, 68, 69, -1, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 87, -1, -1, -1, 91, -1, -1, -1, -1, -1, |
| 97, 98, 99, -1, 101, 3, 4, 5, 6, 7, |
| 8, 9, 10, 11, 12, 13, 14, 15, 16, -1, |
| 18, 19, 20, 21, -1, -1, -1, 25, 26, 27, |
| 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, |
| 38, 39, 40, 41, -1, 43, 44, 45, -1, -1, |
| 48, 49, 50, 51, 52, 53, -1, 55, -1, -1, |
| 58, 59, 60, 61, 62, 63, 64, 65, -1, -1, |
| 68, 69, -1, -1, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, 87, |
| -1, -1, -1, 91, -1, -1, -1, -1, -1, 97, |
| 98, 99, -1, 101, 3, 4, 5, 6, 7, 8, |
| 9, 10, 11, 12, 13, 14, 15, 16, -1, 18, |
| 19, 20, 21, -1, -1, -1, 25, 26, 27, 28, |
| 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
| 39, 40, 41, -1, 43, 44, 45, -1, -1, 48, |
| 49, 50, 51, 52, 53, -1, 55, -1, -1, 58, |
| 59, 60, 61, 62, 63, 64, 65, -1, -1, 68, |
| 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, 87, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, 97, 98, |
| 99, -1, 101, 3, 4, 5, 6, 7, 8, 9, |
| 10, 11, 12, 13, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, 25, 26, 27, 28, 29, |
| 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, |
| 40, 41, -1, 43, 44, 45, -1, -1, 48, 49, |
| -1, 51, 52, 53, -1, 55, -1, -1, 58, 59, |
| 60, 61, 62, 63, 64, 65, -1, -1, 68, 69, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, 3, 4, 5, 6, 87, 8, 9, |
| 10, 11, 12, 13, -1, -1, -1, 97, 98, 99, |
| -1, 101, -1, -1, -1, 25, 26, 27, 28, 29, |
| 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, |
| 40, 41, -1, 43, 44, 45, -1, -1, 48, 49, |
| -1, 51, 52, 53, -1, 55, -1, -1, 58, 59, |
| 60, 61, 62, 63, 64, 65, -1, -1, 68, 69, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, 87, 10, 11, |
| 12, 13, -1, -1, -1, -1, -1, -1, 98, 99, |
| -1, 101, -1, 25, 26, 27, 28, 29, 30, 31, |
| 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, |
| -1, -1, -1, -1, -1, -1, 48, 49, -1, 51, |
| 52, 53, -1, 55, -1, -1, -1, 59, 60, 61, |
| 62, 63, 64, 65, -1, -1, 68, 69, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, 87, 10, 11, 12, 13, |
| -1, -1, -1, -1, -1, 97, 98, 99, -1, 101, |
| -1, 25, 26, 27, 28, 29, 30, 31, 32, 33, |
| 34, 35, 36, 37, 38, 39, -1, -1, -1, -1, |
| -1, -1, -1, -1, 48, 49, -1, 51, 52, 53, |
| -1, 55, -1, -1, -1, 59, 60, 61, 62, 63, |
| 64, 65, -1, -1, 68, 69, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, 87, -1, -1, 90, 10, 11, 12, |
| 13, -1, -1, -1, 98, 99, -1, 101, -1, -1, |
| -1, -1, 25, 26, 27, 28, 29, 30, 31, 32, |
| 33, 34, 35, 36, 37, 38, 39, -1, -1, -1, |
| -1, -1, -1, -1, -1, 48, 49, -1, 51, 52, |
| 53, -1, 55, -1, -1, -1, 59, 60, 61, 62, |
| 63, 64, 65, -1, -1, 68, 69, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, 87, 10, 11, 12, 13, -1, |
| -1, -1, -1, -1, -1, 98, 99, -1, 101, -1, |
| 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 35, 36, 37, 38, 39, -1, -1, -1, -1, -1, |
| -1, -1, -1, 48, 49, -1, 51, 52, 53, -1, |
| 55, -1, -1, -1, 59, 60, 61, 62, 63, 64, |
| 65, -1, -1, 68, 69, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, |
| -1, -1, 87, 10, 11, 12, 13, -1, -1, -1, |
| -1, -1, -1, 98, 99, -1, 101, -1, 25, 26, |
| 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, |
| 37, 38, 39, -1, -1, -1, -1, -1, -1, -1, |
| -1, 48, 49, -1, 51, 52, 53, -1, 55, 4, |
| 5, 6, -1, 60, -1, 10, 11, 12, 13, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 35, 36, 37, 38, 39, 92, -1, -1, -1, -1, |
| -1, -1, -1, 48, 49, -1, 51, 52, 53, -1, |
| 55, -1, -1, -1, -1, 60, -1, -1, -1, -1, |
| -1, -1, -1, 0, -1, -1, 3, 4, 5, 6, |
| 7, 8, 9, 10, 11, 12, 13, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, 92, 25, 26, |
| 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, |
| 37, 38, 39, 40, 41, -1, 43, 44, 45, -1, |
| -1, 48, 49, -1, 51, 52, 53, -1, 55, -1, |
| -1, 58, -1, 60, 3, 4, 5, 6, 7, 8, |
| 9, 10, 11, 12, 13, -1, -1, -1, -1, -1, |
| -1, -1, -1, -1, -1, -1, 25, 26, 27, 28, |
| 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
| 39, 40, 41, -1, 43, 44, 45, -1, -1, 48, |
| 49, -1, 51, 52, 53, -1, 55, -1, -1, 58, |
| -1, 60, 4, 5, 6, -1, -1, -1, 10, 11, |
| 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, |
| -1, -1, -1, 25, 26, 27, 28, 29, 30, 31, |
| 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, |
| -1, -1, -1, -1, -1, -1, 48, 49, -1, 51, |
| 52, 53, -1, 55, 10, 11, 12, 13, 60, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, |
| 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, |
| 36, 37, 38, 39, -1, -1, -1, -1, -1, -1, |
| -1, -1, 48, 49, -1, 51, 52, 53, -1, 55, |
| -1, -1, -1, 59, 60, 10, 11, 12, 13, 65, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 35, 36, 37, 38, 39, -1, -1, -1, -1, -1, |
| -1, -1, -1, 48, 49, -1, 51, 52, 53, -1, |
| 55, -1, -1, -1, -1, 60 |
| }; |
| |
| /* 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, 13, 25, 26, 27, 28, 29, 30, 31, 32, |
| 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, |
| 44, 45, 48, 49, 51, 52, 53, 55, 58, 60, |
| 141, 142, 143, 144, 145, 150, 151, 152, 154, 155, |
| 156, 157, 158, 161, 162, 163, 195, 196, 197, 44, |
| 59, 157, 40, 41, 59, 91, 87, 97, 198, 88, |
| 94, 9, 40, 41, 42, 147, 148, 153, 94, 97, |
| 59, 156, 161, 155, 89, 0, 196, 161, 91, 165, |
| 59, 159, 160, 91, 181, 147, 146, 149, 156, 148, |
| 59, 87, 89, 96, 59, 61, 62, 63, 64, 65, |
| 68, 69, 87, 98, 99, 101, 112, 113, 114, 116, |
| 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, |
| 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, |
| 140, 162, 97, 164, 156, 166, 167, 96, 88, 94, |
| 14, 15, 16, 18, 19, 20, 21, 50, 91, 92, |
| 97, 123, 136, 137, 139, 141, 142, 162, 171, 172, |
| 173, 174, 182, 183, 184, 187, 194, 59, 146, 149, |
| 89, 96, 90, 140, 137, 170, 123, 123, 139, 68, |
| 69, 89, 93, 88, 88, 94, 49, 137, 87, 123, |
| 102, 103, 99, 101, 70, 71, 105, 106, 72, 73, |
| 74, 76, 75, 110, 90, 166, 59, 168, 169, 92, |
| 167, 62, 63, 160, 97, 97, 189, 87, 87, 97, |
| 97, 139, 87, 92, 175, 77, 78, 79, 86, 96, |
| 138, 94, 97, 92, 172, 89, 90, 140, 170, 90, |
| 88, 115, 139, 59, 65, 118, 137, 123, 123, 125, |
| 125, 127, 127, 127, 127, 128, 128, 132, 133, 134, |
| 139, 92, 89, 94, 97, 178, 179, 180, 190, 139, |
| 97, 188, 182, 137, 137, 140, 90, 90, 95, 140, |
| 169, 50, 181, 173, 171, 183, 191, 88, 3, 139, |
| 152, 186, 176, 90, 137, 90, 87, 186, 192, 193, |
| 178, 185, 59, 88, 92, 139, 97, 88, 17, 96, |
| 173, 177, 181, 88, 139, 177, 178, 170, 97 |
| }; |
| |
| #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 |
| |
| |
| /* Like YYERROR except do call yyerror. This remains here temporarily |
| to ease the transition to the new meaning of YYERROR, for GCC. |
| Once GCC version 2 has supplanted version 1, this can go. */ |
| |
| #define YYFAIL goto yyerrlab |
| |
| #define YYRECOVERING() (!!yyerrstatus) |
| |
| #define YYBACKUP(Token, Value) \ |
| do \ |
| if (yychar == YYEMPTY && yylen == 1) \ |
| { \ |
| yychar = (Token); \ |
| yylval = (Value); \ |
| yytoken = YYTRANSLATE (yychar); \ |
| YYPOPSTACK (1); \ |
| goto yybackup; \ |
| } \ |
| else \ |
| { \ |
| yyerror (context, YY_("syntax error: cannot back up")); \ |
| YYERROR; \ |
| } \ |
| while (YYID (0)) |
| |
| |
| #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). */ |
| |
| #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| #ifndef YYLLOC_DEFAULT |
| # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| do \ |
| if (YYID (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 (YYID (0)) |
| #endif |
| |
| |
| /* 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 YYLTYPE_IS_TRIVIAL |
| # define YY_LOCATION_PRINT(File, Loc) \ |
| fprintf (File, "%d.%d-%d.%d", \ |
| (Loc).first_line, (Loc).first_column, \ |
| (Loc).last_line, (Loc).last_column) |
| # else |
| # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| # endif |
| #endif |
| |
| |
| /* YYLEX -- calling `yylex' with the right arguments. */ |
| |
| #ifdef YYLEX_PARAM |
| # define YYLEX yylex (&yylval, YYLEX_PARAM) |
| #else |
| # define YYLEX yylex (&yylval) |
| #endif |
| |
| /* 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 (YYID (0)) |
| |
| # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| do { \ |
| if (yydebug) \ |
| { \ |
| YYFPRINTF (stderr, "%s ", Title); \ |
| yy_symbol_print (stderr, \ |
| Type, Value, context); \ |
| YYFPRINTF (stderr, "\n"); \ |
| } \ |
| } while (YYID (0)) |
| |
| |
| /*--------------------------------. |
| | Print this symbol on YYOUTPUT. | |
| `--------------------------------*/ |
| |
| /*ARGSUSED*/ |
| #if (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| static void |
| yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context) |
| #else |
| static void |
| yy_symbol_value_print (yyoutput, yytype, yyvaluep, context) |
| FILE *yyoutput; |
| int yytype; |
| YYSTYPE const * const yyvaluep; |
| TParseContext* context; |
| #endif |
| { |
| if (!yyvaluep) |
| return; |
| YYUSE (context); |
| # ifdef YYPRINT |
| if (yytype < YYNTOKENS) |
| YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| # else |
| YYUSE (yyoutput); |
| # endif |
| switch (yytype) |
| { |
| default: |
| break; |
| } |
| } |
| |
| |
| /*--------------------------------. |
| | Print this symbol on YYOUTPUT. | |
| `--------------------------------*/ |
| |
| #if (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| static void |
| yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context) |
| #else |
| static void |
| yy_symbol_print (yyoutput, yytype, yyvaluep, context) |
| FILE *yyoutput; |
| int yytype; |
| YYSTYPE const * const yyvaluep; |
| TParseContext* context; |
| #endif |
| { |
| if (yytype < YYNTOKENS) |
| YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| else |
| YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| |
| yy_symbol_value_print (yyoutput, yytype, yyvaluep, context); |
| YYFPRINTF (yyoutput, ")"); |
| } |
| |
| /*------------------------------------------------------------------. |
| | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| | TOP (included). | |
| `------------------------------------------------------------------*/ |
| |
| #if (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| static void |
| yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
| #else |
| static void |
| yy_stack_print (yybottom, yytop) |
| yytype_int16 *yybottom; |
| yytype_int16 *yytop; |
| #endif |
| { |
| 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 (YYID (0)) |
| |
| |
| /*------------------------------------------------. |
| | Report that the YYRULE is going to be reduced. | |
| `------------------------------------------------*/ |
| |
| #if (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| static void |
| yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context) |
| #else |
| static void |
| yy_reduce_print (yyvsp, yyrule, context) |
| YYSTYPE *yyvsp; |
| int yyrule; |
| TParseContext* context; |
| #endif |
| { |
| int yynrhs = yyr2[yyrule]; |
| int yyi; |
| unsigned long int yylno = yyrline[yyrule]; |
| 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, yyrhs[yyprhs[yyrule] + yyi], |
| &(yyvsp[(yyi + 1) - (yynrhs)]) |
| , context); |
| YYFPRINTF (stderr, "\n"); |
| } |
| } |
| |
| # define YY_REDUCE_PRINT(Rule) \ |
| do { \ |
| if (yydebug) \ |
| yy_reduce_print (yyvsp, Rule, context); \ |
| } while (YYID (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. */ |
| #if (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| static YYSIZE_T |
| yystrlen (const char *yystr) |
| #else |
| static YYSIZE_T |
| yystrlen (yystr) |
| const char *yystr; |
| #endif |
| { |
| 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. */ |
| #if (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| static char * |
| yystpcpy (char *yydest, const char *yysrc) |
| #else |
| static char * |
| yystpcpy (yydest, yysrc) |
| char *yydest; |
| const char *yysrc; |
| #endif |
| { |
| 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 YYRESULT an error message about the unexpected token |
| YYCHAR while in state YYSTATE. Return the number of bytes copied, |
| including the terminating null byte. If YYRESULT is null, do not |
| copy anything; just return the number of bytes that would be |
| copied. As a special case, return 0 if an ordinary "syntax error" |
| message will do. Return YYSIZE_MAXIMUM if overflow occurs during |
| size calculation. */ |
| static YYSIZE_T |
| yysyntax_error (char *yyresult, int yystate, int yychar) |
| { |
| int yyn = yypact[yystate]; |
| |
| if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) |
| return 0; |
| else |
| { |
| int yytype = YYTRANSLATE (yychar); |
| YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| YYSIZE_T yysize = yysize0; |
| YYSIZE_T yysize1; |
| int yysize_overflow = 0; |
| enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| int yyx; |
| |
| # if 0 |
| /* This is so xgettext sees the translatable formats that are |
| constructed on the fly. */ |
| YY_("syntax error, unexpected %s"); |
| YY_("syntax error, unexpected %s, expecting %s"); |
| YY_("syntax error, unexpected %s, expecting %s or %s"); |
| YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| # endif |
| char *yyfmt; |
| char const *yyf; |
| static char const yyunexpected[] = "syntax error, unexpected %s"; |
| static char const yyexpecting[] = ", expecting %s"; |
| static char const yyor[] = " or %s"; |
| char yyformat[sizeof yyunexpected |
| + sizeof yyexpecting - 1 |
| + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| * (sizeof yyor - 1))]; |
| char const *yyprefix = yyexpecting; |
| |
| /* Start YYX at -YYN if negative to avoid negative indexes in |
| YYCHECK. */ |
| 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 yycount = 1; |
| |
| yyarg[0] = yytname[yytype]; |
| yyfmt = yystpcpy (yyformat, yyunexpected); |
| |
| for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| { |
| if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| { |
| yycount = 1; |
| yysize = yysize0; |
| yyformat[sizeof yyunexpected - 1] = '\0'; |
| break; |
| } |
| yyarg[yycount++] = yytname[yyx]; |
| yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| yysize_overflow |= (yysize1 < yysize); |
| yysize = yysize1; |
| yyfmt = yystpcpy (yyfmt, yyprefix); |
| yyprefix = yyor; |
| } |
| |
| yyf = YY_(yyformat); |
| yysize1 = yysize + yystrlen (yyf); |
| yysize_overflow |= (yysize1 < yysize); |
| yysize = yysize1; |
| |
| if (yysize_overflow) |
| return YYSIZE_MAXIMUM; |
| |
| if (yyresult) |
| { |
| /* 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 = yyresult; |
| int yyi = 0; |
| while ((*yyp = *yyf) != '\0') |
| { |
| if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| { |
| yyp += yytnamerr (yyp, yyarg[yyi++]); |
| yyf += 2; |
| } |
| else |
| { |
| yyp++; |
| yyf++; |
| } |
| } |
| } |
| return yysize; |
| } |
| } |
| #endif /* YYERROR_VERBOSE */ |
| |
| |
| /*-----------------------------------------------. |
| | Release the memory associated to this symbol. | |
| `-----------------------------------------------*/ |
| |
| /*ARGSUSED*/ |
| #if (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| static void |
| yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context) |
| #else |
| static void |
| yydestruct (yymsg, yytype, yyvaluep, context) |
| const char *yymsg; |
| int yytype; |
| YYSTYPE *yyvaluep; |
| TParseContext* context; |
| #endif |
| { |
| YYUSE (yyvaluep); |
| YYUSE (context); |
| |
| if (!yymsg) |
| yymsg = "Deleting"; |
| YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| |
| switch (yytype) |
| { |
| |
| default: |
| break; |
| } |
| } |
| |
| /* Prevent warnings from -Wmissing-prototypes. */ |
| #ifdef YYPARSE_PARAM |
| #if defined __STDC__ || defined __cplusplus |
| int yyparse (void *YYPARSE_PARAM); |
| #else |
| int yyparse (); |
| #endif |
| #else /* ! YYPARSE_PARAM */ |
| #if defined __STDC__ || defined __cplusplus |
| int yyparse (TParseContext* context); |
| #else |
| int yyparse (); |
| #endif |
| #endif /* ! YYPARSE_PARAM */ |
| |
| |
| |
| |
| |
| /*-------------------------. |
| | yyparse or yypush_parse. | |
| `-------------------------*/ |
| |
| #ifdef YYPARSE_PARAM |
| #if (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| int |
| yyparse (void *YYPARSE_PARAM) |
| #else |
| int |
| yyparse (YYPARSE_PARAM) |
| void *YYPARSE_PARAM; |
| #endif |
| #else /* ! YYPARSE_PARAM */ |
| #if (defined __STDC__ || defined __C99__FUNC__ \ |
| || defined __cplusplus || defined _MSC_VER) |
| int |
| yyparse (TParseContext* context) |
| #else |
| int |
| yyparse (context) |
| TParseContext* context; |
| #endif |
| #endif |
| { |
| /* The lookahead symbol. */ |
| int yychar; |
| |
| /* The semantic value of the lookahead symbol. */ |
| YYSTYPE yylval; |
| |
| /* 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. |
| |
| Refer to the stacks thru 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; |
| |
| YYSIZE_T yystacksize; |
| |
| int yyn; |
| int yyresult; |
| /* Lookahead token as an internal (translated) token number. */ |
| int yytoken; |
| /* The variables used to return semantic value and location from the |
| action routines. */ |
| YYSTYPE yyval; |
| |
| #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)) |
| |
| /* The number of symbols on the RHS of the reduced rule. |
| Keep to zero when no symbol should be popped. */ |
| int yylen = 0; |
| |
| yytoken = 0; |
| yyss = yyssa; |
| yyvs = yyvsa; |
| yystacksize = YYINITDEPTH; |
| |
| YYDPRINTF ((stderr, "Starting parse\n")); |
| |
| yystate = 0; |
| yyerrstatus = 0; |
| yynerrs = 0; |
| yychar = YYEMPTY; /* Cause a token to be read. */ |
| |
| /* Initialize stack pointers. |
| Waste one element of value and location stack |
| so that they stay on the same level as the state stack. |
| The wasted elements are never initialized. */ |
| yyssp = yyss; |
| yyvsp = yyvs; |
| |
| 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; |
| |
| /* 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), |
| &yystacksize); |
| |
| 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); |
| # undef YYSTACK_RELOCATE |
| if (yyss1 != yyssa) |
| YYSTACK_FREE (yyss1); |
| } |
| # endif |
| #endif /* no yyoverflow */ |
| |
| yyssp = yyss + yysize - 1; |
| yyvsp = yyvs + 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 (yyn == YYPACT_NINF) |
| 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; |
| } |
| |
| 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 (yyn == 0 || yyn == YYTABLE_NINF) |
| 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; |
| *++yyvsp = yylval; |
| |
| 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]; |
| |
| |
| YY_REDUCE_PRINT (yyn); |
| switch (yyn) |
| { |
| case 2: |
| |
| { |
| // The symbol table search was done in the lexical phase |
| const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol; |
| const TVariable* variable; |
| if (symbol == 0) { |
| context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str()); |
| context->recover(); |
| TType type(EbtFloat, EbpUndefined); |
| TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type); |
| context->symbolTable.declare(*fakeVariable); |
| variable = fakeVariable; |
| } else { |
| // This identifier can only be a variable type symbol |
| if (! symbol->isVariable()) { |
| context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str()); |
| context->recover(); |
| } |
| variable = static_cast<const TVariable*>(symbol); |
| } |
| |
| // 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, (yyvsp[(1) - (1)].lex).line); |
| } else |
| (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(), |
| variable->getName(), |
| variable->getType(), (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 3: |
| |
| { |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 4: |
| |
| { |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setIConst((yyvsp[(1) - (1)].lex).i); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 5: |
| |
| { |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setUConst((yyvsp[(1) - (1)].lex).u); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 6: |
| |
| { |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setFConst((yyvsp[(1) - (1)].lex).f); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 7: |
| |
| { |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setBConst((yyvsp[(1) - (1)].lex).b); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 8: |
| |
| { |
| (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 9: |
| |
| { |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 10: |
| |
| { |
| if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { |
| if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode()) |
| context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", (yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode()->getSymbol().c_str()); |
| else |
| context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression"); |
| context->recover(); |
| } |
| if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) { |
| if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays |
| (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); |
| } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors |
| TVectorFields fields; |
| fields.num = 1; |
| fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0); // need to do it this way because v.xy sends fields integer array |
| (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); |
| } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices |
| (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); |
| } |
| } else { |
| if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) { |
| if (((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() || (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getNominalSize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) { |
| std::stringstream extraInfoStream; |
| extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'"; |
| std::string extraInfo = extraInfoStream.str(); |
| context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str()); |
| context->recover(); |
| } else { |
| if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { |
| if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) { |
| if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0)) { |
| if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), true, (yyvsp[(2) - (4)].lex).line)) |
| context->recover(); |
| } else { |
| if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line)) |
| context->recover(); |
| } |
| } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) { |
| std::stringstream extraInfoStream; |
| extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'"; |
| std::string extraInfo = extraInfoStream.str(); |
| context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str()); |
| context->recover(); |
| } |
| } |
| (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); |
| } |
| } else { |
| if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) { |
| context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable"); |
| context->recover(); |
| } |
| |
| (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); |
| } |
| } |
| if ((yyval.interm.intermTypedNode) == 0) { |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setFConst(0.0f); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line); |
| } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { |
| if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct()) |
| (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName())); |
| else |
| (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize(), (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())); |
| |
| if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) |
| (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst); |
| } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) |
| (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize())); |
| else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) |
| (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize())); |
| else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) |
| (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst)); |
| else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) |
| (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary)); |
| else |
| (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType()); |
| } |
| break; |
| |
| case 11: |
| |
| { |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 12: |
| |
| { |
| if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) { |
| context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", "."); |
| context->recover(); |
| } |
| |
| if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) { |
| TVectorFields fields; |
| if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) { |
| fields.num = 1; |
| fields.offsets[0] = 0; |
| context->recover(); |
| } |
| |
| if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields |
| (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| } |
| else |
| (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size())); |
| } else { |
| TString vectorString = *(yyvsp[(3) - (3)].lex).string; |
| TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line); |
| (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); |
| (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size())); |
| } |
| } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) { |
| TMatrixFields fields; |
| if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) { |
| fields.wholeRow = false; |
| fields.wholeCol = false; |
| fields.row = 0; |
| fields.col = 0; |
| context->recover(); |
| } |
| |
| if (fields.wholeRow || fields.wholeCol) { |
| context->error((yyvsp[(2) - (3)].lex).line, " 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), (yyvsp[(3) - (3)].lex).line); |
| (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); |
| (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize())); |
| } else { |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row); |
| TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line); |
| (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); |
| (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision())); |
| } |
| } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) { |
| bool fieldFound = false; |
| const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct(); |
| if (fields == 0) { |
| context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error"); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| } else { |
| unsigned int i; |
| for (i = 0; i < fields->size(); ++i) { |
| if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) { |
| fieldFound = true; |
| break; |
| } |
| } |
| if (fieldFound) { |
| if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { |
| (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].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, (yyvsp[(3) - (3)].lex).line); |
| (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); |
| (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type); |
| } |
| } else { |
| context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| } |
| } |
| } else { |
| context->error((yyvsp[(2) - (3)].lex).line, " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| } |
| // don't delete $3.string, it's from the pool |
| } |
| break; |
| |
| case 13: |
| |
| { |
| if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode))) |
| context->recover(); |
| (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode); |
| } |
| } |
| break; |
| |
| case 14: |
| |
| { |
| if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode))) |
| context->recover(); |
| (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode); |
| } |
| } |
| break; |
| |
| case 15: |
| |
| { |
| if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]")) |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 16: |
| |
| { |
| TFunction* fnCall = (yyvsp[(1) - (1)].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((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) { |
| (yyval.interm.intermTypedNode) = 0; |
| } else { |
| // |
| // It's a constructor, of type 'type'. |
| // |
| (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line); |
| } |
| |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->recover(); |
| (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line); |
| } |
| (yyval.interm.intermTypedNode)->setType(type); |
| } else { |
| // |
| // Not a constructor. Find it in the symbol table. |
| // |
| const TFunction* fnCandidate; |
| bool builtIn; |
| fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn); |
| if (fnCandidate) { |
| // |
| // A declared function. |
| // |
| if (builtIn && !fnCandidate->getExtension().empty() && |
| context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, 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[(1) - (1)].interm).intermNode, 0); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| std::stringstream extraInfoStream; |
| extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString(); |
| std::string extraInfo = extraInfoStream.str(); |
| context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str()); |
| YYERROR; |
| } |
| } else { |
| (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line); |
| } |
| } else { |
| // This is a real function call |
| |
| (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line); |
| (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 (int 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[(1) - (1)].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), (yyvsp[(1) - (1)].interm).line); |
| context->recover(); |
| } |
| } |
| delete fnCall; |
| } |
| break; |
| |
| case 17: |
| |
| { |
| (yyval.interm) = (yyvsp[(1) - (1)].interm); |
| } |
| break; |
| |
| case 18: |
| |
| { |
| context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", ""); |
| context->recover(); |
| (yyval.interm) = (yyvsp[(3) - (3)].interm); |
| } |
| break; |
| |
| case 19: |
| |
| { |
| (yyval.interm) = (yyvsp[(1) - (2)].interm); |
| (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; |
| } |
| break; |
| |
| case 20: |
| |
| { |
| (yyval.interm) = (yyvsp[(1) - (2)].interm); |
| (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; |
| } |
| break; |
| |
| case 21: |
| |
| { |
| (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); |
| (yyval.interm).intermNode = 0; |
| } |
| break; |
| |
| case 22: |
| |
| { |
| (yyval.interm).function = (yyvsp[(1) - (1)].interm.function); |
| (yyval.interm).intermNode = 0; |
| } |
| break; |
| |
| case 23: |
| |
| { |
| TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) }; |
| (yyvsp[(1) - (2)].interm.function)->addParameter(param); |
| (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); |
| (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 24: |
| |
| { |
| TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) }; |
| (yyvsp[(1) - (3)].interm).function->addParameter(param); |
| (yyval.interm).function = (yyvsp[(1) - (3)].interm).function; |
| (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| } |
| break; |
| |
| case 25: |
| |
| { |
| (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function); |
| } |
| break; |
| |
| case 26: |
| |
| { |
| // |
| // Constructor |
| // |
| TOperator op = EOpNull; |
| if ((yyvsp[(1) - (1)].interm.type).userDef) { |
| op = EOpConstructStruct; |
| } else { |
| switch ((yyvsp[(1) - (1)].interm.type).type) { |
| case EbtFloat: |
| if ((yyvsp[(1) - (1)].interm.type).matrix) { |
| switch((yyvsp[(1) - (1)].interm.type).size) { |
| case 2: op = EOpConstructMat2; break; |
| case 3: op = EOpConstructMat3; break; |
| case 4: op = EOpConstructMat4; break; |
| } |
| } else { |
| switch((yyvsp[(1) - (1)].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[(1) - (1)].interm.type).size) { |
| case 1: op = EOpConstructInt; break; |
| case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break; |
| case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break; |
| case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break; |
| } |
| break; |
| case EbtBool: |
| switch((yyvsp[(1) - (1)].interm.type).size) { |
| case 1: op = EOpConstructBool; break; |
| case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break; |
| case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break; |
| case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break; |
| } |
| break; |
| default: break; |
| } |
| if (op == EOpNull) { |
| context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type)); |
| context->recover(); |
| (yyvsp[(1) - (1)].interm.type).type = EbtFloat; |
| op = EOpConstructFloat; |
| } |
| } |
| TString tempString; |
| TType type((yyvsp[(1) - (1)].interm.type)); |
| TFunction *function = new TFunction(&tempString, type, op); |
| (yyval.interm.function) = function; |
| } |
| break; |
| |
| case 27: |
| |
| { |
| if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string)) |
| context->recover(); |
| TType type(EbtVoid, EbpUndefined); |
| TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type); |
| (yyval.interm.function) = function; |
| } |
| break; |
| |
| case 28: |
| |
| { |
| if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string)) |
| context->recover(); |
| TType type(EbtVoid, EbpUndefined); |
| TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type); |
| (yyval.interm.function) = function; |
| } |
| break; |
| |
| case 29: |
| |
| { |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 30: |
| |
| { |
| if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode))) |
| context->recover(); |
| (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); |
| } |
| } |
| break; |
| |
| case 31: |
| |
| { |
| if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode))) |
| context->recover(); |
| (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); |
| } |
| } |
| break; |
| |
| case 32: |
| |
| { |
| if ((yyvsp[(1) - (2)].interm).op != EOpNull) { |
| (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| const char* errorOp = ""; |
| switch((yyvsp[(1) - (2)].interm).op) { |
| case EOpNegative: errorOp = "-"; break; |
| case EOpLogicalNot: errorOp = "!"; break; |
| default: break; |
| } |
| context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); |
| } |
| } else |
| (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 33: |
| |
| { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; } |
| break; |
| |
| case 34: |
| |
| { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; } |
| break; |
| |
| case 35: |
| |
| { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; } |
| break; |
| |
| case 36: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 37: |
| |
| { |
| FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line); |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| } |
| } |
| break; |
| |
| case 38: |
| |
| { |
| FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line); |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| } |
| } |
| break; |
| |
| case 39: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 40: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| } |
| } |
| break; |
| |
| case 41: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| } |
| } |
| break; |
| |
| case 42: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 43: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 44: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setBConst(false); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| } |
| } |
| break; |
| |
| case 45: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setBConst(false); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| } |
| } |
| break; |
| |
| case 46: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setBConst(false); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| } |
| } |
| break; |
| |
| case 47: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setBConst(false); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| } |
| } |
| break; |
| |
| case 48: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 49: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setBConst(false); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| } |
| } |
| break; |
| |
| case 50: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setBConst(false); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| } |
| } |
| break; |
| |
| case 51: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 52: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 53: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 54: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 55: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setBConst(false); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| } |
| } |
| break; |
| |
| case 56: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 57: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setBConst(false); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| } |
| } |
| break; |
| |
| case 58: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 59: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| ConstantUnion *unionArray = new ConstantUnion[1]; |
| unionArray->setBConst(false); |
| (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| } |
| } |
| break; |
| |
| case 60: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 61: |
| |
| { |
| if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode))) |
| context->recover(); |
| |
| (yyval.interm.intermTypedNode) = context->intermediate.addSelection((yyvsp[(1) - (5)].interm.intermTypedNode), (yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.intermTypedNode), (yyvsp[(2) - (5)].lex).line); |
| if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType()) |
| (yyval.interm.intermTypedNode) = 0; |
| |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode); |
| } |
| } |
| break; |
| |
| case 62: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 63: |
| |
| { |
| if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode))) |
| context->recover(); |
| (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].interm).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| } |
| } |
| break; |
| |
| case 64: |
| |
| { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; } |
| break; |
| |
| case 65: |
| |
| { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; } |
| break; |
| |
| case 66: |
| |
| { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; } |
| break; |
| |
| case 67: |
| |
| { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; } |
| break; |
| |
| case 68: |
| |
| { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; } |
| break; |
| |
| case 69: |
| |
| { |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 70: |
| |
| { |
| (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| if ((yyval.interm.intermTypedNode) == 0) { |
| context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode); |
| } |
| } |
| break; |
| |
| case 71: |
| |
| { |
| if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode))) |
| context->recover(); |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 72: |
| |
| { |
| TFunction &function = *((yyvsp[(1) - (2)].interm).function); |
| |
| TIntermAggregate *prototype = new TIntermAggregate; |
| prototype->setType(function.getReturnType()); |
| prototype->setName(function.getName()); |
| |
| for (int i = 0; i < function.getParamCount(); i++) |
| { |
| const TParameter ¶m = 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(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line); |
| } |
| else |
| { |
| prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line); |
| } |
| } |
| |
| prototype->setOp(EOpPrototype); |
| (yyval.interm.intermNode) = prototype; |
| |
| context->symbolTable.pop(); |
| } |
| break; |
| |
| case 73: |
| |
| { |
| if ((yyvsp[(1) - (2)].interm).intermAggregate) |
| (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration); |
| (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate; |
| } |
| break; |
| |
| case 74: |
| |
| { |
| if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) { |
| context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].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) - (2)].interm.function)->getMangledName(), context->shaderVersion)); |
| if (prevDec) { |
| if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) { |
| context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString()); |
| context->recover(); |
| } |
| for (int i = 0; i < prevDec->getParamCount(); ++i) { |
| if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) { |
| context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString()); |
| context->recover(); |
| } |
| } |
| } |
| |
| // |
| // 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) - (2)].interm.function); |
| (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; |
| |
| // 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[(1) - (1)].interm.function); |
| } |
| break; |
| |
| case 77: |
| |
| { |
| (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); |
| } |
| break; |
| |
| case 78: |
| |
| { |
| // Add the parameter |
| (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function); |
| if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid) |
| (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param); |
| else |
| delete (yyvsp[(2) - (2)].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[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) { |
| // |
| // This parameter > first is void |
| // |
| context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void"); |
| context->recover(); |
| delete (yyvsp[(3) - (3)].interm).param.type; |
| } else { |
| // Add the parameter |
| (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function); |
| (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param); |
| } |
| } |
| break; |
| |
| case 80: |
| |
| { |
| if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) { |
| context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier)); |
| context->recover(); |
| } |
| // make sure a sampler is not involved as well... |
| if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type))) |
| context->recover(); |
| |
| // Add the function as a prototype after parsing it (we do not support recursion) |
| TFunction *function; |
| TType type((yyvsp[(1) - (3)].interm.type)); |
| function = new TFunction((yyvsp[(2) - (3)].lex).string, type); |
| (yyval.interm.function) = function; |
| |
| context->symbolTable.push(); |
| } |
| break; |
| |
| case 81: |
| |
| { |
| if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) { |
| context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str()); |
| context->recover(); |
| } |
| if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) |
| context->recover(); |
| TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))}; |
| (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; |
| (yyval.interm).param = param; |
| } |
| break; |
| |
| case 82: |
| |
| { |
| // Check that we can make an array out of this type |
| if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type))) |
| context->recover(); |
| |
| if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string)) |
| context->recover(); |
| |
| int size; |
| if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size)) |
| context->recover(); |
| (yyvsp[(1) - (5)].interm.type).setArray(true, size); |
| |
| TType* type = new TType((yyvsp[(1) - (5)].interm.type)); |
| TParameter param = { (yyvsp[(2) - (5)].lex).string, type }; |
| (yyval.interm).line = (yyvsp[(2) - (5)].lex).line; |
| (yyval.interm).param = param; |
| } |
| break; |
| |
| case 83: |
| |
| { |
| (yyval.interm) = (yyvsp[(3) - (3)].interm); |
| if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type)) |
| context->recover(); |
| } |
| break; |
| |
| case 84: |
| |
| { |
| (yyval.interm) = (yyvsp[(2) - (2)].interm); |
| if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type)) |
| context->recover(); |
| if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type)) |
| context->recover(); |
| } |
| break; |
| |
| case 85: |
| |
| { |
| (yyval.interm) = (yyvsp[(3) - (3)].interm); |
| if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type)) |
| context->recover(); |
| } |
| break; |
| |
| case 86: |
| |
| { |
| (yyval.interm) = (yyvsp[(2) - (2)].interm); |
| if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type)) |
| context->recover(); |
| if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].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[(1) - (1)].interm.type)) }; |
| (yyval.interm).param = param; |
| } |
| break; |
| |
| case 92: |
| |
| { |
| (yyval.interm) = (yyvsp[(1) - (1)].interm); |
| } |
| break; |
| |
| case 93: |
| |
| { |
| if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol) |
| { |
| context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str()); |
| context->recover(); |
| } |
| |
| TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line); |
| (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line); |
| |
| if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type)) |
| context->recover(); |
| |
| if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false)) |
| context->recover(); |
| |
| TVariable* variable = 0; |
| if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable)) |
| context->recover(); |
| if (symbol && variable) |
| symbol->setId(variable->getUniqueId()); |
| } |
| break; |
| |
| case 94: |
| |
| { |
| if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type)) |
| context->recover(); |
| |
| if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true)) |
| context->recover(); |
| |
| (yyval.interm) = (yyvsp[(1) - (5)].interm); |
| |
| if (context->arrayTypeErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type) || context->arrayQualifierErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type)) |
| context->recover(); |
| else { |
| (yyvsp[(1) - (5)].interm).type.setArray(true); |
| TVariable* variable; |
| if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable)) |
| context->recover(); |
| } |
| } |
| break; |
| |
| case 95: |
| |
| { |
| if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type)) |
| context->recover(); |
| |
| if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true)) |
| context->recover(); |
| |
| (yyval.interm) = (yyvsp[(1) - (6)].interm); |
| |
| if (context->arrayTypeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type) || context->arrayQualifierErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type)) |
| context->recover(); |
| else { |
| int size; |
| if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size)) |
| context->recover(); |
| (yyvsp[(1) - (6)].interm).type.setArray(true, size); |
| TVariable* variable = 0; |
| if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable)) |
| context->recover(); |
| TType type = TType((yyvsp[(1) - (6)].interm).type); |
| type.setArraySize(size); |
| (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *(yyvsp[(3) - (6)].lex).string, type, (yyvsp[(3) - (6)].lex).line), (yyvsp[(3) - (6)].lex).line); |
| } |
| } |
| break; |
| |
| case 96: |
| |
| { |
| if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type)) |
| context->recover(); |
| |
| (yyval.interm) = (yyvsp[(1) - (5)].interm); |
| |
| TIntermNode* intermNode; |
| if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) { |
| // |
| // build the intermediate representation |
| // |
| if (intermNode) |
| (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line); |
| else |
| (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate; |
| } else { |
| context->recover(); |
| (yyval.interm).intermAggregate = 0; |
| } |
| } |
| break; |
| |
| case 97: |
| |
| { |
| (yyval.interm).type = (yyvsp[(1) - (1)].interm.type); |
| (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType((yyvsp[(1) - (1)].interm.type)), (yyvsp[(1) - (1)].interm.type).line), (yyvsp[(1) - (1)].interm.type).line); |
| } |
| break; |
| |
| case 98: |
| |
| { |
| TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line); |
| (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line); |
| |
| if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type)) |
| context->recover(); |
| |
| if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false)) |
| context->recover(); |
| |
| (yyval.interm).type = (yyvsp[(1) - (2)].interm.type); |
| |
| TVariable* variable = 0; |
| if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable)) |
| context->recover(); |
| if (variable && symbol) |
| symbol->setId(variable->getUniqueId()); |
| } |
| break; |
| |
| case 99: |
| |
| { |
| context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str()); |
| context->recover(); |
| |
| TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line); |
| (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line); |
| (yyval.interm).type = (yyvsp[(1) - (4)].interm.type); |
| } |
| break; |
| |
| case 100: |
| |
| { |
| TType type = TType((yyvsp[(1) - (5)].interm.type)); |
| int size; |
| if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size)) |
| context->recover(); |
| type.setArraySize(size); |
| TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line); |
| (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line); |
| |
| if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type))) |
| context->recover(); |
| |
| if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true)) |
| context->recover(); |
| |
| (yyval.interm).type = (yyvsp[(1) - (5)].interm.type); |
| |
| if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)) || context->arrayQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type))) |
| context->recover(); |
| else { |
| int size; |
| if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size)) |
| context->recover(); |
| |
| (yyvsp[(1) - (5)].interm.type).setArray(true, size); |
| TVariable* variable = 0; |
| if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable)) |
| context->recover(); |
| if (variable && symbol) |
| symbol->setId(variable->getUniqueId()); |
| } |
| } |
| break; |
| |
| case 101: |
| |
| { |
| if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type))) |
| context->recover(); |
| |
| (yyval.interm).type = (yyvsp[(1) - (4)].interm.type); |
| |
| TIntermNode* intermNode; |
| if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) { |
| // |
| // Build intermediate representation |
| // |
| if(intermNode) |
| (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line); |
| else |
| (yyval.interm).intermAggregate = 0; |
| } else { |
| context->recover(); |
| (yyval.interm).intermAggregate = 0; |
| } |
| } |
| break; |
| |
| case 102: |
| |
| { |
| if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying")) |
| context->recover(); |
| (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line); |
| if (!(yyvsp[(2) - (2)].lex).symbol) |
| { |
| context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str()); |
| context->recover(); |
| |
| (yyval.interm).intermAggregate = 0; |
| } |
| else |
| { |
| TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line); |
| (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line); |
| } |
| } |
| break; |
| |
| case 103: |
| |
| { |
| (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); |
| |
| if ((yyvsp[(1) - (1)].interm.type).array) { |
| context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array"); |
| context->recover(); |
| (yyvsp[(1) - (1)].interm.type).setArray(false); |
| } |
| } |
| break; |
| |
| case 104: |
| |
| { |
| if ((yyvsp[(2) - (2)].interm.type).array) { |
| context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array"); |
| context->recover(); |
| (yyvsp[(2) - (2)].interm.type).setArray(false); |
| } |
| |
| if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute && |
| ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) { |
| context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier)); |
| context->recover(); |
| } |
| if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) && |
| ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) { |
| context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier)); |
| context->recover(); |
| } |
| (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type); |
| (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier; |
| } |
| break; |
| |
| case 105: |
| |
| { |
| (yyval.interm.qualifier) = EvqConst; |
| } |
| break; |
| |
| case 106: |
| |
| { |
| VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line); |
| ES2_ONLY("attribute", (yyvsp[(1) - (1)].lex).line); |
| if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute")) |
| context->recover(); |
| (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 107: |
| |
| { |
| ES2_ONLY("varying", (yyvsp[(1) - (1)].lex).line); |
| if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying")) |
| context->recover(); |
| if (context->shaderType == GL_VERTEX_SHADER) |
| (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line); |
| else |
| (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 108: |
| |
| { |
| ES2_ONLY("varying", (yyvsp[(1) - (2)].lex).line); |
| if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying")) |
| context->recover(); |
| if (context->shaderType == GL_VERTEX_SHADER) |
| (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line); |
| else |
| (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line); |
| } |
| break; |
| |
| case 109: |
| |
| { |
| (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yyvsp[(1) - (1)].interm.type).line); |
| } |
| break; |
| |
| case 110: |
| |
| { |
| (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (1)].interm.layoutQualifier); |
| } |
| break; |
| |
| case 111: |
| |
| { |
| (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yyvsp[(2) - (2)].interm.type).line); |
| (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (2)].interm.layoutQualifier); |
| } |
| break; |
| |
| case 112: |
| |
| { |
| (yyval.interm.type).qualifier = EvqConst; |
| (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line; |
| } |
| break; |
| |
| case 113: |
| |
| { |
| ES3_ONLY("in", (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute; |
| (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line; |
| } |
| break; |
| |
| case 114: |
| |
| { |
| ES3_ONLY("out", (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut; |
| (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line; |
| } |
| break; |
| |
| case 115: |
| |
| { |
| ES3_ONLY("in", (yyvsp[(1) - (2)].lex).line); |
| // FIXME: Handle centroid qualifier |
| (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute; |
| (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line; |
| } |
| break; |
| |
| case 116: |
| |
| { |
| ES3_ONLY("out", (yyvsp[(1) - (2)].lex).line); |
| // FIXME: Handle centroid qualifier |
| (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut; |
| (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line; |
| } |
| break; |
| |
| case 117: |
| |
| { |
| if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform")) |
| context->recover(); |
| (yyval.interm.type).qualifier = EvqUniform; |
| (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line; |
| } |
| break; |
| |
| case 118: |
| |
| { |
| (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); |
| |
| if ((yyval.interm.type).precision == EbpUndefined) { |
| (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type); |
| if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) { |
| context->recover(); |
| } |
| } |
| } |
| break; |
| |
| case 119: |
| |
| { |
| (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type); |
| (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision); |
| } |
| break; |
| |
| case 120: |
| |
| { |
| (yyval.interm.precision) = EbpHigh; |
| } |
| break; |
| |
| case 121: |
| |
| { |
| (yyval.interm.precision) = EbpMedium; |
| } |
| break; |
| |
| case 122: |
| |
| { |
| (yyval.interm.precision) = EbpLow; |
| } |
| break; |
| |
| case 123: |
| |
| { |
| ES3_ONLY("layout", (yyvsp[(1) - (4)].lex).line); |
| (yyval.interm.layoutQualifier) = (yyvsp[(3) - (4)].interm.layoutQualifier); |
| } |
| break; |
| |
| case 124: |
| |
| { |
| (yyval.interm.layoutQualifier) = (yyvsp[(1) - (1)].interm.layoutQualifier); |
| } |
| break; |
| |
| case 125: |
| |
| { |
| (yyval.interm.layoutQualifier) = context->joinLayoutQualifiers((yyvsp[(1) - (3)].interm.layoutQualifier), (yyvsp[(3) - (3)].interm.layoutQualifier)); |
| } |
| break; |
| |
| case 126: |
| |
| { |
| (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (1)].lex).string, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 127: |
| |
| { |
| (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yyvsp[(1) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yyvsp[(3) - (3)].lex).line); |
| } |
| break; |
| |
| case 128: |
| |
| { |
| (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yyvsp[(1) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yyvsp[(3) - (3)].lex).line); |
| } |
| break; |
| |
| case 129: |
| |
| { |
| (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); |
| } |
| break; |
| |
| case 130: |
| |
| { |
| (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type); |
| |
| if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type))) |
| context->recover(); |
| else { |
| int size; |
| if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size)) |
| context->recover(); |
| (yyval.interm.type).setArray(true, size); |
| } |
| } |
| break; |
| |
| case 131: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 132: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 133: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 134: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 135: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 136: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(2); |
| } |
| break; |
| |
| case 137: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(3); |
| } |
| break; |
| |
| case 138: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(4); |
| } |
| break; |
| |
| case 139: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(2); |
| } |
| break; |
| |
| case 140: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(3); |
| } |
| break; |
| |
| case 141: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(4); |
| } |
| break; |
| |
| case 142: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(2); |
| } |
| break; |
| |
| case 143: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(3); |
| } |
| break; |
| |
| case 144: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(4); |
| } |
| break; |
| |
| case 145: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(2); |
| } |
| break; |
| |
| case 146: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(3); |
| } |
| break; |
| |
| case 147: |
| |
| { |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(4); |
| } |
| break; |
| |
| case 148: |
| |
| { |
| FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line); |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(2, true); |
| } |
| break; |
| |
| case 149: |
| |
| { |
| FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line); |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(3, true); |
| } |
| break; |
| |
| case 150: |
| |
| { |
| FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line); |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).setAggregate(4, true); |
| } |
| break; |
| |
| case 151: |
| |
| { |
| FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line); |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 152: |
| |
| { |
| FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line); |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 153: |
| |
| { |
| if (!context->supportsExtension("GL_OES_EGL_image_external")) { |
| context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", ""); |
| context->recover(); |
| } |
| FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line); |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 154: |
| |
| { |
| FRAG_VERT_ONLY("sampler3D", (yyvsp[(1) - (1)].lex).line); |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtSampler3D, qual, (yyvsp[(1) - (1)].lex).line); |
| } |
| break; |
| |
| case 155: |
| |
| { |
| FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line); |
| (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); |
| (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| } |
| break; |
| |
| case 156: |
| |
| { |
| // |
| // This is for user defined type names. The lexical phase looked up the |
| // type. |
| // |
| TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType(); |
| TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line); |
| (yyval.interm.type).userDef = &structure; |
| } |
| break; |
| |
| case 157: |
| |
| { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); } |
| break; |
| |
| case 158: |
| |
| { |
| if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string)) |
| context->recover(); |
| |
| TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string); |
| TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true); |
| if (! context->symbolTable.declare(*userTypeDef)) { |
| context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct"); |
| context->recover(); |
| } |
| (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line); |
| (yyval.interm.type).userDef = structure; |
| context->exitStructDeclaration(); |
| } |
| break; |
| |
| case 159: |
| |
| { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); } |
| break; |
| |
| case 160: |
| |
| { |
| TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString("")); |
| (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line); |
| (yyval.interm.type).userDef = structure; |
| context->exitStructDeclaration(); |
| } |
| break; |
| |
| case 161: |
| |
| { |
| (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList); |
| } |
| break; |
| |
| case 162: |
| |
| { |
| (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList); |
| for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) { |
| for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) { |
| if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) { |
| context->error((*(yyvsp[(2) - (2)].interm.typeList))[i].line, "duplicate field name in structure:", "struct", (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName().c_str()); |
| context->recover(); |
| } |
| } |
| (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]); |
| } |
| } |
| break; |
| |
| case 163: |
| |
| { |
| (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList); |
| |
| if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) { |
| context->recover(); |
| } |
| for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { |
| // |
| // Careful not to replace already known aspects of type, like array-ness |
| // |
| TType* type = (*(yyval.interm.typeList))[i].type; |
| type->setBasicType((yyvsp[(1) - (3)].interm.type).type); |
| type->setNominalSize((yyvsp[(1) - (3)].interm.type).size); |
| type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix); |
| type->setPrecision((yyvsp[(1) - (3)].interm.type).precision); |
| |
| // don't allow arrays of arrays |
| if (type->isArray()) { |
| if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type))) |
| context->recover(); |
| } |
| if ((yyvsp[(1) - (3)].interm.type).array) |
| type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize); |
| if ((yyvsp[(1) - (3)].interm.type).userDef) { |
| type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct()); |
| type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName()); |
| } |
| } |
| } |
| break; |
| |
| case 164: |
| |
| { |
| (yyval.interm.typeList) = NewPoolTTypeList(); |
| (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine)); |
| } |
| break; |
| |
| case 165: |
| |
| { |
| (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine)); |
| } |
| break; |
| |
| case 166: |
| |
| { |
| if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string)) |
| context->recover(); |
| |
| (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined); |
| (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line; |
| (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string); |
| } |
| break; |
| |
| case 167: |
| |
| { |
| if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string)) |
| context->recover(); |
| |
| (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined); |
| (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line; |
| (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string); |
| |
| int size; |
| if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size)) |
| context->recover(); |
| (yyval.interm.typeLine).type->setArraySize(size); |
| } |
| break; |
| |
| case 168: |
| |
| { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } |
| break; |
| |
| case 169: |
| |
| { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } |
| break; |
| |
| case 170: |
| |
| { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); } |
| break; |
| |
| case 171: |
| |
| { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } |
| break; |
| |
| case 172: |
| |
| { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } |
| break; |
| |
| case 173: |
| |
| { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } |
| break; |
| |
| case 174: |
| |
| { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } |
| break; |
| |
| case 175: |
| |
| { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } |
| break; |
| |
| case 176: |
| |
| { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } |
| break; |
| |
| case 177: |
| |
| { (yyval.interm.intermAggregate) = 0; } |
| break; |
| |
| case 178: |
| |
| { context->symbolTable.push(); } |
| break; |
| |
| case 179: |
| |
| { context->symbolTable.pop(); } |
| break; |
| |
| case 180: |
| |
| { |
| if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) { |
| (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence); |
| (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line); |
| } |
| (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate); |
| } |
| break; |
| |
| case 181: |
| |
| { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } |
| break; |
| |
| case 182: |
| |
| { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } |
| break; |
| |
| case 183: |
| |
| { context->symbolTable.push(); } |
| break; |
| |
| case 184: |
| |
| { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); } |
| break; |
| |
| case 185: |
| |
| { context->symbolTable.push(); } |
| break; |
| |
| case 186: |
| |
| { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); } |
| break; |
| |
| case 187: |
| |
| { |
| (yyval.interm.intermNode) = 0; |
| } |
| break; |
| |
| case 188: |
| |
| { |
| if ((yyvsp[(2) - (3)].interm.intermAggregate)) { |
| (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence); |
| (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line); |
| } |
| (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate); |
| } |
| break; |
| |
| case 189: |
| |
| { |
| (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0); |
| } |
| break; |
| |
| case 190: |
| |
| { |
| (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0); |
| } |
| break; |
| |
| case 191: |
| |
| { (yyval.interm.intermNode) = 0; } |
| break; |
| |
| case 192: |
| |
| { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); } |
| break; |
| |
| case 193: |
| |
| { |
| if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode))) |
| context->recover(); |
| (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line); |
| } |
| break; |
| |
| case 194: |
| |
| { |
| (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode); |
| (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode); |
| } |
| break; |
| |
| case 195: |
| |
| { |
| (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode); |
| (yyval.interm.nodePair).node2 = 0; |
| } |
| break; |
| |
| case 196: |
| |
| { |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode))) |
| context->recover(); |
| } |
| break; |
| |
| case 197: |
| |
| { |
| TIntermNode* intermNode; |
| if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type))) |
| context->recover(); |
| if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type))) |
| context->recover(); |
| |
| if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) |
| (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode); |
| else { |
| context->recover(); |
| (yyval.interm.intermTypedNode) = 0; |
| } |
| } |
| break; |
| |
| case 198: |
| |
| { context->symbolTable.push(); ++context->loopNestingLevel; } |
| break; |
| |
| case 199: |
| |
| { |
| context->symbolTable.pop(); |
| (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line); |
| --context->loopNestingLevel; |
| } |
| break; |
| |
| case 200: |
| |
| { ++context->loopNestingLevel; } |
| break; |
| |
| case 201: |
| |
| { |
| if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode))) |
| context->recover(); |
| |
| (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line); |
| --context->loopNestingLevel; |
| } |
| break; |
| |
| case 202: |
| |
| { context->symbolTable.push(); ++context->loopNestingLevel; } |
| break; |
| |
| case 203: |
| |
| { |
| context->symbolTable.pop(); |
| (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopFor, (yyvsp[(4) - (7)].interm.intermNode), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node1), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node2), (yyvsp[(7) - (7)].interm.intermNode), (yyvsp[(1) - (7)].lex).line); |
| --context->loopNestingLevel; |
| } |
| break; |
| |
| case 204: |
| |
| { |
| (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); |
| } |
| break; |
| |
| case 205: |
| |
| { |
| (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); |
| } |
| break; |
| |
| case 206: |
| |
| { |
| (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 207: |
| |
| { |
| (yyval.interm.intermTypedNode) = 0; |
| } |
| break; |
| |
| case 208: |
| |
| { |
| (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode); |
| (yyval.interm.nodePair).node2 = 0; |
| } |
| break; |
| |
| case 209: |
| |
| { |
| (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode); |
| } |
| break; |
| |
| case 210: |
| |
| { |
| if (context->loopNestingLevel <= 0) { |
| context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", ""); |
| context->recover(); |
| } |
| (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line); |
| } |
| break; |
| |
| case 211: |
| |
| { |
| if (context->loopNestingLevel <= 0) { |
| context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", ""); |
| context->recover(); |
| } |
| (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line); |
| } |
| break; |
| |
| case 212: |
| |
| { |
| (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line); |
| if (context->currentFunctionType->getBasicType() != EbtVoid) { |
| context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return"); |
| context->recover(); |
| } |
| } |
| break; |
| |
| case 213: |
| |
| { |
| (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line); |
| context->functionReturnsValue = true; |
| if (context->currentFunctionType->getBasicType() == EbtVoid) { |
| context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return"); |
| context->recover(); |
| } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) { |
| context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return"); |
| context->recover(); |
| } |
| } |
| break; |
| |
| case 214: |
| |
| { |
| FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line); |
| (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line); |
| } |
| break; |
| |
| case 215: |
| |
| { |
| (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); |
| context->treeRoot = (yyval.interm.intermNode); |
| } |
| break; |
| |
| case 216: |
| |
| { |
| (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0); |
| context->treeRoot = (yyval.interm.intermNode); |
| } |
| break; |
| |
| case 217: |
| |
| { |
| (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); |
| } |
| break; |
| |
| case 218: |
| |
| { |
| (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); |
| } |
| break; |
| |
| case 219: |
| |
| { |
| TFunction* function = (yyvsp[(1) - (1)].interm).function; |
| |
| const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName(), context->shaderVersion); |
| |
| if (builtIn) |
| { |
| context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str()); |
| context->recover(); |
| } |
| |
| TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName(), context->shaderVersion)); |
| // |
| // 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((yyvsp[(1) - (1)].interm).line, "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((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str()); |
| context->recover(); |
| } |
| if (function->getReturnType().getBasicType() != EbtVoid) { |
| context->error((yyvsp[(1) - (1)].interm).line, "", 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 (int 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.declare(*variable)) { |
| context->error((yyvsp[(1) - (1)].interm).line, "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(), (yyvsp[(1) - (1)].interm).line), |
| (yyvsp[(1) - (1)].interm).line); |
| } else { |
| paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line); |
| } |
| } |
| context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line); |
| (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes; |
| context->loopNestingLevel = 0; |
| } |
| break; |
| |
| case 220: |
| |
| { |
| //?? 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((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str()); |
| context->recover(); |
| } |
| |
| (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0); |
| context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line); |
| (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str()); |
| (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].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); |
| |
| if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()) |
| (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine()); |
| |
| context->symbolTable.pop(); |
| } |
| break; |
| |
| |
| |
| default: break; |
| } |
| YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
| |
| YYPOPSTACK (yylen); |
| yylen = 0; |
| YY_STACK_PRINT (yyss, yyssp); |
| |
| *++yyvsp = yyval; |
| |
| /* 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: |
| /* If not already recovering from an error, report this error. */ |
| if (!yyerrstatus) |
| { |
| ++yynerrs; |
| #if ! YYERROR_VERBOSE |
| yyerror (context, YY_("syntax error")); |
| #else |
| { |
| YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); |
| if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) |
| { |
| YYSIZE_T yyalloc = 2 * yysize; |
| if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) |
| yyalloc = YYSTACK_ALLOC_MAXIMUM; |
| if (yymsg != yymsgbuf) |
| YYSTACK_FREE (yymsg); |
| yymsg = (char *) YYSTACK_ALLOC (yyalloc); |
| if (yymsg) |
| yymsg_alloc = yyalloc; |
| else |
| { |
| yymsg = yymsgbuf; |
| yymsg_alloc = sizeof yymsgbuf; |
| } |
| } |
| |
| if (0 < yysize && yysize <= yymsg_alloc) |
| { |
| (void) yysyntax_error (yymsg, yystate, yychar); |
| yyerror (context, yymsg); |
| } |
| else |
| { |
| yyerror (context, YY_("syntax error")); |
| if (yysize != 0) |
| goto yyexhaustedlab; |
| } |
| } |
| #endif |
| } |
| |
| |
| |
| 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, 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; |
| |
| /* Do not reclaim the symbols of the rule which 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 (yyn != YYPACT_NINF) |
| { |
| 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; |
| |
| |
| yydestruct ("Error: popping", |
| yystos[yystate], yyvsp, context); |
| YYPOPSTACK (1); |
| yystate = *yyssp; |
| YY_STACK_PRINT (yyss, yyssp); |
| } |
| |
| *++yyvsp = yylval; |
| |
| |
| /* 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 (context, YY_("memory exhausted")); |
| yyresult = 2; |
| /* Fall through. */ |
| #endif |
| |
| yyreturn: |
| if (yychar != YYEMPTY) |
| yydestruct ("Cleanup: discarding lookahead", |
| yytoken, &yylval, context); |
| /* Do not reclaim the symbols of the rule which action triggered |
| this YYABORT or YYACCEPT. */ |
| YYPOPSTACK (yylen); |
| YY_STACK_PRINT (yyss, yyssp); |
| while (yyssp != yyss) |
| { |
| yydestruct ("Cleanup: popping", |
| yystos[*yyssp], yyvsp, context); |
| YYPOPSTACK (1); |
| } |
| #ifndef yyoverflow |
| if (yyss != yyssa) |
| YYSTACK_FREE (yyss); |
| #endif |
| #if YYERROR_VERBOSE |
| if (yymsg != yymsgbuf) |
| YYSTACK_FREE (yymsg); |
| #endif |
| /* Make sure YYID is used. */ |
| return YYID (yyresult); |
| } |
| |
| |
| |
| |
| |
| int glslang_parse(TParseContext* context) { |
| return yyparse(context); |
| } |
| |