michael@0: /* A Bison parser, made by GNU Bison 2.7. */
michael@0:
michael@0: /* Bison implementation for Yacc-like parsers in C
michael@0:
michael@0: Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
michael@0:
michael@0: This program is free software: you can redistribute it and/or modify
michael@0: it under the terms of the GNU General Public License as published by
michael@0: the Free Software Foundation, either version 3 of the License, or
michael@0: (at your option) any later version.
michael@0:
michael@0: This program is distributed in the hope that it will be useful,
michael@0: but WITHOUT ANY WARRANTY; without even the implied warranty of
michael@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
michael@0: GNU General Public License for more details.
michael@0:
michael@0: You should have received a copy of the GNU General Public License
michael@0: along with this program. If not, see . */
michael@0:
michael@0: /* As a special exception, you may create a larger work that contains
michael@0: part or all of the Bison parser skeleton and distribute that work
michael@0: under terms of your choice, so long as that work isn't itself a
michael@0: parser generator using the skeleton or a modified version thereof
michael@0: as a parser skeleton. Alternatively, if you modify or redistribute
michael@0: the parser skeleton itself, you may (at your option) remove this
michael@0: special exception, which will cause the skeleton and the resulting
michael@0: Bison output files to be licensed under the GNU General Public
michael@0: License without this special exception.
michael@0:
michael@0: This special exception was added by the Free Software Foundation in
michael@0: version 2.2 of Bison. */
michael@0:
michael@0: /* C LALR(1) parser skeleton written by Richard Stallman, by
michael@0: simplifying the original so-called "semantic" parser. */
michael@0:
michael@0: /* All symbols defined below should begin with yy or YY, to avoid
michael@0: infringing on user name space. This should be done even for local
michael@0: variables, as they might otherwise be expanded by user macros.
michael@0: There are some unavoidable exceptions within include files to
michael@0: define necessary library symbols; they are noted "INFRINGES ON
michael@0: USER NAME SPACE" below. */
michael@0:
michael@0: /* Identify Bison output. */
michael@0: #define YYBISON 1
michael@0:
michael@0: /* Bison version. */
michael@0: #define YYBISON_VERSION "2.7"
michael@0:
michael@0: /* Skeleton name. */
michael@0: #define YYSKELETON_NAME "yacc.c"
michael@0:
michael@0: /* Pure parsers. */
michael@0: #define YYPURE 1
michael@0:
michael@0: /* Push parsers. */
michael@0: #define YYPUSH 0
michael@0:
michael@0: /* Pull parsers. */
michael@0: #define YYPULL 1
michael@0:
michael@0:
michael@0:
michael@0:
michael@0: /* Copy the first part of user declarations. */
michael@0:
michael@0:
michael@0: //
michael@0: // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
michael@0: // Use of this source code is governed by a BSD-style license that can be
michael@0: // found in the LICENSE file.
michael@0: //
michael@0:
michael@0: // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
michael@0:
michael@0: // Ignore errors in auto-generated code.
michael@0: #if defined(__GNUC__)
michael@0: #pragma GCC diagnostic ignored "-Wunused-function"
michael@0: #pragma GCC diagnostic ignored "-Wunused-variable"
michael@0: #pragma GCC diagnostic ignored "-Wswitch-enum"
michael@0: #elif defined(_MSC_VER)
michael@0: #pragma warning(disable: 4065)
michael@0: #pragma warning(disable: 4189)
michael@0: #pragma warning(disable: 4505)
michael@0: #pragma warning(disable: 4701)
michael@0: #endif
michael@0:
michael@0: #include "compiler/SymbolTable.h"
michael@0: #include "compiler/ParseHelper.h"
michael@0: #include "GLSLANG/ShaderLang.h"
michael@0:
michael@0: #define YYENABLE_NLS 0
michael@0:
michael@0: #define YYLEX_PARAM context->scanner
michael@0:
michael@0:
michael@0:
michael@0: # ifndef YY_NULL
michael@0: # if defined __cplusplus && 201103L <= __cplusplus
michael@0: # define YY_NULL nullptr
michael@0: # else
michael@0: # define YY_NULL 0
michael@0: # endif
michael@0: # endif
michael@0:
michael@0: /* Enabling verbose error messages. */
michael@0: #ifdef YYERROR_VERBOSE
michael@0: # undef YYERROR_VERBOSE
michael@0: # define YYERROR_VERBOSE 1
michael@0: #else
michael@0: # define YYERROR_VERBOSE 0
michael@0: #endif
michael@0:
michael@0: /* In a future release of Bison, this section will be replaced
michael@0: by #include "glslang_tab.h". */
michael@0: #ifndef YY_YY_GLSLANG_TAB_H_INCLUDED
michael@0: # define YY_YY_GLSLANG_TAB_H_INCLUDED
michael@0: /* Enabling traces. */
michael@0: #ifndef YYDEBUG
michael@0: # define YYDEBUG 0
michael@0: #endif
michael@0: #if YYDEBUG
michael@0: extern int yydebug;
michael@0: #endif
michael@0: /* "%code requires" blocks. */
michael@0:
michael@0:
michael@0: #define YYLTYPE TSourceLoc
michael@0: #define YYLTYPE_IS_DECLARED 1
michael@0:
michael@0:
michael@0:
michael@0:
michael@0: /* Tokens. */
michael@0: #ifndef YYTOKENTYPE
michael@0: # define YYTOKENTYPE
michael@0: /* Put the tokens into the symbol table, so that GDB and other debuggers
michael@0: know about them. */
michael@0: enum yytokentype {
michael@0: INVARIANT = 258,
michael@0: HIGH_PRECISION = 259,
michael@0: MEDIUM_PRECISION = 260,
michael@0: LOW_PRECISION = 261,
michael@0: PRECISION = 262,
michael@0: ATTRIBUTE = 263,
michael@0: CONST_QUAL = 264,
michael@0: BOOL_TYPE = 265,
michael@0: FLOAT_TYPE = 266,
michael@0: INT_TYPE = 267,
michael@0: BREAK = 268,
michael@0: CONTINUE = 269,
michael@0: DO = 270,
michael@0: ELSE = 271,
michael@0: FOR = 272,
michael@0: IF = 273,
michael@0: DISCARD = 274,
michael@0: RETURN = 275,
michael@0: BVEC2 = 276,
michael@0: BVEC3 = 277,
michael@0: BVEC4 = 278,
michael@0: IVEC2 = 279,
michael@0: IVEC3 = 280,
michael@0: IVEC4 = 281,
michael@0: VEC2 = 282,
michael@0: VEC3 = 283,
michael@0: VEC4 = 284,
michael@0: MATRIX2 = 285,
michael@0: MATRIX3 = 286,
michael@0: MATRIX4 = 287,
michael@0: IN_QUAL = 288,
michael@0: OUT_QUAL = 289,
michael@0: INOUT_QUAL = 290,
michael@0: UNIFORM = 291,
michael@0: VARYING = 292,
michael@0: STRUCT = 293,
michael@0: VOID_TYPE = 294,
michael@0: WHILE = 295,
michael@0: SAMPLER2D = 296,
michael@0: SAMPLERCUBE = 297,
michael@0: SAMPLER_EXTERNAL_OES = 298,
michael@0: SAMPLER2DRECT = 299,
michael@0: IDENTIFIER = 300,
michael@0: TYPE_NAME = 301,
michael@0: FLOATCONSTANT = 302,
michael@0: INTCONSTANT = 303,
michael@0: BOOLCONSTANT = 304,
michael@0: LEFT_OP = 305,
michael@0: RIGHT_OP = 306,
michael@0: INC_OP = 307,
michael@0: DEC_OP = 308,
michael@0: LE_OP = 309,
michael@0: GE_OP = 310,
michael@0: EQ_OP = 311,
michael@0: NE_OP = 312,
michael@0: AND_OP = 313,
michael@0: OR_OP = 314,
michael@0: XOR_OP = 315,
michael@0: MUL_ASSIGN = 316,
michael@0: DIV_ASSIGN = 317,
michael@0: ADD_ASSIGN = 318,
michael@0: MOD_ASSIGN = 319,
michael@0: LEFT_ASSIGN = 320,
michael@0: RIGHT_ASSIGN = 321,
michael@0: AND_ASSIGN = 322,
michael@0: XOR_ASSIGN = 323,
michael@0: OR_ASSIGN = 324,
michael@0: SUB_ASSIGN = 325,
michael@0: LEFT_PAREN = 326,
michael@0: RIGHT_PAREN = 327,
michael@0: LEFT_BRACKET = 328,
michael@0: RIGHT_BRACKET = 329,
michael@0: LEFT_BRACE = 330,
michael@0: RIGHT_BRACE = 331,
michael@0: DOT = 332,
michael@0: COMMA = 333,
michael@0: COLON = 334,
michael@0: EQUAL = 335,
michael@0: SEMICOLON = 336,
michael@0: BANG = 337,
michael@0: DASH = 338,
michael@0: TILDE = 339,
michael@0: PLUS = 340,
michael@0: STAR = 341,
michael@0: SLASH = 342,
michael@0: PERCENT = 343,
michael@0: LEFT_ANGLE = 344,
michael@0: RIGHT_ANGLE = 345,
michael@0: VERTICAL_BAR = 346,
michael@0: CARET = 347,
michael@0: AMPERSAND = 348,
michael@0: QUESTION = 349
michael@0: };
michael@0: #endif
michael@0:
michael@0:
michael@0: #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
michael@0: typedef union YYSTYPE
michael@0: {
michael@0:
michael@0:
michael@0: struct {
michael@0: union {
michael@0: TString *string;
michael@0: float f;
michael@0: int i;
michael@0: bool b;
michael@0: };
michael@0: TSymbol* symbol;
michael@0: } lex;
michael@0: struct {
michael@0: TOperator op;
michael@0: union {
michael@0: TIntermNode* intermNode;
michael@0: TIntermNodePair nodePair;
michael@0: TIntermTyped* intermTypedNode;
michael@0: TIntermAggregate* intermAggregate;
michael@0: };
michael@0: union {
michael@0: TPublicType type;
michael@0: TPrecision precision;
michael@0: TQualifier qualifier;
michael@0: TFunction* function;
michael@0: TParameter param;
michael@0: TField* field;
michael@0: TFieldList* fieldList;
michael@0: };
michael@0: } interm;
michael@0:
michael@0:
michael@0:
michael@0: } YYSTYPE;
michael@0: # define YYSTYPE_IS_TRIVIAL 1
michael@0: # define yystype YYSTYPE /* obsolescent; will be withdrawn */
michael@0: # define YYSTYPE_IS_DECLARED 1
michael@0: #endif
michael@0:
michael@0: #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
michael@0: typedef struct YYLTYPE
michael@0: {
michael@0: int first_line;
michael@0: int first_column;
michael@0: int last_line;
michael@0: int last_column;
michael@0: } YYLTYPE;
michael@0: # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
michael@0: # define YYLTYPE_IS_DECLARED 1
michael@0: # define YYLTYPE_IS_TRIVIAL 1
michael@0: #endif
michael@0:
michael@0:
michael@0: #ifdef YYPARSE_PARAM
michael@0: #if defined __STDC__ || defined __cplusplus
michael@0: int yyparse (void *YYPARSE_PARAM);
michael@0: #else
michael@0: int yyparse ();
michael@0: #endif
michael@0: #else /* ! YYPARSE_PARAM */
michael@0: #if defined __STDC__ || defined __cplusplus
michael@0: int yyparse (TParseContext* context);
michael@0: #else
michael@0: int yyparse ();
michael@0: #endif
michael@0: #endif /* ! YYPARSE_PARAM */
michael@0:
michael@0: #endif /* !YY_YY_GLSLANG_TAB_H_INCLUDED */
michael@0:
michael@0: /* Copy the second part of user declarations. */
michael@0:
michael@0:
michael@0: extern int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, void* yyscanner);
michael@0: static void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason);
michael@0:
michael@0: #define YYLLOC_DEFAULT(Current, Rhs, N) \
michael@0: do { \
michael@0: if (YYID(N)) { \
michael@0: (Current).first_file = YYRHSLOC(Rhs, 1).first_file; \
michael@0: (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
michael@0: (Current).last_file = YYRHSLOC(Rhs, N).last_file; \
michael@0: (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
michael@0: } \
michael@0: else { \
michael@0: (Current).first_file = YYRHSLOC(Rhs, 0).last_file; \
michael@0: (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
michael@0: (Current).last_file = YYRHSLOC(Rhs, 0).last_file; \
michael@0: (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \
michael@0: } \
michael@0: } while (0)
michael@0:
michael@0: #define VERTEX_ONLY(S, L) { \
michael@0: if (context->shaderType != SH_VERTEX_SHADER) { \
michael@0: context->error(L, " supported in vertex shaders only ", S); \
michael@0: context->recover(); \
michael@0: } \
michael@0: }
michael@0:
michael@0: #define FRAG_ONLY(S, L) { \
michael@0: if (context->shaderType != SH_FRAGMENT_SHADER) { \
michael@0: context->error(L, " supported in fragment shaders only ", S); \
michael@0: context->recover(); \
michael@0: } \
michael@0: }
michael@0:
michael@0:
michael@0:
michael@0: #ifdef short
michael@0: # undef short
michael@0: #endif
michael@0:
michael@0: #ifdef YYTYPE_UINT8
michael@0: typedef YYTYPE_UINT8 yytype_uint8;
michael@0: #else
michael@0: typedef unsigned char yytype_uint8;
michael@0: #endif
michael@0:
michael@0: #ifdef YYTYPE_INT8
michael@0: typedef YYTYPE_INT8 yytype_int8;
michael@0: #elif (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: typedef signed char yytype_int8;
michael@0: #else
michael@0: typedef short int yytype_int8;
michael@0: #endif
michael@0:
michael@0: #ifdef YYTYPE_UINT16
michael@0: typedef YYTYPE_UINT16 yytype_uint16;
michael@0: #else
michael@0: typedef unsigned short int yytype_uint16;
michael@0: #endif
michael@0:
michael@0: #ifdef YYTYPE_INT16
michael@0: typedef YYTYPE_INT16 yytype_int16;
michael@0: #else
michael@0: typedef short int yytype_int16;
michael@0: #endif
michael@0:
michael@0: #ifndef YYSIZE_T
michael@0: # ifdef __SIZE_TYPE__
michael@0: # define YYSIZE_T __SIZE_TYPE__
michael@0: # elif defined size_t
michael@0: # define YYSIZE_T size_t
michael@0: # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: # include /* INFRINGES ON USER NAME SPACE */
michael@0: # define YYSIZE_T size_t
michael@0: # else
michael@0: # define YYSIZE_T unsigned int
michael@0: # endif
michael@0: #endif
michael@0:
michael@0: #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
michael@0:
michael@0: #ifndef YY_
michael@0: # if defined YYENABLE_NLS && YYENABLE_NLS
michael@0: # if ENABLE_NLS
michael@0: # include /* INFRINGES ON USER NAME SPACE */
michael@0: # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
michael@0: # endif
michael@0: # endif
michael@0: # ifndef YY_
michael@0: # define YY_(Msgid) Msgid
michael@0: # endif
michael@0: #endif
michael@0:
michael@0: /* Suppress unused-variable warnings by "using" E. */
michael@0: #if ! defined lint || defined __GNUC__
michael@0: # define YYUSE(E) ((void) (E))
michael@0: #else
michael@0: # define YYUSE(E) /* empty */
michael@0: #endif
michael@0:
michael@0: /* Identity function, used to suppress warnings about constant conditions. */
michael@0: #ifndef lint
michael@0: # define YYID(N) (N)
michael@0: #else
michael@0: #if (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: static int
michael@0: YYID (int yyi)
michael@0: #else
michael@0: static int
michael@0: YYID (yyi)
michael@0: int yyi;
michael@0: #endif
michael@0: {
michael@0: return yyi;
michael@0: }
michael@0: #endif
michael@0:
michael@0: #if ! defined yyoverflow || YYERROR_VERBOSE
michael@0:
michael@0: /* The parser invokes alloca or malloc; define the necessary symbols. */
michael@0:
michael@0: # ifdef YYSTACK_USE_ALLOCA
michael@0: # if YYSTACK_USE_ALLOCA
michael@0: # ifdef __GNUC__
michael@0: # define YYSTACK_ALLOC __builtin_alloca
michael@0: # elif defined __BUILTIN_VA_ARG_INCR
michael@0: # include /* INFRINGES ON USER NAME SPACE */
michael@0: # elif defined _AIX
michael@0: # define YYSTACK_ALLOC __alloca
michael@0: # elif defined _MSC_VER
michael@0: # include /* INFRINGES ON USER NAME SPACE */
michael@0: # define alloca _alloca
michael@0: # else
michael@0: # define YYSTACK_ALLOC alloca
michael@0: # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: # include /* INFRINGES ON USER NAME SPACE */
michael@0: /* Use EXIT_SUCCESS as a witness for stdlib.h. */
michael@0: # ifndef EXIT_SUCCESS
michael@0: # define EXIT_SUCCESS 0
michael@0: # endif
michael@0: # endif
michael@0: # endif
michael@0: # endif
michael@0: # endif
michael@0:
michael@0: # ifdef YYSTACK_ALLOC
michael@0: /* Pacify GCC's `empty if-body' warning. */
michael@0: # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
michael@0: # ifndef YYSTACK_ALLOC_MAXIMUM
michael@0: /* The OS might guarantee only one guard page at the bottom of the stack,
michael@0: and a page size can be as small as 4096 bytes. So we cannot safely
michael@0: invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
michael@0: to allow for a few compiler-allocated temporary stack slots. */
michael@0: # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
michael@0: # endif
michael@0: # else
michael@0: # define YYSTACK_ALLOC YYMALLOC
michael@0: # define YYSTACK_FREE YYFREE
michael@0: # ifndef YYSTACK_ALLOC_MAXIMUM
michael@0: # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
michael@0: # endif
michael@0: # if (defined __cplusplus && ! defined EXIT_SUCCESS \
michael@0: && ! ((defined YYMALLOC || defined malloc) \
michael@0: && (defined YYFREE || defined free)))
michael@0: # include /* INFRINGES ON USER NAME SPACE */
michael@0: # ifndef EXIT_SUCCESS
michael@0: # define EXIT_SUCCESS 0
michael@0: # endif
michael@0: # endif
michael@0: # ifndef YYMALLOC
michael@0: # define YYMALLOC malloc
michael@0: # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
michael@0: # endif
michael@0: # endif
michael@0: # ifndef YYFREE
michael@0: # define YYFREE free
michael@0: # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: void free (void *); /* INFRINGES ON USER NAME SPACE */
michael@0: # endif
michael@0: # endif
michael@0: # endif
michael@0: #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
michael@0:
michael@0:
michael@0: #if (! defined yyoverflow \
michael@0: && (! defined __cplusplus \
michael@0: || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
michael@0: && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
michael@0:
michael@0: /* A type that is properly aligned for any stack member. */
michael@0: union yyalloc
michael@0: {
michael@0: yytype_int16 yyss_alloc;
michael@0: YYSTYPE yyvs_alloc;
michael@0: YYLTYPE yyls_alloc;
michael@0: };
michael@0:
michael@0: /* The size of the maximum gap between one aligned stack and the next. */
michael@0: # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
michael@0:
michael@0: /* The size of an array large to enough to hold all stacks, each with
michael@0: N elements. */
michael@0: # define YYSTACK_BYTES(N) \
michael@0: ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
michael@0: + 2 * YYSTACK_GAP_MAXIMUM)
michael@0:
michael@0: # define YYCOPY_NEEDED 1
michael@0:
michael@0: /* Relocate STACK from its old location to the new one. The
michael@0: local variables YYSIZE and YYSTACKSIZE give the old and new number of
michael@0: elements in the stack, and YYPTR gives the new location of the
michael@0: stack. Advance YYPTR to a properly aligned location for the next
michael@0: stack. */
michael@0: # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
michael@0: do \
michael@0: { \
michael@0: YYSIZE_T yynewbytes; \
michael@0: YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
michael@0: Stack = &yyptr->Stack_alloc; \
michael@0: yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
michael@0: yyptr += yynewbytes / sizeof (*yyptr); \
michael@0: } \
michael@0: while (YYID (0))
michael@0:
michael@0: #endif
michael@0:
michael@0: #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
michael@0: /* Copy COUNT objects from SRC to DST. The source and destination do
michael@0: not overlap. */
michael@0: # ifndef YYCOPY
michael@0: # if defined __GNUC__ && 1 < __GNUC__
michael@0: # define YYCOPY(Dst, Src, Count) \
michael@0: __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
michael@0: # else
michael@0: # define YYCOPY(Dst, Src, Count) \
michael@0: do \
michael@0: { \
michael@0: YYSIZE_T yyi; \
michael@0: for (yyi = 0; yyi < (Count); yyi++) \
michael@0: (Dst)[yyi] = (Src)[yyi]; \
michael@0: } \
michael@0: while (YYID (0))
michael@0: # endif
michael@0: # endif
michael@0: #endif /* !YYCOPY_NEEDED */
michael@0:
michael@0: /* YYFINAL -- State number of the termination state. */
michael@0: #define YYFINAL 74
michael@0: /* YYLAST -- Last index in YYTABLE. */
michael@0: #define YYLAST 1490
michael@0:
michael@0: /* YYNTOKENS -- Number of terminals. */
michael@0: #define YYNTOKENS 95
michael@0: /* YYNNTS -- Number of nonterminals. */
michael@0: #define YYNNTS 84
michael@0: /* YYNRULES -- Number of rules. */
michael@0: #define YYNRULES 202
michael@0: /* YYNRULES -- Number of states. */
michael@0: #define YYNSTATES 307
michael@0:
michael@0: /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
michael@0: #define YYUNDEFTOK 2
michael@0: #define YYMAXUTOK 349
michael@0:
michael@0: #define YYTRANSLATE(YYX) \
michael@0: ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
michael@0:
michael@0: /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
michael@0: static const yytype_uint8 yytranslate[] =
michael@0: {
michael@0: 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
michael@0: 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
michael@0: 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
michael@0: 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
michael@0: 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
michael@0: 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
michael@0: 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
michael@0: 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
michael@0: 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
michael@0: 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
michael@0: 85, 86, 87, 88, 89, 90, 91, 92, 93, 94
michael@0: };
michael@0:
michael@0: #if YYDEBUG
michael@0: /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
michael@0: YYRHS. */
michael@0: static const yytype_uint16 yyprhs[] =
michael@0: {
michael@0: 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
michael@0: 21, 23, 28, 30, 34, 37, 40, 42, 44, 46,
michael@0: 50, 53, 56, 59, 61, 64, 68, 71, 73, 75,
michael@0: 77, 80, 83, 86, 88, 90, 92, 94, 98, 102,
michael@0: 104, 108, 112, 114, 116, 120, 124, 128, 132, 134,
michael@0: 138, 142, 144, 146, 148, 150, 154, 156, 160, 162,
michael@0: 166, 168, 174, 176, 180, 182, 184, 186, 188, 190,
michael@0: 192, 196, 198, 201, 204, 209, 212, 214, 216, 219,
michael@0: 223, 227, 230, 236, 240, 243, 247, 250, 251, 253,
michael@0: 255, 257, 259, 261, 265, 271, 278, 284, 286, 289,
michael@0: 294, 300, 305, 308, 310, 313, 315, 317, 319, 322,
michael@0: 324, 326, 329, 331, 333, 335, 337, 342, 344, 346,
michael@0: 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
michael@0: 368, 370, 372, 374, 376, 378, 380, 382, 384, 386,
michael@0: 387, 394, 395, 401, 403, 406, 410, 412, 416, 418,
michael@0: 423, 425, 427, 429, 431, 433, 435, 437, 439, 441,
michael@0: 444, 445, 446, 452, 454, 456, 457, 460, 461, 464,
michael@0: 467, 471, 473, 476, 478, 481, 487, 491, 493, 495,
michael@0: 500, 501, 508, 509, 518, 519, 527, 529, 531, 533,
michael@0: 534, 537, 541, 544, 547, 550, 554, 557, 559, 562,
michael@0: 564, 566, 567
michael@0: };
michael@0:
michael@0: /* YYRHS -- A `-1'-separated list of the rules' RHS. */
michael@0: static const yytype_int16 yyrhs[] =
michael@0: {
michael@0: 175, 0, -1, 45, -1, 46, -1, 45, -1, 97,
michael@0: -1, 48, -1, 47, -1, 49, -1, 71, 124, 72,
michael@0: -1, 98, -1, 99, 73, 100, 74, -1, 101, -1,
michael@0: 99, 77, 96, -1, 99, 52, -1, 99, 53, -1,
michael@0: 124, -1, 102, -1, 103, -1, 99, 77, 103, -1,
michael@0: 105, 72, -1, 104, 72, -1, 106, 39, -1, 106,
michael@0: -1, 106, 122, -1, 105, 78, 122, -1, 107, 71,
michael@0: -1, 142, -1, 45, -1, 99, -1, 52, 108, -1,
michael@0: 53, 108, -1, 109, 108, -1, 85, -1, 83, -1,
michael@0: 82, -1, 108, -1, 110, 86, 108, -1, 110, 87,
michael@0: 108, -1, 110, -1, 111, 85, 110, -1, 111, 83,
michael@0: 110, -1, 111, -1, 112, -1, 113, 89, 112, -1,
michael@0: 113, 90, 112, -1, 113, 54, 112, -1, 113, 55,
michael@0: 112, -1, 113, -1, 114, 56, 113, -1, 114, 57,
michael@0: 113, -1, 114, -1, 115, -1, 116, -1, 117, -1,
michael@0: 118, 58, 117, -1, 118, -1, 119, 60, 118, -1,
michael@0: 119, -1, 120, 59, 119, -1, 120, -1, 120, 94,
michael@0: 124, 79, 122, -1, 121, -1, 108, 123, 122, -1,
michael@0: 80, -1, 61, -1, 62, -1, 63, -1, 70, -1,
michael@0: 122, -1, 124, 78, 122, -1, 121, -1, 127, 81,
michael@0: -1, 135, 81, -1, 7, 140, 141, 81, -1, 128,
michael@0: 72, -1, 130, -1, 129, -1, 130, 132, -1, 129,
michael@0: 78, 132, -1, 137, 45, 71, -1, 139, 96, -1,
michael@0: 139, 96, 73, 125, 74, -1, 138, 133, 131, -1,
michael@0: 133, 131, -1, 138, 133, 134, -1, 133, 134, -1,
michael@0: -1, 33, -1, 34, -1, 35, -1, 139, -1, 136,
michael@0: -1, 135, 78, 96, -1, 135, 78, 96, 73, 74,
michael@0: -1, 135, 78, 96, 73, 125, 74, -1, 135, 78,
michael@0: 96, 80, 150, -1, 137, -1, 137, 96, -1, 137,
michael@0: 96, 73, 74, -1, 137, 96, 73, 125, 74, -1,
michael@0: 137, 96, 80, 150, -1, 3, 45, -1, 139, -1,
michael@0: 138, 139, -1, 9, -1, 8, -1, 37, -1, 3,
michael@0: 37, -1, 36, -1, 141, -1, 140, 141, -1, 4,
michael@0: -1, 5, -1, 6, -1, 142, -1, 142, 73, 125,
michael@0: 74, -1, 39, -1, 11, -1, 12, -1, 10, -1,
michael@0: 27, -1, 28, -1, 29, -1, 21, -1, 22, -1,
michael@0: 23, -1, 24, -1, 25, -1, 26, -1, 30, -1,
michael@0: 31, -1, 32, -1, 41, -1, 42, -1, 43, -1,
michael@0: 44, -1, 143, -1, 46, -1, -1, 38, 96, 75,
michael@0: 144, 146, 76, -1, -1, 38, 75, 145, 146, 76,
michael@0: -1, 147, -1, 146, 147, -1, 139, 148, 81, -1,
michael@0: 149, -1, 148, 78, 149, -1, 96, -1, 96, 73,
michael@0: 125, 74, -1, 122, -1, 126, -1, 154, -1, 153,
michael@0: -1, 151, -1, 163, -1, 164, -1, 167, -1, 174,
michael@0: -1, 75, 76, -1, -1, -1, 75, 155, 162, 156,
michael@0: 76, -1, 161, -1, 153, -1, -1, 159, 161, -1,
michael@0: -1, 160, 153, -1, 75, 76, -1, 75, 162, 76,
michael@0: -1, 152, -1, 162, 152, -1, 81, -1, 124, 81,
michael@0: -1, 18, 71, 124, 72, 165, -1, 158, 16, 158,
michael@0: -1, 158, -1, 124, -1, 137, 96, 80, 150, -1,
michael@0: -1, 40, 71, 168, 166, 72, 157, -1, -1, 15,
michael@0: 169, 158, 40, 71, 124, 72, 81, -1, -1, 17,
michael@0: 71, 170, 171, 173, 72, 157, -1, 163, -1, 151,
michael@0: -1, 166, -1, -1, 172, 81, -1, 172, 81, 124,
michael@0: -1, 14, 81, -1, 13, 81, -1, 20, 81, -1,
michael@0: 20, 124, 81, -1, 19, 81, -1, 176, -1, 175,
michael@0: 176, -1, 177, -1, 126, -1, -1, 127, 178, 161,
michael@0: -1
michael@0: };
michael@0:
michael@0: /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
michael@0: static const yytype_uint16 yyrline[] =
michael@0: {
michael@0: 0, 179, 179, 180, 183, 226, 229, 242, 247, 252,
michael@0: 258, 261, 264, 267, 362, 372, 385, 393, 493, 496,
michael@0: 504, 507, 513, 517, 524, 530, 539, 547, 602, 612,
michael@0: 615, 625, 635, 656, 657, 658, 663, 664, 672, 683,
michael@0: 684, 692, 703, 707, 708, 718, 728, 738, 751, 752,
michael@0: 762, 775, 779, 783, 787, 788, 801, 802, 815, 816,
michael@0: 829, 830, 847, 848, 861, 862, 863, 864, 865, 869,
michael@0: 872, 883, 891, 918, 923, 937, 992, 995, 1002, 1010,
michael@0: 1031, 1052, 1062, 1090, 1095, 1105, 1110, 1120, 1123, 1126,
michael@0: 1129, 1135, 1142, 1145, 1167, 1185, 1209, 1232, 1236, 1254,
michael@0: 1262, 1294, 1314, 1335, 1344, 1367, 1370, 1376, 1384, 1392,
michael@0: 1400, 1410, 1417, 1420, 1423, 1429, 1432, 1447, 1451, 1455,
michael@0: 1459, 1463, 1468, 1473, 1478, 1483, 1488, 1493, 1498, 1503,
michael@0: 1508, 1513, 1518, 1523, 1527, 1531, 1539, 1547, 1551, 1564,
michael@0: 1564, 1578, 1578, 1587, 1590, 1606, 1639, 1643, 1649, 1656,
michael@0: 1671, 1675, 1679, 1680, 1686, 1687, 1688, 1689, 1690, 1694,
michael@0: 1695, 1695, 1695, 1705, 1706, 1710, 1710, 1711, 1711, 1716,
michael@0: 1719, 1729, 1732, 1738, 1739, 1743, 1751, 1755, 1765, 1770,
michael@0: 1787, 1787, 1792, 1792, 1799, 1799, 1807, 1810, 1816, 1819,
michael@0: 1825, 1829, 1836, 1843, 1850, 1857, 1868, 1877, 1881, 1888,
michael@0: 1891, 1897, 1897
michael@0: };
michael@0: #endif
michael@0:
michael@0: #if YYDEBUG || YYERROR_VERBOSE || 0
michael@0: /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
michael@0: First, the terminals, then, starting at YYNTOKENS, nonterminals. */
michael@0: static const char *const yytname[] =
michael@0: {
michael@0: "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
michael@0: "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
michael@0: "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
michael@0: "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
michael@0: "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
michael@0: "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
michael@0: "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
michael@0: "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
michael@0: "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "LEFT_OP", "RIGHT_OP",
michael@0: "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP",
michael@0: "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN",
michael@0: "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN",
michael@0: "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET",
michael@0: "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON",
michael@0: "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH",
michael@0: "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET",
michael@0: "AMPERSAND", "QUESTION", "$accept", "identifier", "variable_identifier",
michael@0: "primary_expression", "postfix_expression", "integer_expression",
michael@0: "function_call", "function_call_or_method", "function_call_generic",
michael@0: "function_call_header_no_parameters",
michael@0: "function_call_header_with_parameters", "function_call_header",
michael@0: "function_identifier", "unary_expression", "unary_operator",
michael@0: "multiplicative_expression", "additive_expression", "shift_expression",
michael@0: "relational_expression", "equality_expression", "and_expression",
michael@0: "exclusive_or_expression", "inclusive_or_expression",
michael@0: "logical_and_expression", "logical_xor_expression",
michael@0: "logical_or_expression", "conditional_expression",
michael@0: "assignment_expression", "assignment_operator", "expression",
michael@0: "constant_expression", "declaration", "function_prototype",
michael@0: "function_declarator", "function_header_with_parameters",
michael@0: "function_header", "parameter_declarator", "parameter_declaration",
michael@0: "parameter_qualifier", "parameter_type_specifier",
michael@0: "init_declarator_list", "single_declaration", "fully_specified_type",
michael@0: "type_qualifier", "type_specifier", "precision_qualifier",
michael@0: "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
michael@0: "$@1", "$@2", "struct_declaration_list", "struct_declaration",
michael@0: "struct_declarator_list", "struct_declarator", "initializer",
michael@0: "declaration_statement", "statement", "simple_statement",
michael@0: "compound_statement", "$@3", "$@4", "statement_no_new_scope",
michael@0: "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
michael@0: "statement_list", "expression_statement", "selection_statement",
michael@0: "selection_rest_statement", "condition", "iteration_statement", "$@7",
michael@0: "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
michael@0: "jump_statement", "translation_unit", "external_declaration",
michael@0: "function_definition", "$@10", YY_NULL
michael@0: };
michael@0: #endif
michael@0:
michael@0: # ifdef YYPRINT
michael@0: /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
michael@0: token YYLEX-NUM. */
michael@0: static const yytype_uint16 yytoknum[] =
michael@0: {
michael@0: 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
michael@0: 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
michael@0: 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
michael@0: 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
michael@0: 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
michael@0: 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
michael@0: 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
michael@0: 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
michael@0: 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
michael@0: 345, 346, 347, 348, 349
michael@0: };
michael@0: # endif
michael@0:
michael@0: /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
michael@0: static const yytype_uint8 yyr1[] =
michael@0: {
michael@0: 0, 95, 96, 96, 97, 98, 98, 98, 98, 98,
michael@0: 99, 99, 99, 99, 99, 99, 100, 101, 102, 102,
michael@0: 103, 103, 104, 104, 105, 105, 106, 107, 107, 108,
michael@0: 108, 108, 108, 109, 109, 109, 110, 110, 110, 111,
michael@0: 111, 111, 112, 113, 113, 113, 113, 113, 114, 114,
michael@0: 114, 115, 116, 117, 118, 118, 119, 119, 120, 120,
michael@0: 121, 121, 122, 122, 123, 123, 123, 123, 123, 124,
michael@0: 124, 125, 126, 126, 126, 127, 128, 128, 129, 129,
michael@0: 130, 131, 131, 132, 132, 132, 132, 133, 133, 133,
michael@0: 133, 134, 135, 135, 135, 135, 135, 136, 136, 136,
michael@0: 136, 136, 136, 137, 137, 138, 138, 138, 138, 138,
michael@0: 139, 139, 140, 140, 140, 141, 141, 142, 142, 142,
michael@0: 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
michael@0: 142, 142, 142, 142, 142, 142, 142, 142, 142, 144,
michael@0: 143, 145, 143, 146, 146, 147, 148, 148, 149, 149,
michael@0: 150, 151, 152, 152, 153, 153, 153, 153, 153, 154,
michael@0: 155, 156, 154, 157, 157, 159, 158, 160, 158, 161,
michael@0: 161, 162, 162, 163, 163, 164, 165, 165, 166, 166,
michael@0: 168, 167, 169, 167, 170, 167, 171, 171, 172, 172,
michael@0: 173, 173, 174, 174, 174, 174, 174, 175, 175, 176,
michael@0: 176, 178, 177
michael@0: };
michael@0:
michael@0: /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
michael@0: static const yytype_uint8 yyr2[] =
michael@0: {
michael@0: 0, 2, 1, 1, 1, 1, 1, 1, 1, 3,
michael@0: 1, 4, 1, 3, 2, 2, 1, 1, 1, 3,
michael@0: 2, 2, 2, 1, 2, 3, 2, 1, 1, 1,
michael@0: 2, 2, 2, 1, 1, 1, 1, 3, 3, 1,
michael@0: 3, 3, 1, 1, 3, 3, 3, 3, 1, 3,
michael@0: 3, 1, 1, 1, 1, 3, 1, 3, 1, 3,
michael@0: 1, 5, 1, 3, 1, 1, 1, 1, 1, 1,
michael@0: 3, 1, 2, 2, 4, 2, 1, 1, 2, 3,
michael@0: 3, 2, 5, 3, 2, 3, 2, 0, 1, 1,
michael@0: 1, 1, 1, 3, 5, 6, 5, 1, 2, 4,
michael@0: 5, 4, 2, 1, 2, 1, 1, 1, 2, 1,
michael@0: 1, 2, 1, 1, 1, 1, 4, 1, 1, 1,
michael@0: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
michael@0: 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
michael@0: 6, 0, 5, 1, 2, 3, 1, 3, 1, 4,
michael@0: 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
michael@0: 0, 0, 5, 1, 1, 0, 2, 0, 2, 2,
michael@0: 3, 1, 2, 1, 2, 5, 3, 1, 1, 4,
michael@0: 0, 6, 0, 8, 0, 7, 1, 1, 1, 0,
michael@0: 2, 3, 2, 2, 2, 3, 2, 1, 2, 1,
michael@0: 1, 0, 3
michael@0: };
michael@0:
michael@0: /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
michael@0: Performed when YYTABLE doesn't specify something else to do. Zero
michael@0: means the default is an error. */
michael@0: static const yytype_uint8 yydefact[] =
michael@0: {
michael@0: 0, 0, 112, 113, 114, 0, 106, 105, 120, 118,
michael@0: 119, 124, 125, 126, 127, 128, 129, 121, 122, 123,
michael@0: 130, 131, 132, 109, 107, 0, 117, 133, 134, 135,
michael@0: 136, 138, 200, 201, 0, 77, 87, 0, 92, 97,
michael@0: 0, 103, 0, 110, 115, 137, 0, 197, 199, 108,
michael@0: 102, 0, 2, 3, 141, 0, 72, 0, 75, 87,
michael@0: 0, 88, 89, 90, 78, 0, 87, 0, 73, 2,
michael@0: 98, 104, 111, 0, 1, 198, 0, 0, 139, 0,
michael@0: 202, 79, 84, 86, 91, 0, 93, 80, 0, 0,
michael@0: 4, 7, 6, 8, 0, 0, 0, 35, 34, 33,
michael@0: 5, 10, 29, 12, 17, 18, 0, 0, 23, 0,
michael@0: 36, 0, 39, 42, 43, 48, 51, 52, 53, 54,
michael@0: 56, 58, 60, 71, 0, 27, 74, 0, 0, 143,
michael@0: 0, 0, 0, 182, 0, 0, 0, 0, 0, 160,
michael@0: 169, 173, 36, 62, 69, 0, 151, 0, 115, 154,
michael@0: 171, 153, 152, 0, 155, 156, 157, 158, 81, 83,
michael@0: 85, 0, 0, 99, 0, 150, 101, 30, 31, 0,
michael@0: 14, 15, 0, 0, 21, 20, 0, 22, 24, 26,
michael@0: 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 116, 148, 0, 146, 142,
michael@0: 144, 0, 193, 192, 167, 184, 0, 196, 194, 0,
michael@0: 180, 159, 0, 65, 66, 67, 68, 64, 0, 0,
michael@0: 174, 170, 172, 0, 94, 0, 96, 100, 9, 0,
michael@0: 16, 2, 3, 13, 19, 25, 37, 38, 41, 40,
michael@0: 46, 47, 44, 45, 49, 50, 55, 57, 59, 0,
michael@0: 0, 0, 145, 140, 0, 0, 0, 0, 0, 195,
michael@0: 0, 161, 63, 70, 0, 95, 11, 0, 0, 147,
michael@0: 0, 166, 168, 187, 186, 189, 167, 178, 0, 0,
michael@0: 0, 82, 61, 149, 0, 188, 0, 0, 177, 175,
michael@0: 0, 0, 162, 0, 190, 0, 167, 0, 164, 181,
michael@0: 163, 0, 191, 185, 176, 179, 183
michael@0: };
michael@0:
michael@0: /* YYDEFGOTO[NTERM-NUM]. */
michael@0: static const yytype_int16 yydefgoto[] =
michael@0: {
michael@0: -1, 196, 100, 101, 102, 229, 103, 104, 105, 106,
michael@0: 107, 108, 109, 142, 111, 112, 113, 114, 115, 116,
michael@0: 117, 118, 119, 120, 121, 122, 143, 144, 218, 145,
michael@0: 124, 146, 147, 34, 35, 36, 82, 64, 65, 83,
michael@0: 37, 38, 39, 40, 41, 42, 43, 125, 45, 130,
michael@0: 77, 128, 129, 197, 198, 166, 149, 150, 151, 152,
michael@0: 212, 280, 299, 254, 255, 256, 300, 153, 154, 155,
michael@0: 289, 279, 156, 260, 204, 257, 275, 286, 287, 157,
michael@0: 46, 47, 48, 57
michael@0: };
michael@0:
michael@0: /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
michael@0: STATE-NUM. */
michael@0: #define YYPACT_NINF -261
michael@0: static const yytype_int16 yypact[] =
michael@0: {
michael@0: 1327, -20, -261, -261, -261, 113, -261, -261, -261, -261,
michael@0: -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,
michael@0: -261, -261, -261, -261, -261, -19, -261, -261, -261, -261,
michael@0: -261, -261, -261, -61, -40, -28, 75, -7, -261, 24,
michael@0: 1370, -261, 1444, -261, -11, -261, 1283, -261, -261, -261,
michael@0: -261, 1444, -261, -261, -261, 6, -261, 54, -261, 88,
michael@0: 62, -261, -261, -261, -261, 1370, 59, 91, -261, 36,
michael@0: -50, -261, -261, 1051, -261, -261, 63, 1370, -261, 293,
michael@0: -261, -261, -261, -261, 91, 1370, -12, -261, 856, 1051,
michael@0: 77, -261, -261, -261, 1051, 1051, 1051, -261, -261, -261,
michael@0: -261, -261, -14, -261, -261, -261, 84, -44, 1116, 95,
michael@0: -261, 1051, 53, 3, -261, -36, 89, -261, -261, -261,
michael@0: 104, 107, -45, -261, 96, -261, -261, 91, 1184, -261,
michael@0: 1370, 92, 93, -261, 98, 101, 94, 921, 105, 102,
michael@0: -261, -261, 72, -261, -261, 9, -261, -61, 42, -261,
michael@0: -261, -261, -261, 376, -261, -261, -261, -261, 106, -261,
michael@0: -261, 986, 1051, -261, 103, -261, -261, -261, -261, -41,
michael@0: -261, -261, 1051, 1407, -261, -261, 1051, 110, -261, -261,
michael@0: -261, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051,
michael@0: 1051, 1051, 1051, 1051, 1051, -261, 109, 23, -261, -261,
michael@0: -261, 1227, -261, -261, 111, -261, 1051, -261, -261, 25,
michael@0: -261, -261, 459, -261, -261, -261, -261, -261, 1051, 1051,
michael@0: -261, -261, -261, 1051, -261, 114, -261, -261, -261, 115,
michael@0: 112, 77, 116, -261, -261, -261, -261, -261, 53, 53,
michael@0: -261, -261, -261, -261, -36, -36, -261, 104, 107, 76,
michael@0: 1051, 91, -261, -261, 145, 54, 625, 708, -6, -261,
michael@0: 791, 459, -261, -261, 117, -261, -261, 1051, 120, -261,
michael@0: 124, -261, -261, -261, -261, 791, 111, 112, 91, 125,
michael@0: 122, -261, -261, -261, 1051, -261, 118, 128, 180, -261,
michael@0: 126, 542, -261, -5, 1051, 542, 111, 1051, -261, -261,
michael@0: -261, 123, 112, -261, -261, -261, -261
michael@0: };
michael@0:
michael@0: /* YYPGOTO[NTERM-NUM]. */
michael@0: static const yytype_int16 yypgoto[] =
michael@0: {
michael@0: -261, -24, -261, -261, -261, -261, -261, -261, 34, -261,
michael@0: -261, -261, -261, 32, -261, -33, -261, -27, -26, -261,
michael@0: -261, -261, 14, 16, 18, -261, -66, -87, -261, -92,
michael@0: -85, 11, 12, -261, -261, -261, 141, 150, 161, 143,
michael@0: -261, -261, -231, 5, -30, 224, -18, 0, -261, -261,
michael@0: -261, 100, -119, -261, -17, -156, -25, -145, -243, -261,
michael@0: -261, -261, -64, -260, -261, -261, -52, 21, -22, -261,
michael@0: -261, -39, -261, -261, -261, -261, -261, -261, -261, -261,
michael@0: -261, 191, -261, -261
michael@0: };
michael@0:
michael@0: /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
michael@0: positive, shift that token. If negative, reduce the rule which
michael@0: number is the opposite. If YYTABLE_NINF, syntax error. */
michael@0: #define YYTABLE_NINF -166
michael@0: static const yytype_int16 yytable[] =
michael@0: {
michael@0: 44, 55, 165, 164, 169, 80, 226, 123, 222, 200,
michael@0: 71, 32, 33, 272, 193, 70, 288, 49, 185, 186,
michael@0: 56, 178, 123, 88, 72, 50, 52, 53, 175, 278,
michael@0: 89, 228, 58, 76, 176, 84, 304, 219, 170, 171,
michael@0: 44, 66, 44, 86, 278, 209, 44, 127, 298, 194,
michael@0: 59, 44, 298, 187, 188, 84, 54, 32, 33, 172,
michael@0: 158, 161, 73, 173, 66, 44, 276, 301, 162, 69,
michael@0: 53, 67, 219, 219, 68, 165, 225, 44, 60, 148,
michael@0: 230, 78, 200, 6, 7, 44, 183, 219, 184, 235,
michael@0: 220, 60, 61, 62, 63, 123, 6, 7, 127, 49,
michael@0: 127, 251, 249, 219, 252, 110, 259, 87, 61, 62,
michael@0: 63, 23, 24, -27, 258, 73, 222, 2, 3, 4,
michael@0: 110, 61, 62, 63, 23, 24, 167, 168, 44, 79,
michael@0: 44, 262, 263, 213, 214, 215, 52, 53, 264, 181,
michael@0: 182, 305, 216, 180, 126, 189, 190, -76, -28, 233,
michael@0: 238, 239, 217, 148, 219, 267, 174, 123, 240, 241,
michael@0: 242, 243, 191, 244, 245, 268, 179, 192, 277, 205,
michael@0: 195, 127, 206, 202, 203, 207, 210, 227, 211, 223,
michael@0: 282, -117, 250, 277, 123, 270, -165, -138, 265, 266,
michael@0: 219, 281, 293, 110, 283, 284, 296, 291, 292, 294,
michael@0: 295, 44, 302, 271, 306, 246, 297, 234, 247, 81,
michael@0: 165, 248, 148, 236, 237, 110, 110, 110, 110, 110,
michael@0: 110, 110, 110, 110, 110, 110, 159, 85, 160, 51,
michael@0: 201, 303, 273, 261, 269, 274, 285, 75, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 290, 110, 148, 148, 0, 0,
michael@0: 148, 148, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 148, 0, 0, 0, 0,
michael@0: 0, 0, 110, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 148, 0, 0, 0, 148, 1, 2, 3, 4,
michael@0: 5, 6, 7, 8, 9, 10, 131, 132, 133, 0,
michael@0: 134, 135, 136, 137, 11, 12, 13, 14, 15, 16,
michael@0: 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
michael@0: 24, 25, 26, 138, 27, 28, 29, 30, 90, 31,
michael@0: 91, 92, 93, 0, 0, 94, 95, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 96, 0, 0, 0, 139, 140,
michael@0: 0, 0, 0, 0, 141, 97, 98, 0, 99, 1,
michael@0: 2, 3, 4, 5, 6, 7, 8, 9, 10, 131,
michael@0: 132, 133, 0, 134, 135, 136, 137, 11, 12, 13,
michael@0: 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
michael@0: 0, 0, 23, 24, 25, 26, 138, 27, 28, 29,
michael@0: 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 96, 0, 0,
michael@0: 0, 139, 221, 0, 0, 0, 0, 141, 97, 98,
michael@0: 0, 99, 1, 2, 3, 4, 5, 6, 7, 8,
michael@0: 9, 10, 131, 132, 133, 0, 134, 135, 136, 137,
michael@0: 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
michael@0: 21, 22, 0, 0, 0, 23, 24, 25, 26, 138,
michael@0: 27, 28, 29, 30, 90, 31, 91, 92, 93, 0,
michael@0: 0, 94, 95, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 96, 0, 0, 0, 139, 0, 0, 0, 0, 0,
michael@0: 141, 97, 98, 0, 99, 1, 2, 3, 4, 5,
michael@0: 6, 7, 8, 9, 10, 131, 132, 133, 0, 134,
michael@0: 135, 136, 137, 11, 12, 13, 14, 15, 16, 17,
michael@0: 18, 19, 20, 21, 22, 0, 0, 0, 23, 24,
michael@0: 25, 26, 138, 27, 28, 29, 30, 90, 31, 91,
michael@0: 92, 93, 0, 0, 94, 95, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 96, 0, 0, 0, 79, 0, 0,
michael@0: 0, 0, 0, 141, 97, 98, 0, 99, 1, 2,
michael@0: 3, 4, 5, 6, 7, 8, 9, 10, 131, 132,
michael@0: 133, 0, 134, 135, 136, 137, 11, 12, 13, 14,
michael@0: 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
michael@0: 0, 23, 24, 25, 26, 138, 27, 28, 29, 30,
michael@0: 90, 31, 91, 92, 93, 0, 0, 94, 95, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 96, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 141, 97, 98, 0,
michael@0: 99, 1, 2, 3, 4, 5, 6, 7, 8, 9,
michael@0: 10, 0, 0, 0, 0, 0, 0, 0, 0, 11,
michael@0: 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
michael@0: 22, 0, 0, 0, 23, 24, 25, 26, 0, 27,
michael@0: 28, 29, 30, 90, 31, 91, 92, 93, 0, 0,
michael@0: 94, 95, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 141,
michael@0: 97, 98, 0, 99, 60, 2, 3, 4, 0, 6,
michael@0: 7, 8, 9, 10, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 11, 12, 13, 14, 15, 16, 17, 18,
michael@0: 19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
michael@0: 26, 0, 27, 28, 29, 30, 90, 31, 91, 92,
michael@0: 93, 0, 0, 94, 95, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 96, 0, 0, 0, 8, 9, 10, 0,
michael@0: 0, 0, 0, 97, 98, 0, 99, 11, 12, 13,
michael@0: 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
michael@0: 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
michael@0: 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 96, 0, 0,
michael@0: 163, 8, 9, 10, 0, 0, 0, 0, 97, 98,
michael@0: 0, 99, 11, 12, 13, 14, 15, 16, 17, 18,
michael@0: 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
michael@0: 26, 0, 27, 28, 29, 30, 90, 31, 91, 92,
michael@0: 93, 0, 0, 94, 95, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 96, 0, 0, 0, 8, 9, 10, 0,
michael@0: 0, 0, 208, 97, 98, 0, 99, 11, 12, 13,
michael@0: 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
michael@0: 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
michael@0: 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 96, 0, 0,
michael@0: 224, 8, 9, 10, 0, 0, 0, 0, 97, 98,
michael@0: 0, 99, 11, 12, 13, 14, 15, 16, 17, 18,
michael@0: 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
michael@0: 26, 0, 27, 28, 29, 30, 90, 31, 91, 92,
michael@0: 93, 0, 0, 94, 95, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 96, 0, 0, 0, 8, 9, 10, 0,
michael@0: 0, 0, 0, 97, 98, 0, 99, 11, 12, 13,
michael@0: 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
michael@0: 0, 0, 0, 0, 25, 177, 0, 27, 28, 29,
michael@0: 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 0, 0, 96, 2, 3,
michael@0: 4, 0, 0, 0, 8, 9, 10, 0, 97, 98,
michael@0: 0, 99, 0, 0, 0, 11, 12, 13, 14, 15,
michael@0: 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
michael@0: 0, 0, 25, 26, 0, 27, 28, 29, 30, 0,
michael@0: 31, 2, 3, 4, 0, 0, 0, 8, 9, 10,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
michael@0: 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
michael@0: 199, 0, 0, 0, 0, 25, 26, 0, 27, 28,
michael@0: 29, 30, 0, 31, 0, 0, 0, 0, 0, 0,
michael@0: 0, 0, 0, 74, 0, 0, 1, 2, 3, 4,
michael@0: 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
michael@0: 0, 0, 0, 253, 11, 12, 13, 14, 15, 16,
michael@0: 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
michael@0: 24, 25, 26, 0, 27, 28, 29, 30, 0, 31,
michael@0: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
michael@0: 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
michael@0: 0, 0, 0, 23, 24, 25, 26, 0, 27, 28,
michael@0: 29, 30, 0, 31, 2, 3, 4, 0, 0, 0,
michael@0: 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
michael@0: 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
michael@0: 20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
michael@0: 0, 27, 28, 29, 30, 0, 31, 8, 9, 10,
michael@0: 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
michael@0: 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
michael@0: 0, 0, 0, 0, 0, 25, 26, 0, 27, 28,
michael@0: 29, 30, 231, 232, 8, 9, 10, 0, 0, 0,
michael@0: 0, 0, 0, 0, 0, 11, 12, 13, 14, 15,
michael@0: 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
michael@0: 0, 0, 25, 26, 0, 27, 28, 29, 30, 0,
michael@0: 31
michael@0: };
michael@0:
michael@0: #define yypact_value_is_default(Yystate) \
michael@0: (!!((Yystate) == (-261)))
michael@0:
michael@0: #define yytable_value_is_error(Yytable_value) \
michael@0: YYID (0)
michael@0:
michael@0: static const yytype_int16 yycheck[] =
michael@0: {
michael@0: 0, 25, 89, 88, 96, 57, 162, 73, 153, 128,
michael@0: 40, 0, 0, 256, 59, 39, 276, 37, 54, 55,
michael@0: 81, 108, 88, 73, 42, 45, 45, 46, 72, 260,
michael@0: 80, 72, 72, 51, 78, 65, 296, 78, 52, 53,
michael@0: 40, 36, 42, 67, 275, 137, 46, 77, 291, 94,
michael@0: 78, 51, 295, 89, 90, 85, 75, 46, 46, 73,
michael@0: 84, 73, 73, 77, 59, 65, 72, 72, 80, 45,
michael@0: 46, 78, 78, 78, 81, 162, 161, 77, 3, 79,
michael@0: 172, 75, 201, 8, 9, 85, 83, 78, 85, 176,
michael@0: 81, 3, 33, 34, 35, 161, 8, 9, 128, 37,
michael@0: 130, 78, 194, 78, 81, 73, 81, 71, 33, 34,
michael@0: 35, 36, 37, 71, 206, 73, 261, 4, 5, 6,
michael@0: 88, 33, 34, 35, 36, 37, 94, 95, 128, 75,
michael@0: 130, 218, 219, 61, 62, 63, 45, 46, 223, 86,
michael@0: 87, 297, 70, 111, 81, 56, 57, 72, 71, 173,
michael@0: 183, 184, 80, 153, 78, 79, 72, 223, 185, 186,
michael@0: 187, 188, 58, 189, 190, 250, 71, 60, 260, 71,
michael@0: 74, 201, 71, 81, 81, 81, 71, 74, 76, 73,
michael@0: 267, 71, 73, 275, 250, 40, 75, 71, 74, 74,
michael@0: 78, 74, 284, 161, 74, 71, 16, 72, 76, 81,
michael@0: 72, 201, 294, 255, 81, 191, 80, 173, 192, 59,
michael@0: 297, 193, 212, 181, 182, 183, 184, 185, 186, 187,
michael@0: 188, 189, 190, 191, 192, 193, 85, 66, 85, 5,
michael@0: 130, 295, 257, 212, 251, 257, 275, 46, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, 278, 223, 256, 257, -1, -1,
michael@0: 260, 261, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, 275, -1, -1, -1, -1,
michael@0: -1, -1, 250, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, 291, -1, -1, -1, 295, 3, 4, 5, 6,
michael@0: 7, 8, 9, 10, 11, 12, 13, 14, 15, -1,
michael@0: 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
michael@0: 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
michael@0: 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
michael@0: 47, 48, 49, -1, -1, 52, 53, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, 71, -1, -1, -1, 75, 76,
michael@0: -1, -1, -1, -1, 81, 82, 83, -1, 85, 3,
michael@0: 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
michael@0: 14, 15, -1, 17, 18, 19, 20, 21, 22, 23,
michael@0: 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
michael@0: -1, -1, 36, 37, 38, 39, 40, 41, 42, 43,
michael@0: 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, 71, -1, -1,
michael@0: -1, 75, 76, -1, -1, -1, -1, 81, 82, 83,
michael@0: -1, 85, 3, 4, 5, 6, 7, 8, 9, 10,
michael@0: 11, 12, 13, 14, 15, -1, 17, 18, 19, 20,
michael@0: 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
michael@0: 31, 32, -1, -1, -1, 36, 37, 38, 39, 40,
michael@0: 41, 42, 43, 44, 45, 46, 47, 48, 49, -1,
michael@0: -1, 52, 53, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: 71, -1, -1, -1, 75, -1, -1, -1, -1, -1,
michael@0: 81, 82, 83, -1, 85, 3, 4, 5, 6, 7,
michael@0: 8, 9, 10, 11, 12, 13, 14, 15, -1, 17,
michael@0: 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
michael@0: 28, 29, 30, 31, 32, -1, -1, -1, 36, 37,
michael@0: 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
michael@0: 48, 49, -1, -1, 52, 53, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, 71, -1, -1, -1, 75, -1, -1,
michael@0: -1, -1, -1, 81, 82, 83, -1, 85, 3, 4,
michael@0: 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
michael@0: 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
michael@0: 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
michael@0: -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
michael@0: 45, 46, 47, 48, 49, -1, -1, 52, 53, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, 71, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, 81, 82, 83, -1,
michael@0: 85, 3, 4, 5, 6, 7, 8, 9, 10, 11,
michael@0: 12, -1, -1, -1, -1, -1, -1, -1, -1, 21,
michael@0: 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
michael@0: 32, -1, -1, -1, 36, 37, 38, 39, -1, 41,
michael@0: 42, 43, 44, 45, 46, 47, 48, 49, -1, -1,
michael@0: 52, 53, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, 71,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, 81,
michael@0: 82, 83, -1, 85, 3, 4, 5, 6, -1, 8,
michael@0: 9, 10, 11, 12, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, 21, 22, 23, 24, 25, 26, 27, 28,
michael@0: 29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
michael@0: 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
michael@0: 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
michael@0: -1, -1, -1, 82, 83, -1, 85, 21, 22, 23,
michael@0: 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
michael@0: -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
michael@0: 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, 71, -1, -1,
michael@0: 74, 10, 11, 12, -1, -1, -1, -1, 82, 83,
michael@0: -1, 85, 21, 22, 23, 24, 25, 26, 27, 28,
michael@0: 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
michael@0: 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
michael@0: 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
michael@0: -1, -1, 81, 82, 83, -1, 85, 21, 22, 23,
michael@0: 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
michael@0: -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
michael@0: 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, 71, -1, -1,
michael@0: 74, 10, 11, 12, -1, -1, -1, -1, 82, 83,
michael@0: -1, 85, 21, 22, 23, 24, 25, 26, 27, 28,
michael@0: 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
michael@0: 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
michael@0: 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
michael@0: -1, -1, -1, 82, 83, -1, 85, 21, 22, 23,
michael@0: 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
michael@0: -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
michael@0: 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, -1, -1, 71, 4, 5,
michael@0: 6, -1, -1, -1, 10, 11, 12, -1, 82, 83,
michael@0: -1, 85, -1, -1, -1, 21, 22, 23, 24, 25,
michael@0: 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
michael@0: -1, -1, 38, 39, -1, 41, 42, 43, 44, -1,
michael@0: 46, 4, 5, 6, -1, -1, -1, 10, 11, 12,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
michael@0: 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
michael@0: 76, -1, -1, -1, -1, 38, 39, -1, 41, 42,
michael@0: 43, 44, -1, 46, -1, -1, -1, -1, -1, -1,
michael@0: -1, -1, -1, 0, -1, -1, 3, 4, 5, 6,
michael@0: 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
michael@0: -1, -1, -1, 76, 21, 22, 23, 24, 25, 26,
michael@0: 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
michael@0: 37, 38, 39, -1, 41, 42, 43, 44, -1, 46,
michael@0: 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
michael@0: 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
michael@0: -1, -1, -1, 36, 37, 38, 39, -1, 41, 42,
michael@0: 43, 44, -1, 46, 4, 5, 6, -1, -1, -1,
michael@0: 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
michael@0: -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
michael@0: 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
michael@0: -1, 41, 42, 43, 44, -1, 46, 10, 11, 12,
michael@0: -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
michael@0: 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
michael@0: -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
michael@0: 43, 44, 45, 46, 10, 11, 12, -1, -1, -1,
michael@0: -1, -1, -1, -1, -1, 21, 22, 23, 24, 25,
michael@0: 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
michael@0: -1, -1, 38, 39, -1, 41, 42, 43, 44, -1,
michael@0: 46
michael@0: };
michael@0:
michael@0: /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
michael@0: symbol of state STATE-NUM. */
michael@0: static const yytype_uint8 yystos[] =
michael@0: {
michael@0: 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
michael@0: 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
michael@0: 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
michael@0: 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
michael@0: 138, 139, 140, 141, 142, 143, 175, 176, 177, 37,
michael@0: 45, 140, 45, 46, 75, 96, 81, 178, 72, 78,
michael@0: 3, 33, 34, 35, 132, 133, 138, 78, 81, 45,
michael@0: 96, 139, 141, 73, 0, 176, 141, 145, 75, 75,
michael@0: 161, 132, 131, 134, 139, 133, 96, 71, 73, 80,
michael@0: 45, 47, 48, 49, 52, 53, 71, 82, 83, 85,
michael@0: 97, 98, 99, 101, 102, 103, 104, 105, 106, 107,
michael@0: 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
michael@0: 118, 119, 120, 121, 125, 142, 81, 139, 146, 147,
michael@0: 144, 13, 14, 15, 17, 18, 19, 20, 40, 75,
michael@0: 76, 81, 108, 121, 122, 124, 126, 127, 142, 151,
michael@0: 152, 153, 154, 162, 163, 164, 167, 174, 96, 131,
michael@0: 134, 73, 80, 74, 125, 122, 150, 108, 108, 124,
michael@0: 52, 53, 73, 77, 72, 72, 78, 39, 122, 71,
michael@0: 108, 86, 87, 83, 85, 54, 55, 89, 90, 56,
michael@0: 57, 58, 60, 59, 94, 74, 96, 148, 149, 76,
michael@0: 147, 146, 81, 81, 169, 71, 71, 81, 81, 124,
michael@0: 71, 76, 155, 61, 62, 63, 70, 80, 123, 78,
michael@0: 81, 76, 152, 73, 74, 125, 150, 74, 72, 100,
michael@0: 124, 45, 46, 96, 103, 122, 108, 108, 110, 110,
michael@0: 112, 112, 112, 112, 113, 113, 117, 118, 119, 124,
michael@0: 73, 78, 81, 76, 158, 159, 160, 170, 124, 81,
michael@0: 168, 162, 122, 122, 125, 74, 74, 79, 125, 149,
michael@0: 40, 161, 153, 151, 163, 171, 72, 124, 137, 166,
michael@0: 156, 74, 122, 74, 71, 166, 172, 173, 158, 165,
michael@0: 96, 72, 76, 124, 81, 72, 16, 80, 153, 157,
michael@0: 161, 72, 124, 157, 158, 150, 81
michael@0: };
michael@0:
michael@0: #define yyerrok (yyerrstatus = 0)
michael@0: #define yyclearin (yychar = YYEMPTY)
michael@0: #define YYEMPTY (-2)
michael@0: #define YYEOF 0
michael@0:
michael@0: #define YYACCEPT goto yyacceptlab
michael@0: #define YYABORT goto yyabortlab
michael@0: #define YYERROR goto yyerrorlab
michael@0:
michael@0:
michael@0: /* Like YYERROR except do call yyerror. This remains here temporarily
michael@0: to ease the transition to the new meaning of YYERROR, for GCC.
michael@0: Once GCC version 2 has supplanted version 1, this can go. However,
michael@0: YYFAIL appears to be in use. Nevertheless, it is formally deprecated
michael@0: in Bison 2.4.2's NEWS entry, where a plan to phase it out is
michael@0: discussed. */
michael@0:
michael@0: #define YYFAIL goto yyerrlab
michael@0: #if defined YYFAIL
michael@0: /* This is here to suppress warnings from the GCC cpp's
michael@0: -Wunused-macros. Normally we don't worry about that warning, but
michael@0: some users do, and we want to make it easy for users to remove
michael@0: YYFAIL uses, which will produce warnings from Bison 2.5. */
michael@0: #endif
michael@0:
michael@0: #define YYRECOVERING() (!!yyerrstatus)
michael@0:
michael@0: #define YYBACKUP(Token, Value) \
michael@0: do \
michael@0: if (yychar == YYEMPTY) \
michael@0: { \
michael@0: yychar = (Token); \
michael@0: yylval = (Value); \
michael@0: YYPOPSTACK (yylen); \
michael@0: yystate = *yyssp; \
michael@0: goto yybackup; \
michael@0: } \
michael@0: else \
michael@0: { \
michael@0: yyerror (&yylloc, context, YY_("syntax error: cannot back up")); \
michael@0: YYERROR; \
michael@0: } \
michael@0: while (YYID (0))
michael@0:
michael@0: /* Error token number */
michael@0: #define YYTERROR 1
michael@0: #define YYERRCODE 256
michael@0:
michael@0:
michael@0: /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
michael@0: If N is 0, then set CURRENT to the empty location which ends
michael@0: the previous symbol: RHS[0] (always defined). */
michael@0:
michael@0: #ifndef YYLLOC_DEFAULT
michael@0: # define YYLLOC_DEFAULT(Current, Rhs, N) \
michael@0: do \
michael@0: if (YYID (N)) \
michael@0: { \
michael@0: (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
michael@0: (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
michael@0: (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
michael@0: (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
michael@0: } \
michael@0: else \
michael@0: { \
michael@0: (Current).first_line = (Current).last_line = \
michael@0: YYRHSLOC (Rhs, 0).last_line; \
michael@0: (Current).first_column = (Current).last_column = \
michael@0: YYRHSLOC (Rhs, 0).last_column; \
michael@0: } \
michael@0: while (YYID (0))
michael@0: #endif
michael@0:
michael@0: #define YYRHSLOC(Rhs, K) ((Rhs)[K])
michael@0:
michael@0:
michael@0: /* YY_LOCATION_PRINT -- Print the location on the stream.
michael@0: This macro was not mandated originally: define only if we know
michael@0: we won't break user code: when these are the locations we know. */
michael@0:
michael@0: #ifndef YY_LOCATION_PRINT
michael@0: # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
michael@0:
michael@0: /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
michael@0:
michael@0: __attribute__((__unused__))
michael@0: #if (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: static unsigned
michael@0: yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
michael@0: #else
michael@0: static unsigned
michael@0: yy_location_print_ (yyo, yylocp)
michael@0: FILE *yyo;
michael@0: YYLTYPE const * const yylocp;
michael@0: #endif
michael@0: {
michael@0: unsigned res = 0;
michael@0: int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
michael@0: if (0 <= yylocp->first_line)
michael@0: {
michael@0: res += fprintf (yyo, "%d", yylocp->first_line);
michael@0: if (0 <= yylocp->first_column)
michael@0: res += fprintf (yyo, ".%d", yylocp->first_column);
michael@0: }
michael@0: if (0 <= yylocp->last_line)
michael@0: {
michael@0: if (yylocp->first_line < yylocp->last_line)
michael@0: {
michael@0: res += fprintf (yyo, "-%d", yylocp->last_line);
michael@0: if (0 <= end_col)
michael@0: res += fprintf (yyo, ".%d", end_col);
michael@0: }
michael@0: else if (0 <= end_col && yylocp->first_column < end_col)
michael@0: res += fprintf (yyo, "-%d", end_col);
michael@0: }
michael@0: return res;
michael@0: }
michael@0:
michael@0: # define YY_LOCATION_PRINT(File, Loc) \
michael@0: yy_location_print_ (File, &(Loc))
michael@0:
michael@0: # else
michael@0: # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
michael@0: # endif
michael@0: #endif
michael@0:
michael@0:
michael@0: /* YYLEX -- calling `yylex' with the right arguments. */
michael@0: #ifdef YYLEX_PARAM
michael@0: # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
michael@0: #else
michael@0: # define YYLEX yylex (&yylval, &yylloc)
michael@0: #endif
michael@0:
michael@0: /* Enable debugging if requested. */
michael@0: #if YYDEBUG
michael@0:
michael@0: # ifndef YYFPRINTF
michael@0: # include /* INFRINGES ON USER NAME SPACE */
michael@0: # define YYFPRINTF fprintf
michael@0: # endif
michael@0:
michael@0: # define YYDPRINTF(Args) \
michael@0: do { \
michael@0: if (yydebug) \
michael@0: YYFPRINTF Args; \
michael@0: } while (YYID (0))
michael@0:
michael@0: # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
michael@0: do { \
michael@0: if (yydebug) \
michael@0: { \
michael@0: YYFPRINTF (stderr, "%s ", Title); \
michael@0: yy_symbol_print (stderr, \
michael@0: Type, Value, Location, context); \
michael@0: YYFPRINTF (stderr, "\n"); \
michael@0: } \
michael@0: } while (YYID (0))
michael@0:
michael@0:
michael@0: /*--------------------------------.
michael@0: | Print this symbol on YYOUTPUT. |
michael@0: `--------------------------------*/
michael@0:
michael@0: /*ARGSUSED*/
michael@0: #if (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: static void
michael@0: yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context)
michael@0: #else
michael@0: static void
michael@0: yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context)
michael@0: FILE *yyoutput;
michael@0: int yytype;
michael@0: YYSTYPE const * const yyvaluep;
michael@0: YYLTYPE const * const yylocationp;
michael@0: TParseContext* context;
michael@0: #endif
michael@0: {
michael@0: FILE *yyo = yyoutput;
michael@0: YYUSE (yyo);
michael@0: if (!yyvaluep)
michael@0: return;
michael@0: YYUSE (yylocationp);
michael@0: YYUSE (context);
michael@0: # ifdef YYPRINT
michael@0: if (yytype < YYNTOKENS)
michael@0: YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
michael@0: # else
michael@0: YYUSE (yyoutput);
michael@0: # endif
michael@0: switch (yytype)
michael@0: {
michael@0: default:
michael@0: break;
michael@0: }
michael@0: }
michael@0:
michael@0:
michael@0: /*--------------------------------.
michael@0: | Print this symbol on YYOUTPUT. |
michael@0: `--------------------------------*/
michael@0:
michael@0: #if (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: static void
michael@0: yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context)
michael@0: #else
michael@0: static void
michael@0: yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, context)
michael@0: FILE *yyoutput;
michael@0: int yytype;
michael@0: YYSTYPE const * const yyvaluep;
michael@0: YYLTYPE const * const yylocationp;
michael@0: TParseContext* context;
michael@0: #endif
michael@0: {
michael@0: if (yytype < YYNTOKENS)
michael@0: YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
michael@0: else
michael@0: YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
michael@0:
michael@0: YY_LOCATION_PRINT (yyoutput, *yylocationp);
michael@0: YYFPRINTF (yyoutput, ": ");
michael@0: yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context);
michael@0: YYFPRINTF (yyoutput, ")");
michael@0: }
michael@0:
michael@0: /*------------------------------------------------------------------.
michael@0: | yy_stack_print -- Print the state stack from its BOTTOM up to its |
michael@0: | TOP (included). |
michael@0: `------------------------------------------------------------------*/
michael@0:
michael@0: #if (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: static void
michael@0: yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
michael@0: #else
michael@0: static void
michael@0: yy_stack_print (yybottom, yytop)
michael@0: yytype_int16 *yybottom;
michael@0: yytype_int16 *yytop;
michael@0: #endif
michael@0: {
michael@0: YYFPRINTF (stderr, "Stack now");
michael@0: for (; yybottom <= yytop; yybottom++)
michael@0: {
michael@0: int yybot = *yybottom;
michael@0: YYFPRINTF (stderr, " %d", yybot);
michael@0: }
michael@0: YYFPRINTF (stderr, "\n");
michael@0: }
michael@0:
michael@0: # define YY_STACK_PRINT(Bottom, Top) \
michael@0: do { \
michael@0: if (yydebug) \
michael@0: yy_stack_print ((Bottom), (Top)); \
michael@0: } while (YYID (0))
michael@0:
michael@0:
michael@0: /*------------------------------------------------.
michael@0: | Report that the YYRULE is going to be reduced. |
michael@0: `------------------------------------------------*/
michael@0:
michael@0: #if (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: static void
michael@0: yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, TParseContext* context)
michael@0: #else
michael@0: static void
michael@0: yy_reduce_print (yyvsp, yylsp, yyrule, context)
michael@0: YYSTYPE *yyvsp;
michael@0: YYLTYPE *yylsp;
michael@0: int yyrule;
michael@0: TParseContext* context;
michael@0: #endif
michael@0: {
michael@0: int yynrhs = yyr2[yyrule];
michael@0: int yyi;
michael@0: unsigned long int yylno = yyrline[yyrule];
michael@0: YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
michael@0: yyrule - 1, yylno);
michael@0: /* The symbols being reduced. */
michael@0: for (yyi = 0; yyi < yynrhs; yyi++)
michael@0: {
michael@0: YYFPRINTF (stderr, " $%d = ", yyi + 1);
michael@0: yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
michael@0: &(yyvsp[(yyi + 1) - (yynrhs)])
michael@0: , &(yylsp[(yyi + 1) - (yynrhs)]) , context);
michael@0: YYFPRINTF (stderr, "\n");
michael@0: }
michael@0: }
michael@0:
michael@0: # define YY_REDUCE_PRINT(Rule) \
michael@0: do { \
michael@0: if (yydebug) \
michael@0: yy_reduce_print (yyvsp, yylsp, Rule, context); \
michael@0: } while (YYID (0))
michael@0:
michael@0: /* Nonzero means print parse trace. It is left uninitialized so that
michael@0: multiple parsers can coexist. */
michael@0: int yydebug;
michael@0: #else /* !YYDEBUG */
michael@0: # define YYDPRINTF(Args)
michael@0: # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
michael@0: # define YY_STACK_PRINT(Bottom, Top)
michael@0: # define YY_REDUCE_PRINT(Rule)
michael@0: #endif /* !YYDEBUG */
michael@0:
michael@0:
michael@0: /* YYINITDEPTH -- initial size of the parser's stacks. */
michael@0: #ifndef YYINITDEPTH
michael@0: # define YYINITDEPTH 200
michael@0: #endif
michael@0:
michael@0: /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
michael@0: if the built-in stack extension method is used).
michael@0:
michael@0: Do not make this value too large; the results are undefined if
michael@0: YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
michael@0: evaluated with infinite-precision integer arithmetic. */
michael@0:
michael@0: #ifndef YYMAXDEPTH
michael@0: # define YYMAXDEPTH 10000
michael@0: #endif
michael@0:
michael@0:
michael@0: #if YYERROR_VERBOSE
michael@0:
michael@0: # ifndef yystrlen
michael@0: # if defined __GLIBC__ && defined _STRING_H
michael@0: # define yystrlen strlen
michael@0: # else
michael@0: /* Return the length of YYSTR. */
michael@0: #if (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: static YYSIZE_T
michael@0: yystrlen (const char *yystr)
michael@0: #else
michael@0: static YYSIZE_T
michael@0: yystrlen (yystr)
michael@0: const char *yystr;
michael@0: #endif
michael@0: {
michael@0: YYSIZE_T yylen;
michael@0: for (yylen = 0; yystr[yylen]; yylen++)
michael@0: continue;
michael@0: return yylen;
michael@0: }
michael@0: # endif
michael@0: # endif
michael@0:
michael@0: # ifndef yystpcpy
michael@0: # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
michael@0: # define yystpcpy stpcpy
michael@0: # else
michael@0: /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
michael@0: YYDEST. */
michael@0: #if (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: static char *
michael@0: yystpcpy (char *yydest, const char *yysrc)
michael@0: #else
michael@0: static char *
michael@0: yystpcpy (yydest, yysrc)
michael@0: char *yydest;
michael@0: const char *yysrc;
michael@0: #endif
michael@0: {
michael@0: char *yyd = yydest;
michael@0: const char *yys = yysrc;
michael@0:
michael@0: while ((*yyd++ = *yys++) != '\0')
michael@0: continue;
michael@0:
michael@0: return yyd - 1;
michael@0: }
michael@0: # endif
michael@0: # endif
michael@0:
michael@0: # ifndef yytnamerr
michael@0: /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
michael@0: quotes and backslashes, so that it's suitable for yyerror. The
michael@0: heuristic is that double-quoting is unnecessary unless the string
michael@0: contains an apostrophe, a comma, or backslash (other than
michael@0: backslash-backslash). YYSTR is taken from yytname. If YYRES is
michael@0: null, do not copy; instead, return the length of what the result
michael@0: would have been. */
michael@0: static YYSIZE_T
michael@0: yytnamerr (char *yyres, const char *yystr)
michael@0: {
michael@0: if (*yystr == '"')
michael@0: {
michael@0: YYSIZE_T yyn = 0;
michael@0: char const *yyp = yystr;
michael@0:
michael@0: for (;;)
michael@0: switch (*++yyp)
michael@0: {
michael@0: case '\'':
michael@0: case ',':
michael@0: goto do_not_strip_quotes;
michael@0:
michael@0: case '\\':
michael@0: if (*++yyp != '\\')
michael@0: goto do_not_strip_quotes;
michael@0: /* Fall through. */
michael@0: default:
michael@0: if (yyres)
michael@0: yyres[yyn] = *yyp;
michael@0: yyn++;
michael@0: break;
michael@0:
michael@0: case '"':
michael@0: if (yyres)
michael@0: yyres[yyn] = '\0';
michael@0: return yyn;
michael@0: }
michael@0: do_not_strip_quotes: ;
michael@0: }
michael@0:
michael@0: if (! yyres)
michael@0: return yystrlen (yystr);
michael@0:
michael@0: return yystpcpy (yyres, yystr) - yyres;
michael@0: }
michael@0: # endif
michael@0:
michael@0: /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
michael@0: about the unexpected token YYTOKEN for the state stack whose top is
michael@0: YYSSP.
michael@0:
michael@0: Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
michael@0: not large enough to hold the message. In that case, also set
michael@0: *YYMSG_ALLOC to the required number of bytes. Return 2 if the
michael@0: required number of bytes is too large to store. */
michael@0: static int
michael@0: yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
michael@0: yytype_int16 *yyssp, int yytoken)
michael@0: {
michael@0: YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
michael@0: YYSIZE_T yysize = yysize0;
michael@0: enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
michael@0: /* Internationalized format string. */
michael@0: const char *yyformat = YY_NULL;
michael@0: /* Arguments of yyformat. */
michael@0: char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
michael@0: /* Number of reported tokens (one for the "unexpected", one per
michael@0: "expected"). */
michael@0: int yycount = 0;
michael@0:
michael@0: /* There are many possibilities here to consider:
michael@0: - Assume YYFAIL is not used. It's too flawed to consider. See
michael@0:
michael@0: for details. YYERROR is fine as it does not invoke this
michael@0: function.
michael@0: - If this state is a consistent state with a default action, then
michael@0: the only way this function was invoked is if the default action
michael@0: is an error action. In that case, don't check for expected
michael@0: tokens because there are none.
michael@0: - The only way there can be no lookahead present (in yychar) is if
michael@0: this state is a consistent state with a default action. Thus,
michael@0: detecting the absence of a lookahead is sufficient to determine
michael@0: that there is no unexpected or expected token to report. In that
michael@0: case, just report a simple "syntax error".
michael@0: - Don't assume there isn't a lookahead just because this state is a
michael@0: consistent state with a default action. There might have been a
michael@0: previous inconsistent state, consistent state with a non-default
michael@0: action, or user semantic action that manipulated yychar.
michael@0: - Of course, the expected token list depends on states to have
michael@0: correct lookahead information, and it depends on the parser not
michael@0: to perform extra reductions after fetching a lookahead from the
michael@0: scanner and before detecting a syntax error. Thus, state merging
michael@0: (from LALR or IELR) and default reductions corrupt the expected
michael@0: token list. However, the list is correct for canonical LR with
michael@0: one exception: it will still contain any token that will not be
michael@0: accepted due to an error action in a later state.
michael@0: */
michael@0: if (yytoken != YYEMPTY)
michael@0: {
michael@0: int yyn = yypact[*yyssp];
michael@0: yyarg[yycount++] = yytname[yytoken];
michael@0: if (!yypact_value_is_default (yyn))
michael@0: {
michael@0: /* Start YYX at -YYN if negative to avoid negative indexes in
michael@0: YYCHECK. In other words, skip the first -YYN actions for
michael@0: this state because they are default actions. */
michael@0: int yyxbegin = yyn < 0 ? -yyn : 0;
michael@0: /* Stay within bounds of both yycheck and yytname. */
michael@0: int yychecklim = YYLAST - yyn + 1;
michael@0: int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
michael@0: int yyx;
michael@0:
michael@0: for (yyx = yyxbegin; yyx < yyxend; ++yyx)
michael@0: if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
michael@0: && !yytable_value_is_error (yytable[yyx + yyn]))
michael@0: {
michael@0: if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
michael@0: {
michael@0: yycount = 1;
michael@0: yysize = yysize0;
michael@0: break;
michael@0: }
michael@0: yyarg[yycount++] = yytname[yyx];
michael@0: {
michael@0: YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
michael@0: if (! (yysize <= yysize1
michael@0: && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
michael@0: return 2;
michael@0: yysize = yysize1;
michael@0: }
michael@0: }
michael@0: }
michael@0: }
michael@0:
michael@0: switch (yycount)
michael@0: {
michael@0: # define YYCASE_(N, S) \
michael@0: case N: \
michael@0: yyformat = S; \
michael@0: break
michael@0: YYCASE_(0, YY_("syntax error"));
michael@0: YYCASE_(1, YY_("syntax error, unexpected %s"));
michael@0: YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
michael@0: YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
michael@0: YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
michael@0: YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
michael@0: # undef YYCASE_
michael@0: }
michael@0:
michael@0: {
michael@0: YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
michael@0: if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
michael@0: return 2;
michael@0: yysize = yysize1;
michael@0: }
michael@0:
michael@0: if (*yymsg_alloc < yysize)
michael@0: {
michael@0: *yymsg_alloc = 2 * yysize;
michael@0: if (! (yysize <= *yymsg_alloc
michael@0: && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
michael@0: *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
michael@0: return 1;
michael@0: }
michael@0:
michael@0: /* Avoid sprintf, as that infringes on the user's name space.
michael@0: Don't have undefined behavior even if the translation
michael@0: produced a string with the wrong number of "%s"s. */
michael@0: {
michael@0: char *yyp = *yymsg;
michael@0: int yyi = 0;
michael@0: while ((*yyp = *yyformat) != '\0')
michael@0: if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
michael@0: {
michael@0: yyp += yytnamerr (yyp, yyarg[yyi++]);
michael@0: yyformat += 2;
michael@0: }
michael@0: else
michael@0: {
michael@0: yyp++;
michael@0: yyformat++;
michael@0: }
michael@0: }
michael@0: return 0;
michael@0: }
michael@0: #endif /* YYERROR_VERBOSE */
michael@0:
michael@0: /*-----------------------------------------------.
michael@0: | Release the memory associated to this symbol. |
michael@0: `-----------------------------------------------*/
michael@0:
michael@0: /*ARGSUSED*/
michael@0: #if (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: static void
michael@0: yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, TParseContext* context)
michael@0: #else
michael@0: static void
michael@0: yydestruct (yymsg, yytype, yyvaluep, yylocationp, context)
michael@0: const char *yymsg;
michael@0: int yytype;
michael@0: YYSTYPE *yyvaluep;
michael@0: YYLTYPE *yylocationp;
michael@0: TParseContext* context;
michael@0: #endif
michael@0: {
michael@0: YYUSE (yyvaluep);
michael@0: YYUSE (yylocationp);
michael@0: YYUSE (context);
michael@0:
michael@0: if (!yymsg)
michael@0: yymsg = "Deleting";
michael@0: YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
michael@0:
michael@0: switch (yytype)
michael@0: {
michael@0:
michael@0: default:
michael@0: break;
michael@0: }
michael@0: }
michael@0:
michael@0:
michael@0:
michael@0:
michael@0: /*----------.
michael@0: | yyparse. |
michael@0: `----------*/
michael@0:
michael@0: #ifdef YYPARSE_PARAM
michael@0: #if (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: int
michael@0: yyparse (void *YYPARSE_PARAM)
michael@0: #else
michael@0: int
michael@0: yyparse (YYPARSE_PARAM)
michael@0: void *YYPARSE_PARAM;
michael@0: #endif
michael@0: #else /* ! YYPARSE_PARAM */
michael@0: #if (defined __STDC__ || defined __C99__FUNC__ \
michael@0: || defined __cplusplus || defined _MSC_VER)
michael@0: int
michael@0: yyparse (TParseContext* context)
michael@0: #else
michael@0: int
michael@0: yyparse (context)
michael@0: TParseContext* context;
michael@0: #endif
michael@0: #endif
michael@0: {
michael@0: /* The lookahead symbol. */
michael@0: int yychar;
michael@0:
michael@0:
michael@0: #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
michael@0: /* Suppress an incorrect diagnostic about yylval being uninitialized. */
michael@0: # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
michael@0: _Pragma ("GCC diagnostic push") \
michael@0: _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
michael@0: _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
michael@0: # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
michael@0: _Pragma ("GCC diagnostic pop")
michael@0: #else
michael@0: /* Default value used for initialization, for pacifying older GCCs
michael@0: or non-GCC compilers. */
michael@0: static YYSTYPE yyval_default;
michael@0: # define YY_INITIAL_VALUE(Value) = Value
michael@0: #endif
michael@0: static YYLTYPE yyloc_default
michael@0: # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
michael@0: = { 1, 1, 1, 1 }
michael@0: # endif
michael@0: ;
michael@0: #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
michael@0: # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
michael@0: # define YY_IGNORE_MAYBE_UNINITIALIZED_END
michael@0: #endif
michael@0: #ifndef YY_INITIAL_VALUE
michael@0: # define YY_INITIAL_VALUE(Value) /* Nothing. */
michael@0: #endif
michael@0:
michael@0: /* The semantic value of the lookahead symbol. */
michael@0: YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
michael@0:
michael@0: /* Location data for the lookahead symbol. */
michael@0: YYLTYPE yylloc = yyloc_default;
michael@0:
michael@0:
michael@0: /* Number of syntax errors so far. */
michael@0: int yynerrs;
michael@0:
michael@0: int yystate;
michael@0: /* Number of tokens to shift before error messages enabled. */
michael@0: int yyerrstatus;
michael@0:
michael@0: /* The stacks and their tools:
michael@0: `yyss': related to states.
michael@0: `yyvs': related to semantic values.
michael@0: `yyls': related to locations.
michael@0:
michael@0: Refer to the stacks through separate pointers, to allow yyoverflow
michael@0: to reallocate them elsewhere. */
michael@0:
michael@0: /* The state stack. */
michael@0: yytype_int16 yyssa[YYINITDEPTH];
michael@0: yytype_int16 *yyss;
michael@0: yytype_int16 *yyssp;
michael@0:
michael@0: /* The semantic value stack. */
michael@0: YYSTYPE yyvsa[YYINITDEPTH];
michael@0: YYSTYPE *yyvs;
michael@0: YYSTYPE *yyvsp;
michael@0:
michael@0: /* The location stack. */
michael@0: YYLTYPE yylsa[YYINITDEPTH];
michael@0: YYLTYPE *yyls;
michael@0: YYLTYPE *yylsp;
michael@0:
michael@0: /* The locations where the error started and ended. */
michael@0: YYLTYPE yyerror_range[3];
michael@0:
michael@0: YYSIZE_T yystacksize;
michael@0:
michael@0: int yyn;
michael@0: int yyresult;
michael@0: /* Lookahead token as an internal (translated) token number. */
michael@0: int yytoken = 0;
michael@0: /* The variables used to return semantic value and location from the
michael@0: action routines. */
michael@0: YYSTYPE yyval;
michael@0: YYLTYPE yyloc;
michael@0:
michael@0: #if YYERROR_VERBOSE
michael@0: /* Buffer for error messages, and its allocated size. */
michael@0: char yymsgbuf[128];
michael@0: char *yymsg = yymsgbuf;
michael@0: YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
michael@0: #endif
michael@0:
michael@0: #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
michael@0:
michael@0: /* The number of symbols on the RHS of the reduced rule.
michael@0: Keep to zero when no symbol should be popped. */
michael@0: int yylen = 0;
michael@0:
michael@0: yyssp = yyss = yyssa;
michael@0: yyvsp = yyvs = yyvsa;
michael@0: yylsp = yyls = yylsa;
michael@0: yystacksize = YYINITDEPTH;
michael@0:
michael@0: YYDPRINTF ((stderr, "Starting parse\n"));
michael@0:
michael@0: yystate = 0;
michael@0: yyerrstatus = 0;
michael@0: yynerrs = 0;
michael@0: yychar = YYEMPTY; /* Cause a token to be read. */
michael@0: yylsp[0] = yylloc;
michael@0: goto yysetstate;
michael@0:
michael@0: /*------------------------------------------------------------.
michael@0: | yynewstate -- Push a new state, which is found in yystate. |
michael@0: `------------------------------------------------------------*/
michael@0: yynewstate:
michael@0: /* In all cases, when you get here, the value and location stacks
michael@0: have just been pushed. So pushing a state here evens the stacks. */
michael@0: yyssp++;
michael@0:
michael@0: yysetstate:
michael@0: *yyssp = yystate;
michael@0:
michael@0: if (yyss + yystacksize - 1 <= yyssp)
michael@0: {
michael@0: /* Get the current used size of the three stacks, in elements. */
michael@0: YYSIZE_T yysize = yyssp - yyss + 1;
michael@0:
michael@0: #ifdef yyoverflow
michael@0: {
michael@0: /* Give user a chance to reallocate the stack. Use copies of
michael@0: these so that the &'s don't force the real ones into
michael@0: memory. */
michael@0: YYSTYPE *yyvs1 = yyvs;
michael@0: yytype_int16 *yyss1 = yyss;
michael@0: YYLTYPE *yyls1 = yyls;
michael@0:
michael@0: /* Each stack pointer address is followed by the size of the
michael@0: data in use in that stack, in bytes. This used to be a
michael@0: conditional around just the two extra args, but that might
michael@0: be undefined if yyoverflow is a macro. */
michael@0: yyoverflow (YY_("memory exhausted"),
michael@0: &yyss1, yysize * sizeof (*yyssp),
michael@0: &yyvs1, yysize * sizeof (*yyvsp),
michael@0: &yyls1, yysize * sizeof (*yylsp),
michael@0: &yystacksize);
michael@0:
michael@0: yyls = yyls1;
michael@0: yyss = yyss1;
michael@0: yyvs = yyvs1;
michael@0: }
michael@0: #else /* no yyoverflow */
michael@0: # ifndef YYSTACK_RELOCATE
michael@0: goto yyexhaustedlab;
michael@0: # else
michael@0: /* Extend the stack our own way. */
michael@0: if (YYMAXDEPTH <= yystacksize)
michael@0: goto yyexhaustedlab;
michael@0: yystacksize *= 2;
michael@0: if (YYMAXDEPTH < yystacksize)
michael@0: yystacksize = YYMAXDEPTH;
michael@0:
michael@0: {
michael@0: yytype_int16 *yyss1 = yyss;
michael@0: union yyalloc *yyptr =
michael@0: (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
michael@0: if (! yyptr)
michael@0: goto yyexhaustedlab;
michael@0: YYSTACK_RELOCATE (yyss_alloc, yyss);
michael@0: YYSTACK_RELOCATE (yyvs_alloc, yyvs);
michael@0: YYSTACK_RELOCATE (yyls_alloc, yyls);
michael@0: # undef YYSTACK_RELOCATE
michael@0: if (yyss1 != yyssa)
michael@0: YYSTACK_FREE (yyss1);
michael@0: }
michael@0: # endif
michael@0: #endif /* no yyoverflow */
michael@0:
michael@0: yyssp = yyss + yysize - 1;
michael@0: yyvsp = yyvs + yysize - 1;
michael@0: yylsp = yyls + yysize - 1;
michael@0:
michael@0: YYDPRINTF ((stderr, "Stack size increased to %lu\n",
michael@0: (unsigned long int) yystacksize));
michael@0:
michael@0: if (yyss + yystacksize - 1 <= yyssp)
michael@0: YYABORT;
michael@0: }
michael@0:
michael@0: YYDPRINTF ((stderr, "Entering state %d\n", yystate));
michael@0:
michael@0: if (yystate == YYFINAL)
michael@0: YYACCEPT;
michael@0:
michael@0: goto yybackup;
michael@0:
michael@0: /*-----------.
michael@0: | yybackup. |
michael@0: `-----------*/
michael@0: yybackup:
michael@0:
michael@0: /* Do appropriate processing given the current state. Read a
michael@0: lookahead token if we need one and don't already have one. */
michael@0:
michael@0: /* First try to decide what to do without reference to lookahead token. */
michael@0: yyn = yypact[yystate];
michael@0: if (yypact_value_is_default (yyn))
michael@0: goto yydefault;
michael@0:
michael@0: /* Not known => get a lookahead token if don't already have one. */
michael@0:
michael@0: /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
michael@0: if (yychar == YYEMPTY)
michael@0: {
michael@0: YYDPRINTF ((stderr, "Reading a token: "));
michael@0: yychar = YYLEX;
michael@0: }
michael@0:
michael@0: if (yychar <= YYEOF)
michael@0: {
michael@0: yychar = yytoken = YYEOF;
michael@0: YYDPRINTF ((stderr, "Now at end of input.\n"));
michael@0: }
michael@0: else
michael@0: {
michael@0: yytoken = YYTRANSLATE (yychar);
michael@0: YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
michael@0: }
michael@0:
michael@0: /* If the proper action on seeing token YYTOKEN is to reduce or to
michael@0: detect an error, take that action. */
michael@0: yyn += yytoken;
michael@0: if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
michael@0: goto yydefault;
michael@0: yyn = yytable[yyn];
michael@0: if (yyn <= 0)
michael@0: {
michael@0: if (yytable_value_is_error (yyn))
michael@0: goto yyerrlab;
michael@0: yyn = -yyn;
michael@0: goto yyreduce;
michael@0: }
michael@0:
michael@0: /* Count tokens shifted since error; after three, turn off error
michael@0: status. */
michael@0: if (yyerrstatus)
michael@0: yyerrstatus--;
michael@0:
michael@0: /* Shift the lookahead token. */
michael@0: YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
michael@0:
michael@0: /* Discard the shifted token. */
michael@0: yychar = YYEMPTY;
michael@0:
michael@0: yystate = yyn;
michael@0: YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
michael@0: *++yyvsp = yylval;
michael@0: YY_IGNORE_MAYBE_UNINITIALIZED_END
michael@0: *++yylsp = yylloc;
michael@0: goto yynewstate;
michael@0:
michael@0:
michael@0: /*-----------------------------------------------------------.
michael@0: | yydefault -- do the default action for the current state. |
michael@0: `-----------------------------------------------------------*/
michael@0: yydefault:
michael@0: yyn = yydefact[yystate];
michael@0: if (yyn == 0)
michael@0: goto yyerrlab;
michael@0: goto yyreduce;
michael@0:
michael@0:
michael@0: /*-----------------------------.
michael@0: | yyreduce -- Do a reduction. |
michael@0: `-----------------------------*/
michael@0: yyreduce:
michael@0: /* yyn is the number of a rule to reduce with. */
michael@0: yylen = yyr2[yyn];
michael@0:
michael@0: /* If YYLEN is nonzero, implement the default value of the action:
michael@0: `$$ = $1'.
michael@0:
michael@0: Otherwise, the following line sets YYVAL to garbage.
michael@0: This behavior is undocumented and Bison
michael@0: users should not rely upon it. Assigning to YYVAL
michael@0: unconditionally makes the parser a bit smaller, and it avoids a
michael@0: GCC warning that YYVAL may be used uninitialized. */
michael@0: yyval = yyvsp[1-yylen];
michael@0:
michael@0: /* Default location. */
michael@0: YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
michael@0: YY_REDUCE_PRINT (yyn);
michael@0: switch (yyn)
michael@0: {
michael@0: case 4:
michael@0:
michael@0: {
michael@0: // The symbol table search was done in the lexical phase
michael@0: const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
michael@0: const TVariable* variable;
michael@0: if (symbol == 0) {
michael@0: context->error((yylsp[(1) - (1)]), "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
michael@0: context->recover();
michael@0: TType type(EbtFloat, EbpUndefined);
michael@0: TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
michael@0: context->symbolTable.insert(*fakeVariable);
michael@0: variable = fakeVariable;
michael@0: } else {
michael@0: // This identifier can only be a variable type symbol
michael@0: if (! symbol->isVariable()) {
michael@0: context->error((yylsp[(1) - (1)]), "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
michael@0: context->recover();
michael@0: }
michael@0:
michael@0: variable = static_cast(symbol);
michael@0:
michael@0: if (context->symbolTable.findBuiltIn(variable->getName()) &&
michael@0: !variable->getExtension().empty() &&
michael@0: context->extensionErrorCheck((yylsp[(1) - (1)]), variable->getExtension())) {
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0:
michael@0: // don't delete $1.string, it's used by error recovery, and the pool
michael@0: // pop will reclaim the memory
michael@0:
michael@0: if (variable->getType().getQualifier() == EvqConst ) {
michael@0: ConstantUnion* constArray = variable->getConstPointer();
michael@0: TType t(variable->getType());
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yylsp[(1) - (1)]));
michael@0: } else
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
michael@0: variable->getName(),
michael@0: variable->getType(),
michael@0: (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 5:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 6:
michael@0:
michael@0: {
michael@0: //
michael@0: // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
michael@0: // check for overflow for constants
michael@0: //
michael@0: if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
michael@0: context->error((yylsp[(1) - (1)]), " integer constant overflow", "");
michael@0: context->recover();
michael@0: }
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 7:
michael@0:
michael@0: {
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 8:
michael@0:
michael@0: {
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 9:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 10:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 11:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->addIndexExpression((yyvsp[(1) - (4)].interm.intermTypedNode), (yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 12:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 13:
michael@0:
michael@0: {
michael@0: if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
michael@0: context->error((yylsp[(3) - (3)]), "cannot apply dot operator to an array", ".");
michael@0: context->recover();
michael@0: }
michael@0:
michael@0: if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
michael@0: TVectorFields fields;
michael@0: if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yylsp[(3) - (3)]))) {
michael@0: fields.num = 1;
michael@0: fields.offsets[0] = 0;
michael@0: context->recover();
michael@0: }
michael@0:
michael@0: if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
michael@0: (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(3) - (3)]));
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: else
michael@0: (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()));
michael@0: } else {
michael@0: TString vectorString = *(yyvsp[(3) - (3)].lex).string;
michael@0: TIntermTyped* index = context->intermediate.addSwizzle(fields, (yylsp[(3) - (3)]));
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
michael@0: (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
michael@0: }
michael@0: } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
michael@0: TMatrixFields fields;
michael@0: if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yylsp[(3) - (3)]))) {
michael@0: fields.wholeRow = false;
michael@0: fields.wholeCol = false;
michael@0: fields.row = 0;
michael@0: fields.col = 0;
michael@0: context->recover();
michael@0: }
michael@0:
michael@0: if (fields.wholeRow || fields.wholeCol) {
michael@0: context->error((yylsp[(2) - (3)]), " non-scalar fields not implemented yet", ".");
michael@0: context->recover();
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setIConst(0);
michael@0: TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(3) - (3)]));
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
michael@0: (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
michael@0: } else {
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
michael@0: TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(3) - (3)]));
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
michael@0: (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
michael@0: }
michael@0: } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
michael@0: bool fieldFound = false;
michael@0: const TFieldList& fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct()->fields();
michael@0: unsigned int i;
michael@0: for (i = 0; i < fields.size(); ++i) {
michael@0: if (fields[i]->name() == *(yyvsp[(3) - (3)].lex).string) {
michael@0: fieldFound = true;
michael@0: break;
michael@0: }
michael@0: }
michael@0: if (fieldFound) {
michael@0: if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
michael@0: (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: else {
michael@0: (yyval.interm.intermTypedNode)->setType(*fields[i]->type());
michael@0: // change the qualifier of the return type, not of the structure field
michael@0: // as the structure definition is shared between various structures.
michael@0: (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
michael@0: }
michael@0: } else {
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setIConst(i);
michael@0: TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *fields[i]->type(), (yylsp[(3) - (3)]));
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
michael@0: (yyval.interm.intermTypedNode)->setType(*fields[i]->type());
michael@0: }
michael@0: } else {
michael@0: context->error((yylsp[(2) - (3)]), " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: } else {
michael@0: context->error((yylsp[(2) - (3)]), " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: // don't delete $3.string, it's from the pool
michael@0: }
michael@0: break;
michael@0:
michael@0: case 14:
michael@0:
michael@0: {
michael@0: if (context->lValueErrorCheck((yylsp[(2) - (2)]), "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->unaryOpError((yylsp[(2) - (2)]), "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 15:
michael@0:
michael@0: {
michael@0: if (context->lValueErrorCheck((yylsp[(2) - (2)]), "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->unaryOpError((yylsp[(2) - (2)]), "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 16:
michael@0:
michael@0: {
michael@0: if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 17:
michael@0:
michael@0: {
michael@0: TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
michael@0: TOperator op = fnCall->getBuiltInOp();
michael@0:
michael@0: if (op != EOpNull)
michael@0: {
michael@0: //
michael@0: // Then this should be a constructor.
michael@0: // Don't go through the symbol table for constructors.
michael@0: // Their parameters will be verified algorithmically.
michael@0: //
michael@0: TType type(EbtVoid, EbpUndefined); // use this to get the type back
michael@0: if (context->constructorErrorCheck((yylsp[(1) - (1)]), (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
michael@0: (yyval.interm.intermTypedNode) = 0;
michael@0: } else {
michael@0: //
michael@0: // It's a constructor, of type 'type'.
michael@0: //
michael@0: (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yylsp[(1) - (1)]));
michael@0: }
michael@0:
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yylsp[(1) - (1)]));
michael@0: }
michael@0: (yyval.interm.intermTypedNode)->setType(type);
michael@0: } else {
michael@0: //
michael@0: // Not a constructor. Find it in the symbol table.
michael@0: //
michael@0: const TFunction* fnCandidate;
michael@0: bool builtIn;
michael@0: fnCandidate = context->findFunction((yylsp[(1) - (1)]), fnCall, &builtIn);
michael@0: if (fnCandidate) {
michael@0: //
michael@0: // A declared function.
michael@0: //
michael@0: if (builtIn && !fnCandidate->getExtension().empty() &&
michael@0: context->extensionErrorCheck((yylsp[(1) - (1)]), fnCandidate->getExtension())) {
michael@0: context->recover();
michael@0: }
michael@0: op = fnCandidate->getBuiltInOp();
michael@0: if (builtIn && op != EOpNull) {
michael@0: //
michael@0: // A function call mapped to a built-in operation.
michael@0: //
michael@0: if (fnCandidate->getParamCount() == 1) {
michael@0: //
michael@0: // Treat it like a built-in unary operator.
michael@0: //
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, (yylsp[(1) - (1)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: std::stringstream extraInfoStream;
michael@0: extraInfoStream << "built in unary operator function. Type: " << static_cast((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
michael@0: std::string extraInfo = extraInfoStream.str();
michael@0: context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
michael@0: YYERROR;
michael@0: }
michael@0: } else {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yylsp[(1) - (1)]));
michael@0: }
michael@0: } else {
michael@0: // This is a real function call
michael@0:
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
michael@0:
michael@0: // this is how we know whether the given function is a builtIn function or a user defined function
michael@0: // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
michael@0: // if builtIn == true, it's definitely a builtIn function with EOpNull
michael@0: if (!builtIn)
michael@0: (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
michael@0: (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
michael@0:
michael@0: TQualifier qual;
michael@0: for (size_t i = 0; i < fnCandidate->getParamCount(); ++i) {
michael@0: qual = fnCandidate->getParam(i).type->getQualifier();
michael@0: if (qual == EvqOut || qual == EvqInOut) {
michael@0: if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
michael@0: context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error");
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0: }
michael@0: }
michael@0: (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
michael@0: } else {
michael@0: // error message was put out by PaFindFunction()
michael@0: // Put on a dummy node for error recovery
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setFConst(0.0f);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0: delete fnCall;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 18:
michael@0:
michael@0: {
michael@0: (yyval.interm) = (yyvsp[(1) - (1)].interm);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 19:
michael@0:
michael@0: {
michael@0: context->error((yylsp[(3) - (3)]), "methods are not supported", "");
michael@0: context->recover();
michael@0: (yyval.interm) = (yyvsp[(3) - (3)].interm);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 20:
michael@0:
michael@0: {
michael@0: (yyval.interm) = (yyvsp[(1) - (2)].interm);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 21:
michael@0:
michael@0: {
michael@0: (yyval.interm) = (yyvsp[(1) - (2)].interm);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 22:
michael@0:
michael@0: {
michael@0: (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
michael@0: (yyval.interm).intermNode = 0;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 23:
michael@0:
michael@0: {
michael@0: (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
michael@0: (yyval.interm).intermNode = 0;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 24:
michael@0:
michael@0: {
michael@0: TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
michael@0: (yyvsp[(1) - (2)].interm.function)->addParameter(param);
michael@0: (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
michael@0: (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 25:
michael@0:
michael@0: {
michael@0: TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
michael@0: (yyvsp[(1) - (3)].interm).function->addParameter(param);
michael@0: (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
michael@0: (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 26:
michael@0:
michael@0: {
michael@0: (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 27:
michael@0:
michael@0: {
michael@0: //
michael@0: // Constructor
michael@0: //
michael@0: TOperator op = EOpNull;
michael@0: if ((yyvsp[(1) - (1)].interm.type).userDef) {
michael@0: op = EOpConstructStruct;
michael@0: } else {
michael@0: switch ((yyvsp[(1) - (1)].interm.type).type) {
michael@0: case EbtFloat:
michael@0: if ((yyvsp[(1) - (1)].interm.type).matrix) {
michael@0: switch((yyvsp[(1) - (1)].interm.type).size) {
michael@0: case 2: op = EOpConstructMat2; break;
michael@0: case 3: op = EOpConstructMat3; break;
michael@0: case 4: op = EOpConstructMat4; break;
michael@0: }
michael@0: } else {
michael@0: switch((yyvsp[(1) - (1)].interm.type).size) {
michael@0: case 1: op = EOpConstructFloat; break;
michael@0: case 2: op = EOpConstructVec2; break;
michael@0: case 3: op = EOpConstructVec3; break;
michael@0: case 4: op = EOpConstructVec4; break;
michael@0: }
michael@0: }
michael@0: break;
michael@0: case EbtInt:
michael@0: switch((yyvsp[(1) - (1)].interm.type).size) {
michael@0: case 1: op = EOpConstructInt; break;
michael@0: case 2: op = EOpConstructIVec2; break;
michael@0: case 3: op = EOpConstructIVec3; break;
michael@0: case 4: op = EOpConstructIVec4; break;
michael@0: }
michael@0: break;
michael@0: case EbtBool:
michael@0: switch((yyvsp[(1) - (1)].interm.type).size) {
michael@0: case 1: op = EOpConstructBool; break;
michael@0: case 2: op = EOpConstructBVec2; break;
michael@0: case 3: op = EOpConstructBVec3; break;
michael@0: case 4: op = EOpConstructBVec4; break;
michael@0: }
michael@0: break;
michael@0: default: break;
michael@0: }
michael@0: if (op == EOpNull) {
michael@0: context->error((yylsp[(1) - (1)]), "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
michael@0: context->recover();
michael@0: (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
michael@0: op = EOpConstructFloat;
michael@0: }
michael@0: }
michael@0: TString tempString;
michael@0: TType type((yyvsp[(1) - (1)].interm.type));
michael@0: TFunction *function = new TFunction(&tempString, type, op);
michael@0: (yyval.interm.function) = function;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 28:
michael@0:
michael@0: {
michael@0: if (context->reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string))
michael@0: context->recover();
michael@0: TType type(EbtVoid, EbpUndefined);
michael@0: TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
michael@0: (yyval.interm.function) = function;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 29:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 30:
michael@0:
michael@0: {
michael@0: if (context->lValueErrorCheck((yylsp[(1) - (2)]), "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->unaryOpError((yylsp[(1) - (2)]), "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 31:
michael@0:
michael@0: {
michael@0: if (context->lValueErrorCheck((yylsp[(1) - (2)]), "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->unaryOpError((yylsp[(1) - (2)]), "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 32:
michael@0:
michael@0: {
michael@0: if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: const char* errorOp = "";
michael@0: switch((yyvsp[(1) - (2)].interm).op) {
michael@0: case EOpNegative: errorOp = "-"; break;
michael@0: case EOpLogicalNot: errorOp = "!"; break;
michael@0: default: break;
michael@0: }
michael@0: context->unaryOpError((yylsp[(1) - (2)]), errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
michael@0: }
michael@0: } else
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 33:
michael@0:
michael@0: { (yyval.interm).op = EOpNull; }
michael@0: break;
michael@0:
michael@0: case 34:
michael@0:
michael@0: { (yyval.interm).op = EOpNegative; }
michael@0: break;
michael@0:
michael@0: case 35:
michael@0:
michael@0: { (yyval.interm).op = EOpLogicalNot; }
michael@0: break;
michael@0:
michael@0: case 36:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 37:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 38:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 39:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 40:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 41:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 42:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 43:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 44:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setBConst(false);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 45:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setBConst(false);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 46:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setBConst(false);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 47:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setBConst(false);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 48:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 49:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setBConst(false);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 50:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setBConst(false);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 51:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 52:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 53:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 54:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 55:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setBConst(false);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 56:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 57:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setBConst(false);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 58:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 59:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: ConstantUnion *unionArray = new ConstantUnion[1];
michael@0: unionArray->setBConst(false);
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 60:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 61:
michael@0:
michael@0: {
michael@0: if (context->boolErrorCheck((yylsp[(2) - (5)]), (yyvsp[(1) - (5)].interm.intermTypedNode)))
michael@0: context->recover();
michael@0:
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addSelection((yyvsp[(1) - (5)].interm.intermTypedNode), (yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.intermTypedNode), (yylsp[(2) - (5)]));
michael@0: if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
michael@0: (yyval.interm.intermTypedNode) = 0;
michael@0:
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (5)]), ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 62:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 63:
michael@0:
michael@0: {
michael@0: if (context->lValueErrorCheck((yylsp[(2) - (3)]), "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->assignError((yylsp[(2) - (3)]), "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 64:
michael@0:
michael@0: { (yyval.interm).op = EOpAssign; }
michael@0: break;
michael@0:
michael@0: case 65:
michael@0:
michael@0: { (yyval.interm).op = EOpMulAssign; }
michael@0: break;
michael@0:
michael@0: case 66:
michael@0:
michael@0: { (yyval.interm).op = EOpDivAssign; }
michael@0: break;
michael@0:
michael@0: case 67:
michael@0:
michael@0: { (yyval.interm).op = EOpAddAssign; }
michael@0: break;
michael@0:
michael@0: case 68:
michael@0:
michael@0: { (yyval.interm).op = EOpSubAssign; }
michael@0: break;
michael@0:
michael@0: case 69:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 70:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
michael@0: if ((yyval.interm.intermTypedNode) == 0) {
michael@0: context->binaryOpError((yylsp[(2) - (3)]), ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 71:
michael@0:
michael@0: {
michael@0: if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 72:
michael@0:
michael@0: {
michael@0: TFunction &function = *((yyvsp[(1) - (2)].interm).function);
michael@0:
michael@0: TIntermAggregate *prototype = new TIntermAggregate;
michael@0: prototype->setType(function.getReturnType());
michael@0: prototype->setName(function.getName());
michael@0:
michael@0: for (size_t i = 0; i < function.getParamCount(); i++)
michael@0: {
michael@0: const TParameter ¶m = function.getParam(i);
michael@0: if (param.name != 0)
michael@0: {
michael@0: TVariable variable(param.name, *param.type);
michael@0:
michael@0: prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), (yylsp[(1) - (2)])), (yylsp[(1) - (2)]));
michael@0: }
michael@0: else
michael@0: {
michael@0: prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yylsp[(1) - (2)])), (yylsp[(1) - (2)]));
michael@0: }
michael@0: }
michael@0:
michael@0: prototype->setOp(EOpPrototype);
michael@0: (yyval.interm.intermNode) = prototype;
michael@0:
michael@0: context->symbolTable.pop();
michael@0: }
michael@0: break;
michael@0:
michael@0: case 73:
michael@0:
michael@0: {
michael@0: if ((yyvsp[(1) - (2)].interm).intermAggregate)
michael@0: (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
michael@0: (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 74:
michael@0:
michael@0: {
michael@0: if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
michael@0: context->error((yylsp[(1) - (4)]), "precision is not supported in fragment shader", "highp");
michael@0: context->recover();
michael@0: }
michael@0: if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
michael@0: context->error((yylsp[(1) - (4)]), "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
michael@0: context->recover();
michael@0: }
michael@0: (yyval.interm.intermNode) = 0;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 75:
michael@0:
michael@0: {
michael@0: //
michael@0: // Multiple declarations of the same function are allowed.
michael@0: //
michael@0: // If this is a definition, the definition production code will check for redefinitions
michael@0: // (we don't know at this point if it's a definition or not).
michael@0: //
michael@0: // Redeclarations are allowed. But, return types and parameter qualifiers must match.
michael@0: //
michael@0: TFunction* prevDec = static_cast(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
michael@0: if (prevDec) {
michael@0: if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
michael@0: context->error((yylsp[(2) - (2)]), "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
michael@0: context->recover();
michael@0: }
michael@0: for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
michael@0: if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
michael@0: context->error((yylsp[(2) - (2)]), "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0: }
michael@0:
michael@0: //
michael@0: // Check for previously declared variables using the same name.
michael@0: //
michael@0: TSymbol *prevSym = context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getName());
michael@0: if (prevSym)
michael@0: {
michael@0: if (!prevSym->isFunction())
michael@0: {
michael@0: context->error((yylsp[(2) - (2)]), "redefinition", (yyvsp[(1) - (2)].interm.function)->getName().c_str(), "function");
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0: else
michael@0: {
michael@0: // Insert the unmangled name to detect potential future redefinition as a variable.
michael@0: context->symbolTable.getOuterLevel()->insert((yyvsp[(1) - (2)].interm.function)->getName(), *(yyvsp[(1) - (2)].interm.function));
michael@0: }
michael@0:
michael@0: //
michael@0: // If this is a redeclaration, it could also be a definition,
michael@0: // in which case, we want to use the variable names from this one, and not the one that's
michael@0: // being redeclared. So, pass back up this declaration, not the one in the symbol table.
michael@0: //
michael@0: (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
michael@0:
michael@0: // We're at the inner scope level of the function's arguments and body statement.
michael@0: // Add the function prototype to the surrounding scope instead.
michael@0: context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 76:
michael@0:
michael@0: {
michael@0: (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 77:
michael@0:
michael@0: {
michael@0: (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 78:
michael@0:
michael@0: {
michael@0: // Add the parameter
michael@0: (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
michael@0: if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
michael@0: (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
michael@0: else
michael@0: delete (yyvsp[(2) - (2)].interm).param.type;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 79:
michael@0:
michael@0: {
michael@0: //
michael@0: // Only first parameter of one-parameter functions can be void
michael@0: // The check for named parameters not being void is done in parameter_declarator
michael@0: //
michael@0: if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
michael@0: //
michael@0: // This parameter > first is void
michael@0: //
michael@0: context->error((yylsp[(2) - (3)]), "cannot be an argument type except for '(void)'", "void");
michael@0: context->recover();
michael@0: delete (yyvsp[(3) - (3)].interm).param.type;
michael@0: } else {
michael@0: // Add the parameter
michael@0: (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
michael@0: (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 80:
michael@0:
michael@0: {
michael@0: if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
michael@0: context->error((yylsp[(2) - (3)]), "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
michael@0: context->recover();
michael@0: }
michael@0: // make sure a sampler is not involved as well...
michael@0: if (context->structQualifierErrorCheck((yylsp[(2) - (3)]), (yyvsp[(1) - (3)].interm.type)))
michael@0: context->recover();
michael@0:
michael@0: // Add the function as a prototype after parsing it (we do not support recursion)
michael@0: TFunction *function;
michael@0: TType type((yyvsp[(1) - (3)].interm.type));
michael@0: function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
michael@0: (yyval.interm.function) = function;
michael@0:
michael@0: context->symbolTable.push();
michael@0: }
michael@0: break;
michael@0:
michael@0: case 81:
michael@0:
michael@0: {
michael@0: if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
michael@0: context->error((yylsp[(2) - (2)]), "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
michael@0: context->recover();
michael@0: }
michael@0: if (context->reservedErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string))
michael@0: context->recover();
michael@0: TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
michael@0: (yyval.interm).param = param;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 82:
michael@0:
michael@0: {
michael@0: // Check that we can make an array out of this type
michael@0: if (context->arrayTypeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type)))
michael@0: context->recover();
michael@0:
michael@0: if (context->reservedErrorCheck((yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string))
michael@0: context->recover();
michael@0:
michael@0: int size;
michael@0: if (context->arraySizeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size))
michael@0: context->recover();
michael@0: (yyvsp[(1) - (5)].interm.type).setArray(true, size);
michael@0:
michael@0: TType* type = new TType((yyvsp[(1) - (5)].interm.type));
michael@0: TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
michael@0: (yyval.interm).param = param;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 83:
michael@0:
michael@0: {
michael@0: (yyval.interm) = (yyvsp[(3) - (3)].interm);
michael@0: if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
michael@0: context->recover();
michael@0: }
michael@0: break;
michael@0:
michael@0: case 84:
michael@0:
michael@0: {
michael@0: (yyval.interm) = (yyvsp[(2) - (2)].interm);
michael@0: if (context->parameterSamplerErrorCheck((yylsp[(2) - (2)]), (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
michael@0: context->recover();
michael@0: if (context->paramErrorCheck((yylsp[(2) - (2)]), EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
michael@0: context->recover();
michael@0: }
michael@0: break;
michael@0:
michael@0: case 85:
michael@0:
michael@0: {
michael@0: (yyval.interm) = (yyvsp[(3) - (3)].interm);
michael@0: if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
michael@0: context->recover();
michael@0: }
michael@0: break;
michael@0:
michael@0: case 86:
michael@0:
michael@0: {
michael@0: (yyval.interm) = (yyvsp[(2) - (2)].interm);
michael@0: if (context->parameterSamplerErrorCheck((yylsp[(2) - (2)]), (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
michael@0: context->recover();
michael@0: if (context->paramErrorCheck((yylsp[(2) - (2)]), EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
michael@0: context->recover();
michael@0: }
michael@0: break;
michael@0:
michael@0: case 87:
michael@0:
michael@0: {
michael@0: (yyval.interm.qualifier) = EvqIn;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 88:
michael@0:
michael@0: {
michael@0: (yyval.interm.qualifier) = EvqIn;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 89:
michael@0:
michael@0: {
michael@0: (yyval.interm.qualifier) = EvqOut;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 90:
michael@0:
michael@0: {
michael@0: (yyval.interm.qualifier) = EvqInOut;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 91:
michael@0:
michael@0: {
michael@0: TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
michael@0: (yyval.interm).param = param;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 92:
michael@0:
michael@0: {
michael@0: (yyval.interm) = (yyvsp[(1) - (1)].interm);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 93:
michael@0:
michael@0: {
michael@0: if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
michael@0: {
michael@0: context->error((yylsp[(3) - (3)]), "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
michael@0: context->recover();
michael@0: }
michael@0:
michael@0: TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yylsp[(3) - (3)]));
michael@0: (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yylsp[(3) - (3)]));
michael@0:
michael@0: if (context->structQualifierErrorCheck((yylsp[(3) - (3)]), (yyval.interm).type))
michael@0: context->recover();
michael@0:
michael@0: if (context->nonInitConstErrorCheck((yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
michael@0: context->recover();
michael@0:
michael@0: TVariable* variable = 0;
michael@0: if (context->nonInitErrorCheck((yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
michael@0: context->recover();
michael@0: if (symbol && variable)
michael@0: symbol->setId(variable->getUniqueId());
michael@0: }
michael@0: break;
michael@0:
michael@0: case 94:
michael@0:
michael@0: {
michael@0: if (context->structQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm).type))
michael@0: context->recover();
michael@0:
michael@0: if (context->nonInitConstErrorCheck((yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
michael@0: context->recover();
michael@0:
michael@0: (yyval.interm) = (yyvsp[(1) - (5)].interm);
michael@0:
michael@0: if (context->arrayTypeErrorCheck((yylsp[(4) - (5)]), (yyvsp[(1) - (5)].interm).type) || context->arrayQualifierErrorCheck((yylsp[(4) - (5)]), (yyvsp[(1) - (5)].interm).type))
michael@0: context->recover();
michael@0: else {
michael@0: (yyvsp[(1) - (5)].interm).type.setArray(true);
michael@0: TVariable* variable;
michael@0: if (context->arrayErrorCheck((yylsp[(4) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 95:
michael@0:
michael@0: {
michael@0: if (context->structQualifierErrorCheck((yylsp[(3) - (6)]), (yyvsp[(1) - (6)].interm).type))
michael@0: context->recover();
michael@0:
michael@0: if (context->nonInitConstErrorCheck((yylsp[(3) - (6)]), *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
michael@0: context->recover();
michael@0:
michael@0: (yyval.interm) = (yyvsp[(1) - (6)].interm);
michael@0:
michael@0: if (context->arrayTypeErrorCheck((yylsp[(4) - (6)]), (yyvsp[(1) - (6)].interm).type) || context->arrayQualifierErrorCheck((yylsp[(4) - (6)]), (yyvsp[(1) - (6)].interm).type))
michael@0: context->recover();
michael@0: else {
michael@0: int size;
michael@0: if (context->arraySizeErrorCheck((yylsp[(4) - (6)]), (yyvsp[(5) - (6)].interm.intermTypedNode), size))
michael@0: context->recover();
michael@0: (yyvsp[(1) - (6)].interm).type.setArray(true, size);
michael@0: TVariable* variable = 0;
michael@0: if (context->arrayErrorCheck((yylsp[(4) - (6)]), *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
michael@0: context->recover();
michael@0: TType type = TType((yyvsp[(1) - (6)].interm).type);
michael@0: type.setArraySize(size);
michael@0: (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *(yyvsp[(3) - (6)].lex).string, type, (yylsp[(3) - (6)])), (yylsp[(3) - (6)]));
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 96:
michael@0:
michael@0: {
michael@0: if (context->structQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm).type))
michael@0: context->recover();
michael@0:
michael@0: (yyval.interm) = (yyvsp[(1) - (5)].interm);
michael@0:
michael@0: TIntermNode* intermNode;
michael@0: if (!context->executeInitializer((yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
michael@0: //
michael@0: // build the intermediate representation
michael@0: //
michael@0: if (intermNode)
michael@0: (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yylsp[(4) - (5)]));
michael@0: else
michael@0: (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
michael@0: } else {
michael@0: context->recover();
michael@0: (yyval.interm).intermAggregate = 0;
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 97:
michael@0:
michael@0: {
michael@0: (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
michael@0: (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType((yyvsp[(1) - (1)].interm.type)), (yylsp[(1) - (1)])), (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 98:
michael@0:
michael@0: {
michael@0: TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yylsp[(2) - (2)]));
michael@0: (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (2)]));
michael@0:
michael@0: if (context->structQualifierErrorCheck((yylsp[(2) - (2)]), (yyval.interm).type))
michael@0: context->recover();
michael@0:
michael@0: if (context->nonInitConstErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
michael@0: context->recover();
michael@0:
michael@0: (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
michael@0:
michael@0: TVariable* variable = 0;
michael@0: if (context->nonInitErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
michael@0: context->recover();
michael@0: if (variable && symbol)
michael@0: symbol->setId(variable->getUniqueId());
michael@0: }
michael@0: break;
michael@0:
michael@0: case 99:
michael@0:
michael@0: {
michael@0: context->error((yylsp[(2) - (4)]), "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
michael@0: context->recover();
michael@0:
michael@0: TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yylsp[(2) - (4)]));
michael@0: (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (4)]));
michael@0: (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 100:
michael@0:
michael@0: {
michael@0: TType type = TType((yyvsp[(1) - (5)].interm.type));
michael@0: int size;
michael@0: if (context->arraySizeErrorCheck((yylsp[(2) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size))
michael@0: context->recover();
michael@0: type.setArraySize(size);
michael@0: TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yylsp[(2) - (5)]));
michael@0: (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (5)]));
michael@0:
michael@0: if (context->structQualifierErrorCheck((yylsp[(2) - (5)]), (yyvsp[(1) - (5)].interm.type)))
michael@0: context->recover();
michael@0:
michael@0: if (context->nonInitConstErrorCheck((yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
michael@0: context->recover();
michael@0:
michael@0: (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
michael@0:
michael@0: if (context->arrayTypeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type)) || context->arrayQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type)))
michael@0: context->recover();
michael@0: else {
michael@0: int size;
michael@0: if (context->arraySizeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size))
michael@0: context->recover();
michael@0:
michael@0: (yyvsp[(1) - (5)].interm.type).setArray(true, size);
michael@0: TVariable* variable = 0;
michael@0: if (context->arrayErrorCheck((yylsp[(3) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
michael@0: context->recover();
michael@0: if (variable && symbol)
michael@0: symbol->setId(variable->getUniqueId());
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 101:
michael@0:
michael@0: {
michael@0: if (context->structQualifierErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
michael@0: context->recover();
michael@0:
michael@0: (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
michael@0:
michael@0: TIntermNode* intermNode;
michael@0: if (!context->executeInitializer((yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
michael@0: //
michael@0: // Build intermediate representation
michael@0: //
michael@0: if(intermNode)
michael@0: (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yylsp[(3) - (4)]));
michael@0: else
michael@0: (yyval.interm).intermAggregate = 0;
michael@0: } else {
michael@0: context->recover();
michael@0: (yyval.interm).intermAggregate = 0;
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 102:
michael@0:
michael@0: {
michael@0: VERTEX_ONLY("invariant declaration", (yylsp[(1) - (2)]));
michael@0: if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying"))
michael@0: context->recover();
michael@0: (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yylsp[(2) - (2)]));
michael@0: if (!(yyvsp[(2) - (2)].lex).symbol)
michael@0: {
michael@0: context->error((yylsp[(2) - (2)]), "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
michael@0: context->recover();
michael@0:
michael@0: (yyval.interm).intermAggregate = 0;
michael@0: }
michael@0: else
michael@0: {
michael@0: TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yylsp[(2) - (2)]));
michael@0: (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (2)]));
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 103:
michael@0:
michael@0: {
michael@0: (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
michael@0:
michael@0: if ((yyvsp[(1) - (1)].interm.type).array) {
michael@0: context->error((yylsp[(1) - (1)]), "not supported", "first-class array");
michael@0: context->recover();
michael@0: (yyvsp[(1) - (1)].interm.type).setArray(false);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 104:
michael@0:
michael@0: {
michael@0: if ((yyvsp[(2) - (2)].interm.type).array) {
michael@0: context->error((yylsp[(2) - (2)]), "not supported", "first-class array");
michael@0: context->recover();
michael@0: (yyvsp[(2) - (2)].interm.type).setArray(false);
michael@0: }
michael@0:
michael@0: if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
michael@0: ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
michael@0: context->error((yylsp[(2) - (2)]), "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
michael@0: context->recover();
michael@0: }
michael@0: if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
michael@0: ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
michael@0: context->error((yylsp[(2) - (2)]), "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
michael@0: context->recover();
michael@0: }
michael@0: (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
michael@0: (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 105:
michael@0:
michael@0: {
michael@0: (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 106:
michael@0:
michael@0: {
michael@0: VERTEX_ONLY("attribute", (yylsp[(1) - (1)]));
michael@0: if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "attribute"))
michael@0: context->recover();
michael@0: (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 107:
michael@0:
michael@0: {
michael@0: if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "varying"))
michael@0: context->recover();
michael@0: if (context->shaderType == SH_VERTEX_SHADER)
michael@0: (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yylsp[(1) - (1)]));
michael@0: else
michael@0: (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 108:
michael@0:
michael@0: {
michael@0: if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying"))
michael@0: context->recover();
michael@0: if (context->shaderType == SH_VERTEX_SHADER)
michael@0: (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yylsp[(1) - (2)]));
michael@0: else
michael@0: (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yylsp[(1) - (2)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 109:
michael@0:
michael@0: {
michael@0: if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "uniform"))
michael@0: context->recover();
michael@0: (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 110:
michael@0:
michael@0: {
michael@0: (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
michael@0:
michael@0: if ((yyval.interm.type).precision == EbpUndefined) {
michael@0: (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
michael@0: if (context->precisionErrorCheck((yylsp[(1) - (1)]), (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 111:
michael@0:
michael@0: {
michael@0: (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
michael@0: (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 112:
michael@0:
michael@0: {
michael@0: (yyval.interm.precision) = EbpHigh;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 113:
michael@0:
michael@0: {
michael@0: (yyval.interm.precision) = EbpMedium;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 114:
michael@0:
michael@0: {
michael@0: (yyval.interm.precision) = EbpLow;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 115:
michael@0:
michael@0: {
michael@0: (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 116:
michael@0:
michael@0: {
michael@0: (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
michael@0:
michael@0: if (context->arrayTypeErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
michael@0: context->recover();
michael@0: else {
michael@0: int size;
michael@0: if (context->arraySizeErrorCheck((yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size))
michael@0: context->recover();
michael@0: (yyval.interm.type).setArray(true, size);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 117:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 118:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 119:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 120:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 121:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(2);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 122:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(3);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 123:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(4);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 124:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(2);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 125:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(3);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 126:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(4);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 127:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(2);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 128:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(3);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 129:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(4);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 130:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(2, true);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 131:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(3, true);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 132:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).setAggregate(4, true);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 133:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtSampler2D, qual, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 134:
michael@0:
michael@0: {
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 135:
michael@0:
michael@0: {
michael@0: if (!context->supportsExtension("GL_OES_EGL_image_external")) {
michael@0: context->error((yylsp[(1) - (1)]), "unsupported type", "samplerExternalOES");
michael@0: context->recover();
michael@0: }
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 136:
michael@0:
michael@0: {
michael@0: if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
michael@0: context->error((yylsp[(1) - (1)]), "unsupported type", "sampler2DRect");
michael@0: context->recover();
michael@0: }
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yylsp[(1) - (1)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 137:
michael@0:
michael@0: {
michael@0: (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
michael@0: (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 138:
michael@0:
michael@0: {
michael@0: //
michael@0: // This is for user defined type names. The lexical phase looked up the
michael@0: // type.
michael@0: //
michael@0: TType& structure = static_cast((yyvsp[(1) - (1)].lex).symbol)->getType();
michael@0: TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
michael@0: (yyval.interm.type).setBasic(EbtStruct, qual, (yylsp[(1) - (1)]));
michael@0: (yyval.interm.type).userDef = &structure;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 139:
michael@0:
michael@0: { if (context->enterStructDeclaration((yylsp[(2) - (3)]), *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
michael@0: break;
michael@0:
michael@0: case 140:
michael@0:
michael@0: {
michael@0: if (context->reservedErrorCheck((yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string))
michael@0: context->recover();
michael@0:
michael@0: TType* structure = new TType(new TStructure((yyvsp[(2) - (6)].lex).string, (yyvsp[(5) - (6)].interm.fieldList)));
michael@0: TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
michael@0: if (! context->symbolTable.insert(*userTypeDef)) {
michael@0: context->error((yylsp[(2) - (6)]), "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
michael@0: context->recover();
michael@0: }
michael@0: (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yylsp[(1) - (6)]));
michael@0: (yyval.interm.type).userDef = structure;
michael@0: context->exitStructDeclaration();
michael@0: }
michael@0: break;
michael@0:
michael@0: case 141:
michael@0:
michael@0: { if (context->enterStructDeclaration((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
michael@0: break;
michael@0:
michael@0: case 142:
michael@0:
michael@0: {
michael@0: TType* structure = new TType(new TStructure(NewPoolTString(""), (yyvsp[(4) - (5)].interm.fieldList)));
michael@0: (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yylsp[(1) - (5)]));
michael@0: (yyval.interm.type).userDef = structure;
michael@0: context->exitStructDeclaration();
michael@0: }
michael@0: break;
michael@0:
michael@0: case 143:
michael@0:
michael@0: {
michael@0: (yyval.interm.fieldList) = (yyvsp[(1) - (1)].interm.fieldList);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 144:
michael@0:
michael@0: {
michael@0: (yyval.interm.fieldList) = (yyvsp[(1) - (2)].interm.fieldList);
michael@0: for (size_t i = 0; i < (yyvsp[(2) - (2)].interm.fieldList)->size(); ++i) {
michael@0: TField* field = (*(yyvsp[(2) - (2)].interm.fieldList))[i];
michael@0: for (size_t j = 0; j < (yyval.interm.fieldList)->size(); ++j) {
michael@0: if ((*(yyval.interm.fieldList))[j]->name() == field->name()) {
michael@0: context->error((yylsp[(2) - (2)]), "duplicate field name in structure:", "struct", field->name().c_str());
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0: (yyval.interm.fieldList)->push_back(field);
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 145:
michael@0:
michael@0: {
michael@0: (yyval.interm.fieldList) = (yyvsp[(2) - (3)].interm.fieldList);
michael@0:
michael@0: if (context->voidErrorCheck((yylsp[(1) - (3)]), (*(yyvsp[(2) - (3)].interm.fieldList))[0]->name(), (yyvsp[(1) - (3)].interm.type))) {
michael@0: context->recover();
michael@0: }
michael@0: for (unsigned int i = 0; i < (yyval.interm.fieldList)->size(); ++i) {
michael@0: //
michael@0: // Careful not to replace already known aspects of type, like array-ness
michael@0: //
michael@0: TType* type = (*(yyval.interm.fieldList))[i]->type();
michael@0: type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
michael@0: type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
michael@0: type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
michael@0: type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
michael@0:
michael@0: // don't allow arrays of arrays
michael@0: if (type->isArray()) {
michael@0: if (context->arrayTypeErrorCheck((yylsp[(1) - (3)]), (yyvsp[(1) - (3)].interm.type)))
michael@0: context->recover();
michael@0: }
michael@0: if ((yyvsp[(1) - (3)].interm.type).array)
michael@0: type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
michael@0: if ((yyvsp[(1) - (3)].interm.type).userDef)
michael@0: type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
michael@0:
michael@0: if (context->structNestingErrorCheck((yylsp[(1) - (3)]), *(*(yyval.interm.fieldList))[i]))
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 146:
michael@0:
michael@0: {
michael@0: (yyval.interm.fieldList) = NewPoolTFieldList();
michael@0: (yyval.interm.fieldList)->push_back((yyvsp[(1) - (1)].interm.field));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 147:
michael@0:
michael@0: {
michael@0: (yyval.interm.fieldList)->push_back((yyvsp[(3) - (3)].interm.field));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 148:
michael@0:
michael@0: {
michael@0: if (context->reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string))
michael@0: context->recover();
michael@0:
michael@0: TType* type = new TType(EbtVoid, EbpUndefined);
michael@0: (yyval.interm.field) = new TField(type, (yyvsp[(1) - (1)].lex).string);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 149:
michael@0:
michael@0: {
michael@0: if (context->reservedErrorCheck((yylsp[(1) - (4)]), *(yyvsp[(1) - (4)].lex).string))
michael@0: context->recover();
michael@0:
michael@0: TType* type = new TType(EbtVoid, EbpUndefined);
michael@0: int size = 0;
michael@0: if (context->arraySizeErrorCheck((yylsp[(3) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size))
michael@0: context->recover();
michael@0: type->setArraySize(size);
michael@0:
michael@0: (yyval.interm.field) = new TField(type, (yyvsp[(1) - (4)].lex).string);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 150:
michael@0:
michael@0: { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
michael@0: break;
michael@0:
michael@0: case 151:
michael@0:
michael@0: { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
michael@0: break;
michael@0:
michael@0: case 152:
michael@0:
michael@0: { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
michael@0: break;
michael@0:
michael@0: case 153:
michael@0:
michael@0: { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
michael@0: break;
michael@0:
michael@0: case 154:
michael@0:
michael@0: { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
michael@0: break;
michael@0:
michael@0: case 155:
michael@0:
michael@0: { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
michael@0: break;
michael@0:
michael@0: case 156:
michael@0:
michael@0: { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
michael@0: break;
michael@0:
michael@0: case 157:
michael@0:
michael@0: { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
michael@0: break;
michael@0:
michael@0: case 158:
michael@0:
michael@0: { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
michael@0: break;
michael@0:
michael@0: case 159:
michael@0:
michael@0: { (yyval.interm.intermAggregate) = 0; }
michael@0: break;
michael@0:
michael@0: case 160:
michael@0:
michael@0: { context->symbolTable.push(); }
michael@0: break;
michael@0:
michael@0: case 161:
michael@0:
michael@0: { context->symbolTable.pop(); }
michael@0: break;
michael@0:
michael@0: case 162:
michael@0:
michael@0: {
michael@0: if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
michael@0: (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
michael@0: (yyvsp[(3) - (5)].interm.intermAggregate)->setLine((yyloc));
michael@0: }
michael@0: (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 163:
michael@0:
michael@0: { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
michael@0: break;
michael@0:
michael@0: case 164:
michael@0:
michael@0: { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
michael@0: break;
michael@0:
michael@0: case 165:
michael@0:
michael@0: { context->symbolTable.push(); }
michael@0: break;
michael@0:
michael@0: case 166:
michael@0:
michael@0: { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
michael@0: break;
michael@0:
michael@0: case 167:
michael@0:
michael@0: { context->symbolTable.push(); }
michael@0: break;
michael@0:
michael@0: case 168:
michael@0:
michael@0: { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
michael@0: break;
michael@0:
michael@0: case 169:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermNode) = 0;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 170:
michael@0:
michael@0: {
michael@0: if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
michael@0: (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
michael@0: (yyvsp[(2) - (3)].interm.intermAggregate)->setLine((yyloc));
michael@0: }
michael@0: (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 171:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), (yyloc));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 172:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), (yyloc));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 173:
michael@0:
michael@0: { (yyval.interm.intermNode) = 0; }
michael@0: break;
michael@0:
michael@0: case 174:
michael@0:
michael@0: { (yyval.interm.intermNode) = static_cast((yyvsp[(1) - (2)].interm.intermTypedNode)); }
michael@0: break;
michael@0:
michael@0: case 175:
michael@0:
michael@0: {
michael@0: if (context->boolErrorCheck((yylsp[(1) - (5)]), (yyvsp[(3) - (5)].interm.intermTypedNode)))
michael@0: context->recover();
michael@0: (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yylsp[(1) - (5)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 176:
michael@0:
michael@0: {
michael@0: (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
michael@0: (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 177:
michael@0:
michael@0: {
michael@0: (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
michael@0: (yyval.interm.nodePair).node2 = 0;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 178:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
michael@0: if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
michael@0: context->recover();
michael@0: }
michael@0: break;
michael@0:
michael@0: case 179:
michael@0:
michael@0: {
michael@0: TIntermNode* intermNode;
michael@0: if (context->structQualifierErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
michael@0: context->recover();
michael@0: if (context->boolErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
michael@0: context->recover();
michael@0:
michael@0: if (!context->executeInitializer((yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
michael@0: else {
michael@0: context->recover();
michael@0: (yyval.interm.intermTypedNode) = 0;
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 180:
michael@0:
michael@0: { context->symbolTable.push(); ++context->loopNestingLevel; }
michael@0: break;
michael@0:
michael@0: case 181:
michael@0:
michael@0: {
michael@0: context->symbolTable.pop();
michael@0: (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yylsp[(1) - (6)]));
michael@0: --context->loopNestingLevel;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 182:
michael@0:
michael@0: { ++context->loopNestingLevel; }
michael@0: break;
michael@0:
michael@0: case 183:
michael@0:
michael@0: {
michael@0: if (context->boolErrorCheck((yylsp[(8) - (8)]), (yyvsp[(6) - (8)].interm.intermTypedNode)))
michael@0: context->recover();
michael@0:
michael@0: (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yylsp[(4) - (8)]));
michael@0: --context->loopNestingLevel;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 184:
michael@0:
michael@0: { context->symbolTable.push(); ++context->loopNestingLevel; }
michael@0: break;
michael@0:
michael@0: case 185:
michael@0:
michael@0: {
michael@0: context->symbolTable.pop();
michael@0: (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopFor, (yyvsp[(4) - (7)].interm.intermNode), reinterpret_cast((yyvsp[(5) - (7)].interm.nodePair).node1), reinterpret_cast((yyvsp[(5) - (7)].interm.nodePair).node2), (yyvsp[(7) - (7)].interm.intermNode), (yylsp[(1) - (7)]));
michael@0: --context->loopNestingLevel;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 186:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 187:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 188:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 189:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermTypedNode) = 0;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 190:
michael@0:
michael@0: {
michael@0: (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
michael@0: (yyval.interm.nodePair).node2 = 0;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 191:
michael@0:
michael@0: {
michael@0: (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
michael@0: (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 192:
michael@0:
michael@0: {
michael@0: if (context->loopNestingLevel <= 0) {
michael@0: context->error((yylsp[(1) - (2)]), "continue statement only allowed in loops", "");
michael@0: context->recover();
michael@0: }
michael@0: (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yylsp[(1) - (2)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 193:
michael@0:
michael@0: {
michael@0: if (context->loopNestingLevel <= 0) {
michael@0: context->error((yylsp[(1) - (2)]), "break statement only allowed in loops", "");
michael@0: context->recover();
michael@0: }
michael@0: (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yylsp[(1) - (2)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 194:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yylsp[(1) - (2)]));
michael@0: if (context->currentFunctionType->getBasicType() != EbtVoid) {
michael@0: context->error((yylsp[(1) - (2)]), "non-void function must return a value", "return");
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 195:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yylsp[(1) - (3)]));
michael@0: context->functionReturnsValue = true;
michael@0: if (context->currentFunctionType->getBasicType() == EbtVoid) {
michael@0: context->error((yylsp[(1) - (3)]), "void function cannot return a value", "return");
michael@0: context->recover();
michael@0: } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
michael@0: context->error((yylsp[(1) - (3)]), "function return is not matching type:", "return");
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0: break;
michael@0:
michael@0: case 196:
michael@0:
michael@0: {
michael@0: FRAG_ONLY("discard", (yylsp[(1) - (2)]));
michael@0: (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yylsp[(1) - (2)]));
michael@0: }
michael@0: break;
michael@0:
michael@0: case 197:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
michael@0: context->treeRoot = (yyval.interm.intermNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 198:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), (yyloc));
michael@0: context->treeRoot = (yyval.interm.intermNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 199:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 200:
michael@0:
michael@0: {
michael@0: (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
michael@0: }
michael@0: break;
michael@0:
michael@0: case 201:
michael@0:
michael@0: {
michael@0: TFunction* function = (yyvsp[(1) - (1)].interm).function;
michael@0:
michael@0: const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
michael@0:
michael@0: if (builtIn)
michael@0: {
michael@0: context->error((yylsp[(1) - (1)]), "built-in functions cannot be redefined", function->getName().c_str());
michael@0: context->recover();
michael@0: }
michael@0:
michael@0: TFunction* prevDec = static_cast(context->symbolTable.find(function->getMangledName()));
michael@0: //
michael@0: // Note: 'prevDec' could be 'function' if this is the first time we've seen function
michael@0: // as it would have just been put in the symbol table. Otherwise, we're looking up
michael@0: // an earlier occurance.
michael@0: //
michael@0: if (prevDec->isDefined()) {
michael@0: //
michael@0: // Then this function already has a body.
michael@0: //
michael@0: context->error((yylsp[(1) - (1)]), "function already has a body", function->getName().c_str());
michael@0: context->recover();
michael@0: }
michael@0: prevDec->setDefined();
michael@0:
michael@0: //
michael@0: // Raise error message if main function takes any parameters or return anything other than void
michael@0: //
michael@0: if (function->getName() == "main") {
michael@0: if (function->getParamCount() > 0) {
michael@0: context->error((yylsp[(1) - (1)]), "function cannot take any parameter(s)", function->getName().c_str());
michael@0: context->recover();
michael@0: }
michael@0: if (function->getReturnType().getBasicType() != EbtVoid) {
michael@0: context->error((yylsp[(1) - (1)]), "", function->getReturnType().getBasicString(), "main function cannot return a value");
michael@0: context->recover();
michael@0: }
michael@0: }
michael@0:
michael@0: //
michael@0: // Remember the return type for later checking for RETURN statements.
michael@0: //
michael@0: context->currentFunctionType = &(prevDec->getReturnType());
michael@0: context->functionReturnsValue = false;
michael@0:
michael@0: //
michael@0: // Insert parameters into the symbol table.
michael@0: // If the parameter has no name, it's not an error, just don't insert it
michael@0: // (could be used for unused args).
michael@0: //
michael@0: // Also, accumulate the list of parameters into the HIL, so lower level code
michael@0: // knows where to find parameters.
michael@0: //
michael@0: TIntermAggregate* paramNodes = new TIntermAggregate;
michael@0: for (size_t i = 0; i < function->getParamCount(); i++) {
michael@0: const TParameter& param = function->getParam(i);
michael@0: if (param.name != 0) {
michael@0: TVariable *variable = new TVariable(param.name, *param.type);
michael@0: //
michael@0: // Insert the parameters with name in the symbol table.
michael@0: //
michael@0: if (! context->symbolTable.insert(*variable)) {
michael@0: context->error((yylsp[(1) - (1)]), "redefinition", variable->getName().c_str());
michael@0: context->recover();
michael@0: delete variable;
michael@0: }
michael@0:
michael@0: //
michael@0: // Add the parameter to the HIL
michael@0: //
michael@0: paramNodes = context->intermediate.growAggregate(
michael@0: paramNodes,
michael@0: context->intermediate.addSymbol(variable->getUniqueId(),
michael@0: variable->getName(),
michael@0: variable->getType(),
michael@0: (yylsp[(1) - (1)])),
michael@0: (yylsp[(1) - (1)]));
michael@0: } else {
michael@0: paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yylsp[(1) - (1)])), (yylsp[(1) - (1)]));
michael@0: }
michael@0: }
michael@0: context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yylsp[(1) - (1)]));
michael@0: (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
michael@0: context->loopNestingLevel = 0;
michael@0: }
michael@0: break;
michael@0:
michael@0: case 202:
michael@0:
michael@0: {
michael@0: //?? Check that all paths return a value if return type != void ?
michael@0: // May be best done as post process phase on intermediate code
michael@0: if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
michael@0: context->error((yylsp[(1) - (3)]), "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
michael@0: context->recover();
michael@0: }
michael@0:
michael@0: (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), (yyloc));
michael@0: context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yylsp[(1) - (3)]));
michael@0: (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
michael@0: (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
michael@0:
michael@0: // store the pragma information for debug and optimize and other vendor specific
michael@0: // information. This information can be queried from the parse tree
michael@0: (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
michael@0: (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
michael@0:
michael@0: context->symbolTable.pop();
michael@0: }
michael@0: break;
michael@0:
michael@0:
michael@0:
michael@0: default: break;
michael@0: }
michael@0: /* User semantic actions sometimes alter yychar, and that requires
michael@0: that yytoken be updated with the new translation. We take the
michael@0: approach of translating immediately before every use of yytoken.
michael@0: One alternative is translating here after every semantic action,
michael@0: but that translation would be missed if the semantic action invokes
michael@0: YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
michael@0: if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
michael@0: incorrect destructor might then be invoked immediately. In the
michael@0: case of YYERROR or YYBACKUP, subsequent parser actions might lead
michael@0: to an incorrect destructor call or verbose syntax error message
michael@0: before the lookahead is translated. */
michael@0: YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
michael@0:
michael@0: YYPOPSTACK (yylen);
michael@0: yylen = 0;
michael@0: YY_STACK_PRINT (yyss, yyssp);
michael@0:
michael@0: *++yyvsp = yyval;
michael@0: *++yylsp = yyloc;
michael@0:
michael@0: /* Now `shift' the result of the reduction. Determine what state
michael@0: that goes to, based on the state we popped back to and the rule
michael@0: number reduced by. */
michael@0:
michael@0: yyn = yyr1[yyn];
michael@0:
michael@0: yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
michael@0: if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
michael@0: yystate = yytable[yystate];
michael@0: else
michael@0: yystate = yydefgoto[yyn - YYNTOKENS];
michael@0:
michael@0: goto yynewstate;
michael@0:
michael@0:
michael@0: /*------------------------------------.
michael@0: | yyerrlab -- here on detecting error |
michael@0: `------------------------------------*/
michael@0: yyerrlab:
michael@0: /* Make sure we have latest lookahead translation. See comments at
michael@0: user semantic actions for why this is necessary. */
michael@0: yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
michael@0:
michael@0: /* If not already recovering from an error, report this error. */
michael@0: if (!yyerrstatus)
michael@0: {
michael@0: ++yynerrs;
michael@0: #if ! YYERROR_VERBOSE
michael@0: yyerror (&yylloc, context, YY_("syntax error"));
michael@0: #else
michael@0: # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
michael@0: yyssp, yytoken)
michael@0: {
michael@0: char const *yymsgp = YY_("syntax error");
michael@0: int yysyntax_error_status;
michael@0: yysyntax_error_status = YYSYNTAX_ERROR;
michael@0: if (yysyntax_error_status == 0)
michael@0: yymsgp = yymsg;
michael@0: else if (yysyntax_error_status == 1)
michael@0: {
michael@0: if (yymsg != yymsgbuf)
michael@0: YYSTACK_FREE (yymsg);
michael@0: yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
michael@0: if (!yymsg)
michael@0: {
michael@0: yymsg = yymsgbuf;
michael@0: yymsg_alloc = sizeof yymsgbuf;
michael@0: yysyntax_error_status = 2;
michael@0: }
michael@0: else
michael@0: {
michael@0: yysyntax_error_status = YYSYNTAX_ERROR;
michael@0: yymsgp = yymsg;
michael@0: }
michael@0: }
michael@0: yyerror (&yylloc, context, yymsgp);
michael@0: if (yysyntax_error_status == 2)
michael@0: goto yyexhaustedlab;
michael@0: }
michael@0: # undef YYSYNTAX_ERROR
michael@0: #endif
michael@0: }
michael@0:
michael@0: yyerror_range[1] = yylloc;
michael@0:
michael@0: if (yyerrstatus == 3)
michael@0: {
michael@0: /* If just tried and failed to reuse lookahead token after an
michael@0: error, discard it. */
michael@0:
michael@0: if (yychar <= YYEOF)
michael@0: {
michael@0: /* Return failure if at end of input. */
michael@0: if (yychar == YYEOF)
michael@0: YYABORT;
michael@0: }
michael@0: else
michael@0: {
michael@0: yydestruct ("Error: discarding",
michael@0: yytoken, &yylval, &yylloc, context);
michael@0: yychar = YYEMPTY;
michael@0: }
michael@0: }
michael@0:
michael@0: /* Else will try to reuse lookahead token after shifting the error
michael@0: token. */
michael@0: goto yyerrlab1;
michael@0:
michael@0:
michael@0: /*---------------------------------------------------.
michael@0: | yyerrorlab -- error raised explicitly by YYERROR. |
michael@0: `---------------------------------------------------*/
michael@0: yyerrorlab:
michael@0:
michael@0: /* Pacify compilers like GCC when the user code never invokes
michael@0: YYERROR and the label yyerrorlab therefore never appears in user
michael@0: code. */
michael@0: if (/*CONSTCOND*/ 0)
michael@0: goto yyerrorlab;
michael@0:
michael@0: yyerror_range[1] = yylsp[1-yylen];
michael@0: /* Do not reclaim the symbols of the rule which action triggered
michael@0: this YYERROR. */
michael@0: YYPOPSTACK (yylen);
michael@0: yylen = 0;
michael@0: YY_STACK_PRINT (yyss, yyssp);
michael@0: yystate = *yyssp;
michael@0: goto yyerrlab1;
michael@0:
michael@0:
michael@0: /*-------------------------------------------------------------.
michael@0: | yyerrlab1 -- common code for both syntax error and YYERROR. |
michael@0: `-------------------------------------------------------------*/
michael@0: yyerrlab1:
michael@0: yyerrstatus = 3; /* Each real token shifted decrements this. */
michael@0:
michael@0: for (;;)
michael@0: {
michael@0: yyn = yypact[yystate];
michael@0: if (!yypact_value_is_default (yyn))
michael@0: {
michael@0: yyn += YYTERROR;
michael@0: if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
michael@0: {
michael@0: yyn = yytable[yyn];
michael@0: if (0 < yyn)
michael@0: break;
michael@0: }
michael@0: }
michael@0:
michael@0: /* Pop the current state because it cannot handle the error token. */
michael@0: if (yyssp == yyss)
michael@0: YYABORT;
michael@0:
michael@0: yyerror_range[1] = *yylsp;
michael@0: yydestruct ("Error: popping",
michael@0: yystos[yystate], yyvsp, yylsp, context);
michael@0: YYPOPSTACK (1);
michael@0: yystate = *yyssp;
michael@0: YY_STACK_PRINT (yyss, yyssp);
michael@0: }
michael@0:
michael@0: YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
michael@0: *++yyvsp = yylval;
michael@0: YY_IGNORE_MAYBE_UNINITIALIZED_END
michael@0:
michael@0: yyerror_range[2] = yylloc;
michael@0: /* Using YYLLOC is tempting, but would change the location of
michael@0: the lookahead. YYLOC is available though. */
michael@0: YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
michael@0: *++yylsp = yyloc;
michael@0:
michael@0: /* Shift the error token. */
michael@0: YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
michael@0:
michael@0: yystate = yyn;
michael@0: goto yynewstate;
michael@0:
michael@0:
michael@0: /*-------------------------------------.
michael@0: | yyacceptlab -- YYACCEPT comes here. |
michael@0: `-------------------------------------*/
michael@0: yyacceptlab:
michael@0: yyresult = 0;
michael@0: goto yyreturn;
michael@0:
michael@0: /*-----------------------------------.
michael@0: | yyabortlab -- YYABORT comes here. |
michael@0: `-----------------------------------*/
michael@0: yyabortlab:
michael@0: yyresult = 1;
michael@0: goto yyreturn;
michael@0:
michael@0: #if !defined yyoverflow || YYERROR_VERBOSE
michael@0: /*-------------------------------------------------.
michael@0: | yyexhaustedlab -- memory exhaustion comes here. |
michael@0: `-------------------------------------------------*/
michael@0: yyexhaustedlab:
michael@0: yyerror (&yylloc, context, YY_("memory exhausted"));
michael@0: yyresult = 2;
michael@0: /* Fall through. */
michael@0: #endif
michael@0:
michael@0: yyreturn:
michael@0: if (yychar != YYEMPTY)
michael@0: {
michael@0: /* Make sure we have latest lookahead translation. See comments at
michael@0: user semantic actions for why this is necessary. */
michael@0: yytoken = YYTRANSLATE (yychar);
michael@0: yydestruct ("Cleanup: discarding lookahead",
michael@0: yytoken, &yylval, &yylloc, context);
michael@0: }
michael@0: /* Do not reclaim the symbols of the rule which action triggered
michael@0: this YYABORT or YYACCEPT. */
michael@0: YYPOPSTACK (yylen);
michael@0: YY_STACK_PRINT (yyss, yyssp);
michael@0: while (yyssp != yyss)
michael@0: {
michael@0: yydestruct ("Cleanup: popping",
michael@0: yystos[*yyssp], yyvsp, yylsp, context);
michael@0: YYPOPSTACK (1);
michael@0: }
michael@0: #ifndef yyoverflow
michael@0: if (yyss != yyssa)
michael@0: YYSTACK_FREE (yyss);
michael@0: #endif
michael@0: #if YYERROR_VERBOSE
michael@0: if (yymsg != yymsgbuf)
michael@0: YYSTACK_FREE (yymsg);
michael@0: #endif
michael@0: /* Make sure YYID is used. */
michael@0: return YYID (yyresult);
michael@0: }
michael@0:
michael@0:
michael@0:
michael@0:
michael@0:
michael@0: void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason) {
michael@0: context->error(*yylloc, reason, "");
michael@0: context->recover();
michael@0: }
michael@0:
michael@0: int glslang_parse(TParseContext* context) {
michael@0: return yyparse(context);
michael@0: }