diff --git a/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp b/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp new file mode 100644 index 0000000..90c0dd4 --- /dev/null +++ b/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp @@ -0,0 +1,3041 @@ +#line 17 "./glslang.l" +// +// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// This file is auto-generated by generate_parser.sh. DO NOT EDIT! + +// Ignore errors in auto-generated code. +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wshorten-64-to-32" +#endif +#if defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wswitch-enum" +#elif defined(_MSC_VER) +#pragma warning(disable: 4065) +#pragma warning(disable: 4189) +#pragma warning(disable: 4505) +#pragma warning(disable: 4701) +#endif + + + +#line 25 "./glslang_lex.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE yylex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-yylineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + yy_size_t yyl;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void yypop_buffer_state (yyscan_t yyscanner ); + +static void yyensure_buffer_stack (yyscan_t yyscanner ); +static void yy_load_buffer_state (yyscan_t yyscanner ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); + +void *yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void yyfree (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 155 +#define YY_END_OF_BUFFER 156 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[459] = + { 0, + 0, 0, 0, 0, 0, 0, 156, 154, 153, 153, + 138, 144, 149, 133, 134, 142, 141, 130, 139, 137, + 143, 102, 102, 131, 127, 145, 132, 146, 150, 98, + 135, 136, 148, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 128, 147, 129, 140, 3, 4, 3, + 152, 155, 151, 124, 110, 129, 118, 113, 108, 116, + 106, 117, 107, 105, 2, 1, 109, 104, 100, 101, + 0, 0, 102, 136, 128, 135, 125, 121, 123, 122, + 126, 98, 114, 120, 98, 98, 98, 98, 98, 98, + + 98, 98, 98, 98, 17, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 20, 22, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 115, 119, 5, + 151, 0, 1, 104, 0, 0, 103, 99, 111, 112, + 50, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 18, + 98, 98, 98, 98, 98, 98, 98, 98, 26, 98, + 98, 98, 98, 98, 98, 98, 98, 23, 98, 98, + + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 0, 105, 0, 104, 98, 28, 98, 98, 95, + 98, 98, 98, 98, 98, 98, 98, 21, 53, 98, + 98, 98, 69, 98, 98, 58, 73, 98, 98, 98, + 98, 98, 98, 98, 98, 70, 9, 33, 34, 35, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 56, 29, 98, 98, + 98, 98, 98, 98, 36, 37, 38, 27, 98, 98, + 98, 15, 42, 43, 44, 51, 12, 98, 98, 98, + + 98, 82, 83, 84, 98, 30, 74, 25, 85, 86, + 87, 7, 79, 80, 81, 98, 24, 77, 98, 98, + 39, 40, 41, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 71, 98, 98, 98, 98, 98, 98, 98, + 98, 52, 98, 97, 98, 98, 19, 98, 98, 98, + 98, 72, 66, 61, 98, 98, 98, 98, 98, 78, + 57, 98, 64, 32, 98, 94, 65, 49, 76, 59, + 98, 98, 98, 98, 98, 98, 98, 98, 60, 31, + 98, 98, 98, 8, 98, 98, 98, 98, 98, 54, + 13, 98, 14, 98, 98, 16, 67, 98, 98, 98, + + 62, 98, 98, 98, 98, 98, 98, 55, 75, 63, + 11, 68, 6, 96, 10, 88, 45, 89, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 46, 98, 98, 98, 98, 98, 98, 98, 48, 98, + 92, 98, 98, 98, 98, 98, 90, 98, 91, 98, + 98, 98, 98, 98, 98, 47, 93, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 4, 1, 1, 1, 5, 6, 1, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 20, 20, 21, 21, 22, 23, 24, + 25, 26, 27, 1, 28, 28, 29, 30, 31, 28, + 32, 32, 32, 32, 32, 32, 32, 32, 33, 32, + 32, 34, 35, 32, 32, 32, 32, 36, 32, 32, + 37, 1, 38, 39, 32, 1, 40, 41, 42, 43, + + 44, 45, 46, 47, 48, 32, 49, 50, 51, 52, + 53, 54, 32, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[68] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, + 3, 1, 1, 1, 1, 1, 1, 3, 3, 3, + 3, 4, 4, 4, 4, 4, 1, 1, 1, 3, + 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 1, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[464] = + { 0, + 0, 0, 65, 66, 75, 0, 680, 681, 681, 681, + 654, 45, 137, 681, 681, 653, 134, 681, 133, 131, + 146, 159, 168, 651, 681, 186, 651, 47, 681, 0, + 681, 681, 128, 100, 110, 152, 156, 146, 166, 622, + 173, 109, 621, 126, 177, 615, 178, 628, 187, 184, + 141, 197, 624, 681, 157, 681, 681, 681, 681, 656, + 681, 681, 0, 681, 681, 681, 681, 681, 681, 681, + 681, 681, 681, 236, 681, 0, 681, 243, 273, 282, + 304, 0, 314, 681, 681, 681, 644, 681, 681, 681, + 643, 0, 681, 681, 616, 609, 612, 620, 619, 606, + + 621, 608, 614, 602, 599, 612, 599, 596, 596, 602, + 590, 189, 595, 605, 591, 597, 600, 601, 0, 216, + 600, 188, 586, 599, 590, 592, 582, 596, 593, 595, + 578, 583, 580, 569, 183, 577, 582, 578, 580, 569, + 572, 220, 577, 569, 581, 176, 574, 681, 681, 681, + 0, 331, 0, 344, 361, 290, 374, 0, 681, 681, + 0, 566, 570, 579, 576, 560, 560, 215, 575, 572, + 572, 570, 567, 559, 565, 552, 563, 549, 565, 0, + 562, 550, 557, 554, 558, 551, 540, 539, 552, 555, + 552, 547, 538, 260, 543, 546, 537, 534, 538, 544, + + 535, 526, 529, 527, 537, 523, 521, 534, 520, 522, + 519, 530, 529, 283, 524, 519, 508, 264, 526, 528, + 517, 381, 388, 395, 402, 518, 0, 516, 320, 0, + 508, 506, 514, 503, 520, 509, 336, 0, 0, 503, + 513, 513, 0, 498, 349, 0, 0, 500, 366, 501, + 495, 494, 495, 494, 407, 0, 0, 0, 0, 0, + 490, 491, 496, 487, 500, 495, 494, 486, 490, 482, + 485, 489, 494, 480, 492, 483, 0, 0, 489, 478, + 478, 483, 482, 479, 0, 0, 0, 0, 469, 481, + 483, 0, 0, 0, 0, 0, 0, 471, 472, 466, + + 476, 0, 0, 0, 467, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 474, 0, 0, 472, 468, + 0, 0, 0, 464, 460, 465, 455, 468, 454, 467, + 456, 463, 0, 461, 463, 447, 449, 455, 461, 456, + 444, 0, 446, 0, 445, 448, 0, 437, 436, 436, + 449, 0, 451, 0, 450, 449, 434, 447, 434, 0, + 0, 437, 0, 0, 429, 0, 0, 0, 0, 0, + 426, 437, 430, 436, 433, 428, 420, 432, 0, 0, + 425, 432, 421, 0, 430, 427, 417, 411, 425, 0, + 0, 425, 0, 423, 422, 0, 0, 421, 407, 419, + + 0, 410, 431, 430, 429, 400, 396, 0, 0, 0, + 0, 0, 0, 0, 0, 421, 250, 421, 411, 384, + 392, 394, 390, 392, 391, 390, 393, 390, 391, 388, + 0, 332, 343, 317, 329, 313, 317, 304, 321, 291, + 0, 302, 280, 271, 255, 262, 0, 256, 0, 232, + 206, 212, 148, 159, 113, 0, 0, 681, 442, 444, + 446, 450, 161 + } ; + +static yyconst flex_int16_t yy_def[464] = + { 0, + 458, 1, 459, 459, 458, 5, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 460, + 458, 458, 458, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 461, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 462, 458, 458, 458, 458, + 458, 463, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 460, 458, 458, 460, 460, 460, 460, 460, 460, + + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 458, 458, 458, + 461, 458, 462, 458, 458, 458, 458, 463, 458, 458, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 458, 458, 458, 458, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, + 460, 460, 460, 460, 460, 460, 460, 0, 458, 458, + 458, 458, 458 + } ; + +static yyconst flex_int16_t yy_nxt[749] = + { 0, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 23, 23, 23, 23, + 23, 24, 25, 26, 27, 28, 29, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 30, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 30, 30, 30, 54, 55, 56, 57, 59, 59, 65, + 66, 90, 91, 60, 60, 8, 61, 62, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + + 8, 8, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 8, 8, 8, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 8, 8, + 8, 8, 67, 70, 72, 74, 74, 74, 74, 74, + 74, 74, 93, 119, 75, 95, 96, 73, 71, 76, + 120, 68, 97, 158, 98, 123, 94, 121, 99, 124, + 77, 78, 457, 79, 79, 79, 79, 79, 79, 80, + 78, 148, 83, 83, 83, 83, 83, 83, 83, 81, + 85, 100, 142, 456, 82, 107, 143, 108, 81, 103, + + 455, 101, 81, 104, 102, 110, 109, 86, 105, 87, + 88, 81, 116, 111, 106, 112, 125, 128, 113, 82, + 117, 149, 206, 219, 114, 220, 132, 138, 178, 126, + 139, 118, 129, 133, 134, 130, 144, 207, 140, 192, + 145, 179, 454, 135, 136, 141, 137, 193, 453, 146, + 74, 74, 74, 74, 74, 74, 74, 154, 154, 154, + 154, 154, 154, 154, 452, 186, 152, 214, 187, 188, + 232, 233, 189, 155, 190, 215, 258, 259, 260, 152, + 285, 286, 287, 422, 423, 78, 155, 79, 79, 79, + 79, 79, 79, 80, 78, 451, 80, 80, 80, 80, + + 80, 80, 80, 81, 157, 157, 157, 157, 157, 157, + 157, 450, 81, 156, 449, 156, 81, 448, 157, 157, + 157, 157, 157, 157, 157, 81, 78, 280, 83, 83, + 83, 83, 83, 83, 83, 281, 293, 294, 295, 447, + 222, 446, 222, 445, 81, 223, 223, 223, 223, 223, + 223, 223, 302, 303, 304, 444, 443, 81, 154, 154, + 154, 154, 154, 154, 154, 309, 310, 311, 442, 441, + 224, 440, 224, 439, 155, 225, 225, 225, 225, 225, + 225, 225, 313, 314, 315, 438, 437, 155, 157, 157, + 157, 157, 157, 157, 157, 223, 223, 223, 223, 223, + + 223, 223, 223, 223, 223, 223, 223, 223, 223, 225, + 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, + 225, 225, 225, 321, 322, 323, 403, 404, 405, 436, + 435, 434, 433, 432, 431, 430, 429, 428, 427, 406, + 426, 407, 58, 58, 58, 58, 92, 92, 151, 151, + 153, 425, 153, 153, 424, 421, 420, 419, 418, 417, + 416, 415, 414, 413, 412, 411, 410, 409, 408, 402, + 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, + 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, + 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, + + 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, + 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, + 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, + 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, + 331, 330, 329, 328, 327, 326, 325, 324, 320, 319, + 318, 317, 316, 312, 308, 307, 306, 305, 301, 300, + 299, 298, 297, 296, 292, 291, 290, 289, 288, 284, + 283, 282, 279, 278, 277, 276, 275, 274, 273, 272, + 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, + 261, 257, 256, 255, 254, 253, 252, 251, 250, 249, + + 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, + 238, 237, 236, 235, 234, 231, 230, 229, 228, 227, + 226, 221, 218, 217, 216, 213, 212, 211, 210, 209, + 208, 205, 204, 203, 202, 201, 200, 199, 198, 197, + 196, 195, 194, 191, 185, 184, 183, 182, 181, 180, + 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, + 167, 166, 165, 164, 163, 162, 161, 160, 159, 150, + 147, 131, 127, 122, 115, 89, 84, 69, 64, 458, + 7, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458 + } ; + +static yyconst flex_int16_t yy_chk[749] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 4, 12, + 12, 28, 28, 3, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 13, 17, 19, 20, 20, 20, 20, 20, + 20, 20, 33, 42, 21, 34, 34, 19, 17, 21, + 42, 13, 35, 463, 35, 44, 33, 42, 35, 44, + 21, 22, 455, 22, 22, 22, 22, 22, 22, 22, + 23, 55, 23, 23, 23, 23, 23, 23, 23, 22, + 26, 36, 51, 454, 22, 38, 51, 38, 23, 37, + + 453, 36, 22, 37, 36, 39, 38, 26, 37, 26, + 26, 23, 41, 39, 37, 39, 45, 47, 39, 22, + 41, 55, 135, 146, 39, 146, 49, 50, 112, 45, + 50, 41, 47, 49, 49, 47, 52, 135, 50, 122, + 52, 112, 452, 49, 49, 50, 49, 122, 451, 52, + 74, 74, 74, 74, 74, 74, 74, 78, 78, 78, + 78, 78, 78, 78, 450, 120, 74, 142, 120, 120, + 168, 168, 120, 78, 120, 142, 194, 194, 194, 74, + 218, 218, 218, 417, 417, 79, 78, 79, 79, 79, + 79, 79, 79, 79, 80, 448, 80, 80, 80, 80, + + 80, 80, 80, 79, 156, 156, 156, 156, 156, 156, + 156, 446, 80, 81, 445, 81, 79, 444, 81, 81, + 81, 81, 81, 81, 81, 80, 83, 214, 83, 83, + 83, 83, 83, 83, 83, 214, 229, 229, 229, 443, + 152, 442, 152, 440, 83, 152, 152, 152, 152, 152, + 152, 152, 237, 237, 237, 439, 438, 83, 154, 154, + 154, 154, 154, 154, 154, 245, 245, 245, 437, 436, + 155, 435, 155, 434, 154, 155, 155, 155, 155, 155, + 155, 155, 249, 249, 249, 433, 432, 154, 157, 157, + 157, 157, 157, 157, 157, 222, 222, 222, 222, 222, + + 222, 222, 223, 223, 223, 223, 223, 223, 223, 224, + 224, 224, 224, 224, 224, 224, 225, 225, 225, 225, + 225, 225, 225, 255, 255, 255, 388, 388, 388, 430, + 429, 428, 427, 426, 425, 424, 423, 422, 421, 388, + 420, 388, 459, 459, 459, 459, 460, 460, 461, 461, + 462, 419, 462, 462, 418, 416, 407, 406, 405, 404, + 403, 402, 400, 399, 398, 395, 394, 392, 389, 387, + 386, 385, 383, 382, 381, 378, 377, 376, 375, 374, + 373, 372, 371, 365, 362, 359, 358, 357, 356, 355, + 353, 351, 350, 349, 348, 346, 345, 343, 341, 340, + + 339, 338, 337, 336, 335, 334, 332, 331, 330, 329, + 328, 327, 326, 325, 324, 320, 319, 316, 305, 301, + 300, 299, 298, 291, 290, 289, 284, 283, 282, 281, + 280, 279, 276, 275, 274, 273, 272, 271, 270, 269, + 268, 267, 266, 265, 264, 263, 262, 261, 254, 253, + 252, 251, 250, 248, 244, 242, 241, 240, 236, 235, + 234, 233, 232, 231, 228, 226, 221, 220, 219, 217, + 216, 215, 213, 212, 211, 210, 209, 208, 207, 206, + 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, + 195, 193, 192, 191, 190, 189, 188, 187, 186, 185, + + 184, 183, 182, 181, 179, 178, 177, 176, 175, 174, + 173, 172, 171, 170, 169, 167, 166, 165, 164, 163, + 162, 147, 145, 144, 143, 141, 140, 139, 138, 137, + 136, 134, 133, 132, 131, 130, 129, 128, 127, 126, + 125, 124, 123, 121, 118, 117, 116, 115, 114, 113, + 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, + 101, 100, 99, 98, 97, 96, 95, 91, 87, 60, + 53, 48, 46, 43, 40, 27, 24, 16, 11, 7, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458 + } ; + +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[156] = + { 0, +0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, }; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +/* +// +// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +This file contains the Lex specification for GLSL ES. +Based on ANSI C grammar, Lex specification: +http://www.lysator.liu.se/c/ANSI-C-grammar-l.html + +IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh, +WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp). +*/ + +#include "compiler/glslang.h" +#include "compiler/ParseHelper.h" +#include "compiler/preprocessor/Token.h" +#include "compiler/util.h" +#include "glslang_tab.h" + +/* windows only pragma */ +#ifdef _MSC_VER +#pragma warning(disable : 4102) +#endif + +#define YY_USER_ACTION yylval->lex.line = yylineno; +#define YY_INPUT(buf, result, max_size) \ + result = string_input(buf, max_size, yyscanner); + +static int string_input(char* buf, int max_size, yyscan_t yyscanner); +static int check_type(yyscan_t yyscanner); +static int reserved_word(yyscan_t yyscanner); + +#define INITIAL 0 +#define COMMENT 1 +#define FIELDS 2 + +#define YY_EXTRA_TYPE TParseContext* + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + yy_size_t yy_n_chars; + yy_size_t yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + YYSTYPE * yylval_r; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + + /* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ + # define yylval yyg->yylval_r + +int yylex_init (yyscan_t* scanner); + +int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (yyscan_t yyscanner ); + +int yyget_debug (yyscan_t yyscanner ); + +void yyset_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *yyget_in (yyscan_t yyscanner ); + +void yyset_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *yyget_out (yyscan_t yyscanner ); + +void yyset_out (FILE * out_str ,yyscan_t yyscanner ); + +yy_size_t yyget_leng (yyscan_t yyscanner ); + +char *yyget_text (yyscan_t yyscanner ); + +int yyget_lineno (yyscan_t yyscanner ); + +void yyset_lineno (int line_number ,yyscan_t yyscanner ); + +YYSTYPE * yyget_lval (yyscan_t yyscanner ); + +void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (yyscan_t yyscanner ); +#else +extern int yywrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + + static void yy_push_state (int new_state ,yyscan_t yyscanner); + + static void yy_pop_state (yyscan_t yyscanner ); + + static int yy_top_state (yyscan_t yyscanner ); + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + yy_size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex \ + (YYSTYPE * yylval_param ,yyscan_t yyscanner); + +#define YY_DECL int yylex \ + (YYSTYPE * yylval_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + TParseContext* context = yyextra; + + /* Single-line comments */ + + yylval = yylval_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 459 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_current_state != 458 ); + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + yy_size_t yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + } + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +; + YY_BREAK +/* Multi-line comments */ +case 2: +YY_RULE_SETUP +{ yy_push_state(COMMENT, yyscanner); } + YY_BREAK +case 3: +case 4: +/* rule 4 can match eol */ +YY_RULE_SETUP +; + YY_BREAK +case 5: +YY_RULE_SETUP +{ yy_pop_state(yyscanner); } + YY_BREAK +case 6: +YY_RULE_SETUP +{ return(INVARIANT); } + YY_BREAK +case 7: +YY_RULE_SETUP +{ return(HIGH_PRECISION); } + YY_BREAK +case 8: +YY_RULE_SETUP +{ return(MEDIUM_PRECISION); } + YY_BREAK +case 9: +YY_RULE_SETUP +{ return(LOW_PRECISION); } + YY_BREAK +case 10: +YY_RULE_SETUP +{ return(PRECISION); } + YY_BREAK +case 11: +YY_RULE_SETUP +{ return(ATTRIBUTE); } + YY_BREAK +case 12: +YY_RULE_SETUP +{ return(CONST_QUAL); } + YY_BREAK +case 13: +YY_RULE_SETUP +{ return(UNIFORM); } + YY_BREAK +case 14: +YY_RULE_SETUP +{ return(VARYING); } + YY_BREAK +case 15: +YY_RULE_SETUP +{ return(BREAK); } + YY_BREAK +case 16: +YY_RULE_SETUP +{ return(CONTINUE); } + YY_BREAK +case 17: +YY_RULE_SETUP +{ return(DO); } + YY_BREAK +case 18: +YY_RULE_SETUP +{ return(FOR); } + YY_BREAK +case 19: +YY_RULE_SETUP +{ return(WHILE); } + YY_BREAK +case 20: +YY_RULE_SETUP +{ return(IF); } + YY_BREAK +case 21: +YY_RULE_SETUP +{ return(ELSE); } + YY_BREAK +case 22: +YY_RULE_SETUP +{ return(IN_QUAL); } + YY_BREAK +case 23: +YY_RULE_SETUP +{ return(OUT_QUAL); } + YY_BREAK +case 24: +YY_RULE_SETUP +{ return(INOUT_QUAL); } + YY_BREAK +case 25: +YY_RULE_SETUP +{ context->lexAfterType = true; return(FLOAT_TYPE); } + YY_BREAK +case 26: +YY_RULE_SETUP +{ context->lexAfterType = true; return(INT_TYPE); } + YY_BREAK +case 27: +YY_RULE_SETUP +{ context->lexAfterType = true; return(VOID_TYPE); } + YY_BREAK +case 28: +YY_RULE_SETUP +{ context->lexAfterType = true; return(BOOL_TYPE); } + YY_BREAK +case 29: +YY_RULE_SETUP +{ yylval->lex.b = true; return(BOOLCONSTANT); } + YY_BREAK +case 30: +YY_RULE_SETUP +{ yylval->lex.b = false; return(BOOLCONSTANT); } + YY_BREAK +case 31: +YY_RULE_SETUP +{ return(DISCARD); } + YY_BREAK +case 32: +YY_RULE_SETUP +{ return(RETURN); } + YY_BREAK +case 33: +YY_RULE_SETUP +{ context->lexAfterType = true; return(MATRIX2); } + YY_BREAK +case 34: +YY_RULE_SETUP +{ context->lexAfterType = true; return(MATRIX3); } + YY_BREAK +case 35: +YY_RULE_SETUP +{ context->lexAfterType = true; return(MATRIX4); } + YY_BREAK +case 36: +YY_RULE_SETUP +{ context->lexAfterType = true; return (VEC2); } + YY_BREAK +case 37: +YY_RULE_SETUP +{ context->lexAfterType = true; return (VEC3); } + YY_BREAK +case 38: +YY_RULE_SETUP +{ context->lexAfterType = true; return (VEC4); } + YY_BREAK +case 39: +YY_RULE_SETUP +{ context->lexAfterType = true; return (IVEC2); } + YY_BREAK +case 40: +YY_RULE_SETUP +{ context->lexAfterType = true; return (IVEC3); } + YY_BREAK +case 41: +YY_RULE_SETUP +{ context->lexAfterType = true; return (IVEC4); } + YY_BREAK +case 42: +YY_RULE_SETUP +{ context->lexAfterType = true; return (BVEC2); } + YY_BREAK +case 43: +YY_RULE_SETUP +{ context->lexAfterType = true; return (BVEC3); } + YY_BREAK +case 44: +YY_RULE_SETUP +{ context->lexAfterType = true; return (BVEC4); } + YY_BREAK +case 45: +YY_RULE_SETUP +{ context->lexAfterType = true; return SAMPLER2D; } + YY_BREAK +case 46: +YY_RULE_SETUP +{ context->lexAfterType = true; return SAMPLERCUBE; } + YY_BREAK +case 47: +YY_RULE_SETUP +{ context->lexAfterType = true; return SAMPLER_EXTERNAL_OES; } + YY_BREAK +case 48: +YY_RULE_SETUP +{ context->lexAfterType = true; return SAMPLER2DRECT; } + YY_BREAK +case 49: +YY_RULE_SETUP +{ context->lexAfterType = true; return(STRUCT); } + YY_BREAK +case 50: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 51: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 52: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 53: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 54: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 55: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 56: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 57: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 58: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 59: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 60: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 61: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 62: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 63: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 64: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 65: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 66: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 67: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 68: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 69: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 70: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 71: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 72: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 73: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 74: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 75: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 76: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 77: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 78: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 79: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 80: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 81: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 82: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 83: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 84: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 85: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 86: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 87: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 88: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 89: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 90: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 91: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 92: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 93: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 94: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 95: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 96: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 97: +YY_RULE_SETUP +{ return reserved_word(yyscanner); } + YY_BREAK +case 98: +YY_RULE_SETUP +{ + yylval->lex.string = NewPoolTString(yytext); + return check_type(yyscanner); +} + YY_BREAK +case 99: +YY_RULE_SETUP +{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); } + YY_BREAK +case 100: +YY_RULE_SETUP +{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); } + YY_BREAK +case 101: +YY_RULE_SETUP +{ context->error(yylineno, "Invalid Octal number.", yytext); context->recover(); return 0;} + YY_BREAK +case 102: +YY_RULE_SETUP +{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); } + YY_BREAK +case 103: +YY_RULE_SETUP +{ yylval->lex.f = static_cast(atof_dot(yytext)); return(FLOATCONSTANT); } + YY_BREAK +case 104: +YY_RULE_SETUP +{ yylval->lex.f = static_cast(atof_dot(yytext)); return(FLOATCONSTANT); } + YY_BREAK +case 105: +YY_RULE_SETUP +{ yylval->lex.f = static_cast(atof_dot(yytext)); return(FLOATCONSTANT); } + YY_BREAK +case 106: +YY_RULE_SETUP +{ return(ADD_ASSIGN); } + YY_BREAK +case 107: +YY_RULE_SETUP +{ return(SUB_ASSIGN); } + YY_BREAK +case 108: +YY_RULE_SETUP +{ return(MUL_ASSIGN); } + YY_BREAK +case 109: +YY_RULE_SETUP +{ return(DIV_ASSIGN); } + YY_BREAK +case 110: +YY_RULE_SETUP +{ return(MOD_ASSIGN); } + YY_BREAK +case 111: +YY_RULE_SETUP +{ return(LEFT_ASSIGN); } + YY_BREAK +case 112: +YY_RULE_SETUP +{ return(RIGHT_ASSIGN); } + YY_BREAK +case 113: +YY_RULE_SETUP +{ return(AND_ASSIGN); } + YY_BREAK +case 114: +YY_RULE_SETUP +{ return(XOR_ASSIGN); } + YY_BREAK +case 115: +YY_RULE_SETUP +{ return(OR_ASSIGN); } + YY_BREAK +case 116: +YY_RULE_SETUP +{ return(INC_OP); } + YY_BREAK +case 117: +YY_RULE_SETUP +{ return(DEC_OP); } + YY_BREAK +case 118: +YY_RULE_SETUP +{ return(AND_OP); } + YY_BREAK +case 119: +YY_RULE_SETUP +{ return(OR_OP); } + YY_BREAK +case 120: +YY_RULE_SETUP +{ return(XOR_OP); } + YY_BREAK +case 121: +YY_RULE_SETUP +{ return(LE_OP); } + YY_BREAK +case 122: +YY_RULE_SETUP +{ return(GE_OP); } + YY_BREAK +case 123: +YY_RULE_SETUP +{ return(EQ_OP); } + YY_BREAK +case 124: +YY_RULE_SETUP +{ return(NE_OP); } + YY_BREAK +case 125: +YY_RULE_SETUP +{ return(LEFT_OP); } + YY_BREAK +case 126: +YY_RULE_SETUP +{ return(RIGHT_OP); } + YY_BREAK +case 127: +YY_RULE_SETUP +{ context->lexAfterType = false; return(SEMICOLON); } + YY_BREAK +case 128: +YY_RULE_SETUP +{ context->lexAfterType = false; return(LEFT_BRACE); } + YY_BREAK +case 129: +YY_RULE_SETUP +{ return(RIGHT_BRACE); } + YY_BREAK +case 130: +YY_RULE_SETUP +{ if (context->inTypeParen) context->lexAfterType = false; return(COMMA); } + YY_BREAK +case 131: +YY_RULE_SETUP +{ return(COLON); } + YY_BREAK +case 132: +YY_RULE_SETUP +{ context->lexAfterType = false; return(EQUAL); } + YY_BREAK +case 133: +YY_RULE_SETUP +{ context->lexAfterType = false; context->inTypeParen = true; return(LEFT_PAREN); } + YY_BREAK +case 134: +YY_RULE_SETUP +{ context->inTypeParen = false; return(RIGHT_PAREN); } + YY_BREAK +case 135: +YY_RULE_SETUP +{ return(LEFT_BRACKET); } + YY_BREAK +case 136: +YY_RULE_SETUP +{ return(RIGHT_BRACKET); } + YY_BREAK +case 137: +YY_RULE_SETUP +{ BEGIN(FIELDS); return(DOT); } + YY_BREAK +case 138: +YY_RULE_SETUP +{ return(BANG); } + YY_BREAK +case 139: +YY_RULE_SETUP +{ return(DASH); } + YY_BREAK +case 140: +YY_RULE_SETUP +{ return(TILDE); } + YY_BREAK +case 141: +YY_RULE_SETUP +{ return(PLUS); } + YY_BREAK +case 142: +YY_RULE_SETUP +{ return(STAR); } + YY_BREAK +case 143: +YY_RULE_SETUP +{ return(SLASH); } + YY_BREAK +case 144: +YY_RULE_SETUP +{ return(PERCENT); } + YY_BREAK +case 145: +YY_RULE_SETUP +{ return(LEFT_ANGLE); } + YY_BREAK +case 146: +YY_RULE_SETUP +{ return(RIGHT_ANGLE); } + YY_BREAK +case 147: +YY_RULE_SETUP +{ return(VERTICAL_BAR); } + YY_BREAK +case 148: +YY_RULE_SETUP +{ return(CARET); } + YY_BREAK +case 149: +YY_RULE_SETUP +{ return(AMPERSAND); } + YY_BREAK +case 150: +YY_RULE_SETUP +{ return(QUESTION); } + YY_BREAK +case 151: +YY_RULE_SETUP +{ + BEGIN(INITIAL); + yylval->lex.string = NewPoolTString(yytext); + return FIELD_SELECTION; +} + YY_BREAK +case 152: +YY_RULE_SETUP +{} + YY_BREAK +case 153: +/* rule 153 can match eol */ +YY_RULE_SETUP +{ } + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(COMMENT): +case YY_STATE_EOF(FIELDS): +{ context->AfterEOF = true; yyterminate(); } + YY_BREAK +case 154: +YY_RULE_SETUP +{ context->warning(yylineno, "Unknown char", yytext, ""); return 0; } + YY_BREAK +case 155: +YY_RULE_SETUP +ECHO; + YY_BREAK + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( yywrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 459 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 459 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 458); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap(yyscanner ) ) + return 0; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + if ( c == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + yy_load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void yy_load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * @param yyscanner The scanner object. + */ + void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ,yyscanner ); + + yyfree((void *) b ,yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(yyscanner); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void yypop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (yyscan_t yyscanner) +{ + yy_size_t num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n, i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + + static void yy_push_state (int new_state , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) + { + yy_size_t new_size; + + yyg->yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yyg->yy_start_stack_depth * sizeof( int ); + + if ( ! yyg->yy_start_stack ) + yyg->yy_start_stack = (int *) yyalloc(new_size ,yyscanner ); + + else + yyg->yy_start_stack = (int *) yyrealloc((void *) yyg->yy_start_stack,new_size ,yyscanner ); + + if ( ! yyg->yy_start_stack ) + YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); + } + + yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); +} + + static void yy_pop_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( --yyg->yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); +} + + static int yy_top_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1]; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +yy_size_t yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "yyset_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void yyset_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void yyset_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * yyget_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +/* User-visible API */ + +/* yylex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int yylex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* yylex_init_extra has the same functionality as yylex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to yyalloc in + * the yyextra field. + */ + +int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + yyfree(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + yyfree(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + yyfree ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +int string_input(char* buf, int max_size, yyscan_t yyscanner) { + pp::Token token; + yyget_extra(yyscanner)->preprocessor.lex(&token); + int len = token.type == pp::Token::LAST ? 0 : token.text.size(); + if ((len > 0) && (len < max_size)) + memcpy(buf, token.text.c_str(), len); + yyset_lineno(EncodeSourceLoc(token.location.file, token.location.line),yyscanner); + + if (len >= max_size) + YY_FATAL_ERROR("Input buffer overflow"); + else if (len > 0) + buf[len++] = ' '; + return len; +} + +int check_type(yyscan_t yyscanner) { + struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; + + int token = IDENTIFIER; + TSymbol* symbol = yyextra->symbolTable.find(yytext); + if (yyextra->lexAfterType == false && symbol && symbol->isVariable()) { + TVariable* variable = static_cast(symbol); + if (variable->isUserType()) { + yyextra->lexAfterType = true; + token = TYPE_NAME; + } + } + yylval->lex.symbol = symbol; + return token; +} + +int reserved_word(yyscan_t yyscanner) { + struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; + + yyextra->error(yylineno, "Illegal use of reserved word", yytext, ""); + yyextra->recover(); + return 0; +} + +void yyerror(TParseContext* context, const char* reason) { + struct yyguts_t* yyg = (struct yyguts_t*) context->scanner; + + if (context->AfterEOF) { + context->error(yylineno, reason, "unexpected EOF"); + } else { + context->error(yylineno, reason, yytext); + } + context->recover(); +} + +int glslang_initialize(TParseContext* context) { + yyscan_t scanner = NULL; + if (yylex_init_extra(context,&scanner)) + return 1; + + context->scanner = scanner; + return 0; +} + +int glslang_finalize(TParseContext* context) { + yyscan_t scanner = context->scanner; + if (scanner == NULL) return 0; + + context->scanner = NULL; + yylex_destroy(scanner); + + return 0; +} + +int glslang_scan(int count, const char* const string[], const int length[], + TParseContext* context) { + yyrestart(NULL,context->scanner); + yyset_lineno(EncodeSourceLoc(0, 1),context->scanner); + context->AfterEOF = false; + + // Initialize preprocessor. + if (!context->preprocessor.init(count, string, length)) + return 1; + + // Define extension macros. + const TExtensionBehavior& extBehavior = context->extensionBehavior(); + for (TExtensionBehavior::const_iterator iter = extBehavior.begin(); + iter != extBehavior.end(); ++iter) { + context->preprocessor.predefineMacro(iter->first.c_str(), 1); + } + return 0; +} + diff --git a/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp b/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp new file mode 100644 index 0000000..72cc849 --- /dev/null +++ b/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp @@ -0,0 +1,4847 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + INVARIANT = 258, + HIGH_PRECISION = 259, + MEDIUM_PRECISION = 260, + LOW_PRECISION = 261, + PRECISION = 262, + ATTRIBUTE = 263, + CONST_QUAL = 264, + BOOL_TYPE = 265, + FLOAT_TYPE = 266, + INT_TYPE = 267, + BREAK = 268, + CONTINUE = 269, + DO = 270, + ELSE = 271, + FOR = 272, + IF = 273, + DISCARD = 274, + RETURN = 275, + BVEC2 = 276, + BVEC3 = 277, + BVEC4 = 278, + IVEC2 = 279, + IVEC3 = 280, + IVEC4 = 281, + VEC2 = 282, + VEC3 = 283, + VEC4 = 284, + MATRIX2 = 285, + MATRIX3 = 286, + MATRIX4 = 287, + IN_QUAL = 288, + OUT_QUAL = 289, + INOUT_QUAL = 290, + UNIFORM = 291, + VARYING = 292, + STRUCT = 293, + VOID_TYPE = 294, + WHILE = 295, + SAMPLER2D = 296, + SAMPLERCUBE = 297, + SAMPLER_EXTERNAL_OES = 298, + SAMPLER2DRECT = 299, + IDENTIFIER = 300, + TYPE_NAME = 301, + FLOATCONSTANT = 302, + INTCONSTANT = 303, + BOOLCONSTANT = 304, + FIELD_SELECTION = 305, + LEFT_OP = 306, + RIGHT_OP = 307, + INC_OP = 308, + DEC_OP = 309, + LE_OP = 310, + GE_OP = 311, + EQ_OP = 312, + NE_OP = 313, + AND_OP = 314, + OR_OP = 315, + XOR_OP = 316, + MUL_ASSIGN = 317, + DIV_ASSIGN = 318, + ADD_ASSIGN = 319, + MOD_ASSIGN = 320, + LEFT_ASSIGN = 321, + RIGHT_ASSIGN = 322, + AND_ASSIGN = 323, + XOR_ASSIGN = 324, + OR_ASSIGN = 325, + SUB_ASSIGN = 326, + LEFT_PAREN = 327, + RIGHT_PAREN = 328, + LEFT_BRACKET = 329, + RIGHT_BRACKET = 330, + LEFT_BRACE = 331, + RIGHT_BRACE = 332, + DOT = 333, + COMMA = 334, + COLON = 335, + EQUAL = 336, + SEMICOLON = 337, + BANG = 338, + DASH = 339, + TILDE = 340, + PLUS = 341, + STAR = 342, + SLASH = 343, + PERCENT = 344, + LEFT_ANGLE = 345, + RIGHT_ANGLE = 346, + VERTICAL_BAR = 347, + CARET = 348, + AMPERSAND = 349, + QUESTION = 350 + }; +#endif +/* Tokens. */ +#define INVARIANT 258 +#define HIGH_PRECISION 259 +#define MEDIUM_PRECISION 260 +#define LOW_PRECISION 261 +#define PRECISION 262 +#define ATTRIBUTE 263 +#define CONST_QUAL 264 +#define BOOL_TYPE 265 +#define FLOAT_TYPE 266 +#define INT_TYPE 267 +#define BREAK 268 +#define CONTINUE 269 +#define DO 270 +#define ELSE 271 +#define FOR 272 +#define IF 273 +#define DISCARD 274 +#define RETURN 275 +#define BVEC2 276 +#define BVEC3 277 +#define BVEC4 278 +#define IVEC2 279 +#define IVEC3 280 +#define IVEC4 281 +#define VEC2 282 +#define VEC3 283 +#define VEC4 284 +#define MATRIX2 285 +#define MATRIX3 286 +#define MATRIX4 287 +#define IN_QUAL 288 +#define OUT_QUAL 289 +#define INOUT_QUAL 290 +#define UNIFORM 291 +#define VARYING 292 +#define STRUCT 293 +#define VOID_TYPE 294 +#define WHILE 295 +#define SAMPLER2D 296 +#define SAMPLERCUBE 297 +#define SAMPLER_EXTERNAL_OES 298 +#define SAMPLER2DRECT 299 +#define IDENTIFIER 300 +#define TYPE_NAME 301 +#define FLOATCONSTANT 302 +#define INTCONSTANT 303 +#define BOOLCONSTANT 304 +#define FIELD_SELECTION 305 +#define LEFT_OP 306 +#define RIGHT_OP 307 +#define INC_OP 308 +#define DEC_OP 309 +#define LE_OP 310 +#define GE_OP 311 +#define EQ_OP 312 +#define NE_OP 313 +#define AND_OP 314 +#define OR_OP 315 +#define XOR_OP 316 +#define MUL_ASSIGN 317 +#define DIV_ASSIGN 318 +#define ADD_ASSIGN 319 +#define MOD_ASSIGN 320 +#define LEFT_ASSIGN 321 +#define RIGHT_ASSIGN 322 +#define AND_ASSIGN 323 +#define XOR_ASSIGN 324 +#define OR_ASSIGN 325 +#define SUB_ASSIGN 326 +#define LEFT_PAREN 327 +#define RIGHT_PAREN 328 +#define LEFT_BRACKET 329 +#define RIGHT_BRACKET 330 +#define LEFT_BRACE 331 +#define RIGHT_BRACE 332 +#define DOT 333 +#define COMMA 334 +#define COLON 335 +#define EQUAL 336 +#define SEMICOLON 337 +#define BANG 338 +#define DASH 339 +#define TILDE 340 +#define PLUS 341 +#define STAR 342 +#define SLASH 343 +#define PERCENT 344 +#define LEFT_ANGLE 345 +#define RIGHT_ANGLE 346 +#define VERTICAL_BAR 347 +#define CARET 348 +#define AMPERSAND 349 +#define QUESTION 350 + + + + +/* Copy the first part of user declarations. */ + + +// +// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// This file is auto-generated by generate_parser.sh. DO NOT EDIT! + +// Ignore errors in auto-generated code. +#if defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wswitch-enum" +#elif defined(_MSC_VER) +#pragma warning(disable: 4065) +#pragma warning(disable: 4189) +#pragma warning(disable: 4505) +#pragma warning(disable: 4701) +#endif + +#include "compiler/SymbolTable.h" +#include "compiler/ParseHelper.h" +#include "GLSLANG/ShaderLang.h" + +#define YYENABLE_NLS 0 +#define YYLTYPE_IS_TRIVIAL 1 + +#define YYLEX_PARAM context->scanner + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE + +{ + struct { + TSourceLoc line; + union { + TString *string; + float f; + int i; + bool b; + }; + TSymbol* symbol; + } lex; + struct { + TSourceLoc line; + TOperator op; + union { + TIntermNode* intermNode; + TIntermNodePair nodePair; + TIntermTyped* intermTypedNode; + TIntermAggregate* intermAggregate; + }; + union { + TPublicType type; + TPrecision precision; + TQualifier qualifier; + TFunction* function; + TParameter param; + TTypeLine typeLine; + TTypeList* typeList; + }; + } interm; +} +/* Line 193 of yacc.c. */ + + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +extern int yylex(YYSTYPE* yylval_param, void* yyscanner); +extern void yyerror(TParseContext* context, const char* reason); + +#define FRAG_VERT_ONLY(S, L) { \ + if (context->shaderType != SH_FRAGMENT_SHADER && \ + context->shaderType != SH_VERTEX_SHADER) { \ + context->error(L, " supported in vertex/fragment shaders only ", S); \ + context->recover(); \ + } \ +} + +#define VERTEX_ONLY(S, L) { \ + if (context->shaderType != SH_VERTEX_SHADER) { \ + context->error(L, " supported in vertex shaders only ", S); \ + context->recover(); \ + } \ +} + +#define FRAG_ONLY(S, L) { \ + if (context->shaderType != SH_FRAGMENT_SHADER) { \ + context->error(L, " supported in fragment shaders only ", S); \ + context->recover(); \ + } \ +} + + +/* Line 216 of yacc.c. */ + + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 71 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 1416 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 96 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 83 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 201 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 304 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 350 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 5, 7, 9, 11, 13, 17, 19, + 24, 26, 30, 33, 36, 38, 40, 42, 46, 49, + 52, 55, 57, 60, 64, 67, 69, 71, 73, 75, + 78, 81, 84, 86, 88, 90, 92, 96, 100, 102, + 106, 110, 112, 114, 118, 122, 126, 130, 132, 136, + 140, 142, 144, 146, 148, 152, 154, 158, 160, 164, + 166, 172, 174, 178, 180, 182, 184, 186, 188, 190, + 194, 196, 199, 202, 207, 210, 212, 214, 217, 221, + 225, 228, 234, 238, 241, 245, 248, 249, 251, 253, + 255, 257, 259, 263, 269, 276, 282, 284, 287, 292, + 298, 303, 306, 308, 311, 313, 315, 317, 320, 322, + 324, 327, 329, 331, 333, 335, 340, 342, 344, 346, + 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, + 368, 370, 372, 374, 376, 378, 380, 382, 384, 385, + 392, 393, 399, 401, 404, 408, 410, 414, 416, 421, + 423, 425, 427, 429, 431, 433, 435, 437, 439, 442, + 443, 444, 450, 452, 454, 455, 458, 459, 462, 465, + 469, 471, 474, 476, 479, 485, 489, 491, 493, 498, + 499, 506, 507, 516, 517, 525, 527, 529, 531, 532, + 535, 539, 542, 545, 548, 552, 555, 557, 560, 562, + 564, 565 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = +{ + 175, 0, -1, 45, -1, 97, -1, 48, -1, 47, + -1, 49, -1, 72, 124, 73, -1, 98, -1, 99, + 74, 100, 75, -1, 101, -1, 99, 78, 50, -1, + 99, 53, -1, 99, 54, -1, 124, -1, 102, -1, + 103, -1, 99, 78, 103, -1, 105, 73, -1, 104, + 73, -1, 106, 39, -1, 106, -1, 106, 122, -1, + 105, 79, 122, -1, 107, 72, -1, 142, -1, 45, + -1, 50, -1, 99, -1, 53, 108, -1, 54, 108, + -1, 109, 108, -1, 86, -1, 84, -1, 83, -1, + 108, -1, 110, 87, 108, -1, 110, 88, 108, -1, + 110, -1, 111, 86, 110, -1, 111, 84, 110, -1, + 111, -1, 112, -1, 113, 90, 112, -1, 113, 91, + 112, -1, 113, 55, 112, -1, 113, 56, 112, -1, + 113, -1, 114, 57, 113, -1, 114, 58, 113, -1, + 114, -1, 115, -1, 116, -1, 117, -1, 118, 59, + 117, -1, 118, -1, 119, 61, 118, -1, 119, -1, + 120, 60, 119, -1, 120, -1, 120, 95, 124, 80, + 122, -1, 121, -1, 108, 123, 122, -1, 81, -1, + 62, -1, 63, -1, 64, -1, 71, -1, 122, -1, + 124, 79, 122, -1, 121, -1, 127, 82, -1, 135, + 82, -1, 7, 140, 141, 82, -1, 128, 73, -1, + 130, -1, 129, -1, 130, 132, -1, 129, 79, 132, + -1, 137, 45, 72, -1, 139, 45, -1, 139, 45, + 74, 125, 75, -1, 138, 133, 131, -1, 133, 131, + -1, 138, 133, 134, -1, 133, 134, -1, -1, 33, + -1, 34, -1, 35, -1, 139, -1, 136, -1, 135, + 79, 45, -1, 135, 79, 45, 74, 75, -1, 135, + 79, 45, 74, 125, 75, -1, 135, 79, 45, 81, + 150, -1, 137, -1, 137, 45, -1, 137, 45, 74, + 75, -1, 137, 45, 74, 125, 75, -1, 137, 45, + 81, 150, -1, 3, 45, -1, 139, -1, 138, 139, + -1, 9, -1, 8, -1, 37, -1, 3, 37, -1, + 36, -1, 141, -1, 140, 141, -1, 4, -1, 5, + -1, 6, -1, 142, -1, 142, 74, 125, 75, -1, + 39, -1, 11, -1, 12, -1, 10, -1, 27, -1, + 28, -1, 29, -1, 21, -1, 22, -1, 23, -1, + 24, -1, 25, -1, 26, -1, 30, -1, 31, -1, + 32, -1, 41, -1, 42, -1, 43, -1, 44, -1, + 143, -1, 46, -1, -1, 38, 45, 76, 144, 146, + 77, -1, -1, 38, 76, 145, 146, 77, -1, 147, + -1, 146, 147, -1, 139, 148, 82, -1, 149, -1, + 148, 79, 149, -1, 45, -1, 45, 74, 125, 75, + -1, 122, -1, 126, -1, 154, -1, 153, -1, 151, + -1, 163, -1, 164, -1, 167, -1, 174, -1, 76, + 77, -1, -1, -1, 76, 155, 162, 156, 77, -1, + 161, -1, 153, -1, -1, 159, 161, -1, -1, 160, + 153, -1, 76, 77, -1, 76, 162, 77, -1, 152, + -1, 162, 152, -1, 82, -1, 124, 82, -1, 18, + 72, 124, 73, 165, -1, 158, 16, 158, -1, 158, + -1, 124, -1, 137, 45, 81, 150, -1, -1, 40, + 72, 168, 166, 73, 157, -1, -1, 15, 169, 158, + 40, 72, 124, 73, 82, -1, -1, 17, 72, 170, + 171, 173, 73, 157, -1, 163, -1, 151, -1, 166, + -1, -1, 172, 82, -1, 172, 82, 124, -1, 14, + 82, -1, 13, 82, -1, 20, 82, -1, 20, 124, + 82, -1, 19, 82, -1, 176, -1, 175, 176, -1, + 177, -1, 126, -1, -1, 127, 178, 161, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 168, 168, 203, 206, 219, 224, 229, 235, 238, + 317, 320, 421, 431, 444, 452, 552, 555, 563, 567, + 574, 578, 585, 591, 600, 608, 663, 670, 680, 683, + 693, 703, 724, 725, 726, 731, 732, 741, 753, 754, + 762, 773, 777, 778, 788, 798, 808, 821, 822, 832, + 845, 849, 853, 857, 858, 871, 872, 885, 886, 899, + 900, 917, 918, 931, 932, 933, 934, 935, 939, 942, + 953, 961, 988, 993, 1000, 1038, 1041, 1048, 1056, 1077, + 1098, 1109, 1138, 1143, 1153, 1158, 1168, 1171, 1174, 1177, + 1183, 1190, 1193, 1215, 1233, 1257, 1280, 1284, 1302, 1310, + 1342, 1362, 1451, 1460, 1483, 1486, 1492, 1500, 1508, 1516, + 1526, 1533, 1536, 1539, 1545, 1548, 1563, 1567, 1571, 1575, + 1584, 1589, 1594, 1599, 1604, 1609, 1614, 1619, 1624, 1629, + 1635, 1641, 1647, 1652, 1657, 1666, 1675, 1680, 1693, 1693, + 1707, 1707, 1716, 1719, 1734, 1770, 1774, 1780, 1788, 1804, + 1808, 1812, 1813, 1819, 1820, 1821, 1822, 1823, 1827, 1828, + 1828, 1828, 1838, 1839, 1843, 1843, 1844, 1844, 1849, 1852, + 1862, 1865, 1871, 1872, 1876, 1884, 1888, 1898, 1903, 1920, + 1920, 1925, 1925, 1932, 1932, 1940, 1943, 1949, 1952, 1958, + 1962, 1969, 1976, 1983, 1990, 2001, 2010, 2014, 2021, 2024, + 2030, 2030 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION", + "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE", + "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE", + "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3", + "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2", + "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM", + "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE", + "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME", + "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION", + "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", + "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", + "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", + "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", + "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", + "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", + "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", + "CARET", "AMPERSAND", "QUESTION", "$accept", "variable_identifier", + "primary_expression", "postfix_expression", "integer_expression", + "function_call", "function_call_or_method", "function_call_generic", + "function_call_header_no_parameters", + "function_call_header_with_parameters", "function_call_header", + "function_identifier", "unary_expression", "unary_operator", + "multiplicative_expression", "additive_expression", "shift_expression", + "relational_expression", "equality_expression", "and_expression", + "exclusive_or_expression", "inclusive_or_expression", + "logical_and_expression", "logical_xor_expression", + "logical_or_expression", "conditional_expression", + "assignment_expression", "assignment_operator", "expression", + "constant_expression", "declaration", "function_prototype", + "function_declarator", "function_header_with_parameters", + "function_header", "parameter_declarator", "parameter_declaration", + "parameter_qualifier", "parameter_type_specifier", + "init_declarator_list", "single_declaration", "fully_specified_type", + "type_qualifier", "type_specifier", "precision_qualifier", + "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier", + "@1", "@2", "struct_declaration_list", "struct_declaration", + "struct_declarator_list", "struct_declarator", "initializer", + "declaration_statement", "statement", "simple_statement", + "compound_statement", "@3", "@4", "statement_no_new_scope", + "statement_with_scope", "@5", "@6", "compound_statement_no_new_scope", + "statement_list", "expression_statement", "selection_statement", + "selection_rest_statement", "condition", "iteration_statement", "@7", + "@8", "@9", "for_init_statement", "conditionopt", "for_rest_statement", + "jump_statement", "translation_unit", "external_declaration", + "function_definition", "@10", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 96, 97, 98, 98, 98, 98, 98, 99, 99, + 99, 99, 99, 99, 100, 101, 102, 102, 103, 103, + 104, 104, 105, 105, 106, 107, 107, 107, 108, 108, + 108, 108, 109, 109, 109, 110, 110, 110, 111, 111, + 111, 112, 113, 113, 113, 113, 113, 114, 114, 114, + 115, 116, 117, 118, 118, 119, 119, 120, 120, 121, + 121, 122, 122, 123, 123, 123, 123, 123, 124, 124, + 125, 126, 126, 126, 127, 128, 128, 129, 129, 130, + 131, 131, 132, 132, 132, 132, 133, 133, 133, 133, + 134, 135, 135, 135, 135, 135, 136, 136, 136, 136, + 136, 136, 137, 137, 138, 138, 138, 138, 138, 139, + 139, 140, 140, 140, 141, 141, 142, 142, 142, 142, + 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, + 142, 142, 142, 142, 142, 142, 142, 142, 144, 143, + 145, 143, 146, 146, 147, 148, 148, 149, 149, 150, + 151, 152, 152, 153, 153, 153, 153, 153, 154, 155, + 156, 154, 157, 157, 159, 158, 160, 158, 161, 161, + 162, 162, 163, 163, 164, 165, 165, 166, 166, 168, + 167, 169, 167, 170, 167, 171, 171, 172, 172, 173, + 173, 174, 174, 174, 174, 174, 175, 175, 176, 176, + 178, 177 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 1, 1, 3, 1, 4, + 1, 3, 2, 2, 1, 1, 1, 3, 2, 2, + 2, 1, 2, 3, 2, 1, 1, 1, 1, 2, + 2, 2, 1, 1, 1, 1, 3, 3, 1, 3, + 3, 1, 1, 3, 3, 3, 3, 1, 3, 3, + 1, 1, 1, 1, 3, 1, 3, 1, 3, 1, + 5, 1, 3, 1, 1, 1, 1, 1, 1, 3, + 1, 2, 2, 4, 2, 1, 1, 2, 3, 3, + 2, 5, 3, 2, 3, 2, 0, 1, 1, 1, + 1, 1, 3, 5, 6, 5, 1, 2, 4, 5, + 4, 2, 1, 2, 1, 1, 1, 2, 1, 1, + 2, 1, 1, 1, 1, 4, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 0, 6, + 0, 5, 1, 2, 3, 1, 3, 1, 4, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, + 0, 5, 1, 1, 0, 2, 0, 2, 2, 3, + 1, 2, 1, 2, 5, 3, 1, 1, 4, 0, + 6, 0, 8, 0, 7, 1, 1, 1, 0, 2, + 3, 2, 2, 2, 3, 2, 1, 2, 1, 1, + 0, 3 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 0, 111, 112, 113, 0, 105, 104, 119, 117, + 118, 123, 124, 125, 126, 127, 128, 120, 121, 122, + 129, 130, 131, 108, 106, 0, 116, 132, 133, 134, + 135, 137, 199, 200, 0, 76, 86, 0, 91, 96, + 0, 102, 0, 109, 114, 136, 0, 196, 198, 107, + 101, 0, 0, 140, 71, 0, 74, 86, 0, 87, + 88, 89, 77, 0, 86, 0, 72, 97, 103, 110, + 0, 1, 197, 0, 138, 0, 0, 201, 78, 83, + 85, 90, 0, 92, 79, 0, 0, 2, 5, 4, + 6, 27, 0, 0, 0, 34, 33, 32, 3, 8, + 28, 10, 15, 16, 0, 0, 21, 0, 35, 0, + 38, 41, 42, 47, 50, 51, 52, 53, 55, 57, + 59, 70, 0, 25, 73, 0, 0, 0, 142, 0, + 0, 181, 0, 0, 0, 0, 0, 159, 168, 172, + 35, 61, 68, 0, 150, 0, 114, 153, 170, 152, + 151, 0, 154, 155, 156, 157, 80, 82, 84, 0, + 0, 98, 0, 149, 100, 29, 30, 0, 12, 13, + 0, 0, 19, 18, 0, 20, 22, 24, 31, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 115, 0, 147, 0, 145, 141, 143, + 192, 191, 166, 183, 0, 195, 193, 0, 179, 158, + 0, 64, 65, 66, 67, 63, 0, 0, 173, 169, + 171, 0, 93, 0, 95, 99, 7, 0, 14, 26, + 11, 17, 23, 36, 37, 40, 39, 45, 46, 43, + 44, 48, 49, 54, 56, 58, 0, 139, 0, 0, + 144, 0, 0, 0, 0, 0, 194, 0, 160, 62, + 69, 0, 94, 9, 0, 0, 146, 0, 165, 167, + 186, 185, 188, 166, 177, 0, 0, 0, 81, 60, + 148, 0, 187, 0, 0, 176, 174, 0, 0, 161, + 0, 189, 0, 166, 0, 163, 180, 162, 0, 190, + 184, 175, 178, 182 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 98, 99, 100, 227, 101, 102, 103, 104, 105, + 106, 107, 140, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 141, 142, 216, 143, 122, + 144, 145, 34, 35, 36, 79, 62, 63, 80, 37, + 38, 39, 40, 41, 42, 43, 123, 45, 125, 75, + 127, 128, 196, 197, 164, 147, 148, 149, 150, 210, + 277, 296, 251, 252, 253, 297, 151, 152, 153, 286, + 276, 154, 257, 202, 254, 272, 283, 284, 155, 46, + 47, 48, 55 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -266 +static const yytype_int16 yypact[] = +{ + 1253, -20, -266, -266, -266, 148, -266, -266, -266, -266, + -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, + -266, -266, -266, -266, -266, -39, -266, -266, -266, -266, + -266, -266, -266, -18, -2, 6, 21, -61, -266, 51, + 1296, -266, 1370, -266, 25, -266, 1209, -266, -266, -266, + -266, 1370, 42, -266, -266, 50, -266, 71, 95, -266, + -266, -266, -266, 1296, 123, 105, -266, 9, -266, -266, + 974, -266, -266, 81, -266, 1296, 290, -266, -266, -266, + -266, 125, 1296, -13, -266, 776, 974, 99, -266, -266, + -266, -266, 974, 974, 974, -266, -266, -266, -266, -266, + 35, -266, -266, -266, 100, -6, 1040, 104, -266, 974, + 36, -64, -266, -21, 102, -266, -266, -266, 113, 117, + -51, -266, 108, -266, -266, 1296, 129, 1109, -266, 97, + 103, -266, 112, 114, 106, 842, 115, 116, -266, -266, + 39, -266, -266, -43, -266, -18, 47, -266, -266, -266, + -266, 374, -266, -266, -266, -266, 118, -266, -266, 908, + 974, -266, 120, -266, -266, -266, -266, 19, -266, -266, + 974, 1333, -266, -266, 974, 119, -266, -266, -266, 974, + 974, 974, 974, 974, 974, 974, 974, 974, 974, 974, + 974, 974, 974, -266, 1152, 122, -29, -266, -266, -266, + -266, -266, 121, -266, 974, -266, -266, 5, -266, -266, + 458, -266, -266, -266, -266, -266, 974, 974, -266, -266, + -266, 974, -266, 137, -266, -266, -266, 138, 111, -266, + 142, -266, -266, -266, -266, 36, 36, -266, -266, -266, + -266, -21, -21, -266, 113, 117, 82, -266, 974, 129, + -266, 175, 50, 626, 710, 38, -266, 197, 458, -266, + -266, 141, -266, -266, 974, 155, -266, 145, -266, -266, + -266, -266, 197, 121, 111, 186, 159, 160, -266, -266, + -266, 974, -266, 166, 176, 236, -266, 174, 542, -266, + 43, 974, 542, 121, 974, -266, -266, -266, 177, 111, + -266, -266, -266, -266 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -266, -266, -266, -266, -266, -266, -266, 85, -266, -266, + -266, -266, -44, -266, -15, -266, -55, -19, -266, -266, + -266, 72, 70, 73, -266, -66, -83, -266, -92, -73, + 13, 14, -266, -266, -266, 180, 206, 201, 184, -266, + -266, -241, -25, -30, 262, -4, 0, -266, -266, -266, + 143, -122, -266, 22, -145, 16, -144, -226, -266, -266, + -266, -17, -265, -266, -266, -54, 63, 20, -266, -266, + 4, -266, -266, -266, -266, -266, -266, -266, -266, -266, + 231, -266, -266 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -165 +static const yytype_int16 yytable[] = +{ + 44, 77, 167, 163, 121, 199, 52, 220, 285, 191, + 68, 64, 162, 32, 33, 224, 275, 49, 65, 121, + 181, 66, 182, 176, 58, 50, 108, 269, 301, 6, + 7, 275, 64, 81, 183, 184, 217, 53, 69, 218, + 44, 108, 44, 207, 192, 126, 44, 73, 165, 166, + 249, 44, 81, 250, 59, 60, 61, 23, 24, 32, + 33, 159, 295, 44, 54, 178, 295, 173, 160, 185, + 186, 56, 199, 174, 58, 44, 146, 163, 228, 6, + 7, 84, 44, 85, 217, 57, 223, 256, 168, 169, + 86, 232, 226, 121, -75, 126, 67, 126, 217, 70, + 246, 211, 212, 213, 59, 60, 61, 23, 24, 170, + 214, 273, 255, 171, 220, 108, 298, 217, 74, -25, + 215, 70, 217, 179, 180, 44, 76, 44, 237, 238, + 239, 240, 49, 259, 260, 233, 234, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 261, 302, + 83, 146, 2, 3, 4, 121, 59, 60, 61, 187, + 188, 217, 264, 124, 126, 274, 235, 236, 241, 242, + 156, -26, 189, 172, 195, 265, 177, 108, 190, 200, + 274, 279, 121, 193, 203, 201, 204, 208, 205, 290, + 217, -116, 221, 209, 44, 225, 248, -164, 268, 299, + 58, 2, 3, 4, 108, 6, 7, 8, 9, 10, + 146, 163, 262, 263, -27, 267, 278, 281, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 280, 287, 288, 23, 24, 25, 26, 289, 27, 28, + 29, 30, 87, 31, 88, 89, 90, 91, 291, 292, + 92, 93, 293, 146, 146, 294, 231, 146, 146, 303, + 244, 243, 157, 78, 245, 82, 158, 51, 194, 94, + 270, 266, 146, 258, 271, 300, 282, 72, 0, 0, + 95, 96, 0, 97, 0, 0, 0, 0, 146, 0, + 0, 0, 146, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 129, 130, 131, 0, 132, 133, 134, + 135, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 0, 0, 0, 23, 24, 25, 26, + 136, 27, 28, 29, 30, 87, 31, 88, 89, 90, + 91, 0, 0, 92, 93, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 94, 0, 0, 0, 137, 138, 0, 0, + 0, 0, 139, 95, 96, 0, 97, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 129, 130, 131, + 0, 132, 133, 134, 135, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, + 23, 24, 25, 26, 136, 27, 28, 29, 30, 87, + 31, 88, 89, 90, 91, 0, 0, 92, 93, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 94, 0, 0, 0, + 137, 219, 0, 0, 0, 0, 139, 95, 96, 0, + 97, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 129, 130, 131, 0, 132, 133, 134, 135, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 0, 0, 0, 23, 24, 25, 26, 136, 27, + 28, 29, 30, 87, 31, 88, 89, 90, 91, 0, + 0, 92, 93, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 94, 0, 0, 0, 137, 0, 0, 0, 0, 0, + 139, 95, 96, 0, 97, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 129, 130, 131, 0, 132, + 133, 134, 135, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 0, 0, 0, 23, 24, + 25, 26, 136, 27, 28, 29, 30, 87, 31, 88, + 89, 90, 91, 0, 0, 92, 93, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 94, 0, 0, 0, 76, 0, + 0, 0, 0, 0, 139, 95, 96, 0, 97, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 129, + 130, 131, 0, 132, 133, 134, 135, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, + 0, 0, 23, 24, 25, 26, 136, 27, 28, 29, + 30, 87, 31, 88, 89, 90, 91, 0, 0, 92, + 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 94, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 139, 95, + 96, 0, 97, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, + 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 0, 0, 0, 23, 24, 25, 26, + 0, 27, 28, 29, 30, 87, 31, 88, 89, 90, + 91, 0, 0, 92, 93, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 94, 0, 0, 0, 8, 9, 10, 0, + 0, 0, 139, 95, 96, 0, 97, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, + 0, 0, 0, 0, 25, 26, 0, 27, 28, 29, + 30, 87, 31, 88, 89, 90, 91, 0, 0, 92, + 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 94, 0, + 0, 161, 8, 9, 10, 0, 0, 0, 0, 95, + 96, 0, 97, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 0, 0, 0, 0, 0, + 25, 26, 0, 27, 28, 29, 30, 87, 31, 88, + 89, 90, 91, 0, 0, 92, 93, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 94, 0, 0, 0, 8, 9, + 10, 0, 0, 0, 206, 95, 96, 0, 97, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 0, 0, 0, 0, 0, 25, 26, 0, 27, + 28, 29, 30, 87, 31, 88, 89, 90, 91, 0, + 0, 92, 93, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 94, 0, 0, 222, 8, 9, 10, 0, 0, 0, + 0, 95, 96, 0, 97, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, + 0, 0, 25, 26, 0, 27, 28, 29, 30, 87, + 31, 88, 89, 90, 91, 0, 0, 92, 93, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 94, 0, 0, 0, + 8, 9, 10, 0, 0, 0, 0, 95, 96, 0, + 97, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 0, 0, 0, 0, 0, 25, 175, + 0, 27, 28, 29, 30, 87, 31, 88, 89, 90, + 91, 0, 0, 92, 93, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 94, 2, 3, 4, 0, 0, 0, 8, + 9, 10, 0, 95, 96, 0, 97, 0, 0, 0, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 0, 0, 0, 0, 0, 25, 26, 0, + 27, 28, 29, 30, 0, 31, 2, 3, 4, 0, + 0, 0, 8, 9, 10, 0, 0, 0, 0, 0, + 0, 0, 0, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 0, 198, 0, 0, 0, + 25, 26, 0, 27, 28, 29, 30, 0, 31, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, + 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 0, 0, 0, 0, 0, 0, 0, 247, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 0, 0, 0, 23, 24, 25, 26, 0, + 27, 28, 29, 30, 0, 31, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, + 0, 0, 0, 0, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 0, 0, 0, 23, + 24, 25, 26, 0, 27, 28, 29, 30, 0, 31, + 2, 3, 4, 0, 0, 0, 8, 9, 10, 0, + 0, 0, 0, 0, 0, 0, 0, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, + 0, 0, 0, 0, 25, 26, 0, 27, 28, 29, + 30, 0, 31, 8, 9, 10, 0, 0, 0, 0, + 0, 0, 0, 0, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, + 0, 25, 26, 0, 27, 28, 29, 30, 229, 31, + 8, 9, 10, 230, 0, 0, 0, 0, 0, 0, + 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 0, 0, 0, 0, 0, 25, 26, + 0, 27, 28, 29, 30, 0, 31 +}; + +static const yytype_int16 yycheck[] = +{ + 0, 55, 94, 86, 70, 127, 45, 151, 273, 60, + 40, 36, 85, 0, 0, 160, 257, 37, 79, 85, + 84, 82, 86, 106, 3, 45, 70, 253, 293, 8, + 9, 272, 57, 63, 55, 56, 79, 76, 42, 82, + 40, 85, 42, 135, 95, 75, 46, 51, 92, 93, + 79, 51, 82, 82, 33, 34, 35, 36, 37, 46, + 46, 74, 288, 63, 82, 109, 292, 73, 81, 90, + 91, 73, 194, 79, 3, 75, 76, 160, 170, 8, + 9, 72, 82, 74, 79, 79, 159, 82, 53, 54, + 81, 174, 73, 159, 73, 125, 45, 127, 79, 74, + 192, 62, 63, 64, 33, 34, 35, 36, 37, 74, + 71, 73, 204, 78, 258, 159, 73, 79, 76, 72, + 81, 74, 79, 87, 88, 125, 76, 127, 183, 184, + 185, 186, 37, 216, 217, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 221, 294, + 45, 151, 4, 5, 6, 221, 33, 34, 35, 57, + 58, 79, 80, 82, 194, 257, 181, 182, 187, 188, + 45, 72, 59, 73, 45, 248, 72, 221, 61, 82, + 272, 264, 248, 75, 72, 82, 72, 72, 82, 281, + 79, 72, 74, 77, 194, 75, 74, 76, 252, 291, + 3, 4, 5, 6, 248, 8, 9, 10, 11, 12, + 210, 294, 75, 75, 72, 40, 75, 72, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 75, 45, 73, 36, 37, 38, 39, 77, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 82, 73, + 53, 54, 16, 253, 254, 81, 171, 257, 258, 82, + 190, 189, 82, 57, 191, 64, 82, 5, 125, 72, + 254, 249, 272, 210, 254, 292, 272, 46, -1, -1, + 83, 84, -1, 86, -1, -1, -1, -1, 288, -1, + -1, -1, 292, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, -1, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, -1, -1, -1, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, -1, -1, 53, 54, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 72, -1, -1, -1, 76, 77, -1, -1, + -1, -1, 82, 83, 84, -1, 86, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, -1, -1, 53, 54, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, + 76, 77, -1, -1, -1, -1, 82, 83, 84, -1, + 86, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, -1, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, -1, -1, -1, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, -1, + -1, 53, 54, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, + 82, 83, 84, -1, 86, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, -1, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, -1, -1, -1, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, -1, -1, 53, 54, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 72, -1, -1, -1, 76, -1, + -1, -1, -1, -1, 82, 83, 84, -1, 86, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, -1, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, + -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, -1, -1, 53, + 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, 83, + 84, -1, 86, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, -1, -1, -1, -1, -1, -1, -1, + -1, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, -1, -1, -1, 36, 37, 38, 39, + -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, -1, -1, 53, 54, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 72, -1, -1, -1, 10, 11, 12, -1, + -1, -1, 82, 83, 84, -1, 86, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, + -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, -1, -1, 53, + 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, + -1, 75, 10, 11, 12, -1, -1, -1, -1, 83, + 84, -1, 86, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, -1, -1, -1, -1, -1, + 38, 39, -1, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, -1, -1, 53, 54, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 72, -1, -1, -1, 10, 11, + 12, -1, -1, -1, 82, 83, 84, -1, 86, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, -1, -1, -1, -1, -1, 38, 39, -1, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, -1, + -1, 53, 54, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 72, -1, -1, 75, 10, 11, 12, -1, -1, -1, + -1, 83, 84, -1, 86, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, + -1, -1, 38, 39, -1, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, -1, -1, 53, 54, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, + 10, 11, 12, -1, -1, -1, -1, 83, 84, -1, + 86, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, -1, -1, -1, -1, -1, 38, 39, + -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, -1, -1, 53, 54, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 72, 4, 5, 6, -1, -1, -1, 10, + 11, 12, -1, 83, 84, -1, 86, -1, -1, -1, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, -1, -1, -1, -1, -1, 38, 39, -1, + 41, 42, 43, 44, -1, 46, 4, 5, 6, -1, + -1, -1, 10, 11, 12, -1, -1, -1, -1, -1, + -1, -1, -1, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, -1, 77, -1, -1, -1, + 38, 39, -1, 41, 42, 43, 44, -1, 46, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, + -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, -1, -1, -1, -1, -1, -1, -1, 77, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, -1, -1, -1, 36, 37, 38, 39, -1, + 41, 42, 43, 44, -1, 46, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, -1, -1, -1, -1, + -1, -1, -1, -1, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, -1, -1, -1, 36, + 37, 38, 39, -1, 41, 42, 43, 44, -1, 46, + 4, 5, 6, -1, -1, -1, 10, 11, 12, -1, + -1, -1, -1, -1, -1, -1, -1, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, + -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, + 44, -1, 46, 10, 11, 12, -1, -1, -1, -1, + -1, -1, -1, -1, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, + -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, + 10, 11, 12, 50, -1, -1, -1, -1, -1, -1, + -1, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, -1, -1, -1, -1, -1, 38, 39, + -1, 41, 42, 43, 44, -1, 46 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 36, 37, 38, 39, 41, 42, 43, + 44, 46, 126, 127, 128, 129, 130, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 175, 176, 177, 37, + 45, 140, 45, 76, 82, 178, 73, 79, 3, 33, + 34, 35, 132, 133, 138, 79, 82, 45, 139, 141, + 74, 0, 176, 141, 76, 145, 76, 161, 132, 131, + 134, 139, 133, 45, 72, 74, 81, 45, 47, 48, + 49, 50, 53, 54, 72, 83, 84, 86, 97, 98, + 99, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 125, 142, 82, 144, 139, 146, 147, 13, + 14, 15, 17, 18, 19, 20, 40, 76, 77, 82, + 108, 121, 122, 124, 126, 127, 142, 151, 152, 153, + 154, 162, 163, 164, 167, 174, 45, 131, 134, 74, + 81, 75, 125, 122, 150, 108, 108, 124, 53, 54, + 74, 78, 73, 73, 79, 39, 122, 72, 108, 87, + 88, 84, 86, 55, 56, 90, 91, 57, 58, 59, + 61, 60, 95, 75, 146, 45, 148, 149, 77, 147, + 82, 82, 169, 72, 72, 82, 82, 124, 72, 77, + 155, 62, 63, 64, 71, 81, 123, 79, 82, 77, + 152, 74, 75, 125, 150, 75, 73, 100, 124, 45, + 50, 103, 122, 108, 108, 110, 110, 112, 112, 112, + 112, 113, 113, 117, 118, 119, 124, 77, 74, 79, + 82, 158, 159, 160, 170, 124, 82, 168, 162, 122, + 122, 125, 75, 75, 80, 125, 149, 40, 161, 153, + 151, 163, 171, 73, 124, 137, 166, 156, 75, 122, + 75, 72, 166, 172, 173, 158, 165, 45, 73, 77, + 124, 82, 73, 16, 81, 153, 157, 161, 73, 124, + 157, 158, 150, 82 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (context, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval) +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, context); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep, context) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + TParseContext* context; +#endif +{ + if (!yyvaluep) + return; + YYUSE (context); +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep, context) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + TParseContext* context; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep, context); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +#else +static void +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context) +#else +static void +yy_reduce_print (yyvsp, yyrule, context) + YYSTYPE *yyvsp; + int yyrule; + TParseContext* context; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , context); + fprintf (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule, context); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context) +#else +static void +yydestruct (yymsg, yytype, yyvaluep, context) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; + TParseContext* context; +#endif +{ + YYUSE (yyvaluep); + YYUSE (context); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (TParseContext* context); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (TParseContext* context) +#else +int +yyparse (context) + TParseContext* context; +#endif +#endif +{ + /* The look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to look-ahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a look-ahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + if (yyn == YYFINAL) + YYACCEPT; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: + + { + // The symbol table search was done in the lexical phase + const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol; + const TVariable* variable; + if (symbol == 0) { + context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str()); + context->recover(); + TType type(EbtFloat, EbpUndefined); + TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type); + context->symbolTable.insert(*fakeVariable); + variable = fakeVariable; + } else { + // This identifier can only be a variable type symbol + if (! symbol->isVariable()) { + context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str()); + context->recover(); + } + variable = static_cast(symbol); + } + + // don't delete $1.string, it's used by error recovery, and the pool + // pop will reclaim the memory + + if (variable->getType().getQualifier() == EvqConst ) { + ConstantUnion* constArray = variable->getConstPointer(); + TType t(variable->getType()); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line); + } else + (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(), + variable->getName(), + variable->getType(), (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 3: + + { + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + ;} + break; + + case 4: + + { + // + // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders, + // check for overflow for constants + // + if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) { + context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", ""); + context->recover(); + } + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setIConst((yyvsp[(1) - (1)].lex).i); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 5: + + { + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setFConst((yyvsp[(1) - (1)].lex).f); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 6: + + { + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setBConst((yyvsp[(1) - (1)].lex).b); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 7: + + { + (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode); + ;} + break; + + case 8: + + { + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + ;} + break; + + case 9: + + { + if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { + if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode()) + context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", (yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode()->getSymbol().c_str()); + else + context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression"); + context->recover(); + } + if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) { + if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays + (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); + } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors + TVectorFields fields; + fields.num = 1; + fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array + (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); + } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices + (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); + } + } else { + if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) { + if (((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() || (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getNominalSize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) { + std::stringstream extraInfoStream; + extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'"; + std::string extraInfo = extraInfoStream.str(); + context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str()); + context->recover(); + } else { + if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { + if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) { + if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) { + if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, (yyvsp[(2) - (4)].lex).line)) + context->recover(); + } else { + if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line)) + context->recover(); + } + } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) { + std::stringstream extraInfoStream; + extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'"; + std::string extraInfo = extraInfoStream.str(); + context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str()); + context->recover(); + } + } + (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); + } + } else { + if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) { + context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable"); + context->recover(); + } + + (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); + } + } + if ((yyval.interm.intermTypedNode) == 0) { + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setFConst(0.0f); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line); + } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { + if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct()) + (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName())); + else + (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize(), (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())); + + if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) + (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst); + } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) + (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize())); + else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) + (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize())); + else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) + (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst)); + else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) + (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary)); + else + (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType()); + ;} + break; + + case 10: + + { + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + ;} + break; + + case 11: + + { + if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) { + context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", "."); + context->recover(); + } + + if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) { + TVectorFields fields; + if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) { + fields.num = 1; + fields.offsets[0] = 0; + context->recover(); + } + + if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields + (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line); + if ((yyval.interm.intermTypedNode) == 0) { + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + } + else + (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size())); + } else { + TString vectorString = *(yyvsp[(3) - (3)].lex).string; + TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line); + (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); + (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size())); + } + } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) { + TMatrixFields fields; + if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) { + fields.wholeRow = false; + fields.wholeCol = false; + fields.row = 0; + fields.col = 0; + context->recover(); + } + + if (fields.wholeRow || fields.wholeCol) { + context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", "."); + context->recover(); + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setIConst(0); + TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line); + (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); + (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize())); + } else { + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row); + TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line); + (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); + (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision())); + } + } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) { + bool fieldFound = false; + const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct(); + if (fields == 0) { + context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error"); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + } else { + unsigned int i; + for (i = 0; i < fields->size(); ++i) { + if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) { + fieldFound = true; + break; + } + } + if (fieldFound) { + if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { + (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); + if ((yyval.interm.intermTypedNode) == 0) { + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + } + else { + (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type); + // change the qualifier of the return type, not of the structure field + // as the structure definition is shared between various structures. + (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst); + } + } else { + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setIConst(i); + TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line); + (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); + (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type); + } + } else { + context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + } + } + } else { + context->error((yyvsp[(2) - (3)].lex).line, " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + } + // don't delete $3.string, it's from the pool + ;} + break; + + case 12: + + { + if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode))) + context->recover(); + (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode); + } + ;} + break; + + case 13: + + { + if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode))) + context->recover(); + (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode); + } + ;} + break; + + case 14: + + { + if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]")) + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + ;} + break; + + case 15: + + { + TFunction* fnCall = (yyvsp[(1) - (1)].interm).function; + TOperator op = fnCall->getBuiltInOp(); + + if (op != EOpNull) + { + // + // Then this should be a constructor. + // Don't go through the symbol table for constructors. + // Their parameters will be verified algorithmically. + // + TType type(EbtVoid, EbpUndefined); // use this to get the type back + if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) { + (yyval.interm.intermTypedNode) = 0; + } else { + // + // It's a constructor, of type 'type'. + // + (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line); + } + + if ((yyval.interm.intermTypedNode) == 0) { + context->recover(); + (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line); + } + (yyval.interm.intermTypedNode)->setType(type); + } else { + // + // Not a constructor. Find it in the symbol table. + // + const TFunction* fnCandidate; + bool builtIn; + fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn); + if (fnCandidate) { + // + // A declared function. + // + if (builtIn && !fnCandidate->getExtension().empty() && + context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) { + context->recover(); + } + op = fnCandidate->getBuiltInOp(); + if (builtIn && op != EOpNull) { + // + // A function call mapped to a built-in operation. + // + if (fnCandidate->getParamCount() == 1) { + // + // Treat it like a built-in unary operator. + // + (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + std::stringstream extraInfoStream; + extraInfoStream << "built in unary operator function. Type: " << static_cast((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString(); + std::string extraInfo = extraInfoStream.str(); + context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str()); + YYERROR; + } + } else { + (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line); + } + } else { + // This is a real function call + + (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line); + (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType()); + + // this is how we know whether the given function is a builtIn function or a user defined function + // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also + // if builtIn == true, it's definitely a builtIn function with EOpNull + if (!builtIn) + (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined(); + (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName()); + + TQualifier qual; + for (int i = 0; i < fnCandidate->getParamCount(); ++i) { + qual = fnCandidate->getParam(i).type->getQualifier(); + if (qual == EvqOut || qual == EvqInOut) { + if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) { + context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error"); + context->recover(); + } + } + } + } + (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType()); + } else { + // error message was put out by PaFindFunction() + // Put on a dummy node for error recovery + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setFConst(0.0f); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line); + context->recover(); + } + } + delete fnCall; + ;} + break; + + case 16: + + { + (yyval.interm) = (yyvsp[(1) - (1)].interm); + ;} + break; + + case 17: + + { + context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", ""); + context->recover(); + (yyval.interm) = (yyvsp[(3) - (3)].interm); + ;} + break; + + case 18: + + { + (yyval.interm) = (yyvsp[(1) - (2)].interm); + (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; + ;} + break; + + case 19: + + { + (yyval.interm) = (yyvsp[(1) - (2)].interm); + (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; + ;} + break; + + case 20: + + { + (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); + (yyval.interm).intermNode = 0; + ;} + break; + + case 21: + + { + (yyval.interm).function = (yyvsp[(1) - (1)].interm.function); + (yyval.interm).intermNode = 0; + ;} + break; + + case 22: + + { + TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) }; + (yyvsp[(1) - (2)].interm.function)->addParameter(param); + (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); + (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode); + ;} + break; + + case 23: + + { + TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) }; + (yyvsp[(1) - (3)].interm).function->addParameter(param); + (yyval.interm).function = (yyvsp[(1) - (3)].interm).function; + (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); + ;} + break; + + case 24: + + { + (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function); + ;} + break; + + case 25: + + { + // + // Constructor + // + TOperator op = EOpNull; + if ((yyvsp[(1) - (1)].interm.type).userDef) { + op = EOpConstructStruct; + } else { + switch ((yyvsp[(1) - (1)].interm.type).type) { + case EbtFloat: + if ((yyvsp[(1) - (1)].interm.type).matrix) { + switch((yyvsp[(1) - (1)].interm.type).size) { + case 2: op = EOpConstructMat2; break; + case 3: op = EOpConstructMat3; break; + case 4: op = EOpConstructMat4; break; + } + } else { + switch((yyvsp[(1) - (1)].interm.type).size) { + case 1: op = EOpConstructFloat; break; + case 2: op = EOpConstructVec2; break; + case 3: op = EOpConstructVec3; break; + case 4: op = EOpConstructVec4; break; + } + } + break; + case EbtInt: + switch((yyvsp[(1) - (1)].interm.type).size) { + case 1: op = EOpConstructInt; break; + case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break; + case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break; + case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break; + } + break; + case EbtBool: + switch((yyvsp[(1) - (1)].interm.type).size) { + case 1: op = EOpConstructBool; break; + case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break; + case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break; + case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break; + } + break; + default: break; + } + if (op == EOpNull) { + context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type)); + context->recover(); + (yyvsp[(1) - (1)].interm.type).type = EbtFloat; + op = EOpConstructFloat; + } + } + TString tempString; + TType type((yyvsp[(1) - (1)].interm.type)); + TFunction *function = new TFunction(&tempString, type, op); + (yyval.interm.function) = function; + ;} + break; + + case 26: + + { + if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string)) + context->recover(); + TType type(EbtVoid, EbpUndefined); + TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type); + (yyval.interm.function) = function; + ;} + break; + + case 27: + + { + if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string)) + context->recover(); + TType type(EbtVoid, EbpUndefined); + TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type); + (yyval.interm.function) = function; + ;} + break; + + case 28: + + { + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + ;} + break; + + case 29: + + { + if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode))) + context->recover(); + (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); + } + ;} + break; + + case 30: + + { + if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode))) + context->recover(); + (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); + } + ;} + break; + + case 31: + + { + if ((yyvsp[(1) - (2)].interm).op != EOpNull) { + (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + const char* errorOp = ""; + switch((yyvsp[(1) - (2)].interm).op) { + case EOpNegative: errorOp = "-"; break; + case EOpLogicalNot: errorOp = "!"; break; + default: break; + } + context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); + } + } else + (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); + ;} + break; + + case 32: + + { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; ;} + break; + + case 33: + + { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; ;} + break; + + case 34: + + { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; ;} + break; + + case 35: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 36: + + { + FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line); + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + } + ;} + break; + + case 37: + + { + FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line); + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + } + ;} + break; + + case 38: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 39: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + } + ;} + break; + + case 40: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + } + ;} + break; + + case 41: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 42: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 43: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setBConst(false); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); + } + ;} + break; + + case 44: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setBConst(false); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); + } + ;} + break; + + case 45: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setBConst(false); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); + } + ;} + break; + + case 46: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setBConst(false); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); + } + ;} + break; + + case 47: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 48: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setBConst(false); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); + } + ;} + break; + + case 49: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setBConst(false); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); + } + ;} + break; + + case 50: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 51: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 52: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 53: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 54: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setBConst(false); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); + } + ;} + break; + + case 55: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 56: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setBConst(false); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); + } + ;} + break; + + case 57: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 58: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setBConst(false); + (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); + } + ;} + break; + + case 59: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 60: + + { + if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode))) + context->recover(); + + (yyval.interm.intermTypedNode) = context->intermediate.addSelection((yyvsp[(1) - (5)].interm.intermTypedNode), (yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.intermTypedNode), (yyvsp[(2) - (5)].lex).line); + if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType()) + (yyval.interm.intermTypedNode) = 0; + + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode); + } + ;} + break; + + case 61: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 62: + + { + if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode))) + context->recover(); + (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].interm).line); + if ((yyval.interm.intermTypedNode) == 0) { + context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + } + ;} + break; + + case 63: + + { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; ;} + break; + + case 64: + + { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; ;} + break; + + case 65: + + { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; ;} + break; + + case 66: + + { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; ;} + break; + + case 67: + + { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; ;} + break; + + case 68: + + { + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + ;} + break; + + case 69: + + { + (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); + if ((yyval.interm.intermTypedNode) == 0) { + context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode); + } + ;} + break; + + case 70: + + { + if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode))) + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + ;} + break; + + case 71: + + { + TFunction &function = *((yyvsp[(1) - (2)].interm).function); + + TIntermAggregate *prototype = new TIntermAggregate; + prototype->setType(function.getReturnType()); + prototype->setName(function.getName()); + + for (int i = 0; i < function.getParamCount(); i++) + { + const TParameter ¶m = function.getParam(i); + if (param.name != 0) + { + TVariable *variable = new TVariable(param.name, *param.type); + + prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line); + } + else + { + prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line); + } + } + + prototype->setOp(EOpPrototype); + (yyval.interm.intermNode) = prototype; + + context->symbolTable.pop(); + ;} + break; + + case 72: + + { + if ((yyvsp[(1) - (2)].interm).intermAggregate) + (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration); + (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate; + ;} + break; + + case 73: + + { + context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) ); + (yyval.interm.intermNode) = 0; + ;} + break; + + case 74: + + { + // + // Multiple declarations of the same function are allowed. + // + // If this is a definition, the definition production code will check for redefinitions + // (we don't know at this point if it's a definition or not). + // + // Redeclarations are allowed. But, return types and parameter qualifiers must match. + // + TFunction* prevDec = static_cast(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName())); + if (prevDec) { + if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) { + context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString()); + context->recover(); + } + for (int i = 0; i < prevDec->getParamCount(); ++i) { + if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) { + context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString()); + context->recover(); + } + } + } + + // + // If this is a redeclaration, it could also be a definition, + // in which case, we want to use the variable names from this one, and not the one that's + // being redeclared. So, pass back up this declaration, not the one in the symbol table. + // + (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); + (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; + + // We're at the inner scope level of the function's arguments and body statement. + // Add the function prototype to the surrounding scope instead. + context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function); + ;} + break; + + case 75: + + { + (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); + ;} + break; + + case 76: + + { + (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); + ;} + break; + + case 77: + + { + // Add the parameter + (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function); + if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid) + (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param); + else + delete (yyvsp[(2) - (2)].interm).param.type; + ;} + break; + + case 78: + + { + // + // Only first parameter of one-parameter functions can be void + // The check for named parameters not being void is done in parameter_declarator + // + if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) { + // + // This parameter > first is void + // + context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void"); + context->recover(); + delete (yyvsp[(3) - (3)].interm).param.type; + } else { + // Add the parameter + (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function); + (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param); + } + ;} + break; + + case 79: + + { + if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) { + context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier)); + context->recover(); + } + // make sure a sampler is not involved as well... + if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type))) + context->recover(); + + // Add the function as a prototype after parsing it (we do not support recursion) + TFunction *function; + TType type((yyvsp[(1) - (3)].interm.type)); + function = new TFunction((yyvsp[(2) - (3)].lex).string, type); + (yyval.interm.function) = function; + + context->symbolTable.push(); + ;} + break; + + case 80: + + { + if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) { + context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str()); + context->recover(); + } + if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) + context->recover(); + TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))}; + (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; + (yyval.interm).param = param; + ;} + break; + + case 81: + + { + // Check that we can make an array out of this type + if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type))) + context->recover(); + + if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string)) + context->recover(); + + int size; + if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size)) + context->recover(); + (yyvsp[(1) - (5)].interm.type).setArray(true, size); + + TType* type = new TType((yyvsp[(1) - (5)].interm.type)); + TParameter param = { (yyvsp[(2) - (5)].lex).string, type }; + (yyval.interm).line = (yyvsp[(2) - (5)].lex).line; + (yyval.interm).param = param; + ;} + break; + + case 82: + + { + (yyval.interm) = (yyvsp[(3) - (3)].interm); + if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type)) + context->recover(); + ;} + break; + + case 83: + + { + (yyval.interm) = (yyvsp[(2) - (2)].interm); + if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type)) + context->recover(); + if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type)) + context->recover(); + ;} + break; + + case 84: + + { + (yyval.interm) = (yyvsp[(3) - (3)].interm); + if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type)) + context->recover(); + ;} + break; + + case 85: + + { + (yyval.interm) = (yyvsp[(2) - (2)].interm); + if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type)) + context->recover(); + if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type)) + context->recover(); + ;} + break; + + case 86: + + { + (yyval.interm.qualifier) = EvqIn; + ;} + break; + + case 87: + + { + (yyval.interm.qualifier) = EvqIn; + ;} + break; + + case 88: + + { + (yyval.interm.qualifier) = EvqOut; + ;} + break; + + case 89: + + { + (yyval.interm.qualifier) = EvqInOut; + ;} + break; + + case 90: + + { + TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) }; + (yyval.interm).param = param; + ;} + break; + + case 91: + + { + (yyval.interm) = (yyvsp[(1) - (1)].interm); + ;} + break; + + case 92: + + { + if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol) + { + context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str()); + context->recover(); + } + + TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line); + (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line); + + if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type)) + context->recover(); + + if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false)) + context->recover(); + + TVariable* variable = 0; + if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable)) + context->recover(); + if (symbol && variable) + symbol->setId(variable->getUniqueId()); + ;} + break; + + case 93: + + { + if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type)) + context->recover(); + + if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true)) + context->recover(); + + (yyval.interm) = (yyvsp[(1) - (5)].interm); + + if (context->arrayTypeErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type) || context->arrayQualifierErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type)) + context->recover(); + else { + (yyvsp[(1) - (5)].interm).type.setArray(true); + TVariable* variable; + if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable)) + context->recover(); + } + ;} + break; + + case 94: + + { + if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type)) + context->recover(); + + if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true)) + context->recover(); + + (yyval.interm) = (yyvsp[(1) - (6)].interm); + + if (context->arrayTypeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type) || context->arrayQualifierErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type)) + context->recover(); + else { + int size; + if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size)) + context->recover(); + (yyvsp[(1) - (6)].interm).type.setArray(true, size); + TVariable* variable = 0; + if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable)) + context->recover(); + TType type = TType((yyvsp[(1) - (6)].interm).type); + type.setArraySize(size); + (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *(yyvsp[(3) - (6)].lex).string, type, (yyvsp[(3) - (6)].lex).line), (yyvsp[(3) - (6)].lex).line); + } + ;} + break; + + case 95: + + { + if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type)) + context->recover(); + + (yyval.interm) = (yyvsp[(1) - (5)].interm); + + TIntermNode* intermNode; + if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) { + // + // build the intermediate representation + // + if (intermNode) + (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line); + else + (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate; + } else { + context->recover(); + (yyval.interm).intermAggregate = 0; + } + ;} + break; + + case 96: + + { + (yyval.interm).type = (yyvsp[(1) - (1)].interm.type); + (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType((yyvsp[(1) - (1)].interm.type)), (yyvsp[(1) - (1)].interm.type).line), (yyvsp[(1) - (1)].interm.type).line); + ;} + break; + + case 97: + + { + TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line); + (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line); + + if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type)) + context->recover(); + + if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false)) + context->recover(); + + (yyval.interm).type = (yyvsp[(1) - (2)].interm.type); + + TVariable* variable = 0; + if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable)) + context->recover(); + if (variable && symbol) + symbol->setId(variable->getUniqueId()); + ;} + break; + + case 98: + + { + context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str()); + context->recover(); + + TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line); + (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line); + (yyval.interm).type = (yyvsp[(1) - (4)].interm.type); + ;} + break; + + case 99: + + { + TType type = TType((yyvsp[(1) - (5)].interm.type)); + int size; + if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size)) + context->recover(); + type.setArraySize(size); + TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line); + (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line); + + if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type))) + context->recover(); + + if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true)) + context->recover(); + + (yyval.interm).type = (yyvsp[(1) - (5)].interm.type); + + if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)) || context->arrayQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type))) + context->recover(); + else { + int size; + if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size)) + context->recover(); + + (yyvsp[(1) - (5)].interm.type).setArray(true, size); + TVariable* variable = 0; + if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable)) + context->recover(); + if (variable && symbol) + symbol->setId(variable->getUniqueId()); + } + ;} + break; + + case 100: + + { + if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type))) + context->recover(); + + (yyval.interm).type = (yyvsp[(1) - (4)].interm.type); + + TIntermNode* intermNode; + if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) { + // + // Build intermediate representation + // + if(intermNode) + (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line); + else + (yyval.interm).intermAggregate = 0; + } else { + context->recover(); + (yyval.interm).intermAggregate = 0; + } + ;} + break; + + case 101: + + { + VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line); + if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying")) + context->recover(); + (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line); + if (!(yyvsp[(2) - (2)].lex).symbol) + { + context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str()); + context->recover(); + + (yyval.interm).intermAggregate = 0; + } + else + { + TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line); + (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line); + } + ;} + break; + + case 102: + + { + (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + + if ((yyvsp[(1) - (1)].interm.type).array) { + context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array"); + context->recover(); + (yyvsp[(1) - (1)].interm.type).setArray(false); + } + ;} + break; + + case 103: + + { + if ((yyvsp[(2) - (2)].interm.type).array) { + context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array"); + context->recover(); + (yyvsp[(2) - (2)].interm.type).setArray(false); + } + + if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute && + ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) { + context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier)); + context->recover(); + } + if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) && + ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) { + context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier)); + context->recover(); + } + (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type); + (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier; + ;} + break; + + case 104: + + { + (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 105: + + { + VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line); + if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute")) + context->recover(); + (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 106: + + { + if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying")) + context->recover(); + if (context->shaderType == SH_VERTEX_SHADER) + (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line); + else + (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 107: + + { + if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying")) + context->recover(); + if (context->shaderType == SH_VERTEX_SHADER) + (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line); + else + (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line); + ;} + break; + + case 108: + + { + if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform")) + context->recover(); + (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 109: + + { + (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + + if ((yyval.interm.type).precision == EbpUndefined) { + (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type); + if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) { + context->recover(); + } + } + ;} + break; + + case 110: + + { + (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type); + (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision); + ;} + break; + + case 111: + + { + (yyval.interm.precision) = EbpHigh; + ;} + break; + + case 112: + + { + (yyval.interm.precision) = EbpMedium; + ;} + break; + + case 113: + + { + (yyval.interm.precision) = EbpLow; + ;} + break; + + case 114: + + { + (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + ;} + break; + + case 115: + + { + (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type); + + if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type))) + context->recover(); + else { + int size; + if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size)) + context->recover(); + (yyval.interm.type).setArray(true, size); + } + ;} + break; + + case 116: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 117: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 118: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 119: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 120: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(2); + ;} + break; + + case 121: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(3); + ;} + break; + + case 122: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(4); + ;} + break; + + case 123: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(2); + ;} + break; + + case 124: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(3); + ;} + break; + + case 125: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(4); + ;} + break; + + case 126: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(2); + ;} + break; + + case 127: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(3); + ;} + break; + + case 128: + + { + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(4); + ;} + break; + + case 129: + + { + FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line); + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(2, true); + ;} + break; + + case 130: + + { + FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line); + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(3, true); + ;} + break; + + case 131: + + { + FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line); + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).setAggregate(4, true); + ;} + break; + + case 132: + + { + FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line); + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 133: + + { + FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line); + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 134: + + { + if (!context->supportsExtension("GL_OES_EGL_image_external")) { + context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES"); + context->recover(); + } + FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line); + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 135: + + { + if (!context->supportsExtension("GL_ARB_texture_rectangle")) { + context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect"); + context->recover(); + } + FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line); + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line); + ;} + break; + + case 136: + + { + FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line); + (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + ;} + break; + + case 137: + + { + // + // This is for user defined type names. The lexical phase looked up the + // type. + // + TType& structure = static_cast((yyvsp[(1) - (1)].lex).symbol)->getType(); + TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line); + (yyval.interm.type).userDef = &structure; + ;} + break; + + case 138: + + { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); ;} + break; + + case 139: + + { + if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string)) + context->recover(); + + TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string); + TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true); + if (! context->symbolTable.insert(*userTypeDef)) { + context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct"); + context->recover(); + } + (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line); + (yyval.interm.type).userDef = structure; + context->exitStructDeclaration(); + ;} + break; + + case 140: + + { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); ;} + break; + + case 141: + + { + TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString("")); + (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line); + (yyval.interm.type).userDef = structure; + context->exitStructDeclaration(); + ;} + break; + + case 142: + + { + (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList); + ;} + break; + + case 143: + + { + (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList); + for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) { + for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) { + if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) { + context->error((*(yyvsp[(2) - (2)].interm.typeList))[i].line, "duplicate field name in structure:", "struct", (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName().c_str()); + context->recover(); + } + } + (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]); + } + ;} + break; + + case 144: + + { + (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList); + + if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) { + context->recover(); + } + for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { + // + // Careful not to replace already known aspects of type, like array-ness + // + TType* type = (*(yyval.interm.typeList))[i].type; + type->setBasicType((yyvsp[(1) - (3)].interm.type).type); + type->setNominalSize((yyvsp[(1) - (3)].interm.type).size); + type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix); + type->setPrecision((yyvsp[(1) - (3)].interm.type).precision); + + // don't allow arrays of arrays + if (type->isArray()) { + if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type))) + context->recover(); + } + if ((yyvsp[(1) - (3)].interm.type).array) + type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize); + if ((yyvsp[(1) - (3)].interm.type).userDef) { + type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct()); + type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName()); + } + + if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) { + context->recover(); + } + } + ;} + break; + + case 145: + + { + (yyval.interm.typeList) = NewPoolTTypeList(); + (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine)); + ;} + break; + + case 146: + + { + (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine)); + ;} + break; + + case 147: + + { + if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string)) + context->recover(); + + (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined); + (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line; + (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string); + ;} + break; + + case 148: + + { + if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string)) + context->recover(); + + (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined); + (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line; + (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string); + + int size; + if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size)) + context->recover(); + (yyval.interm.typeLine).type->setArraySize(size); + ;} + break; + + case 149: + + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} + break; + + case 150: + + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} + break; + + case 151: + + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); ;} + break; + + case 152: + + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} + break; + + case 153: + + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} + break; + + case 154: + + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} + break; + + case 155: + + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} + break; + + case 156: + + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} + break; + + case 157: + + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} + break; + + case 158: + + { (yyval.interm.intermAggregate) = 0; ;} + break; + + case 159: + + { context->symbolTable.push(); ;} + break; + + case 160: + + { context->symbolTable.pop(); ;} + break; + + case 161: + + { + if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) { + (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence); + (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line); + } + (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate); + ;} + break; + + case 162: + + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} + break; + + case 163: + + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} + break; + + case 164: + + { context->symbolTable.push(); ;} + break; + + case 165: + + { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); ;} + break; + + case 166: + + { context->symbolTable.push(); ;} + break; + + case 167: + + { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); ;} + break; + + case 168: + + { + (yyval.interm.intermNode) = 0; + ;} + break; + + case 169: + + { + if ((yyvsp[(2) - (3)].interm.intermAggregate)) { + (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence); + (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line); + } + (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate); + ;} + break; + + case 170: + + { + (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0); + ;} + break; + + case 171: + + { + (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0); + ;} + break; + + case 172: + + { (yyval.interm.intermNode) = 0; ;} + break; + + case 173: + + { (yyval.interm.intermNode) = static_cast((yyvsp[(1) - (2)].interm.intermTypedNode)); ;} + break; + + case 174: + + { + if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode))) + context->recover(); + (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line); + ;} + break; + + case 175: + + { + (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode); + (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode); + ;} + break; + + case 176: + + { + (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode); + (yyval.interm.nodePair).node2 = 0; + ;} + break; + + case 177: + + { + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode))) + context->recover(); + ;} + break; + + case 178: + + { + TIntermNode* intermNode; + if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type))) + context->recover(); + if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type))) + context->recover(); + + if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) + (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode); + else { + context->recover(); + (yyval.interm.intermTypedNode) = 0; + } + ;} + break; + + case 179: + + { context->symbolTable.push(); ++context->loopNestingLevel; ;} + break; + + case 180: + + { + context->symbolTable.pop(); + (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line); + --context->loopNestingLevel; + ;} + break; + + case 181: + + { ++context->loopNestingLevel; ;} + break; + + case 182: + + { + if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode))) + context->recover(); + + (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line); + --context->loopNestingLevel; + ;} + break; + + case 183: + + { context->symbolTable.push(); ++context->loopNestingLevel; ;} + break; + + case 184: + + { + context->symbolTable.pop(); + (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), (yyvsp[(1) - (7)].lex).line); + --context->loopNestingLevel; + ;} + break; + + case 185: + + { + (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); + ;} + break; + + case 186: + + { + (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); + ;} + break; + + case 187: + + { + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + ;} + break; + + case 188: + + { + (yyval.interm.intermTypedNode) = 0; + ;} + break; + + case 189: + + { + (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode); + (yyval.interm.nodePair).node2 = 0; + ;} + break; + + case 190: + + { + (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode); + (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode); + ;} + break; + + case 191: + + { + if (context->loopNestingLevel <= 0) { + context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", ""); + context->recover(); + } + (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line); + ;} + break; + + case 192: + + { + if (context->loopNestingLevel <= 0) { + context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", ""); + context->recover(); + } + (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line); + ;} + break; + + case 193: + + { + (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line); + if (context->currentFunctionType->getBasicType() != EbtVoid) { + context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return"); + context->recover(); + } + ;} + break; + + case 194: + + { + (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line); + context->functionReturnsValue = true; + if (context->currentFunctionType->getBasicType() == EbtVoid) { + context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return"); + context->recover(); + } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) { + context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return"); + context->recover(); + } + ;} + break; + + case 195: + + { + FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line); + (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line); + ;} + break; + + case 196: + + { + (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); + context->treeRoot = (yyval.interm.intermNode); + ;} + break; + + case 197: + + { + (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0); + context->treeRoot = (yyval.interm.intermNode); + ;} + break; + + case 198: + + { + (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); + ;} + break; + + case 199: + + { + (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); + ;} + break; + + case 200: + + { + TFunction* function = (yyvsp[(1) - (1)].interm).function; + + const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName()); + + if (builtIn) + { + context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str()); + context->recover(); + } + + TFunction* prevDec = static_cast(context->symbolTable.find(function->getMangledName())); + // + // Note: 'prevDec' could be 'function' if this is the first time we've seen function + // as it would have just been put in the symbol table. Otherwise, we're looking up + // an earlier occurance. + // + if (prevDec->isDefined()) { + // + // Then this function already has a body. + // + context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str()); + context->recover(); + } + prevDec->setDefined(); + + // + // Raise error message if main function takes any parameters or return anything other than void + // + if (function->getName() == "main") { + if (function->getParamCount() > 0) { + context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str()); + context->recover(); + } + if (function->getReturnType().getBasicType() != EbtVoid) { + context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value"); + context->recover(); + } + } + + // + // Remember the return type for later checking for RETURN statements. + // + context->currentFunctionType = &(prevDec->getReturnType()); + context->functionReturnsValue = false; + + // + // Insert parameters into the symbol table. + // If the parameter has no name, it's not an error, just don't insert it + // (could be used for unused args). + // + // Also, accumulate the list of parameters into the HIL, so lower level code + // knows where to find parameters. + // + TIntermAggregate* paramNodes = new TIntermAggregate; + for (int i = 0; i < function->getParamCount(); i++) { + const TParameter& param = function->getParam(i); + if (param.name != 0) { + TVariable *variable = new TVariable(param.name, *param.type); + // + // Insert the parameters with name in the symbol table. + // + if (! context->symbolTable.insert(*variable)) { + context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str()); + context->recover(); + delete variable; + } + + // + // Add the parameter to the HIL + // + paramNodes = context->intermediate.growAggregate( + paramNodes, + context->intermediate.addSymbol(variable->getUniqueId(), + variable->getName(), + variable->getType(), (yyvsp[(1) - (1)].interm).line), + (yyvsp[(1) - (1)].interm).line); + } else { + paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line); + } + } + context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line); + (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes; + context->loopNestingLevel = 0; + ;} + break; + + case 201: + + { + //?? Check that all paths return a value if return type != void ? + // May be best done as post process phase on intermediate code + if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) { + context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str()); + context->recover(); + } + + (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0); + context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line); + (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str()); + (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType()); + + // store the pragma information for debug and optimize and other vendor specific + // information. This information can be queried from the parse tree + (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize); + (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug); + + if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()) + (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine()); + + context->symbolTable.pop(); + ;} + break; + + +/* Line 1267 of yacc.c. */ + + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (context, YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (context, yymsg); + } + else + { + yyerror (context, YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, context); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp, context); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (context, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, context); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, context); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + + + +int glslang_parse(TParseContext* context) { + return yyparse(context); +} + + diff --git a/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.h b/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.h new file mode 100644 index 0000000..23945b8 --- /dev/null +++ b/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.h @@ -0,0 +1,278 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + INVARIANT = 258, + HIGH_PRECISION = 259, + MEDIUM_PRECISION = 260, + LOW_PRECISION = 261, + PRECISION = 262, + ATTRIBUTE = 263, + CONST_QUAL = 264, + BOOL_TYPE = 265, + FLOAT_TYPE = 266, + INT_TYPE = 267, + BREAK = 268, + CONTINUE = 269, + DO = 270, + ELSE = 271, + FOR = 272, + IF = 273, + DISCARD = 274, + RETURN = 275, + BVEC2 = 276, + BVEC3 = 277, + BVEC4 = 278, + IVEC2 = 279, + IVEC3 = 280, + IVEC4 = 281, + VEC2 = 282, + VEC3 = 283, + VEC4 = 284, + MATRIX2 = 285, + MATRIX3 = 286, + MATRIX4 = 287, + IN_QUAL = 288, + OUT_QUAL = 289, + INOUT_QUAL = 290, + UNIFORM = 291, + VARYING = 292, + STRUCT = 293, + VOID_TYPE = 294, + WHILE = 295, + SAMPLER2D = 296, + SAMPLERCUBE = 297, + SAMPLER_EXTERNAL_OES = 298, + SAMPLER2DRECT = 299, + IDENTIFIER = 300, + TYPE_NAME = 301, + FLOATCONSTANT = 302, + INTCONSTANT = 303, + BOOLCONSTANT = 304, + FIELD_SELECTION = 305, + LEFT_OP = 306, + RIGHT_OP = 307, + INC_OP = 308, + DEC_OP = 309, + LE_OP = 310, + GE_OP = 311, + EQ_OP = 312, + NE_OP = 313, + AND_OP = 314, + OR_OP = 315, + XOR_OP = 316, + MUL_ASSIGN = 317, + DIV_ASSIGN = 318, + ADD_ASSIGN = 319, + MOD_ASSIGN = 320, + LEFT_ASSIGN = 321, + RIGHT_ASSIGN = 322, + AND_ASSIGN = 323, + XOR_ASSIGN = 324, + OR_ASSIGN = 325, + SUB_ASSIGN = 326, + LEFT_PAREN = 327, + RIGHT_PAREN = 328, + LEFT_BRACKET = 329, + RIGHT_BRACKET = 330, + LEFT_BRACE = 331, + RIGHT_BRACE = 332, + DOT = 333, + COMMA = 334, + COLON = 335, + EQUAL = 336, + SEMICOLON = 337, + BANG = 338, + DASH = 339, + TILDE = 340, + PLUS = 341, + STAR = 342, + SLASH = 343, + PERCENT = 344, + LEFT_ANGLE = 345, + RIGHT_ANGLE = 346, + VERTICAL_BAR = 347, + CARET = 348, + AMPERSAND = 349, + QUESTION = 350 + }; +#endif +/* Tokens. */ +#define INVARIANT 258 +#define HIGH_PRECISION 259 +#define MEDIUM_PRECISION 260 +#define LOW_PRECISION 261 +#define PRECISION 262 +#define ATTRIBUTE 263 +#define CONST_QUAL 264 +#define BOOL_TYPE 265 +#define FLOAT_TYPE 266 +#define INT_TYPE 267 +#define BREAK 268 +#define CONTINUE 269 +#define DO 270 +#define ELSE 271 +#define FOR 272 +#define IF 273 +#define DISCARD 274 +#define RETURN 275 +#define BVEC2 276 +#define BVEC3 277 +#define BVEC4 278 +#define IVEC2 279 +#define IVEC3 280 +#define IVEC4 281 +#define VEC2 282 +#define VEC3 283 +#define VEC4 284 +#define MATRIX2 285 +#define MATRIX3 286 +#define MATRIX4 287 +#define IN_QUAL 288 +#define OUT_QUAL 289 +#define INOUT_QUAL 290 +#define UNIFORM 291 +#define VARYING 292 +#define STRUCT 293 +#define VOID_TYPE 294 +#define WHILE 295 +#define SAMPLER2D 296 +#define SAMPLERCUBE 297 +#define SAMPLER_EXTERNAL_OES 298 +#define SAMPLER2DRECT 299 +#define IDENTIFIER 300 +#define TYPE_NAME 301 +#define FLOATCONSTANT 302 +#define INTCONSTANT 303 +#define BOOLCONSTANT 304 +#define FIELD_SELECTION 305 +#define LEFT_OP 306 +#define RIGHT_OP 307 +#define INC_OP 308 +#define DEC_OP 309 +#define LE_OP 310 +#define GE_OP 311 +#define EQ_OP 312 +#define NE_OP 313 +#define AND_OP 314 +#define OR_OP 315 +#define XOR_OP 316 +#define MUL_ASSIGN 317 +#define DIV_ASSIGN 318 +#define ADD_ASSIGN 319 +#define MOD_ASSIGN 320 +#define LEFT_ASSIGN 321 +#define RIGHT_ASSIGN 322 +#define AND_ASSIGN 323 +#define XOR_ASSIGN 324 +#define OR_ASSIGN 325 +#define SUB_ASSIGN 326 +#define LEFT_PAREN 327 +#define RIGHT_PAREN 328 +#define LEFT_BRACKET 329 +#define RIGHT_BRACKET 330 +#define LEFT_BRACE 331 +#define RIGHT_BRACE 332 +#define DOT 333 +#define COMMA 334 +#define COLON 335 +#define EQUAL 336 +#define SEMICOLON 337 +#define BANG 338 +#define DASH 339 +#define TILDE 340 +#define PLUS 341 +#define STAR 342 +#define SLASH 343 +#define PERCENT 344 +#define LEFT_ANGLE 345 +#define RIGHT_ANGLE 346 +#define VERTICAL_BAR 347 +#define CARET 348 +#define AMPERSAND 349 +#define QUESTION 350 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE + +{ + struct { + TSourceLoc line; + union { + TString *string; + float f; + int i; + bool b; + }; + TSymbol* symbol; + } lex; + struct { + TSourceLoc line; + TOperator op; + union { + TIntermNode* intermNode; + TIntermNodePair nodePair; + TIntermTyped* intermTypedNode; + TIntermAggregate* intermAggregate; + }; + union { + TPublicType type; + TPrecision precision; + TQualifier qualifier; + TFunction* function; + TParameter param; + TTypeLine typeLine; + TTypeList* typeList; + }; + } interm; +} +/* Line 1529 of yacc.c. */ + + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index f31a472..4837b70 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -352,14 +352,6 @@ audio_DATA = $(WebCore)/platform/audio/resources/Composite.wav dist_audio_DATA = $(audio_DATA) endif # END ENABLE_WEB_AUDIO -# ANGLE tokenizer & parser -DerivedSources/ANGLE/glslang.cpp: Source/ThirdParty/ANGLE/src/compiler/glslang.l - $(AM_V_GEN)$(FLEX) --noline --nounistd --outfile="$@" "$<" - -DerivedSources/ANGLE/glslang_tab.cpp: Source/ThirdParty/ANGLE/src/compiler/glslang.y - $(AM_V_GEN)$(BISON) --no-lines --defines="DerivedSources/ANGLE/glslang_tab.h" --skeleton=yacc.c --output="$@" $< -DerivedSources/ANGLE/glslang_tab.h: DerivedSources/ANGLE/glslang_tab.cpp - IDL_PATH := \ $(WebCore)/Modules/filesystem \ $(WebCore)/Modules/gamepad \ diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index a1c6841..19ee41b 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -6305,11 +6305,6 @@ endif # 3D canvas (WebGL) support # --- if ENABLE_WEBGL -webcore_built_sources += \ - DerivedSources/ANGLE/glslang.cpp \ - DerivedSources/ANGLE/glslang_tab.cpp \ - DerivedSources/ANGLE/glslang_tab.h - webcore_sources += \ Source/ThirdParty/ANGLE/include/EGL/egl.h \ Source/ThirdParty/ANGLE/include/EGL/eglplatform.h \ @@ -6346,6 +6341,9 @@ webcore_sources += \ Source/ThirdParty/ANGLE/src/compiler/ForLoopUnroll.cpp \ Source/ThirdParty/ANGLE/src/compiler/ForLoopUnroll.h \ Source/ThirdParty/ANGLE/src/compiler/glslang.h \ + Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp \ + Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp \ + Source/ThirdParty/ANGLE/src/compiler/glslang_tab.h \ Source/ThirdParty/ANGLE/src/compiler/HashNames.h \ Source/ThirdParty/ANGLE/src/compiler/InfoSink.cpp \ Source/ThirdParty/ANGLE/src/compiler/InfoSink.h \