1 #line 17 "./glslang.l" 2 // 3 // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style license that can be 5 // found in the LICENSE file. 6 // 7 8 // This file is auto-generated by generate_parser.sh. DO NOT EDIT! 9 10 // Ignore errors in auto-generated code. 11 #if defined(__GNUC__) 12 #pragma GCC diagnostic ignored "-Wunused-function" 13 #pragma GCC diagnostic ignored "-Wunused-variable" 14 #pragma GCC diagnostic ignored "-Wswitch-enum" 15 #elif defined(_MSC_VER) 16 #pragma warning(disable: 4065) 17 #pragma warning(disable: 4189) 18 #pragma warning(disable: 4505) 19 #pragma warning(disable: 4701) 20 #endif 21 22 23 24 #line 25 "./glslang_lex.cpp" 25 26 #define YY_INT_ALIGNED short int 27 28 /* A lexical scanner generated by flex */ 29 30 #define FLEX_SCANNER 31 #define YY_FLEX_MAJOR_VERSION 2 32 #define YY_FLEX_MINOR_VERSION 5 33 #define YY_FLEX_SUBMINOR_VERSION 35 34 #if YY_FLEX_SUBMINOR_VERSION > 0 35 #define FLEX_BETA 36 #endif 37 38 /* First, we deal with platform-specific or compiler-specific issues. */ 39 40 /* begin standard C headers. */ 41 #include <stdio.h> 42 #include <string.h> 43 #include <errno.h> 44 #include <stdlib.h> 45 46 /* end standard C headers. */ 47 48 /* flex integer type definitions */ 49 50 #ifndef FLEXINT_H 51 #define FLEXINT_H 52 53 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 54 55 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 56 57 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 58 * if you want the limit (max/min) macros for int types. 59 */ 60 #ifndef __STDC_LIMIT_MACROS 61 #define __STDC_LIMIT_MACROS 1 62 #endif 63 64 #include <inttypes.h> 65 typedef int8_t flex_int8_t; 66 typedef uint8_t flex_uint8_t; 67 typedef int16_t flex_int16_t; 68 typedef uint16_t flex_uint16_t; 69 typedef int32_t flex_int32_t; 70 typedef uint32_t flex_uint32_t; 71 typedef uint64_t flex_uint64_t; 72 #else 73 typedef signed char flex_int8_t; 74 typedef short int flex_int16_t; 75 typedef int flex_int32_t; 76 typedef unsigned char flex_uint8_t; 77 typedef unsigned short int flex_uint16_t; 78 typedef unsigned int flex_uint32_t; 79 #endif /* ! C99 */ 80 81 /* Limits of integral types. */ 82 #ifndef INT8_MIN 83 #define INT8_MIN (-128) 84 #endif 85 #ifndef INT16_MIN 86 #define INT16_MIN (-32767-1) 87 #endif 88 #ifndef INT32_MIN 89 #define INT32_MIN (-2147483647-1) 90 #endif 91 #ifndef INT8_MAX 92 #define INT8_MAX (127) 93 #endif 94 #ifndef INT16_MAX 95 #define INT16_MAX (32767) 96 #endif 97 #ifndef INT32_MAX 98 #define INT32_MAX (2147483647) 99 #endif 100 #ifndef UINT8_MAX 101 #define UINT8_MAX (255U) 102 #endif 103 #ifndef UINT16_MAX 104 #define UINT16_MAX (65535U) 105 #endif 106 #ifndef UINT32_MAX 107 #define UINT32_MAX (4294967295U) 108 #endif 109 110 #endif /* ! FLEXINT_H */ 111 112 #ifdef __cplusplus 113 114 /* The "const" storage-class-modifier is valid. */ 115 #define YY_USE_CONST 116 117 #else /* ! __cplusplus */ 118 119 /* C99 requires __STDC__ to be defined as 1. */ 120 #if defined (__STDC__) 121 122 #define YY_USE_CONST 123 124 #endif /* defined (__STDC__) */ 125 #endif /* ! __cplusplus */ 126 127 #ifdef YY_USE_CONST 128 #define yyconst const 129 #else 130 #define yyconst 131 #endif 132 133 /* Returned upon end-of-file. */ 134 #define YY_NULL 0 135 136 /* Promotes a possibly negative, possibly signed char to an unsigned 137 * integer for use as an array index. If the signed char is negative, 138 * we want to instead treat it as an 8-bit unsigned char, hence the 139 * double cast. 140 */ 141 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 142 143 /* An opaque pointer. */ 144 #ifndef YY_TYPEDEF_YY_SCANNER_T 145 #define YY_TYPEDEF_YY_SCANNER_T 146 typedef void* yyscan_t; 147 #endif 148 149 /* For convenience, these vars (plus the bison vars far below) 150 are macros in the reentrant scanner. */ 151 #define yyin yyg->yyin_r 152 #define yyout yyg->yyout_r 153 #define yyextra yyg->yyextra_r 154 #define yyleng yyg->yyleng_r 155 #define yytext yyg->yytext_r 156 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) 157 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) 158 #define yy_flex_debug yyg->yy_flex_debug_r 159 160 /* Enter a start condition. This macro really ought to take a parameter, 161 * but we do it the disgusting crufty way forced on us by the ()-less 162 * definition of BEGIN. 163 */ 164 #define BEGIN yyg->yy_start = 1 + 2 * 165 166 /* Translate the current start state into a value that can be later handed 167 * to BEGIN to return to the state. The YYSTATE alias is for lex 168 * compatibility. 169 */ 170 #define YY_START ((yyg->yy_start - 1) / 2) 171 #define YYSTATE YY_START 172 173 /* Action number for EOF rule of a given start state. */ 174 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 175 176 /* Special action meaning "start processing a new file". */ 177 #define YY_NEW_FILE yyrestart(yyin ,yyscanner ) 178 179 #define YY_END_OF_BUFFER_CHAR 0 180 181 /* Size of default input buffer. */ 182 #ifndef YY_BUF_SIZE 183 #define YY_BUF_SIZE 16384 184 #endif 185 186 /* The state buf must be large enough to hold one state per character in the main buffer. 187 */ 188 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 189 190 #ifndef YY_TYPEDEF_YY_BUFFER_STATE 191 #define YY_TYPEDEF_YY_BUFFER_STATE 192 typedef struct yy_buffer_state *YY_BUFFER_STATE; 193 #endif 194 195 #ifndef YY_TYPEDEF_YY_SIZE_T 196 #define YY_TYPEDEF_YY_SIZE_T 197 typedef size_t yy_size_t; 198 #endif 199 200 #define EOB_ACT_CONTINUE_SCAN 0 201 #define EOB_ACT_END_OF_FILE 1 202 #define EOB_ACT_LAST_MATCH 2 203 204 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires 205 * access to the local variable yy_act. Since yyless() is a macro, it would break 206 * existing scanners that call yyless() from OUTSIDE yylex. 207 * One obvious solution it to make yy_act a global. I tried that, and saw 208 * a 5% performance hit in a non-yylineno scanner, because yy_act is 209 * normally declared as a register variable-- so it is not worth it. 210 */ 211 #define YY_LESS_LINENO(n) \ 212 do { \ 213 yy_size_t yyl;\ 214 for ( yyl = n; yyl < yyleng; ++yyl )\ 215 if ( yytext[yyl] == '\n' )\ 216 --yylineno;\ 217 }while(0) 218 219 /* Return all but the first "n" matched characters back to the input stream. */ 220 #define yyless(n) \ 221 do \ 222 { \ 223 /* Undo effects of setting up yytext. */ \ 224 int yyless_macro_arg = (n); \ 225 YY_LESS_LINENO(yyless_macro_arg);\ 226 *yy_cp = yyg->yy_hold_char; \ 227 YY_RESTORE_YY_MORE_OFFSET \ 228 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 229 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 230 } \ 231 while ( 0 ) 232 233 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) 234 235 #ifndef YY_STRUCT_YY_BUFFER_STATE 236 #define YY_STRUCT_YY_BUFFER_STATE 237 struct yy_buffer_state 238 { 239 FILE *yy_input_file; 240 241 char *yy_ch_buf; /* input buffer */ 242 char *yy_buf_pos; /* current position in input buffer */ 243 244 /* Size of input buffer in bytes, not including room for EOB 245 * characters. 246 */ 247 yy_size_t yy_buf_size; 248 249 /* Number of characters read into yy_ch_buf, not including EOB 250 * characters. 251 */ 252 yy_size_t yy_n_chars; 253 254 /* Whether we "own" the buffer - i.e., we know we created it, 255 * and can realloc() it to grow it, and should free() it to 256 * delete it. 257 */ 258 int yy_is_our_buffer; 259 260 /* Whether this is an "interactive" input source; if so, and 261 * if we're using stdio for input, then we want to use getc() 262 * instead of fread(), to make sure we stop fetching input after 263 * each newline. 264 */ 265 int yy_is_interactive; 266 267 /* Whether we're considered to be at the beginning of a line. 268 * If so, '^' rules will be active on the next match, otherwise 269 * not. 270 */ 271 int yy_at_bol; 272 273 int yy_bs_lineno; /**< The line count. */ 274 int yy_bs_column; /**< The column count. */ 275 276 /* Whether to try to fill the input buffer when we reach the 277 * end of it. 278 */ 279 int yy_fill_buffer; 280 281 int yy_buffer_status; 282 283 #define YY_BUFFER_NEW 0 284 #define YY_BUFFER_NORMAL 1 285 /* When an EOF's been seen but there's still some text to process 286 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 287 * shouldn't try reading from the input source any more. We might 288 * still have a bunch of tokens to match, though, because of 289 * possible backing-up. 290 * 291 * When we actually see the EOF, we change the status to "new" 292 * (via yyrestart()), so that the user can continue scanning by 293 * just pointing yyin at a new input file. 294 */ 295 #define YY_BUFFER_EOF_PENDING 2 296 297 }; 298 #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 299 300 /* We provide macros for accessing buffer states in case in the 301 * future we want to put the buffer states in a more general 302 * "scanner state". 303 * 304 * Returns the top of the stack, or NULL. 305 */ 306 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ 307 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ 308 : NULL) 309 310 /* Same as previous macro, but useful when we know that the buffer stack is not 311 * NULL or when we need an lvalue. For internal use only. 312 */ 313 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] 314 315 void yyrestart (FILE *input_file ,yyscan_t yyscanner ); 316 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 317 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); 318 void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 319 void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 320 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 321 void yypop_buffer_state (yyscan_t yyscanner ); 322 323 static void yyensure_buffer_stack (yyscan_t yyscanner ); 324 static void yy_load_buffer_state (yyscan_t yyscanner ); 325 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); 326 327 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) 328 329 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); 330 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); 331 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); 332 333 void *yyalloc (yy_size_t ,yyscan_t yyscanner ); 334 void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); 335 void yyfree (void * ,yyscan_t yyscanner ); 336 337 #define yy_new_buffer yy_create_buffer 338 339 #define yy_set_interactive(is_interactive) \ 340 { \ 341 if ( ! YY_CURRENT_BUFFER ){ \ 342 yyensure_buffer_stack (yyscanner); \ 343 YY_CURRENT_BUFFER_LVALUE = \ 344 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 345 } \ 346 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 347 } 348 349 #define yy_set_bol(at_bol) \ 350 { \ 351 if ( ! YY_CURRENT_BUFFER ){\ 352 yyensure_buffer_stack (yyscanner); \ 353 YY_CURRENT_BUFFER_LVALUE = \ 354 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 355 } \ 356 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 357 } 358 359 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 360 361 /* Begin user sect3 */ 362 363 #define yywrap(n) 1 364 #define YY_SKIP_YYWRAP 365 366 typedef unsigned char YY_CHAR; 367 368 typedef int yy_state_type; 369 370 #define yytext_ptr yytext_r 371 372 static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); 373 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); 374 static int yy_get_next_buffer (yyscan_t yyscanner ); 375 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); 376 377 /* Done after the current pattern has been matched and before the 378 * corresponding action - sets up yytext. 379 */ 380 #define YY_DO_BEFORE_ACTION \ 381 yyg->yytext_ptr = yy_bp; \ 382 yyleng = (yy_size_t) (yy_cp - yy_bp); \ 383 yyg->yy_hold_char = *yy_cp; \ 384 *yy_cp = '\0'; \ 385 yyg->yy_c_buf_p = yy_cp; 386 387 #define YY_NUM_RULES 147 388 #define YY_END_OF_BUFFER 148 389 /* This struct is not used in this scanner, 390 but its presence is necessary. */ 391 struct yy_trans_info 392 { 393 flex_int32_t yy_verify; 394 flex_int32_t yy_nxt; 395 }; 396 static yyconst flex_int16_t yy_accept[443] = 397 { 0, 398 0, 0, 148, 146, 145, 145, 132, 138, 143, 127, 399 128, 136, 135, 124, 133, 131, 137, 96, 96, 125, 400 121, 139, 126, 140, 144, 93, 129, 130, 142, 93, 401 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 402 93, 93, 93, 93, 93, 93, 93, 93, 93, 122, 403 141, 123, 134, 118, 104, 123, 112, 107, 102, 110, 404 100, 111, 101, 99, 103, 98, 95, 96, 0, 0, 405 130, 122, 129, 119, 115, 117, 116, 120, 93, 108, 406 114, 93, 93, 93, 93, 93, 93, 93, 93, 93, 407 93, 12, 93, 93, 93, 93, 93, 93, 93, 93, 408 409 93, 93, 93, 93, 93, 15, 17, 93, 93, 93, 410 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 411 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 412 93, 93, 93, 93, 109, 113, 0, 98, 0, 0, 413 97, 94, 105, 106, 45, 93, 93, 93, 93, 93, 414 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 415 93, 93, 93, 13, 93, 93, 93, 93, 93, 93, 416 93, 93, 21, 93, 93, 93, 93, 93, 93, 93, 417 93, 18, 93, 93, 93, 93, 93, 93, 93, 93, 418 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 419 420 93, 93, 93, 93, 93, 0, 99, 0, 98, 93, 421 23, 93, 93, 90, 93, 93, 93, 93, 93, 93, 422 93, 16, 48, 93, 93, 93, 64, 93, 93, 53, 423 68, 93, 93, 93, 93, 93, 93, 93, 93, 65, 424 4, 28, 29, 30, 93, 93, 93, 93, 93, 93, 425 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 426 51, 24, 93, 93, 93, 93, 93, 93, 31, 32, 427 33, 22, 93, 93, 93, 10, 37, 38, 39, 46, 428 7, 93, 93, 93, 93, 77, 78, 79, 93, 25, 429 69, 20, 80, 81, 82, 2, 74, 75, 76, 93, 430 431 19, 72, 93, 93, 34, 35, 36, 93, 93, 93, 432 93, 93, 93, 93, 93, 93, 66, 93, 93, 93, 433 93, 93, 93, 93, 93, 47, 93, 92, 93, 93, 434 14, 93, 93, 93, 93, 67, 61, 56, 93, 93, 435 93, 93, 93, 73, 52, 93, 59, 27, 93, 89, 436 60, 44, 71, 54, 93, 93, 93, 93, 93, 93, 437 93, 93, 55, 26, 93, 93, 93, 3, 93, 93, 438 93, 93, 93, 49, 8, 93, 9, 93, 93, 11, 439 62, 93, 93, 93, 57, 93, 93, 93, 93, 93, 440 93, 50, 70, 58, 6, 63, 1, 91, 5, 83, 441 442 40, 84, 93, 93, 93, 93, 93, 93, 93, 93, 443 93, 93, 93, 93, 41, 93, 93, 93, 93, 93, 444 93, 93, 43, 93, 87, 93, 93, 93, 93, 93, 445 85, 93, 86, 93, 93, 93, 93, 93, 93, 42, 446 88, 0 447 } ; 448 449 static yyconst flex_int32_t yy_ec[256] = 450 { 0, 451 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 452 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 453 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 454 1, 2, 4, 1, 1, 1, 5, 6, 1, 7, 455 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 456 18, 19, 20, 20, 20, 21, 21, 22, 23, 24, 457 25, 26, 27, 1, 28, 28, 29, 30, 31, 28, 458 32, 32, 32, 32, 32, 32, 32, 32, 33, 32, 459 32, 34, 35, 32, 32, 32, 32, 36, 32, 32, 460 37, 1, 38, 39, 32, 1, 40, 41, 42, 43, 461 462 44, 45, 46, 47, 48, 32, 49, 50, 51, 52, 463 53, 54, 32, 55, 56, 57, 58, 59, 60, 61, 464 62, 63, 64, 65, 66, 67, 1, 1, 1, 1, 465 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 466 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 467 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 469 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 470 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 471 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 472 473 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 474 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 475 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 476 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 477 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 478 1, 1, 1, 1, 1 479 } ; 480 481 static yyconst flex_int32_t yy_meta[68] = 482 { 0, 483 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 484 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 485 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 486 2, 3, 3, 3, 3, 3, 1, 1, 1, 2, 487 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 488 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 489 3, 3, 3, 1, 1, 1, 1 490 } ; 491 492 static yyconst flex_int16_t yy_base[445] = 493 { 0, 494 0, 0, 587, 588, 588, 588, 561, 43, 64, 588, 495 588, 560, 61, 588, 60, 58, 559, 77, 86, 557, 496 588, 104, 557, 55, 588, 0, 588, 588, 75, 26, 497 57, 82, 83, 73, 93, 528, 97, 95, 527, 44, 498 71, 521, 104, 534, 110, 116, 35, 111, 530, 588, 499 114, 588, 588, 588, 588, 588, 588, 588, 588, 588, 500 588, 588, 588, 165, 588, 172, 202, 211, 233, 0, 501 588, 588, 588, 551, 588, 588, 588, 550, 0, 588, 502 588, 523, 516, 519, 527, 526, 513, 528, 515, 521, 503 509, 506, 519, 506, 503, 503, 509, 497, 108, 502, 504 505 512, 498, 504, 507, 508, 0, 145, 507, 113, 493, 506 506, 497, 499, 489, 503, 500, 502, 485, 490, 487, 507 476, 157, 484, 489, 485, 487, 476, 479, 118, 484, 508 476, 488, 70, 481, 588, 588, 246, 253, 270, 219, 509 283, 0, 588, 588, 0, 473, 477, 486, 483, 467, 510 467, 119, 482, 479, 479, 477, 474, 466, 472, 459, 511 470, 456, 472, 0, 469, 457, 464, 461, 465, 458, 512 447, 446, 459, 462, 459, 454, 445, 188, 450, 453, 513 444, 441, 445, 451, 442, 433, 436, 434, 444, 430, 514 428, 441, 427, 429, 426, 437, 436, 124, 431, 426, 515 516 415, 258, 433, 435, 424, 290, 297, 304, 311, 425, 517 0, 423, 275, 0, 415, 413, 421, 410, 427, 416, 518 316, 0, 0, 410, 420, 420, 0, 405, 319, 0, 519 0, 407, 322, 408, 402, 401, 402, 401, 325, 0, 520 0, 0, 0, 0, 397, 398, 403, 394, 407, 402, 521 401, 393, 397, 389, 392, 396, 401, 387, 399, 390, 522 0, 0, 396, 385, 385, 390, 389, 386, 0, 0, 523 0, 0, 376, 388, 390, 0, 0, 0, 0, 0, 524 0, 378, 379, 373, 383, 0, 0, 0, 374, 0, 525 0, 0, 0, 0, 0, 0, 0, 0, 0, 381, 526 527 0, 0, 379, 375, 0, 0, 0, 371, 367, 372, 528 362, 375, 361, 374, 363, 370, 0, 368, 370, 354, 529 356, 362, 368, 363, 351, 0, 353, 0, 352, 355, 530 0, 344, 343, 343, 356, 0, 358, 0, 357, 356, 531 341, 354, 341, 0, 0, 344, 0, 0, 336, 0, 532 0, 0, 0, 0, 333, 344, 337, 343, 340, 335, 533 327, 339, 0, 0, 332, 339, 328, 0, 337, 334, 534 324, 329, 332, 0, 0, 332, 0, 330, 329, 0, 535 0, 328, 314, 326, 0, 317, 338, 337, 336, 307, 536 303, 0, 0, 0, 0, 0, 0, 0, 0, 328, 537 538 166, 325, 316, 299, 308, 310, 306, 308, 307, 306, 539 309, 306, 256, 253, 0, 228, 238, 222, 235, 203, 540 207, 204, 212, 191, 0, 201, 165, 167, 153, 161, 541 0, 170, 0, 175, 151, 141, 100, 114, 59, 0, 542 0, 588, 359, 113 543 } ; 544 545 static yyconst flex_int16_t yy_def[445] = 546 { 0, 547 442, 1, 442, 442, 442, 442, 442, 442, 442, 442, 548 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 549 442, 442, 442, 442, 442, 443, 442, 442, 442, 443, 550 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 551 443, 443, 443, 443, 443, 443, 443, 443, 443, 442, 552 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 553 442, 442, 442, 442, 442, 442, 442, 442, 442, 444, 554 442, 442, 442, 442, 442, 442, 442, 442, 443, 442, 555 442, 443, 443, 443, 443, 443, 443, 443, 443, 443, 556 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 557 558 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 559 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 560 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 561 443, 443, 443, 443, 442, 442, 442, 442, 442, 442, 562 442, 444, 442, 442, 443, 443, 443, 443, 443, 443, 563 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 564 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 565 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 566 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 567 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 568 569 443, 443, 443, 443, 443, 442, 442, 442, 442, 443, 570 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 571 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 572 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 573 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 574 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 575 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 576 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 577 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 578 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 579 580 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 581 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 582 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 583 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 584 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 585 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 586 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 587 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 588 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 589 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 590 591 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 592 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 593 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 594 443, 443, 443, 443, 443, 443, 443, 443, 443, 443, 595 443, 0, 442, 442 596 } ; 597 598 static yyconst flex_int16_t yy_nxt[656] = 599 { 0, 600 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 601 14, 15, 16, 17, 18, 19, 19, 19, 19, 19, 602 19, 20, 21, 22, 23, 24, 25, 26, 26, 26, 603 26, 26, 26, 26, 26, 26, 27, 28, 29, 30, 604 31, 32, 33, 34, 35, 36, 37, 38, 26, 39, 605 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 606 26, 26, 26, 50, 51, 52, 53, 55, 56, 57, 607 60, 62, 64, 64, 64, 64, 64, 64, 64, 77, 608 78, 82, 83, 110, 63, 61, 129, 111, 58, 66, 609 130, 67, 67, 67, 67, 67, 67, 68, 66, 80, 610 611 68, 68, 68, 68, 68, 68, 68, 69, 72, 84, 612 112, 85, 70, 81, 142, 86, 69, 203, 441, 204, 613 69, 87, 94, 113, 95, 73, 90, 74, 75, 69, 614 91, 88, 97, 96, 89, 92, 103, 70, 135, 106, 615 98, 93, 99, 115, 104, 100, 107, 162, 440, 119, 616 131, 101, 439, 108, 132, 105, 120, 121, 116, 125, 617 163, 117, 126, 133, 176, 198, 122, 123, 264, 124, 618 127, 438, 177, 199, 216, 217, 265, 128, 136, 64, 619 64, 64, 64, 64, 64, 64, 138, 138, 138, 138, 620 138, 138, 138, 437, 170, 137, 190, 171, 172, 406, 621 622 407, 173, 139, 174, 242, 243, 244, 436, 137, 435, 623 434, 191, 433, 432, 66, 139, 67, 67, 67, 67, 624 67, 67, 68, 66, 431, 68, 68, 68, 68, 68, 625 68, 68, 69, 141, 141, 141, 141, 141, 141, 141, 626 430, 69, 140, 429, 140, 69, 428, 141, 141, 141, 627 141, 141, 141, 141, 69, 206, 427, 206, 426, 425, 628 207, 207, 207, 207, 207, 207, 207, 138, 138, 138, 629 138, 138, 138, 138, 269, 270, 271, 424, 423, 208, 630 422, 208, 421, 139, 209, 209, 209, 209, 209, 209, 631 209, 277, 278, 279, 420, 419, 139, 141, 141, 141, 632 633 141, 141, 141, 141, 207, 207, 207, 207, 207, 207, 634 207, 207, 207, 207, 207, 207, 207, 207, 209, 209, 635 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 636 209, 209, 286, 287, 288, 293, 294, 295, 297, 298, 637 299, 305, 306, 307, 387, 388, 389, 418, 417, 416, 638 415, 414, 413, 412, 411, 410, 409, 390, 408, 391, 639 79, 79, 405, 404, 403, 402, 401, 400, 399, 398, 640 397, 396, 395, 394, 393, 392, 386, 385, 384, 383, 641 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 642 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 643 644 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 645 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 646 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 647 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 648 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 649 312, 311, 310, 309, 308, 304, 303, 302, 301, 300, 650 296, 292, 291, 290, 289, 285, 284, 283, 282, 281, 651 280, 276, 275, 274, 273, 272, 268, 267, 266, 263, 652 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 653 252, 251, 250, 249, 248, 247, 246, 245, 241, 240, 654 655 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 656 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 657 219, 218, 215, 214, 213, 212, 211, 210, 205, 202, 658 201, 200, 197, 196, 195, 194, 193, 192, 189, 188, 659 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 660 175, 169, 168, 167, 166, 165, 164, 161, 160, 159, 661 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 662 148, 147, 146, 145, 144, 143, 134, 118, 114, 109, 663 102, 76, 71, 65, 59, 54, 442, 3, 442, 442, 664 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 665 666 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 667 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 668 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 669 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 670 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 671 442, 442, 442, 442, 442 672 } ; 673 674 static yyconst flex_int16_t yy_chk[656] = 675 { 0, 676 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 677 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 678 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 679 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 680 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 681 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 682 1, 1, 1, 1, 1, 1, 1, 8, 8, 9, 683 13, 15, 16, 16, 16, 16, 16, 16, 16, 24, 684 24, 30, 30, 40, 15, 13, 47, 40, 9, 18, 685 47, 18, 18, 18, 18, 18, 18, 18, 19, 29, 686 687 19, 19, 19, 19, 19, 19, 19, 18, 22, 31, 688 41, 31, 18, 29, 444, 31, 19, 133, 439, 133, 689 18, 32, 34, 41, 34, 22, 33, 22, 22, 19, 690 33, 32, 35, 34, 32, 33, 37, 18, 51, 38, 691 35, 33, 35, 43, 37, 35, 38, 99, 438, 45, 692 48, 35, 437, 38, 48, 37, 45, 45, 43, 46, 693 99, 43, 46, 48, 109, 129, 45, 45, 198, 45, 694 46, 436, 109, 129, 152, 152, 198, 46, 51, 64, 695 64, 64, 64, 64, 64, 64, 66, 66, 66, 66, 696 66, 66, 66, 435, 107, 64, 122, 107, 107, 401, 697 698 401, 107, 66, 107, 178, 178, 178, 434, 64, 432, 699 430, 122, 429, 428, 67, 66, 67, 67, 67, 67, 700 67, 67, 67, 68, 427, 68, 68, 68, 68, 68, 701 68, 68, 67, 140, 140, 140, 140, 140, 140, 140, 702 426, 68, 69, 424, 69, 67, 423, 69, 69, 69, 703 69, 69, 69, 69, 68, 137, 422, 137, 421, 420, 704 137, 137, 137, 137, 137, 137, 137, 138, 138, 138, 705 138, 138, 138, 138, 202, 202, 202, 419, 418, 139, 706 417, 139, 416, 138, 139, 139, 139, 139, 139, 139, 707 139, 213, 213, 213, 414, 413, 138, 141, 141, 141, 708 709 141, 141, 141, 141, 206, 206, 206, 206, 206, 206, 710 206, 207, 207, 207, 207, 207, 207, 207, 208, 208, 711 208, 208, 208, 208, 208, 209, 209, 209, 209, 209, 712 209, 209, 221, 221, 221, 229, 229, 229, 233, 233, 713 233, 239, 239, 239, 372, 372, 372, 412, 411, 410, 714 409, 408, 407, 406, 405, 404, 403, 372, 402, 372, 715 443, 443, 400, 391, 390, 389, 388, 387, 386, 384, 716 383, 382, 379, 378, 376, 373, 371, 370, 369, 367, 717 366, 365, 362, 361, 360, 359, 358, 357, 356, 355, 718 349, 346, 343, 342, 341, 340, 339, 337, 335, 334, 719 720 333, 332, 330, 329, 327, 325, 324, 323, 322, 321, 721 320, 319, 318, 316, 315, 314, 313, 312, 311, 310, 722 309, 308, 304, 303, 300, 289, 285, 284, 283, 282, 723 275, 274, 273, 268, 267, 266, 265, 264, 263, 260, 724 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 725 249, 248, 247, 246, 245, 238, 237, 236, 235, 234, 726 232, 228, 226, 225, 224, 220, 219, 218, 217, 216, 727 215, 212, 210, 205, 204, 203, 201, 200, 199, 197, 728 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 729 186, 185, 184, 183, 182, 181, 180, 179, 177, 176, 730 731 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 732 165, 163, 162, 161, 160, 159, 158, 157, 156, 155, 733 154, 153, 151, 150, 149, 148, 147, 146, 134, 132, 734 131, 130, 128, 127, 126, 125, 124, 123, 121, 120, 735 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 736 108, 105, 104, 103, 102, 101, 100, 98, 97, 96, 737 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 738 85, 84, 83, 82, 78, 74, 49, 44, 42, 39, 739 36, 23, 20, 17, 12, 7, 3, 442, 442, 442, 740 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 741 742 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 743 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 744 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 745 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 746 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 747 442, 442, 442, 442, 442 748 } ; 749 750 /* Table of booleans, true if rule could match eol. */ 751 static yyconst flex_int32_t yy_rule_can_match_eol[148] = 752 { 0, 753 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 754 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 755 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 756 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 757 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 758 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 759 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 760 0, 0, 0, 0, 0, 1, 0, 0, }; 761 762 /* The intent behind this definition is that it'll catch 763 * any uses of REJECT which flex missed. 764 */ 765 #define REJECT reject_used_but_not_detected 766 #define yymore() yymore_used_but_not_detected 767 #define YY_MORE_ADJ 0 768 #define YY_RESTORE_YY_MORE_OFFSET 769 /* 770 // 771 // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. 772 // Use of this source code is governed by a BSD-style license that can be 773 // found in the LICENSE file. 774 // 775 776 This file contains the Lex specification for GLSL ES. 777 Based on ANSI C grammar, Lex specification: 778 http://www.lysator.liu.se/c/ANSI-C-grammar-l.html 779 780 IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh, 781 WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp). 782 */ 783 784 #include "compiler/glslang.h" 785 #include "compiler/ParseContext.h" 786 #include "compiler/preprocessor/Token.h" 787 #include "compiler/util.h" 788 #include "glslang_tab.h" 789 790 /* windows only pragma */ 791 #ifdef _MSC_VER 792 #pragma warning(disable : 4102) 793 #endif 794 795 #define YY_USER_ACTION \ 796 yylloc->first_file = yylloc->last_file = yycolumn; \ 797 yylloc->first_line = yylloc->last_line = yylineno; 798 799 #define YY_INPUT(buf, result, max_size) \ 800 result = string_input(buf, max_size, yyscanner); 801 802 static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner); 803 static int check_type(yyscan_t yyscanner); 804 static int reserved_word(yyscan_t yyscanner); 805 static int int_constant(yyscan_t yyscanner); 806 static int float_constant(yyscan_t yyscanner); 807 808 #define INITIAL 0 809 810 #define YY_EXTRA_TYPE TParseContext* 811 812 /* Holds the entire state of the reentrant scanner. */ 813 struct yyguts_t 814 { 815 816 /* User-defined. Not touched by flex. */ 817 YY_EXTRA_TYPE yyextra_r; 818 819 /* The rest are the same as the globals declared in the non-reentrant scanner. */ 820 FILE *yyin_r, *yyout_r; 821 size_t yy_buffer_stack_top; /**< index of top of stack. */ 822 size_t yy_buffer_stack_max; /**< capacity of stack. */ 823 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ 824 char yy_hold_char; 825 yy_size_t yy_n_chars; 826 yy_size_t yyleng_r; 827 char *yy_c_buf_p; 828 int yy_init; 829 int yy_start; 830 int yy_did_buffer_switch_on_eof; 831 int yy_start_stack_ptr; 832 int yy_start_stack_depth; 833 int *yy_start_stack; 834 yy_state_type yy_last_accepting_state; 835 char* yy_last_accepting_cpos; 836 837 int yylineno_r; 838 int yy_flex_debug_r; 839 840 char *yytext_r; 841 int yy_more_flag; 842 int yy_more_len; 843 844 YYSTYPE * yylval_r; 845 846 YYLTYPE * yylloc_r; 847 848 }; /* end struct yyguts_t */ 849 850 static int yy_init_globals (yyscan_t yyscanner ); 851 852 /* This must go here because YYSTYPE and YYLTYPE are included 853 * from bison output in section 1.*/ 854 # define yylval yyg->yylval_r 855 856 # define yylloc yyg->yylloc_r 857 858 int yylex_init (yyscan_t* scanner); 859 860 int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); 861 862 /* Accessor methods to globals. 863 These are made visible to non-reentrant scanners for convenience. */ 864 865 int yylex_destroy (yyscan_t yyscanner ); 866 867 int yyget_debug (yyscan_t yyscanner ); 868 869 void yyset_debug (int debug_flag ,yyscan_t yyscanner ); 870 871 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner ); 872 873 void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); 874 875 FILE *yyget_in (yyscan_t yyscanner ); 876 877 void yyset_in (FILE * in_str ,yyscan_t yyscanner ); 878 879 FILE *yyget_out (yyscan_t yyscanner ); 880 881 void yyset_out (FILE * out_str ,yyscan_t yyscanner ); 882 883 yy_size_t yyget_leng (yyscan_t yyscanner ); 884 885 char *yyget_text (yyscan_t yyscanner ); 886 887 int yyget_lineno (yyscan_t yyscanner ); 888 889 void yyset_lineno (int line_number ,yyscan_t yyscanner ); 890 891 YYSTYPE * yyget_lval (yyscan_t yyscanner ); 892 893 void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); 894 895 YYLTYPE *yyget_lloc (yyscan_t yyscanner ); 896 897 void yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); 898 899 /* Macros after this point can all be overridden by user definitions in 900 * section 1. 901 */ 902 903 #ifndef YY_SKIP_YYWRAP 904 #ifdef __cplusplus 905 extern "C" int yywrap (yyscan_t yyscanner ); 906 #else 907 extern int yywrap (yyscan_t yyscanner ); 908 #endif 909 #endif 910 911 #ifndef yytext_ptr 912 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); 913 #endif 914 915 #ifdef YY_NEED_STRLEN 916 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); 917 #endif 918 919 #ifndef YY_NO_INPUT 920 921 #ifdef __cplusplus 922 static int yyinput (yyscan_t yyscanner ); 923 #else 924 static int input (yyscan_t yyscanner ); 925 #endif 926 927 #endif 928 929 /* Amount of stuff to slurp up with each read. */ 930 #ifndef YY_READ_BUF_SIZE 931 #define YY_READ_BUF_SIZE 8192 932 #endif 933 934 /* Copy whatever the last rule matched to the standard output. */ 935 #ifndef ECHO 936 /* This used to be an fputs(), but since the string might contain NUL's, 937 * we now use fwrite(). 938 */ 939 #define ECHO fwrite( yytext, yyleng, 1, yyout ) 940 #endif 941 942 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 943 * is returned in "result". 944 */ 945 #ifndef YY_INPUT 946 #define YY_INPUT(buf,result,max_size) \ 947 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 948 { \ 949 int c = '*'; \ 950 yy_size_t n; \ 951 for ( n = 0; n < max_size && \ 952 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 953 buf[n] = (char) c; \ 954 if ( c == '\n' ) \ 955 buf[n++] = (char) c; \ 956 if ( c == EOF && ferror( yyin ) ) \ 957 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 958 result = n; \ 959 } \ 960 else \ 961 { \ 962 errno=0; \ 963 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 964 { \ 965 if( errno != EINTR) \ 966 { \ 967 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 968 break; \ 969 } \ 970 errno=0; \ 971 clearerr(yyin); \ 972 } \ 973 }\ 974 \ 975 976 #endif 977 978 /* No semi-colon after return; correct usage is to write "yyterminate();" - 979 * we don't want an extra ';' after the "return" because that will cause 980 * some compilers to complain about unreachable statements. 981 */ 982 #ifndef yyterminate 983 #define yyterminate() return YY_NULL 984 #endif 985 986 /* Number of entries by which start-condition stack grows. */ 987 #ifndef YY_START_STACK_INCR 988 #define YY_START_STACK_INCR 25 989 #endif 990 991 /* Report a fatal error. */ 992 #ifndef YY_FATAL_ERROR 993 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) 994 #endif 995 996 /* end tables serialization structures and prototypes */ 997 998 /* Default declaration of generated scanner - a define so the user can 999 * easily add parameters. 1000 */ 1001 #ifndef YY_DECL 1002 #define YY_DECL_IS_OURS 1 1003 1004 extern int yylex \ 1005 (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); 1006 1007 #define YY_DECL int yylex \ 1008 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) 1009 #endif /* !YY_DECL */ 1010 1011 /* Code executed at the beginning of each rule, after yytext and yyleng 1012 * have been set up. 1013 */ 1014 #ifndef YY_USER_ACTION 1015 #define YY_USER_ACTION 1016 #endif 1017 1018 /* Code executed at the end of each rule. */ 1019 #ifndef YY_BREAK 1020 #define YY_BREAK break; 1021 #endif 1022 1023 #define YY_RULE_SETUP \ 1024 YY_USER_ACTION 1025 1026 /** The main scanner function which does all the work. 1027 */ 1028 YY_DECL 1029 { 1030 register yy_state_type yy_current_state; 1031 register char *yy_cp, *yy_bp; 1032 register int yy_act; 1033 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1034 1035 yylval = yylval_param; 1036 1037 yylloc = yylloc_param; 1038 1039 if ( !yyg->yy_init ) 1040 { 1041 yyg->yy_init = 1; 1042 1043 #ifdef YY_USER_INIT 1044 YY_USER_INIT; 1045 #endif 1046 1047 if ( ! yyg->yy_start ) 1048 yyg->yy_start = 1; /* first start state */ 1049 1050 if ( ! yyin ) 1051 yyin = stdin; 1052 1053 if ( ! yyout ) 1054 yyout = stdout; 1055 1056 if ( ! YY_CURRENT_BUFFER ) { 1057 yyensure_buffer_stack (yyscanner); 1058 YY_CURRENT_BUFFER_LVALUE = 1059 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 1060 } 1061 1062 yy_load_buffer_state(yyscanner ); 1063 } 1064 1065 while ( 1 ) /* loops until end-of-file is reached */ 1066 { 1067 yy_cp = yyg->yy_c_buf_p; 1068 1069 /* Support of yytext. */ 1070 *yy_cp = yyg->yy_hold_char; 1071 1072 /* yy_bp points to the position in yy_ch_buf of the start of 1073 * the current run. 1074 */ 1075 yy_bp = yy_cp; 1076 1077 yy_current_state = yyg->yy_start; 1078 yy_match: 1079 do 1080 { 1081 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 1082 if ( yy_accept[yy_current_state] ) 1083 { 1084 yyg->yy_last_accepting_state = yy_current_state; 1085 yyg->yy_last_accepting_cpos = yy_cp; 1086 } 1087 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1088 { 1089 yy_current_state = (int) yy_def[yy_current_state]; 1090 if ( yy_current_state >= 443 ) 1091 yy_c = yy_meta[(unsigned int) yy_c]; 1092 } 1093 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1094 ++yy_cp; 1095 } 1096 while ( yy_current_state != 442 ); 1097 yy_cp = yyg->yy_last_accepting_cpos; 1098 yy_current_state = yyg->yy_last_accepting_state; 1099 1100 yy_find_action: 1101 yy_act = yy_accept[yy_current_state]; 1102 1103 YY_DO_BEFORE_ACTION; 1104 1105 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) 1106 { 1107 yy_size_t yyl; 1108 for ( yyl = 0; yyl < yyleng; ++yyl ) 1109 if ( yytext[yyl] == '\n' ) 1110 1111 do{ yylineno++; 1112 yycolumn=0; 1113 }while(0) 1114 ; 1115 } 1116 1117 do_action: /* This label is used only to access EOF actions. */ 1118 1119 switch ( yy_act ) 1120 { /* beginning of action switch */ 1121 case 0: /* must back up */ 1122 /* undo the effects of YY_DO_BEFORE_ACTION */ 1123 *yy_cp = yyg->yy_hold_char; 1124 yy_cp = yyg->yy_last_accepting_cpos; 1125 yy_current_state = yyg->yy_last_accepting_state; 1126 goto yy_find_action; 1127 1128 case 1: 1129 YY_RULE_SETUP 1130 { return INVARIANT; } 1131 YY_BREAK 1132 case 2: 1133 YY_RULE_SETUP 1134 { return HIGH_PRECISION; } 1135 YY_BREAK 1136 case 3: 1137 YY_RULE_SETUP 1138 { return MEDIUM_PRECISION; } 1139 YY_BREAK 1140 case 4: 1141 YY_RULE_SETUP 1142 { return LOW_PRECISION; } 1143 YY_BREAK 1144 case 5: 1145 YY_RULE_SETUP 1146 { return PRECISION; } 1147 YY_BREAK 1148 case 6: 1149 YY_RULE_SETUP 1150 { return ATTRIBUTE; } 1151 YY_BREAK 1152 case 7: 1153 YY_RULE_SETUP 1154 { return CONST_QUAL; } 1155 YY_BREAK 1156 case 8: 1157 YY_RULE_SETUP 1158 { return UNIFORM; } 1159 YY_BREAK 1160 case 9: 1161 YY_RULE_SETUP 1162 { return VARYING; } 1163 YY_BREAK 1164 case 10: 1165 YY_RULE_SETUP 1166 { return BREAK; } 1167 YY_BREAK 1168 case 11: 1169 YY_RULE_SETUP 1170 { return CONTINUE; } 1171 YY_BREAK 1172 case 12: 1173 YY_RULE_SETUP 1174 { return DO; } 1175 YY_BREAK 1176 case 13: 1177 YY_RULE_SETUP 1178 { return FOR; } 1179 YY_BREAK 1180 case 14: 1181 YY_RULE_SETUP 1182 { return WHILE; } 1183 YY_BREAK 1184 case 15: 1185 YY_RULE_SETUP 1186 { return IF; } 1187 YY_BREAK 1188 case 16: 1189 YY_RULE_SETUP 1190 { return ELSE; } 1191 YY_BREAK 1192 case 17: 1193 YY_RULE_SETUP 1194 { return IN_QUAL; } 1195 YY_BREAK 1196 case 18: 1197 YY_RULE_SETUP 1198 { return OUT_QUAL; } 1199 YY_BREAK 1200 case 19: 1201 YY_RULE_SETUP 1202 { return INOUT_QUAL; } 1203 YY_BREAK 1204 case 20: 1205 YY_RULE_SETUP 1206 { return FLOAT_TYPE; } 1207 YY_BREAK 1208 case 21: 1209 YY_RULE_SETUP 1210 { return INT_TYPE; } 1211 YY_BREAK 1212 case 22: 1213 YY_RULE_SETUP 1214 { return VOID_TYPE; } 1215 YY_BREAK 1216 case 23: 1217 YY_RULE_SETUP 1218 { return BOOL_TYPE; } 1219 YY_BREAK 1220 case 24: 1221 YY_RULE_SETUP 1222 { yylval->lex.b = true; return BOOLCONSTANT; } 1223 YY_BREAK 1224 case 25: 1225 YY_RULE_SETUP 1226 { yylval->lex.b = false; return BOOLCONSTANT; } 1227 YY_BREAK 1228 case 26: 1229 YY_RULE_SETUP 1230 { return DISCARD; } 1231 YY_BREAK 1232 case 27: 1233 YY_RULE_SETUP 1234 { return RETURN; } 1235 YY_BREAK 1236 case 28: 1237 YY_RULE_SETUP 1238 { return MATRIX2; } 1239 YY_BREAK 1240 case 29: 1241 YY_RULE_SETUP 1242 { return MATRIX3; } 1243 YY_BREAK 1244 case 30: 1245 YY_RULE_SETUP 1246 { return MATRIX4; } 1247 YY_BREAK 1248 case 31: 1249 YY_RULE_SETUP 1250 { return VEC2; } 1251 YY_BREAK 1252 case 32: 1253 YY_RULE_SETUP 1254 { return VEC3; } 1255 YY_BREAK 1256 case 33: 1257 YY_RULE_SETUP 1258 { return VEC4; } 1259 YY_BREAK 1260 case 34: 1261 YY_RULE_SETUP 1262 { return IVEC2; } 1263 YY_BREAK 1264 case 35: 1265 YY_RULE_SETUP 1266 { return IVEC3; } 1267 YY_BREAK 1268 case 36: 1269 YY_RULE_SETUP 1270 { return IVEC4; } 1271 YY_BREAK 1272 case 37: 1273 YY_RULE_SETUP 1274 { return BVEC2; } 1275 YY_BREAK 1276 case 38: 1277 YY_RULE_SETUP 1278 { return BVEC3; } 1279 YY_BREAK 1280 case 39: 1281 YY_RULE_SETUP 1282 { return BVEC4; } 1283 YY_BREAK 1284 case 40: 1285 YY_RULE_SETUP 1286 { return SAMPLER2D; } 1287 YY_BREAK 1288 case 41: 1289 YY_RULE_SETUP 1290 { return SAMPLERCUBE; } 1291 YY_BREAK 1292 case 42: 1293 YY_RULE_SETUP 1294 { return SAMPLER_EXTERNAL_OES; } 1295 YY_BREAK 1296 case 43: 1297 YY_RULE_SETUP 1298 { return SAMPLER2DRECT; } 1299 YY_BREAK 1300 case 44: 1301 YY_RULE_SETUP 1302 { return STRUCT; } 1303 YY_BREAK 1304 case 45: 1305 YY_RULE_SETUP 1306 { return reserved_word(yyscanner); } 1307 YY_BREAK 1308 case 46: 1309 YY_RULE_SETUP 1310 { return reserved_word(yyscanner); } 1311 YY_BREAK 1312 case 47: 1313 YY_RULE_SETUP 1314 { return reserved_word(yyscanner); } 1315 YY_BREAK 1316 case 48: 1317 YY_RULE_SETUP 1318 { return reserved_word(yyscanner); } 1319 YY_BREAK 1320 case 49: 1321 YY_RULE_SETUP 1322 { return reserved_word(yyscanner); } 1323 YY_BREAK 1324 case 50: 1325 YY_RULE_SETUP 1326 { return reserved_word(yyscanner); } 1327 YY_BREAK 1328 case 51: 1329 YY_RULE_SETUP 1330 { return reserved_word(yyscanner); } 1331 YY_BREAK 1332 case 52: 1333 YY_RULE_SETUP 1334 { return reserved_word(yyscanner); } 1335 YY_BREAK 1336 case 53: 1337 YY_RULE_SETUP 1338 { return reserved_word(yyscanner); } 1339 YY_BREAK 1340 case 54: 1341 YY_RULE_SETUP 1342 { return reserved_word(yyscanner); } 1343 YY_BREAK 1344 case 55: 1345 YY_RULE_SETUP 1346 { return reserved_word(yyscanner); } 1347 YY_BREAK 1348 case 56: 1349 YY_RULE_SETUP 1350 { return reserved_word(yyscanner); } 1351 YY_BREAK 1352 case 57: 1353 YY_RULE_SETUP 1354 { return reserved_word(yyscanner); } 1355 YY_BREAK 1356 case 58: 1357 YY_RULE_SETUP 1358 { return reserved_word(yyscanner); } 1359 YY_BREAK 1360 case 59: 1361 YY_RULE_SETUP 1362 { return reserved_word(yyscanner); } 1363 YY_BREAK 1364 case 60: 1365 YY_RULE_SETUP 1366 { return reserved_word(yyscanner); } 1367 YY_BREAK 1368 case 61: 1369 YY_RULE_SETUP 1370 { return reserved_word(yyscanner); } 1371 YY_BREAK 1372 case 62: 1373 YY_RULE_SETUP 1374 { return reserved_word(yyscanner); } 1375 YY_BREAK 1376 case 63: 1377 YY_RULE_SETUP 1378 { return reserved_word(yyscanner); } 1379 YY_BREAK 1380 case 64: 1381 YY_RULE_SETUP 1382 { return reserved_word(yyscanner); } 1383 YY_BREAK 1384 case 65: 1385 YY_RULE_SETUP 1386 { return reserved_word(yyscanner); } 1387 YY_BREAK 1388 case 66: 1389 YY_RULE_SETUP 1390 { return reserved_word(yyscanner); } 1391 YY_BREAK 1392 case 67: 1393 YY_RULE_SETUP 1394 { return reserved_word(yyscanner); } 1395 YY_BREAK 1396 case 68: 1397 YY_RULE_SETUP 1398 { return reserved_word(yyscanner); } 1399 YY_BREAK 1400 case 69: 1401 YY_RULE_SETUP 1402 { return reserved_word(yyscanner); } 1403 YY_BREAK 1404 case 70: 1405 YY_RULE_SETUP 1406 { return reserved_word(yyscanner); } 1407 YY_BREAK 1408 case 71: 1409 YY_RULE_SETUP 1410 { return reserved_word(yyscanner); } 1411 YY_BREAK 1412 case 72: 1413 YY_RULE_SETUP 1414 { return reserved_word(yyscanner); } 1415 YY_BREAK 1416 case 73: 1417 YY_RULE_SETUP 1418 { return reserved_word(yyscanner); } 1419 YY_BREAK 1420 case 74: 1421 YY_RULE_SETUP 1422 { return reserved_word(yyscanner); } 1423 YY_BREAK 1424 case 75: 1425 YY_RULE_SETUP 1426 { return reserved_word(yyscanner); } 1427 YY_BREAK 1428 case 76: 1429 YY_RULE_SETUP 1430 { return reserved_word(yyscanner); } 1431 YY_BREAK 1432 case 77: 1433 YY_RULE_SETUP 1434 { return reserved_word(yyscanner); } 1435 YY_BREAK 1436 case 78: 1437 YY_RULE_SETUP 1438 { return reserved_word(yyscanner); } 1439 YY_BREAK 1440 case 79: 1441 YY_RULE_SETUP 1442 { return reserved_word(yyscanner); } 1443 YY_BREAK 1444 case 80: 1445 YY_RULE_SETUP 1446 { return reserved_word(yyscanner); } 1447 YY_BREAK 1448 case 81: 1449 YY_RULE_SETUP 1450 { return reserved_word(yyscanner); } 1451 YY_BREAK 1452 case 82: 1453 YY_RULE_SETUP 1454 { return reserved_word(yyscanner); } 1455 YY_BREAK 1456 case 83: 1457 YY_RULE_SETUP 1458 { return reserved_word(yyscanner); } 1459 YY_BREAK 1460 case 84: 1461 YY_RULE_SETUP 1462 { return reserved_word(yyscanner); } 1463 YY_BREAK 1464 case 85: 1465 YY_RULE_SETUP 1466 { return reserved_word(yyscanner); } 1467 YY_BREAK 1468 case 86: 1469 YY_RULE_SETUP 1470 { return reserved_word(yyscanner); } 1471 YY_BREAK 1472 case 87: 1473 YY_RULE_SETUP 1474 { return reserved_word(yyscanner); } 1475 YY_BREAK 1476 case 88: 1477 YY_RULE_SETUP 1478 { return reserved_word(yyscanner); } 1479 YY_BREAK 1480 case 89: 1481 YY_RULE_SETUP 1482 { return reserved_word(yyscanner); } 1483 YY_BREAK 1484 case 90: 1485 YY_RULE_SETUP 1486 { return reserved_word(yyscanner); } 1487 YY_BREAK 1488 case 91: 1489 YY_RULE_SETUP 1490 { return reserved_word(yyscanner); } 1491 YY_BREAK 1492 case 92: 1493 YY_RULE_SETUP 1494 { return reserved_word(yyscanner); } 1495 YY_BREAK 1496 case 93: 1497 YY_RULE_SETUP 1498 { 1499 yylval->lex.string = NewPoolTString(yytext); 1500 return check_type(yyscanner); 1501 } 1502 YY_BREAK 1503 case 94: 1504 YY_RULE_SETUP 1505 { return int_constant(yyscanner); } 1506 YY_BREAK 1507 case 95: 1508 YY_RULE_SETUP 1509 { return int_constant(yyscanner); } 1510 YY_BREAK 1511 case 96: 1512 YY_RULE_SETUP 1513 { return int_constant(yyscanner); } 1514 YY_BREAK 1515 case 97: 1516 YY_RULE_SETUP 1517 { return float_constant(yyscanner); } 1518 YY_BREAK 1519 case 98: 1520 YY_RULE_SETUP 1521 { return float_constant(yyscanner); } 1522 YY_BREAK 1523 case 99: 1524 YY_RULE_SETUP 1525 { return float_constant(yyscanner); } 1526 YY_BREAK 1527 case 100: 1528 YY_RULE_SETUP 1529 { return ADD_ASSIGN; } 1530 YY_BREAK 1531 case 101: 1532 YY_RULE_SETUP 1533 { return SUB_ASSIGN; } 1534 YY_BREAK 1535 case 102: 1536 YY_RULE_SETUP 1537 { return MUL_ASSIGN; } 1538 YY_BREAK 1539 case 103: 1540 YY_RULE_SETUP 1541 { return DIV_ASSIGN; } 1542 YY_BREAK 1543 case 104: 1544 YY_RULE_SETUP 1545 { return MOD_ASSIGN; } 1546 YY_BREAK 1547 case 105: 1548 YY_RULE_SETUP 1549 { return LEFT_ASSIGN; } 1550 YY_BREAK 1551 case 106: 1552 YY_RULE_SETUP 1553 { return RIGHT_ASSIGN; } 1554 YY_BREAK 1555 case 107: 1556 YY_RULE_SETUP 1557 { return AND_ASSIGN; } 1558 YY_BREAK 1559 case 108: 1560 YY_RULE_SETUP 1561 { return XOR_ASSIGN; } 1562 YY_BREAK 1563 case 109: 1564 YY_RULE_SETUP 1565 { return OR_ASSIGN; } 1566 YY_BREAK 1567 case 110: 1568 YY_RULE_SETUP 1569 { return INC_OP; } 1570 YY_BREAK 1571 case 111: 1572 YY_RULE_SETUP 1573 { return DEC_OP; } 1574 YY_BREAK 1575 case 112: 1576 YY_RULE_SETUP 1577 { return AND_OP; } 1578 YY_BREAK 1579 case 113: 1580 YY_RULE_SETUP 1581 { return OR_OP; } 1582 YY_BREAK 1583 case 114: 1584 YY_RULE_SETUP 1585 { return XOR_OP; } 1586 YY_BREAK 1587 case 115: 1588 YY_RULE_SETUP 1589 { return LE_OP; } 1590 YY_BREAK 1591 case 116: 1592 YY_RULE_SETUP 1593 { return GE_OP; } 1594 YY_BREAK 1595 case 117: 1596 YY_RULE_SETUP 1597 { return EQ_OP; } 1598 YY_BREAK 1599 case 118: 1600 YY_RULE_SETUP 1601 { return NE_OP; } 1602 YY_BREAK 1603 case 119: 1604 YY_RULE_SETUP 1605 { return LEFT_OP; } 1606 YY_BREAK 1607 case 120: 1608 YY_RULE_SETUP 1609 { return RIGHT_OP; } 1610 YY_BREAK 1611 case 121: 1612 YY_RULE_SETUP 1613 { return SEMICOLON; } 1614 YY_BREAK 1615 case 122: 1616 YY_RULE_SETUP 1617 { return LEFT_BRACE; } 1618 YY_BREAK 1619 case 123: 1620 YY_RULE_SETUP 1621 { return RIGHT_BRACE; } 1622 YY_BREAK 1623 case 124: 1624 YY_RULE_SETUP 1625 { return COMMA; } 1626 YY_BREAK 1627 case 125: 1628 YY_RULE_SETUP 1629 { return COLON; } 1630 YY_BREAK 1631 case 126: 1632 YY_RULE_SETUP 1633 { return EQUAL; } 1634 YY_BREAK 1635 case 127: 1636 YY_RULE_SETUP 1637 { return LEFT_PAREN; } 1638 YY_BREAK 1639 case 128: 1640 YY_RULE_SETUP 1641 { return RIGHT_PAREN; } 1642 YY_BREAK 1643 case 129: 1644 YY_RULE_SETUP 1645 { return LEFT_BRACKET; } 1646 YY_BREAK 1647 case 130: 1648 YY_RULE_SETUP 1649 { return RIGHT_BRACKET; } 1650 YY_BREAK 1651 case 131: 1652 YY_RULE_SETUP 1653 { return DOT; } 1654 YY_BREAK 1655 case 132: 1656 YY_RULE_SETUP 1657 { return BANG; } 1658 YY_BREAK 1659 case 133: 1660 YY_RULE_SETUP 1661 { return DASH; } 1662 YY_BREAK 1663 case 134: 1664 YY_RULE_SETUP 1665 { return TILDE; } 1666 YY_BREAK 1667 case 135: 1668 YY_RULE_SETUP 1669 { return PLUS; } 1670 YY_BREAK 1671 case 136: 1672 YY_RULE_SETUP 1673 { return STAR; } 1674 YY_BREAK 1675 case 137: 1676 YY_RULE_SETUP 1677 { return SLASH; } 1678 YY_BREAK 1679 case 138: 1680 YY_RULE_SETUP 1681 { return PERCENT; } 1682 YY_BREAK 1683 case 139: 1684 YY_RULE_SETUP 1685 { return LEFT_ANGLE; } 1686 YY_BREAK 1687 case 140: 1688 YY_RULE_SETUP 1689 { return RIGHT_ANGLE; } 1690 YY_BREAK 1691 case 141: 1692 YY_RULE_SETUP 1693 { return VERTICAL_BAR; } 1694 YY_BREAK 1695 case 142: 1696 YY_RULE_SETUP 1697 { return CARET; } 1698 YY_BREAK 1699 case 143: 1700 YY_RULE_SETUP 1701 { return AMPERSAND; } 1702 YY_BREAK 1703 case 144: 1704 YY_RULE_SETUP 1705 { return QUESTION; } 1706 YY_BREAK 1707 case 145: 1708 /* rule 145 can match eol */ 1709 YY_RULE_SETUP 1710 { } 1711 YY_BREAK 1712 case YY_STATE_EOF(INITIAL): 1713 { yyterminate(); } 1714 YY_BREAK 1715 case 146: 1716 YY_RULE_SETUP 1717 { assert(false); return 0; } 1718 YY_BREAK 1719 case 147: 1720 YY_RULE_SETUP 1721 ECHO; 1722 YY_BREAK 1723 1724 case YY_END_OF_BUFFER: 1725 { 1726 /* Amount of text matched not including the EOB char. */ 1727 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; 1728 1729 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1730 *yy_cp = yyg->yy_hold_char; 1731 YY_RESTORE_YY_MORE_OFFSET 1732 1733 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1734 { 1735 /* We're scanning a new file or input source. It's 1736 * possible that this happened because the user 1737 * just pointed yyin at a new source and called 1738 * yylex(). If so, then we have to assure 1739 * consistency between YY_CURRENT_BUFFER and our 1740 * globals. Here is the right place to do so, because 1741 * this is the first action (other than possibly a 1742 * back-up) that will match for the new input source. 1743 */ 1744 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1745 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 1746 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1747 } 1748 1749 /* Note that here we test for yy_c_buf_p "<=" to the position 1750 * of the first EOB in the buffer, since yy_c_buf_p will 1751 * already have been incremented past the NUL character 1752 * (since all states make transitions on EOB to the 1753 * end-of-buffer state). Contrast this with the test 1754 * in input(). 1755 */ 1756 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1757 { /* This was really a NUL. */ 1758 yy_state_type yy_next_state; 1759 1760 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; 1761 1762 yy_current_state = yy_get_previous_state( yyscanner ); 1763 1764 /* Okay, we're now positioned to make the NUL 1765 * transition. We couldn't have 1766 * yy_get_previous_state() go ahead and do it 1767 * for us because it doesn't know how to deal 1768 * with the possibility of jamming (and we don't 1769 * want to build jamming into it because then it 1770 * will run more slowly). 1771 */ 1772 1773 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); 1774 1775 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1776 1777 if ( yy_next_state ) 1778 { 1779 /* Consume the NUL. */ 1780 yy_cp = ++yyg->yy_c_buf_p; 1781 yy_current_state = yy_next_state; 1782 goto yy_match; 1783 } 1784 1785 else 1786 { 1787 yy_cp = yyg->yy_last_accepting_cpos; 1788 yy_current_state = yyg->yy_last_accepting_state; 1789 goto yy_find_action; 1790 } 1791 } 1792 1793 else switch ( yy_get_next_buffer( yyscanner ) ) 1794 { 1795 case EOB_ACT_END_OF_FILE: 1796 { 1797 yyg->yy_did_buffer_switch_on_eof = 0; 1798 1799 if ( yywrap(yyscanner ) ) 1800 { 1801 /* Note: because we've taken care in 1802 * yy_get_next_buffer() to have set up 1803 * yytext, we can now set up 1804 * yy_c_buf_p so that if some total 1805 * hoser (like flex itself) wants to 1806 * call the scanner after we return the 1807 * YY_NULL, it'll still work - another 1808 * YY_NULL will get returned. 1809 */ 1810 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; 1811 1812 yy_act = YY_STATE_EOF(YY_START); 1813 goto do_action; 1814 } 1815 1816 else 1817 { 1818 if ( ! yyg->yy_did_buffer_switch_on_eof ) 1819 YY_NEW_FILE; 1820 } 1821 break; 1822 } 1823 1824 case EOB_ACT_CONTINUE_SCAN: 1825 yyg->yy_c_buf_p = 1826 yyg->yytext_ptr + yy_amount_of_matched_text; 1827 1828 yy_current_state = yy_get_previous_state( yyscanner ); 1829 1830 yy_cp = yyg->yy_c_buf_p; 1831 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1832 goto yy_match; 1833 1834 case EOB_ACT_LAST_MATCH: 1835 yyg->yy_c_buf_p = 1836 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; 1837 1838 yy_current_state = yy_get_previous_state( yyscanner ); 1839 1840 yy_cp = yyg->yy_c_buf_p; 1841 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1842 goto yy_find_action; 1843 } 1844 break; 1845 } 1846 1847 default: 1848 YY_FATAL_ERROR( 1849 "fatal flex scanner internal error--no action found" ); 1850 } /* end of action switch */ 1851 } /* end of scanning one token */ 1852 } /* end of yylex */ 1853 1854 /* yy_get_next_buffer - try to read in a new buffer 1855 * 1856 * Returns a code representing an action: 1857 * EOB_ACT_LAST_MATCH - 1858 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1859 * EOB_ACT_END_OF_FILE - end of file 1860 */ 1861 static int yy_get_next_buffer (yyscan_t yyscanner) 1862 { 1863 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1864 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1865 register char *source = yyg->yytext_ptr; 1866 register int number_to_move, i; 1867 int ret_val; 1868 1869 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) 1870 YY_FATAL_ERROR( 1871 "fatal flex scanner internal error--end of buffer missed" ); 1872 1873 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1874 { /* Don't try to fill the buffer, so this is an EOF. */ 1875 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) 1876 { 1877 /* We matched a single character, the EOB, so 1878 * treat this as a final EOF. 1879 */ 1880 return EOB_ACT_END_OF_FILE; 1881 } 1882 1883 else 1884 { 1885 /* We matched some text prior to the EOB, first 1886 * process it. 1887 */ 1888 return EOB_ACT_LAST_MATCH; 1889 } 1890 } 1891 1892 /* Try to read more data. */ 1893 1894 /* First move last chars to start of buffer. */ 1895 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; 1896 1897 for ( i = 0; i < number_to_move; ++i ) 1898 *(dest++) = *(source++); 1899 1900 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1901 /* don't do the read, it's not guaranteed to return an EOF, 1902 * just force an EOF 1903 */ 1904 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; 1905 1906 else 1907 { 1908 yy_size_t num_to_read = 1909 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1910 1911 while ( num_to_read <= 0 ) 1912 { /* Not enough room in the buffer - grow it. */ 1913 1914 /* just a shorter name for the current buffer */ 1915 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1916 1917 int yy_c_buf_p_offset = 1918 (int) (yyg->yy_c_buf_p - b->yy_ch_buf); 1919 1920 if ( b->yy_is_our_buffer ) 1921 { 1922 yy_size_t new_size = b->yy_buf_size * 2; 1923 1924 if ( new_size <= 0 ) 1925 b->yy_buf_size += b->yy_buf_size / 8; 1926 else 1927 b->yy_buf_size *= 2; 1928 1929 b->yy_ch_buf = (char *) 1930 /* Include room in for 2 EOB chars. */ 1931 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); 1932 } 1933 else 1934 /* Can't grow it, we don't own it. */ 1935 b->yy_ch_buf = 0; 1936 1937 if ( ! b->yy_ch_buf ) 1938 YY_FATAL_ERROR( 1939 "fatal error - scanner input buffer overflow" ); 1940 1941 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; 1942 1943 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1944 number_to_move - 1; 1945 1946 } 1947 1948 if ( num_to_read > YY_READ_BUF_SIZE ) 1949 num_to_read = YY_READ_BUF_SIZE; 1950 1951 /* Read in more data. */ 1952 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1953 yyg->yy_n_chars, num_to_read ); 1954 1955 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1956 } 1957 1958 if ( yyg->yy_n_chars == 0 ) 1959 { 1960 if ( number_to_move == YY_MORE_ADJ ) 1961 { 1962 ret_val = EOB_ACT_END_OF_FILE; 1963 yyrestart(yyin ,yyscanner); 1964 } 1965 1966 else 1967 { 1968 ret_val = EOB_ACT_LAST_MATCH; 1969 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1970 YY_BUFFER_EOF_PENDING; 1971 } 1972 } 1973 1974 else 1975 ret_val = EOB_ACT_CONTINUE_SCAN; 1976 1977 if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1978 /* Extend the array by 50%, plus the number we really need. */ 1979 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); 1980 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); 1981 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1982 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1983 } 1984 1985 yyg->yy_n_chars += number_to_move; 1986 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; 1987 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; 1988 1989 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1990 1991 return ret_val; 1992 } 1993 1994 /* yy_get_previous_state - get the state just before the EOB char was reached */ 1995 1996 static yy_state_type yy_get_previous_state (yyscan_t yyscanner) 1997 { 1998 register yy_state_type yy_current_state; 1999 register char *yy_cp; 2000 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2001 2002 yy_current_state = yyg->yy_start; 2003 2004 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) 2005 { 2006 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 2007 if ( yy_accept[yy_current_state] ) 2008 { 2009 yyg->yy_last_accepting_state = yy_current_state; 2010 yyg->yy_last_accepting_cpos = yy_cp; 2011 } 2012 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 2013 { 2014 yy_current_state = (int) yy_def[yy_current_state]; 2015 if ( yy_current_state >= 443 ) 2016 yy_c = yy_meta[(unsigned int) yy_c]; 2017 } 2018 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 2019 } 2020 2021 return yy_current_state; 2022 } 2023 2024 /* yy_try_NUL_trans - try to make a transition on the NUL character 2025 * 2026 * synopsis 2027 * next_state = yy_try_NUL_trans( current_state ); 2028 */ 2029 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) 2030 { 2031 register int yy_is_jam; 2032 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ 2033 register char *yy_cp = yyg->yy_c_buf_p; 2034 2035 register YY_CHAR yy_c = 1; 2036 if ( yy_accept[yy_current_state] ) 2037 { 2038 yyg->yy_last_accepting_state = yy_current_state; 2039 yyg->yy_last_accepting_cpos = yy_cp; 2040 } 2041 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 2042 { 2043 yy_current_state = (int) yy_def[yy_current_state]; 2044 if ( yy_current_state >= 443 ) 2045 yy_c = yy_meta[(unsigned int) yy_c]; 2046 } 2047 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 2048 yy_is_jam = (yy_current_state == 442); 2049 2050 return yy_is_jam ? 0 : yy_current_state; 2051 } 2052 2053 #ifndef YY_NO_INPUT 2054 #ifdef __cplusplus 2055 static int yyinput (yyscan_t yyscanner) 2056 #else 2057 static int input (yyscan_t yyscanner) 2058 #endif 2059 2060 { 2061 int c; 2062 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2063 2064 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2065 2066 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) 2067 { 2068 /* yy_c_buf_p now points to the character we want to return. 2069 * If this occurs *before* the EOB characters, then it's a 2070 * valid NUL; if not, then we've hit the end of the buffer. 2071 */ 2072 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 2073 /* This was really a NUL. */ 2074 *yyg->yy_c_buf_p = '\0'; 2075 2076 else 2077 { /* need more input */ 2078 yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 2079 ++yyg->yy_c_buf_p; 2080 2081 switch ( yy_get_next_buffer( yyscanner ) ) 2082 { 2083 case EOB_ACT_LAST_MATCH: 2084 /* This happens because yy_g_n_b() 2085 * sees that we've accumulated a 2086 * token and flags that we need to 2087 * try matching the token before 2088 * proceeding. But for input(), 2089 * there's no matching to consider. 2090 * So convert the EOB_ACT_LAST_MATCH 2091 * to EOB_ACT_END_OF_FILE. 2092 */ 2093 2094 /* Reset buffer status. */ 2095 yyrestart(yyin ,yyscanner); 2096 2097 /*FALLTHROUGH*/ 2098 2099 case EOB_ACT_END_OF_FILE: 2100 { 2101 if ( yywrap(yyscanner ) ) 2102 return EOF; 2103 2104 if ( ! yyg->yy_did_buffer_switch_on_eof ) 2105 YY_NEW_FILE; 2106 #ifdef __cplusplus 2107 return yyinput(yyscanner); 2108 #else 2109 return input(yyscanner); 2110 #endif 2111 } 2112 2113 case EOB_ACT_CONTINUE_SCAN: 2114 yyg->yy_c_buf_p = yyg->yytext_ptr + offset; 2115 break; 2116 } 2117 } 2118 } 2119 2120 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ 2121 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ 2122 yyg->yy_hold_char = *++yyg->yy_c_buf_p; 2123 2124 if ( c == '\n' ) 2125 2126 do{ yylineno++; 2127 yycolumn=0; 2128 }while(0) 2129 ; 2130 2131 return c; 2132 } 2133 #endif /* ifndef YY_NO_INPUT */ 2134 2135 /** Immediately switch to a different input stream. 2136 * @param input_file A readable stream. 2137 * @param yyscanner The scanner object. 2138 * @note This function does not reset the start condition to @c INITIAL . 2139 */ 2140 void yyrestart (FILE * input_file , yyscan_t yyscanner) 2141 { 2142 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2143 2144 if ( ! YY_CURRENT_BUFFER ){ 2145 yyensure_buffer_stack (yyscanner); 2146 YY_CURRENT_BUFFER_LVALUE = 2147 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 2148 } 2149 2150 yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); 2151 yy_load_buffer_state(yyscanner ); 2152 } 2153 2154 /** Switch to a different input buffer. 2155 * @param new_buffer The new input buffer. 2156 * @param yyscanner The scanner object. 2157 */ 2158 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 2159 { 2160 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2161 2162 /* TODO. We should be able to replace this entire function body 2163 * with 2164 * yypop_buffer_state(); 2165 * yypush_buffer_state(new_buffer); 2166 */ 2167 yyensure_buffer_stack (yyscanner); 2168 if ( YY_CURRENT_BUFFER == new_buffer ) 2169 return; 2170 2171 if ( YY_CURRENT_BUFFER ) 2172 { 2173 /* Flush out information for old buffer. */ 2174 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2175 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 2176 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 2177 } 2178 2179 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2180 yy_load_buffer_state(yyscanner ); 2181 2182 /* We don't actually know whether we did this switch during 2183 * EOF (yywrap()) processing, but the only time this flag 2184 * is looked at is after yywrap() is called, so it's safe 2185 * to go ahead and always set it. 2186 */ 2187 yyg->yy_did_buffer_switch_on_eof = 1; 2188 } 2189 2190 static void yy_load_buffer_state (yyscan_t yyscanner) 2191 { 2192 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2193 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 2194 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 2195 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 2196 yyg->yy_hold_char = *yyg->yy_c_buf_p; 2197 } 2198 2199 /** Allocate and initialize an input buffer state. 2200 * @param file A readable stream. 2201 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 2202 * @param yyscanner The scanner object. 2203 * @return the allocated buffer state. 2204 */ 2205 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) 2206 { 2207 YY_BUFFER_STATE b; 2208 2209 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 2210 if ( ! b ) 2211 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 2212 2213 b->yy_buf_size = size; 2214 2215 /* yy_ch_buf has to be 2 characters longer than the size given because 2216 * we need to put in 2 end-of-buffer characters. 2217 */ 2218 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner ); 2219 if ( ! b->yy_ch_buf ) 2220 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 2221 2222 b->yy_is_our_buffer = 1; 2223 2224 yy_init_buffer(b,file ,yyscanner); 2225 2226 return b; 2227 } 2228 2229 /** Destroy the buffer. 2230 * @param b a buffer created with yy_create_buffer() 2231 * @param yyscanner The scanner object. 2232 */ 2233 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 2234 { 2235 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2236 2237 if ( ! b ) 2238 return; 2239 2240 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 2241 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 2242 2243 if ( b->yy_is_our_buffer ) 2244 yyfree((void *) b->yy_ch_buf ,yyscanner ); 2245 2246 yyfree((void *) b ,yyscanner ); 2247 } 2248 2249 /* Initializes or reinitializes a buffer. 2250 * This function is sometimes called more than once on the same buffer, 2251 * such as during a yyrestart() or at EOF. 2252 */ 2253 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) 2254 2255 { 2256 int oerrno = errno; 2257 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2258 2259 yy_flush_buffer(b ,yyscanner); 2260 2261 b->yy_input_file = file; 2262 b->yy_fill_buffer = 1; 2263 2264 /* If b is the current buffer, then yy_init_buffer was _probably_ 2265 * called from yyrestart() or through yy_get_next_buffer. 2266 * In that case, we don't want to reset the lineno or column. 2267 */ 2268 if (b != YY_CURRENT_BUFFER){ 2269 b->yy_bs_lineno = 1; 2270 b->yy_bs_column = 0; 2271 } 2272 2273 b->yy_is_interactive = 0; 2274 2275 errno = oerrno; 2276 } 2277 2278 /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 2279 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 2280 * @param yyscanner The scanner object. 2281 */ 2282 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 2283 { 2284 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2285 if ( ! b ) 2286 return; 2287 2288 b->yy_n_chars = 0; 2289 2290 /* We always need two end-of-buffer characters. The first causes 2291 * a transition to the end-of-buffer state. The second causes 2292 * a jam in that state. 2293 */ 2294 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 2295 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 2296 2297 b->yy_buf_pos = &b->yy_ch_buf[0]; 2298 2299 b->yy_at_bol = 1; 2300 b->yy_buffer_status = YY_BUFFER_NEW; 2301 2302 if ( b == YY_CURRENT_BUFFER ) 2303 yy_load_buffer_state(yyscanner ); 2304 } 2305 2306 /** Pushes the new state onto the stack. The new state becomes 2307 * the current state. This function will allocate the stack 2308 * if necessary. 2309 * @param new_buffer The new state. 2310 * @param yyscanner The scanner object. 2311 */ 2312 void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 2313 { 2314 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2315 if (new_buffer == NULL) 2316 return; 2317 2318 yyensure_buffer_stack(yyscanner); 2319 2320 /* This block is copied from yy_switch_to_buffer. */ 2321 if ( YY_CURRENT_BUFFER ) 2322 { 2323 /* Flush out information for old buffer. */ 2324 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2325 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 2326 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 2327 } 2328 2329 /* Only push if top exists. Otherwise, replace top. */ 2330 if (YY_CURRENT_BUFFER) 2331 yyg->yy_buffer_stack_top++; 2332 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2333 2334 /* copied from yy_switch_to_buffer. */ 2335 yy_load_buffer_state(yyscanner ); 2336 yyg->yy_did_buffer_switch_on_eof = 1; 2337 } 2338 2339 /** Removes and deletes the top of the stack, if present. 2340 * The next element becomes the new top. 2341 * @param yyscanner The scanner object. 2342 */ 2343 void yypop_buffer_state (yyscan_t yyscanner) 2344 { 2345 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2346 if (!YY_CURRENT_BUFFER) 2347 return; 2348 2349 yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); 2350 YY_CURRENT_BUFFER_LVALUE = NULL; 2351 if (yyg->yy_buffer_stack_top > 0) 2352 --yyg->yy_buffer_stack_top; 2353 2354 if (YY_CURRENT_BUFFER) { 2355 yy_load_buffer_state(yyscanner ); 2356 yyg->yy_did_buffer_switch_on_eof = 1; 2357 } 2358 } 2359 2360 /* Allocates the stack if it does not exist. 2361 * Guarantees space for at least one push. 2362 */ 2363 static void yyensure_buffer_stack (yyscan_t yyscanner) 2364 { 2365 yy_size_t num_to_alloc; 2366 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2367 2368 if (!yyg->yy_buffer_stack) { 2369 2370 /* First allocation is just for 2 elements, since we don't know if this 2371 * scanner will even need a stack. We use 2 instead of 1 to avoid an 2372 * immediate realloc on the next call. 2373 */ 2374 num_to_alloc = 1; 2375 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc 2376 (num_to_alloc * sizeof(struct yy_buffer_state*) 2377 , yyscanner); 2378 if ( ! yyg->yy_buffer_stack ) 2379 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 2380 2381 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 2382 2383 yyg->yy_buffer_stack_max = num_to_alloc; 2384 yyg->yy_buffer_stack_top = 0; 2385 return; 2386 } 2387 2388 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ 2389 2390 /* Increase the buffer to prepare for a possible push. */ 2391 int grow_size = 8 /* arbitrary grow size */; 2392 2393 num_to_alloc = yyg->yy_buffer_stack_max + grow_size; 2394 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc 2395 (yyg->yy_buffer_stack, 2396 num_to_alloc * sizeof(struct yy_buffer_state*) 2397 , yyscanner); 2398 if ( ! yyg->yy_buffer_stack ) 2399 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 2400 2401 /* zero only the new slots.*/ 2402 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); 2403 yyg->yy_buffer_stack_max = num_to_alloc; 2404 } 2405 } 2406 2407 /** Setup the input buffer state to scan directly from a user-specified character buffer. 2408 * @param base the character buffer 2409 * @param size the size in bytes of the character buffer 2410 * @param yyscanner The scanner object. 2411 * @return the newly allocated buffer state object. 2412 */ 2413 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) 2414 { 2415 YY_BUFFER_STATE b; 2416 2417 if ( size < 2 || 2418 base[size-2] != YY_END_OF_BUFFER_CHAR || 2419 base[size-1] != YY_END_OF_BUFFER_CHAR ) 2420 /* They forgot to leave room for the EOB's. */ 2421 return 0; 2422 2423 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 2424 if ( ! b ) 2425 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 2426 2427 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 2428 b->yy_buf_pos = b->yy_ch_buf = base; 2429 b->yy_is_our_buffer = 0; 2430 b->yy_input_file = 0; 2431 b->yy_n_chars = b->yy_buf_size; 2432 b->yy_is_interactive = 0; 2433 b->yy_at_bol = 1; 2434 b->yy_fill_buffer = 0; 2435 b->yy_buffer_status = YY_BUFFER_NEW; 2436 2437 yy_switch_to_buffer(b ,yyscanner ); 2438 2439 return b; 2440 } 2441 2442 /** Setup the input buffer state to scan a string. The next call to yylex() will 2443 * scan from a @e copy of @a str. 2444 * @param yystr a NUL-terminated string to scan 2445 * @param yyscanner The scanner object. 2446 * @return the newly allocated buffer state object. 2447 * @note If you want to scan bytes that may contain NUL values, then use 2448 * yy_scan_bytes() instead. 2449 */ 2450 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) 2451 { 2452 2453 return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); 2454 } 2455 2456 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will 2457 * scan from a @e copy of @a bytes. 2458 * @param bytes the byte buffer to scan 2459 * @param len the number of bytes in the buffer pointed to by @a bytes. 2460 * @param yyscanner The scanner object. 2461 * @return the newly allocated buffer state object. 2462 */ 2463 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) 2464 { 2465 YY_BUFFER_STATE b; 2466 char *buf; 2467 yy_size_t n, i; 2468 2469 /* Get memory for full buffer, including space for trailing EOB's. */ 2470 n = _yybytes_len + 2; 2471 buf = (char *) yyalloc(n ,yyscanner ); 2472 if ( ! buf ) 2473 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 2474 2475 for ( i = 0; i < _yybytes_len; ++i ) 2476 buf[i] = yybytes[i]; 2477 2478 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 2479 2480 b = yy_scan_buffer(buf,n ,yyscanner); 2481 if ( ! b ) 2482 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 2483 2484 /* It's okay to grow etc. this buffer, and we should throw it 2485 * away when we're done. 2486 */ 2487 b->yy_is_our_buffer = 1; 2488 2489 return b; 2490 } 2491 2492 #ifndef YY_EXIT_FAILURE 2493 #define YY_EXIT_FAILURE 2 2494 #endif 2495 2496 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) 2497 { 2498 (void) fprintf( stderr, "%s\n", msg ); 2499 exit( YY_EXIT_FAILURE ); 2500 } 2501 2502 /* Redefine yyless() so it works in section 3 code. */ 2503 2504 #undef yyless 2505 #define yyless(n) \ 2506 do \ 2507 { \ 2508 /* Undo effects of setting up yytext. */ \ 2509 int yyless_macro_arg = (n); \ 2510 YY_LESS_LINENO(yyless_macro_arg);\ 2511 yytext[yyleng] = yyg->yy_hold_char; \ 2512 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ 2513 yyg->yy_hold_char = *yyg->yy_c_buf_p; \ 2514 *yyg->yy_c_buf_p = '\0'; \ 2515 yyleng = yyless_macro_arg; \ 2516 } \ 2517 while ( 0 ) 2518 2519 /* Accessor methods (get/set functions) to struct members. */ 2520 2521 /** Get the user-defined data for this scanner. 2522 * @param yyscanner The scanner object. 2523 */ 2524 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) 2525 { 2526 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2527 return yyextra; 2528 } 2529 2530 /** Get the current line number. 2531 * @param yyscanner The scanner object. 2532 */ 2533 int yyget_lineno (yyscan_t yyscanner) 2534 { 2535 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2536 2537 if (! YY_CURRENT_BUFFER) 2538 return 0; 2539 2540 return yylineno; 2541 } 2542 2543 /** Get the current column number. 2544 * @param yyscanner The scanner object. 2545 */ 2546 int yyget_column (yyscan_t yyscanner) 2547 { 2548 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2549 2550 if (! YY_CURRENT_BUFFER) 2551 return 0; 2552 2553 return yycolumn; 2554 } 2555 2556 /** Get the input stream. 2557 * @param yyscanner The scanner object. 2558 */ 2559 FILE *yyget_in (yyscan_t yyscanner) 2560 { 2561 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2562 return yyin; 2563 } 2564 2565 /** Get the output stream. 2566 * @param yyscanner The scanner object. 2567 */ 2568 FILE *yyget_out (yyscan_t yyscanner) 2569 { 2570 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2571 return yyout; 2572 } 2573 2574 /** Get the length of the current token. 2575 * @param yyscanner The scanner object. 2576 */ 2577 yy_size_t yyget_leng (yyscan_t yyscanner) 2578 { 2579 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2580 return yyleng; 2581 } 2582 2583 /** Get the current token. 2584 * @param yyscanner The scanner object. 2585 */ 2586 2587 char *yyget_text (yyscan_t yyscanner) 2588 { 2589 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2590 return yytext; 2591 } 2592 2593 /** Set the user-defined data. This data is never touched by the scanner. 2594 * @param user_defined The data to be associated with this scanner. 2595 * @param yyscanner The scanner object. 2596 */ 2597 void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) 2598 { 2599 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2600 yyextra = user_defined ; 2601 } 2602 2603 /** Set the current line number. 2604 * @param line_number 2605 * @param yyscanner The scanner object. 2606 */ 2607 void yyset_lineno (int line_number , yyscan_t yyscanner) 2608 { 2609 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2610 2611 /* lineno is only valid if an input buffer exists. */ 2612 if (! YY_CURRENT_BUFFER ) 2613 yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner); 2614 2615 yylineno = line_number; 2616 } 2617 2618 /** Set the current column. 2619 * @param line_number 2620 * @param yyscanner The scanner object. 2621 */ 2622 void yyset_column (int column_no , yyscan_t yyscanner) 2623 { 2624 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2625 2626 /* column is only valid if an input buffer exists. */ 2627 if (! YY_CURRENT_BUFFER ) 2628 yy_fatal_error( "yyset_column called with no buffer" , yyscanner); 2629 2630 yycolumn = column_no; 2631 } 2632 2633 /** Set the input stream. This does not discard the current 2634 * input buffer. 2635 * @param in_str A readable stream. 2636 * @param yyscanner The scanner object. 2637 * @see yy_switch_to_buffer 2638 */ 2639 void yyset_in (FILE * in_str , yyscan_t yyscanner) 2640 { 2641 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2642 yyin = in_str ; 2643 } 2644 2645 void yyset_out (FILE * out_str , yyscan_t yyscanner) 2646 { 2647 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2648 yyout = out_str ; 2649 } 2650 2651 int yyget_debug (yyscan_t yyscanner) 2652 { 2653 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2654 return yy_flex_debug; 2655 } 2656 2657 void yyset_debug (int bdebug , yyscan_t yyscanner) 2658 { 2659 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2660 yy_flex_debug = bdebug ; 2661 } 2662 2663 /* Accessor methods for yylval and yylloc */ 2664 2665 YYSTYPE * yyget_lval (yyscan_t yyscanner) 2666 { 2667 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2668 return yylval; 2669 } 2670 2671 void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) 2672 { 2673 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2674 yylval = yylval_param; 2675 } 2676 2677 YYLTYPE *yyget_lloc (yyscan_t yyscanner) 2678 { 2679 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2680 return yylloc; 2681 } 2682 2683 void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) 2684 { 2685 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2686 yylloc = yylloc_param; 2687 } 2688 2689 /* User-visible API */ 2690 2691 /* yylex_init is special because it creates the scanner itself, so it is 2692 * the ONLY reentrant function that doesn't take the scanner as the last argument. 2693 * That's why we explicitly handle the declaration, instead of using our macros. 2694 */ 2695 2696 int yylex_init(yyscan_t* ptr_yy_globals) 2697 2698 { 2699 if (ptr_yy_globals == NULL){ 2700 errno = EINVAL; 2701 return 1; 2702 } 2703 2704 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); 2705 2706 if (*ptr_yy_globals == NULL){ 2707 errno = ENOMEM; 2708 return 1; 2709 } 2710 2711 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ 2712 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2713 2714 return yy_init_globals ( *ptr_yy_globals ); 2715 } 2716 2717 /* yylex_init_extra has the same functionality as yylex_init, but follows the 2718 * convention of taking the scanner as the last argument. Note however, that 2719 * this is a *pointer* to a scanner, as it will be allocated by this call (and 2720 * is the reason, too, why this function also must handle its own declaration). 2721 * The user defined value in the first argument will be available to yyalloc in 2722 * the yyextra field. 2723 */ 2724 2725 int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) 2726 2727 { 2728 struct yyguts_t dummy_yyguts; 2729 2730 yyset_extra (yy_user_defined, &dummy_yyguts); 2731 2732 if (ptr_yy_globals == NULL){ 2733 errno = EINVAL; 2734 return 1; 2735 } 2736 2737 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); 2738 2739 if (*ptr_yy_globals == NULL){ 2740 errno = ENOMEM; 2741 return 1; 2742 } 2743 2744 /* By setting to 0xAA, we expose bugs in 2745 yy_init_globals. Leave at 0x00 for releases. */ 2746 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2747 2748 yyset_extra (yy_user_defined, *ptr_yy_globals); 2749 2750 return yy_init_globals ( *ptr_yy_globals ); 2751 } 2752 2753 static int yy_init_globals (yyscan_t yyscanner) 2754 { 2755 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2756 /* Initialization is the same as for the non-reentrant scanner. 2757 * This function is called from yylex_destroy(), so don't allocate here. 2758 */ 2759 2760 yyg->yy_buffer_stack = 0; 2761 yyg->yy_buffer_stack_top = 0; 2762 yyg->yy_buffer_stack_max = 0; 2763 yyg->yy_c_buf_p = (char *) 0; 2764 yyg->yy_init = 0; 2765 yyg->yy_start = 0; 2766 2767 yyg->yy_start_stack_ptr = 0; 2768 yyg->yy_start_stack_depth = 0; 2769 yyg->yy_start_stack = NULL; 2770 2771 /* Defined in main.c */ 2772 #ifdef YY_STDINIT 2773 yyin = stdin; 2774 yyout = stdout; 2775 #else 2776 yyin = (FILE *) 0; 2777 yyout = (FILE *) 0; 2778 #endif 2779 2780 /* For future reference: Set errno on error, since we are called by 2781 * yylex_init() 2782 */ 2783 return 0; 2784 } 2785 2786 /* yylex_destroy is for both reentrant and non-reentrant scanners. */ 2787 int yylex_destroy (yyscan_t yyscanner) 2788 { 2789 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2790 2791 /* Pop the buffer stack, destroying each element. */ 2792 while(YY_CURRENT_BUFFER){ 2793 yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); 2794 YY_CURRENT_BUFFER_LVALUE = NULL; 2795 yypop_buffer_state(yyscanner); 2796 } 2797 2798 /* Destroy the stack itself. */ 2799 yyfree(yyg->yy_buffer_stack ,yyscanner); 2800 yyg->yy_buffer_stack = NULL; 2801 2802 /* Destroy the start condition stack. */ 2803 yyfree(yyg->yy_start_stack ,yyscanner ); 2804 yyg->yy_start_stack = NULL; 2805 2806 /* Reset the globals. This is important in a non-reentrant scanner so the next time 2807 * yylex() is called, initialization will occur. */ 2808 yy_init_globals( yyscanner); 2809 2810 /* Destroy the main struct (reentrant only). */ 2811 yyfree ( yyscanner , yyscanner ); 2812 yyscanner = NULL; 2813 return 0; 2814 } 2815 2816 /* 2817 * Internal utility routines. 2818 */ 2819 2820 #ifndef yytext_ptr 2821 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) 2822 { 2823 register int i; 2824 for ( i = 0; i < n; ++i ) 2825 s1[i] = s2[i]; 2826 } 2827 #endif 2828 2829 #ifdef YY_NEED_STRLEN 2830 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) 2831 { 2832 register int n; 2833 for ( n = 0; s[n]; ++n ) 2834 ; 2835 2836 return n; 2837 } 2838 #endif 2839 2840 void *yyalloc (yy_size_t size , yyscan_t yyscanner) 2841 { 2842 return (void *) malloc( size ); 2843 } 2844 2845 void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) 2846 { 2847 /* The cast to (char *) in the following accommodates both 2848 * implementations that use char* generic pointers, and those 2849 * that use void* generic pointers. It works with the latter 2850 * because both ANSI C and C++ allow castless assignment from 2851 * any pointer type to void*, and deal with argument conversions 2852 * as though doing an assignment. 2853 */ 2854 return (void *) realloc( (char *) ptr, size ); 2855 } 2856 2857 void yyfree (void * ptr , yyscan_t yyscanner) 2858 { 2859 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 2860 } 2861 2862 #define YYTABLES_NAME "yytables" 2863 2864 yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) { 2865 pp::Token token; 2866 yyget_extra(yyscanner)->preprocessor.lex(&token); 2867 yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size(); 2868 if (len < max_size) 2869 memcpy(buf, token.text.c_str(), len); 2870 yyset_column(token.location.file,yyscanner); 2871 yyset_lineno(token.location.line,yyscanner); 2872 2873 if (len >= max_size) 2874 YY_FATAL_ERROR("Input buffer overflow"); 2875 else if (len > 0) 2876 buf[len++] = ' '; 2877 return len; 2878 } 2879 2880 int check_type(yyscan_t yyscanner) { 2881 struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; 2882 2883 int token = IDENTIFIER; 2884 TSymbol* symbol = yyextra->symbolTable.find(yytext); 2885 if (symbol && symbol->isVariable()) { 2886 TVariable* variable = static_cast<TVariable*>(symbol); 2887 if (variable->isUserType()) 2888 token = TYPE_NAME; 2889 } 2890 yylval->lex.symbol = symbol; 2891 return token; 2892 } 2893 2894 int reserved_word(yyscan_t yyscanner) { 2895 struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; 2896 2897 yyextra->error(*yylloc, "Illegal use of reserved word", yytext, ""); 2898 yyextra->recover(); 2899 return 0; 2900 } 2901 2902 void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason) { 2903 context->error(*lloc, reason, yyget_text(context->scanner)); 2904 context->recover(); 2905 } 2906 2907 int int_constant(yyscan_t yyscanner) { 2908 struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; 2909 2910 if (!atoi_clamp(yytext, &(yylval->lex.i))) 2911 yyextra->warning(*yylloc, "Integer overflow", yytext, ""); 2912 return INTCONSTANT; 2913 } 2914 2915 int float_constant(yyscan_t yyscanner) { 2916 struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; 2917 2918 if (!atof_clamp(yytext, &(yylval->lex.f))) 2919 yyextra->warning(*yylloc, "Float overflow", yytext, ""); 2920 return FLOATCONSTANT; 2921 } 2922 2923 int glslang_initialize(TParseContext* context) { 2924 yyscan_t scanner = NULL; 2925 if (yylex_init_extra(context,&scanner)) 2926 return 1; 2927 2928 context->scanner = scanner; 2929 return 0; 2930 } 2931 2932 int glslang_finalize(TParseContext* context) { 2933 yyscan_t scanner = context->scanner; 2934 if (scanner == NULL) return 0; 2935 2936 context->scanner = NULL; 2937 yylex_destroy(scanner); 2938 2939 return 0; 2940 } 2941 2942 int glslang_scan(size_t count, const char* const string[], const int length[], 2943 TParseContext* context) { 2944 yyrestart(NULL,context->scanner); 2945 yyset_column(0,context->scanner); 2946 yyset_lineno(1,context->scanner); 2947 2948 // Initialize preprocessor. 2949 if (!context->preprocessor.init(count, string, length)) 2950 return 1; 2951 context->preprocessor.setMaxTokenLength(SH_MAX_TOKEN_LENGTH); 2952 2953 // Define extension macros. 2954 const TExtensionBehavior& extBehavior = context->extensionBehavior(); 2955 for (TExtensionBehavior::const_iterator iter = extBehavior.begin(); 2956 iter != extBehavior.end(); ++iter) { 2957 context->preprocessor.predefineMacro(iter->first.c_str(), 1); 2958 } 2959 if (context->fragmentPrecisionHigh) 2960 context->preprocessor.predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1); 2961 2962 return 0; 2963 } 2964 2965