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/ParseHelper.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 806 #define INITIAL 0 807 808 #define YY_EXTRA_TYPE TParseContext* 809 810 /* Holds the entire state of the reentrant scanner. */ 811 struct yyguts_t 812 { 813 814 /* User-defined. Not touched by flex. */ 815 YY_EXTRA_TYPE yyextra_r; 816 817 /* The rest are the same as the globals declared in the non-reentrant scanner. */ 818 FILE *yyin_r, *yyout_r; 819 size_t yy_buffer_stack_top; /**< index of top of stack. */ 820 size_t yy_buffer_stack_max; /**< capacity of stack. */ 821 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ 822 char yy_hold_char; 823 yy_size_t yy_n_chars; 824 yy_size_t yyleng_r; 825 char *yy_c_buf_p; 826 int yy_init; 827 int yy_start; 828 int yy_did_buffer_switch_on_eof; 829 int yy_start_stack_ptr; 830 int yy_start_stack_depth; 831 int *yy_start_stack; 832 yy_state_type yy_last_accepting_state; 833 char* yy_last_accepting_cpos; 834 835 int yylineno_r; 836 int yy_flex_debug_r; 837 838 char *yytext_r; 839 int yy_more_flag; 840 int yy_more_len; 841 842 YYSTYPE * yylval_r; 843 844 YYLTYPE * yylloc_r; 845 846 }; /* end struct yyguts_t */ 847 848 static int yy_init_globals (yyscan_t yyscanner ); 849 850 /* This must go here because YYSTYPE and YYLTYPE are included 851 * from bison output in section 1.*/ 852 # define yylval yyg->yylval_r 853 854 # define yylloc yyg->yylloc_r 855 856 int yylex_init (yyscan_t* scanner); 857 858 int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); 859 860 /* Accessor methods to globals. 861 These are made visible to non-reentrant scanners for convenience. */ 862 863 int yylex_destroy (yyscan_t yyscanner ); 864 865 int yyget_debug (yyscan_t yyscanner ); 866 867 void yyset_debug (int debug_flag ,yyscan_t yyscanner ); 868 869 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner ); 870 871 void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); 872 873 FILE *yyget_in (yyscan_t yyscanner ); 874 875 void yyset_in (FILE * in_str ,yyscan_t yyscanner ); 876 877 FILE *yyget_out (yyscan_t yyscanner ); 878 879 void yyset_out (FILE * out_str ,yyscan_t yyscanner ); 880 881 yy_size_t yyget_leng (yyscan_t yyscanner ); 882 883 char *yyget_text (yyscan_t yyscanner ); 884 885 int yyget_lineno (yyscan_t yyscanner ); 886 887 void yyset_lineno (int line_number ,yyscan_t yyscanner ); 888 889 YYSTYPE * yyget_lval (yyscan_t yyscanner ); 890 891 void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); 892 893 YYLTYPE *yyget_lloc (yyscan_t yyscanner ); 894 895 void yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); 896 897 /* Macros after this point can all be overridden by user definitions in 898 * section 1. 899 */ 900 901 #ifndef YY_SKIP_YYWRAP 902 #ifdef __cplusplus 903 extern "C" int yywrap (yyscan_t yyscanner ); 904 #else 905 extern int yywrap (yyscan_t yyscanner ); 906 #endif 907 #endif 908 909 #ifndef yytext_ptr 910 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); 911 #endif 912 913 #ifdef YY_NEED_STRLEN 914 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); 915 #endif 916 917 #ifndef YY_NO_INPUT 918 919 #ifdef __cplusplus 920 static int yyinput (yyscan_t yyscanner ); 921 #else 922 static int input (yyscan_t yyscanner ); 923 #endif 924 925 #endif 926 927 /* Amount of stuff to slurp up with each read. */ 928 #ifndef YY_READ_BUF_SIZE 929 #define YY_READ_BUF_SIZE 8192 930 #endif 931 932 /* Copy whatever the last rule matched to the standard output. */ 933 #ifndef ECHO 934 /* This used to be an fputs(), but since the string might contain NUL's, 935 * we now use fwrite(). 936 */ 937 #define ECHO fwrite( yytext, yyleng, 1, yyout ) 938 #endif 939 940 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 941 * is returned in "result". 942 */ 943 #ifndef YY_INPUT 944 #define YY_INPUT(buf,result,max_size) \ 945 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 946 { \ 947 int c = '*'; \ 948 yy_size_t n; \ 949 for ( n = 0; n < max_size && \ 950 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 951 buf[n] = (char) c; \ 952 if ( c == '\n' ) \ 953 buf[n++] = (char) c; \ 954 if ( c == EOF && ferror( yyin ) ) \ 955 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 956 result = n; \ 957 } \ 958 else \ 959 { \ 960 errno=0; \ 961 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 962 { \ 963 if( errno != EINTR) \ 964 { \ 965 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 966 break; \ 967 } \ 968 errno=0; \ 969 clearerr(yyin); \ 970 } \ 971 }\ 972 \ 973 974 #endif 975 976 /* No semi-colon after return; correct usage is to write "yyterminate();" - 977 * we don't want an extra ';' after the "return" because that will cause 978 * some compilers to complain about unreachable statements. 979 */ 980 #ifndef yyterminate 981 #define yyterminate() return YY_NULL 982 #endif 983 984 /* Number of entries by which start-condition stack grows. */ 985 #ifndef YY_START_STACK_INCR 986 #define YY_START_STACK_INCR 25 987 #endif 988 989 /* Report a fatal error. */ 990 #ifndef YY_FATAL_ERROR 991 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) 992 #endif 993 994 /* end tables serialization structures and prototypes */ 995 996 /* Default declaration of generated scanner - a define so the user can 997 * easily add parameters. 998 */ 999 #ifndef YY_DECL 1000 #define YY_DECL_IS_OURS 1 1001 1002 extern int yylex \ 1003 (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); 1004 1005 #define YY_DECL int yylex \ 1006 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) 1007 #endif /* !YY_DECL */ 1008 1009 /* Code executed at the beginning of each rule, after yytext and yyleng 1010 * have been set up. 1011 */ 1012 #ifndef YY_USER_ACTION 1013 #define YY_USER_ACTION 1014 #endif 1015 1016 /* Code executed at the end of each rule. */ 1017 #ifndef YY_BREAK 1018 #define YY_BREAK break; 1019 #endif 1020 1021 #define YY_RULE_SETUP \ 1022 YY_USER_ACTION 1023 1024 /** The main scanner function which does all the work. 1025 */ 1026 YY_DECL 1027 { 1028 register yy_state_type yy_current_state; 1029 register char *yy_cp, *yy_bp; 1030 register int yy_act; 1031 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1032 1033 yylval = yylval_param; 1034 1035 yylloc = yylloc_param; 1036 1037 if ( !yyg->yy_init ) 1038 { 1039 yyg->yy_init = 1; 1040 1041 #ifdef YY_USER_INIT 1042 YY_USER_INIT; 1043 #endif 1044 1045 if ( ! yyg->yy_start ) 1046 yyg->yy_start = 1; /* first start state */ 1047 1048 if ( ! yyin ) 1049 yyin = stdin; 1050 1051 if ( ! yyout ) 1052 yyout = stdout; 1053 1054 if ( ! YY_CURRENT_BUFFER ) { 1055 yyensure_buffer_stack (yyscanner); 1056 YY_CURRENT_BUFFER_LVALUE = 1057 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 1058 } 1059 1060 yy_load_buffer_state(yyscanner ); 1061 } 1062 1063 while ( 1 ) /* loops until end-of-file is reached */ 1064 { 1065 yy_cp = yyg->yy_c_buf_p; 1066 1067 /* Support of yytext. */ 1068 *yy_cp = yyg->yy_hold_char; 1069 1070 /* yy_bp points to the position in yy_ch_buf of the start of 1071 * the current run. 1072 */ 1073 yy_bp = yy_cp; 1074 1075 yy_current_state = yyg->yy_start; 1076 yy_match: 1077 do 1078 { 1079 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 1080 if ( yy_accept[yy_current_state] ) 1081 { 1082 yyg->yy_last_accepting_state = yy_current_state; 1083 yyg->yy_last_accepting_cpos = yy_cp; 1084 } 1085 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1086 { 1087 yy_current_state = (int) yy_def[yy_current_state]; 1088 if ( yy_current_state >= 443 ) 1089 yy_c = yy_meta[(unsigned int) yy_c]; 1090 } 1091 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1092 ++yy_cp; 1093 } 1094 while ( yy_current_state != 442 ); 1095 yy_cp = yyg->yy_last_accepting_cpos; 1096 yy_current_state = yyg->yy_last_accepting_state; 1097 1098 yy_find_action: 1099 yy_act = yy_accept[yy_current_state]; 1100 1101 YY_DO_BEFORE_ACTION; 1102 1103 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) 1104 { 1105 yy_size_t yyl; 1106 for ( yyl = 0; yyl < yyleng; ++yyl ) 1107 if ( yytext[yyl] == '\n' ) 1108 1109 do{ yylineno++; 1110 yycolumn=0; 1111 }while(0) 1112 ; 1113 } 1114 1115 do_action: /* This label is used only to access EOF actions. */ 1116 1117 switch ( yy_act ) 1118 { /* beginning of action switch */ 1119 case 0: /* must back up */ 1120 /* undo the effects of YY_DO_BEFORE_ACTION */ 1121 *yy_cp = yyg->yy_hold_char; 1122 yy_cp = yyg->yy_last_accepting_cpos; 1123 yy_current_state = yyg->yy_last_accepting_state; 1124 goto yy_find_action; 1125 1126 case 1: 1127 YY_RULE_SETUP 1128 { return INVARIANT; } 1129 YY_BREAK 1130 case 2: 1131 YY_RULE_SETUP 1132 { return HIGH_PRECISION; } 1133 YY_BREAK 1134 case 3: 1135 YY_RULE_SETUP 1136 { return MEDIUM_PRECISION; } 1137 YY_BREAK 1138 case 4: 1139 YY_RULE_SETUP 1140 { return LOW_PRECISION; } 1141 YY_BREAK 1142 case 5: 1143 YY_RULE_SETUP 1144 { return PRECISION; } 1145 YY_BREAK 1146 case 6: 1147 YY_RULE_SETUP 1148 { return ATTRIBUTE; } 1149 YY_BREAK 1150 case 7: 1151 YY_RULE_SETUP 1152 { return CONST_QUAL; } 1153 YY_BREAK 1154 case 8: 1155 YY_RULE_SETUP 1156 { return UNIFORM; } 1157 YY_BREAK 1158 case 9: 1159 YY_RULE_SETUP 1160 { return VARYING; } 1161 YY_BREAK 1162 case 10: 1163 YY_RULE_SETUP 1164 { return BREAK; } 1165 YY_BREAK 1166 case 11: 1167 YY_RULE_SETUP 1168 { return CONTINUE; } 1169 YY_BREAK 1170 case 12: 1171 YY_RULE_SETUP 1172 { return DO; } 1173 YY_BREAK 1174 case 13: 1175 YY_RULE_SETUP 1176 { return FOR; } 1177 YY_BREAK 1178 case 14: 1179 YY_RULE_SETUP 1180 { return WHILE; } 1181 YY_BREAK 1182 case 15: 1183 YY_RULE_SETUP 1184 { return IF; } 1185 YY_BREAK 1186 case 16: 1187 YY_RULE_SETUP 1188 { return ELSE; } 1189 YY_BREAK 1190 case 17: 1191 YY_RULE_SETUP 1192 { return IN_QUAL; } 1193 YY_BREAK 1194 case 18: 1195 YY_RULE_SETUP 1196 { return OUT_QUAL; } 1197 YY_BREAK 1198 case 19: 1199 YY_RULE_SETUP 1200 { return INOUT_QUAL; } 1201 YY_BREAK 1202 case 20: 1203 YY_RULE_SETUP 1204 { return FLOAT_TYPE; } 1205 YY_BREAK 1206 case 21: 1207 YY_RULE_SETUP 1208 { return INT_TYPE; } 1209 YY_BREAK 1210 case 22: 1211 YY_RULE_SETUP 1212 { return VOID_TYPE; } 1213 YY_BREAK 1214 case 23: 1215 YY_RULE_SETUP 1216 { return BOOL_TYPE; } 1217 YY_BREAK 1218 case 24: 1219 YY_RULE_SETUP 1220 { yylval->lex.b = true; return BOOLCONSTANT; } 1221 YY_BREAK 1222 case 25: 1223 YY_RULE_SETUP 1224 { yylval->lex.b = false; return BOOLCONSTANT; } 1225 YY_BREAK 1226 case 26: 1227 YY_RULE_SETUP 1228 { return DISCARD; } 1229 YY_BREAK 1230 case 27: 1231 YY_RULE_SETUP 1232 { return RETURN; } 1233 YY_BREAK 1234 case 28: 1235 YY_RULE_SETUP 1236 { return MATRIX2; } 1237 YY_BREAK 1238 case 29: 1239 YY_RULE_SETUP 1240 { return MATRIX3; } 1241 YY_BREAK 1242 case 30: 1243 YY_RULE_SETUP 1244 { return MATRIX4; } 1245 YY_BREAK 1246 case 31: 1247 YY_RULE_SETUP 1248 { return VEC2; } 1249 YY_BREAK 1250 case 32: 1251 YY_RULE_SETUP 1252 { return VEC3; } 1253 YY_BREAK 1254 case 33: 1255 YY_RULE_SETUP 1256 { return VEC4; } 1257 YY_BREAK 1258 case 34: 1259 YY_RULE_SETUP 1260 { return IVEC2; } 1261 YY_BREAK 1262 case 35: 1263 YY_RULE_SETUP 1264 { return IVEC3; } 1265 YY_BREAK 1266 case 36: 1267 YY_RULE_SETUP 1268 { return IVEC4; } 1269 YY_BREAK 1270 case 37: 1271 YY_RULE_SETUP 1272 { return BVEC2; } 1273 YY_BREAK 1274 case 38: 1275 YY_RULE_SETUP 1276 { return BVEC3; } 1277 YY_BREAK 1278 case 39: 1279 YY_RULE_SETUP 1280 { return BVEC4; } 1281 YY_BREAK 1282 case 40: 1283 YY_RULE_SETUP 1284 { return SAMPLER2D; } 1285 YY_BREAK 1286 case 41: 1287 YY_RULE_SETUP 1288 { return SAMPLERCUBE; } 1289 YY_BREAK 1290 case 42: 1291 YY_RULE_SETUP 1292 { return SAMPLER_EXTERNAL_OES; } 1293 YY_BREAK 1294 case 43: 1295 YY_RULE_SETUP 1296 { return SAMPLER2DRECT; } 1297 YY_BREAK 1298 case 44: 1299 YY_RULE_SETUP 1300 { return STRUCT; } 1301 YY_BREAK 1302 case 45: 1303 YY_RULE_SETUP 1304 { return reserved_word(yyscanner); } 1305 YY_BREAK 1306 case 46: 1307 YY_RULE_SETUP 1308 { return reserved_word(yyscanner); } 1309 YY_BREAK 1310 case 47: 1311 YY_RULE_SETUP 1312 { return reserved_word(yyscanner); } 1313 YY_BREAK 1314 case 48: 1315 YY_RULE_SETUP 1316 { return reserved_word(yyscanner); } 1317 YY_BREAK 1318 case 49: 1319 YY_RULE_SETUP 1320 { return reserved_word(yyscanner); } 1321 YY_BREAK 1322 case 50: 1323 YY_RULE_SETUP 1324 { return reserved_word(yyscanner); } 1325 YY_BREAK 1326 case 51: 1327 YY_RULE_SETUP 1328 { return reserved_word(yyscanner); } 1329 YY_BREAK 1330 case 52: 1331 YY_RULE_SETUP 1332 { return reserved_word(yyscanner); } 1333 YY_BREAK 1334 case 53: 1335 YY_RULE_SETUP 1336 { return reserved_word(yyscanner); } 1337 YY_BREAK 1338 case 54: 1339 YY_RULE_SETUP 1340 { return reserved_word(yyscanner); } 1341 YY_BREAK 1342 case 55: 1343 YY_RULE_SETUP 1344 { return reserved_word(yyscanner); } 1345 YY_BREAK 1346 case 56: 1347 YY_RULE_SETUP 1348 { return reserved_word(yyscanner); } 1349 YY_BREAK 1350 case 57: 1351 YY_RULE_SETUP 1352 { return reserved_word(yyscanner); } 1353 YY_BREAK 1354 case 58: 1355 YY_RULE_SETUP 1356 { return reserved_word(yyscanner); } 1357 YY_BREAK 1358 case 59: 1359 YY_RULE_SETUP 1360 { return reserved_word(yyscanner); } 1361 YY_BREAK 1362 case 60: 1363 YY_RULE_SETUP 1364 { return reserved_word(yyscanner); } 1365 YY_BREAK 1366 case 61: 1367 YY_RULE_SETUP 1368 { return reserved_word(yyscanner); } 1369 YY_BREAK 1370 case 62: 1371 YY_RULE_SETUP 1372 { return reserved_word(yyscanner); } 1373 YY_BREAK 1374 case 63: 1375 YY_RULE_SETUP 1376 { return reserved_word(yyscanner); } 1377 YY_BREAK 1378 case 64: 1379 YY_RULE_SETUP 1380 { return reserved_word(yyscanner); } 1381 YY_BREAK 1382 case 65: 1383 YY_RULE_SETUP 1384 { return reserved_word(yyscanner); } 1385 YY_BREAK 1386 case 66: 1387 YY_RULE_SETUP 1388 { return reserved_word(yyscanner); } 1389 YY_BREAK 1390 case 67: 1391 YY_RULE_SETUP 1392 { return reserved_word(yyscanner); } 1393 YY_BREAK 1394 case 68: 1395 YY_RULE_SETUP 1396 { return reserved_word(yyscanner); } 1397 YY_BREAK 1398 case 69: 1399 YY_RULE_SETUP 1400 { return reserved_word(yyscanner); } 1401 YY_BREAK 1402 case 70: 1403 YY_RULE_SETUP 1404 { return reserved_word(yyscanner); } 1405 YY_BREAK 1406 case 71: 1407 YY_RULE_SETUP 1408 { return reserved_word(yyscanner); } 1409 YY_BREAK 1410 case 72: 1411 YY_RULE_SETUP 1412 { return reserved_word(yyscanner); } 1413 YY_BREAK 1414 case 73: 1415 YY_RULE_SETUP 1416 { return reserved_word(yyscanner); } 1417 YY_BREAK 1418 case 74: 1419 YY_RULE_SETUP 1420 { return reserved_word(yyscanner); } 1421 YY_BREAK 1422 case 75: 1423 YY_RULE_SETUP 1424 { return reserved_word(yyscanner); } 1425 YY_BREAK 1426 case 76: 1427 YY_RULE_SETUP 1428 { return reserved_word(yyscanner); } 1429 YY_BREAK 1430 case 77: 1431 YY_RULE_SETUP 1432 { return reserved_word(yyscanner); } 1433 YY_BREAK 1434 case 78: 1435 YY_RULE_SETUP 1436 { return reserved_word(yyscanner); } 1437 YY_BREAK 1438 case 79: 1439 YY_RULE_SETUP 1440 { return reserved_word(yyscanner); } 1441 YY_BREAK 1442 case 80: 1443 YY_RULE_SETUP 1444 { return reserved_word(yyscanner); } 1445 YY_BREAK 1446 case 81: 1447 YY_RULE_SETUP 1448 { return reserved_word(yyscanner); } 1449 YY_BREAK 1450 case 82: 1451 YY_RULE_SETUP 1452 { return reserved_word(yyscanner); } 1453 YY_BREAK 1454 case 83: 1455 YY_RULE_SETUP 1456 { return reserved_word(yyscanner); } 1457 YY_BREAK 1458 case 84: 1459 YY_RULE_SETUP 1460 { return reserved_word(yyscanner); } 1461 YY_BREAK 1462 case 85: 1463 YY_RULE_SETUP 1464 { return reserved_word(yyscanner); } 1465 YY_BREAK 1466 case 86: 1467 YY_RULE_SETUP 1468 { return reserved_word(yyscanner); } 1469 YY_BREAK 1470 case 87: 1471 YY_RULE_SETUP 1472 { return reserved_word(yyscanner); } 1473 YY_BREAK 1474 case 88: 1475 YY_RULE_SETUP 1476 { return reserved_word(yyscanner); } 1477 YY_BREAK 1478 case 89: 1479 YY_RULE_SETUP 1480 { return reserved_word(yyscanner); } 1481 YY_BREAK 1482 case 90: 1483 YY_RULE_SETUP 1484 { return reserved_word(yyscanner); } 1485 YY_BREAK 1486 case 91: 1487 YY_RULE_SETUP 1488 { return reserved_word(yyscanner); } 1489 YY_BREAK 1490 case 92: 1491 YY_RULE_SETUP 1492 { return reserved_word(yyscanner); } 1493 YY_BREAK 1494 case 93: 1495 YY_RULE_SETUP 1496 { 1497 yylval->lex.string = NewPoolTString(yytext); 1498 return check_type(yyscanner); 1499 } 1500 YY_BREAK 1501 case 94: 1502 YY_RULE_SETUP 1503 { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return INTCONSTANT; } 1504 YY_BREAK 1505 case 95: 1506 YY_RULE_SETUP 1507 { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return INTCONSTANT; } 1508 YY_BREAK 1509 case 96: 1510 YY_RULE_SETUP 1511 { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return INTCONSTANT; } 1512 YY_BREAK 1513 case 97: 1514 YY_RULE_SETUP 1515 { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return FLOATCONSTANT; } 1516 YY_BREAK 1517 case 98: 1518 YY_RULE_SETUP 1519 { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return FLOATCONSTANT; } 1520 YY_BREAK 1521 case 99: 1522 YY_RULE_SETUP 1523 { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return FLOATCONSTANT; } 1524 YY_BREAK 1525 case 100: 1526 YY_RULE_SETUP 1527 { return ADD_ASSIGN; } 1528 YY_BREAK 1529 case 101: 1530 YY_RULE_SETUP 1531 { return SUB_ASSIGN; } 1532 YY_BREAK 1533 case 102: 1534 YY_RULE_SETUP 1535 { return MUL_ASSIGN; } 1536 YY_BREAK 1537 case 103: 1538 YY_RULE_SETUP 1539 { return DIV_ASSIGN; } 1540 YY_BREAK 1541 case 104: 1542 YY_RULE_SETUP 1543 { return MOD_ASSIGN; } 1544 YY_BREAK 1545 case 105: 1546 YY_RULE_SETUP 1547 { return LEFT_ASSIGN; } 1548 YY_BREAK 1549 case 106: 1550 YY_RULE_SETUP 1551 { return RIGHT_ASSIGN; } 1552 YY_BREAK 1553 case 107: 1554 YY_RULE_SETUP 1555 { return AND_ASSIGN; } 1556 YY_BREAK 1557 case 108: 1558 YY_RULE_SETUP 1559 { return XOR_ASSIGN; } 1560 YY_BREAK 1561 case 109: 1562 YY_RULE_SETUP 1563 { return OR_ASSIGN; } 1564 YY_BREAK 1565 case 110: 1566 YY_RULE_SETUP 1567 { return INC_OP; } 1568 YY_BREAK 1569 case 111: 1570 YY_RULE_SETUP 1571 { return DEC_OP; } 1572 YY_BREAK 1573 case 112: 1574 YY_RULE_SETUP 1575 { return AND_OP; } 1576 YY_BREAK 1577 case 113: 1578 YY_RULE_SETUP 1579 { return OR_OP; } 1580 YY_BREAK 1581 case 114: 1582 YY_RULE_SETUP 1583 { return XOR_OP; } 1584 YY_BREAK 1585 case 115: 1586 YY_RULE_SETUP 1587 { return LE_OP; } 1588 YY_BREAK 1589 case 116: 1590 YY_RULE_SETUP 1591 { return GE_OP; } 1592 YY_BREAK 1593 case 117: 1594 YY_RULE_SETUP 1595 { return EQ_OP; } 1596 YY_BREAK 1597 case 118: 1598 YY_RULE_SETUP 1599 { return NE_OP; } 1600 YY_BREAK 1601 case 119: 1602 YY_RULE_SETUP 1603 { return LEFT_OP; } 1604 YY_BREAK 1605 case 120: 1606 YY_RULE_SETUP 1607 { return RIGHT_OP; } 1608 YY_BREAK 1609 case 121: 1610 YY_RULE_SETUP 1611 { return SEMICOLON; } 1612 YY_BREAK 1613 case 122: 1614 YY_RULE_SETUP 1615 { return LEFT_BRACE; } 1616 YY_BREAK 1617 case 123: 1618 YY_RULE_SETUP 1619 { return RIGHT_BRACE; } 1620 YY_BREAK 1621 case 124: 1622 YY_RULE_SETUP 1623 { return COMMA; } 1624 YY_BREAK 1625 case 125: 1626 YY_RULE_SETUP 1627 { return COLON; } 1628 YY_BREAK 1629 case 126: 1630 YY_RULE_SETUP 1631 { return EQUAL; } 1632 YY_BREAK 1633 case 127: 1634 YY_RULE_SETUP 1635 { return LEFT_PAREN; } 1636 YY_BREAK 1637 case 128: 1638 YY_RULE_SETUP 1639 { return RIGHT_PAREN; } 1640 YY_BREAK 1641 case 129: 1642 YY_RULE_SETUP 1643 { return LEFT_BRACKET; } 1644 YY_BREAK 1645 case 130: 1646 YY_RULE_SETUP 1647 { return RIGHT_BRACKET; } 1648 YY_BREAK 1649 case 131: 1650 YY_RULE_SETUP 1651 { return DOT; } 1652 YY_BREAK 1653 case 132: 1654 YY_RULE_SETUP 1655 { return BANG; } 1656 YY_BREAK 1657 case 133: 1658 YY_RULE_SETUP 1659 { return DASH; } 1660 YY_BREAK 1661 case 134: 1662 YY_RULE_SETUP 1663 { return TILDE; } 1664 YY_BREAK 1665 case 135: 1666 YY_RULE_SETUP 1667 { return PLUS; } 1668 YY_BREAK 1669 case 136: 1670 YY_RULE_SETUP 1671 { return STAR; } 1672 YY_BREAK 1673 case 137: 1674 YY_RULE_SETUP 1675 { return SLASH; } 1676 YY_BREAK 1677 case 138: 1678 YY_RULE_SETUP 1679 { return PERCENT; } 1680 YY_BREAK 1681 case 139: 1682 YY_RULE_SETUP 1683 { return LEFT_ANGLE; } 1684 YY_BREAK 1685 case 140: 1686 YY_RULE_SETUP 1687 { return RIGHT_ANGLE; } 1688 YY_BREAK 1689 case 141: 1690 YY_RULE_SETUP 1691 { return VERTICAL_BAR; } 1692 YY_BREAK 1693 case 142: 1694 YY_RULE_SETUP 1695 { return CARET; } 1696 YY_BREAK 1697 case 143: 1698 YY_RULE_SETUP 1699 { return AMPERSAND; } 1700 YY_BREAK 1701 case 144: 1702 YY_RULE_SETUP 1703 { return QUESTION; } 1704 YY_BREAK 1705 case 145: 1706 /* rule 145 can match eol */ 1707 YY_RULE_SETUP 1708 { } 1709 YY_BREAK 1710 case YY_STATE_EOF(INITIAL): 1711 { yyterminate(); } 1712 YY_BREAK 1713 case 146: 1714 YY_RULE_SETUP 1715 { assert(false); return 0; } 1716 YY_BREAK 1717 case 147: 1718 YY_RULE_SETUP 1719 ECHO; 1720 YY_BREAK 1721 1722 case YY_END_OF_BUFFER: 1723 { 1724 /* Amount of text matched not including the EOB char. */ 1725 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; 1726 1727 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1728 *yy_cp = yyg->yy_hold_char; 1729 YY_RESTORE_YY_MORE_OFFSET 1730 1731 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1732 { 1733 /* We're scanning a new file or input source. It's 1734 * possible that this happened because the user 1735 * just pointed yyin at a new source and called 1736 * yylex(). If so, then we have to assure 1737 * consistency between YY_CURRENT_BUFFER and our 1738 * globals. Here is the right place to do so, because 1739 * this is the first action (other than possibly a 1740 * back-up) that will match for the new input source. 1741 */ 1742 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1743 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 1744 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1745 } 1746 1747 /* Note that here we test for yy_c_buf_p "<=" to the position 1748 * of the first EOB in the buffer, since yy_c_buf_p will 1749 * already have been incremented past the NUL character 1750 * (since all states make transitions on EOB to the 1751 * end-of-buffer state). Contrast this with the test 1752 * in input(). 1753 */ 1754 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1755 { /* This was really a NUL. */ 1756 yy_state_type yy_next_state; 1757 1758 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; 1759 1760 yy_current_state = yy_get_previous_state( yyscanner ); 1761 1762 /* Okay, we're now positioned to make the NUL 1763 * transition. We couldn't have 1764 * yy_get_previous_state() go ahead and do it 1765 * for us because it doesn't know how to deal 1766 * with the possibility of jamming (and we don't 1767 * want to build jamming into it because then it 1768 * will run more slowly). 1769 */ 1770 1771 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); 1772 1773 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1774 1775 if ( yy_next_state ) 1776 { 1777 /* Consume the NUL. */ 1778 yy_cp = ++yyg->yy_c_buf_p; 1779 yy_current_state = yy_next_state; 1780 goto yy_match; 1781 } 1782 1783 else 1784 { 1785 yy_cp = yyg->yy_last_accepting_cpos; 1786 yy_current_state = yyg->yy_last_accepting_state; 1787 goto yy_find_action; 1788 } 1789 } 1790 1791 else switch ( yy_get_next_buffer( yyscanner ) ) 1792 { 1793 case EOB_ACT_END_OF_FILE: 1794 { 1795 yyg->yy_did_buffer_switch_on_eof = 0; 1796 1797 if ( yywrap(yyscanner ) ) 1798 { 1799 /* Note: because we've taken care in 1800 * yy_get_next_buffer() to have set up 1801 * yytext, we can now set up 1802 * yy_c_buf_p so that if some total 1803 * hoser (like flex itself) wants to 1804 * call the scanner after we return the 1805 * YY_NULL, it'll still work - another 1806 * YY_NULL will get returned. 1807 */ 1808 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; 1809 1810 yy_act = YY_STATE_EOF(YY_START); 1811 goto do_action; 1812 } 1813 1814 else 1815 { 1816 if ( ! yyg->yy_did_buffer_switch_on_eof ) 1817 YY_NEW_FILE; 1818 } 1819 break; 1820 } 1821 1822 case EOB_ACT_CONTINUE_SCAN: 1823 yyg->yy_c_buf_p = 1824 yyg->yytext_ptr + yy_amount_of_matched_text; 1825 1826 yy_current_state = yy_get_previous_state( yyscanner ); 1827 1828 yy_cp = yyg->yy_c_buf_p; 1829 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1830 goto yy_match; 1831 1832 case EOB_ACT_LAST_MATCH: 1833 yyg->yy_c_buf_p = 1834 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; 1835 1836 yy_current_state = yy_get_previous_state( yyscanner ); 1837 1838 yy_cp = yyg->yy_c_buf_p; 1839 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1840 goto yy_find_action; 1841 } 1842 break; 1843 } 1844 1845 default: 1846 YY_FATAL_ERROR( 1847 "fatal flex scanner internal error--no action found" ); 1848 } /* end of action switch */ 1849 } /* end of scanning one token */ 1850 } /* end of yylex */ 1851 1852 /* yy_get_next_buffer - try to read in a new buffer 1853 * 1854 * Returns a code representing an action: 1855 * EOB_ACT_LAST_MATCH - 1856 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1857 * EOB_ACT_END_OF_FILE - end of file 1858 */ 1859 static int yy_get_next_buffer (yyscan_t yyscanner) 1860 { 1861 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1862 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1863 register char *source = yyg->yytext_ptr; 1864 register int number_to_move, i; 1865 int ret_val; 1866 1867 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) 1868 YY_FATAL_ERROR( 1869 "fatal flex scanner internal error--end of buffer missed" ); 1870 1871 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1872 { /* Don't try to fill the buffer, so this is an EOF. */ 1873 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) 1874 { 1875 /* We matched a single character, the EOB, so 1876 * treat this as a final EOF. 1877 */ 1878 return EOB_ACT_END_OF_FILE; 1879 } 1880 1881 else 1882 { 1883 /* We matched some text prior to the EOB, first 1884 * process it. 1885 */ 1886 return EOB_ACT_LAST_MATCH; 1887 } 1888 } 1889 1890 /* Try to read more data. */ 1891 1892 /* First move last chars to start of buffer. */ 1893 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; 1894 1895 for ( i = 0; i < number_to_move; ++i ) 1896 *(dest++) = *(source++); 1897 1898 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1899 /* don't do the read, it's not guaranteed to return an EOF, 1900 * just force an EOF 1901 */ 1902 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; 1903 1904 else 1905 { 1906 yy_size_t num_to_read = 1907 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1908 1909 while ( num_to_read <= 0 ) 1910 { /* Not enough room in the buffer - grow it. */ 1911 1912 /* just a shorter name for the current buffer */ 1913 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1914 1915 int yy_c_buf_p_offset = 1916 (int) (yyg->yy_c_buf_p - b->yy_ch_buf); 1917 1918 if ( b->yy_is_our_buffer ) 1919 { 1920 yy_size_t new_size = b->yy_buf_size * 2; 1921 1922 if ( new_size <= 0 ) 1923 b->yy_buf_size += b->yy_buf_size / 8; 1924 else 1925 b->yy_buf_size *= 2; 1926 1927 b->yy_ch_buf = (char *) 1928 /* Include room in for 2 EOB chars. */ 1929 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); 1930 } 1931 else 1932 /* Can't grow it, we don't own it. */ 1933 b->yy_ch_buf = 0; 1934 1935 if ( ! b->yy_ch_buf ) 1936 YY_FATAL_ERROR( 1937 "fatal error - scanner input buffer overflow" ); 1938 1939 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; 1940 1941 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1942 number_to_move - 1; 1943 1944 } 1945 1946 if ( num_to_read > YY_READ_BUF_SIZE ) 1947 num_to_read = YY_READ_BUF_SIZE; 1948 1949 /* Read in more data. */ 1950 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1951 yyg->yy_n_chars, num_to_read ); 1952 1953 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1954 } 1955 1956 if ( yyg->yy_n_chars == 0 ) 1957 { 1958 if ( number_to_move == YY_MORE_ADJ ) 1959 { 1960 ret_val = EOB_ACT_END_OF_FILE; 1961 yyrestart(yyin ,yyscanner); 1962 } 1963 1964 else 1965 { 1966 ret_val = EOB_ACT_LAST_MATCH; 1967 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1968 YY_BUFFER_EOF_PENDING; 1969 } 1970 } 1971 1972 else 1973 ret_val = EOB_ACT_CONTINUE_SCAN; 1974 1975 if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1976 /* Extend the array by 50%, plus the number we really need. */ 1977 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); 1978 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); 1979 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1980 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1981 } 1982 1983 yyg->yy_n_chars += number_to_move; 1984 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; 1985 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; 1986 1987 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1988 1989 return ret_val; 1990 } 1991 1992 /* yy_get_previous_state - get the state just before the EOB char was reached */ 1993 1994 static yy_state_type yy_get_previous_state (yyscan_t yyscanner) 1995 { 1996 register yy_state_type yy_current_state; 1997 register char *yy_cp; 1998 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1999 2000 yy_current_state = yyg->yy_start; 2001 2002 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) 2003 { 2004 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 2005 if ( yy_accept[yy_current_state] ) 2006 { 2007 yyg->yy_last_accepting_state = yy_current_state; 2008 yyg->yy_last_accepting_cpos = yy_cp; 2009 } 2010 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 2011 { 2012 yy_current_state = (int) yy_def[yy_current_state]; 2013 if ( yy_current_state >= 443 ) 2014 yy_c = yy_meta[(unsigned int) yy_c]; 2015 } 2016 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 2017 } 2018 2019 return yy_current_state; 2020 } 2021 2022 /* yy_try_NUL_trans - try to make a transition on the NUL character 2023 * 2024 * synopsis 2025 * next_state = yy_try_NUL_trans( current_state ); 2026 */ 2027 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) 2028 { 2029 register int yy_is_jam; 2030 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ 2031 register char *yy_cp = yyg->yy_c_buf_p; 2032 2033 register YY_CHAR yy_c = 1; 2034 if ( yy_accept[yy_current_state] ) 2035 { 2036 yyg->yy_last_accepting_state = yy_current_state; 2037 yyg->yy_last_accepting_cpos = yy_cp; 2038 } 2039 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 2040 { 2041 yy_current_state = (int) yy_def[yy_current_state]; 2042 if ( yy_current_state >= 443 ) 2043 yy_c = yy_meta[(unsigned int) yy_c]; 2044 } 2045 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 2046 yy_is_jam = (yy_current_state == 442); 2047 2048 return yy_is_jam ? 0 : yy_current_state; 2049 } 2050 2051 #ifndef YY_NO_INPUT 2052 #ifdef __cplusplus 2053 static int yyinput (yyscan_t yyscanner) 2054 #else 2055 static int input (yyscan_t yyscanner) 2056 #endif 2057 2058 { 2059 int c; 2060 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2061 2062 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2063 2064 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) 2065 { 2066 /* yy_c_buf_p now points to the character we want to return. 2067 * If this occurs *before* the EOB characters, then it's a 2068 * valid NUL; if not, then we've hit the end of the buffer. 2069 */ 2070 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 2071 /* This was really a NUL. */ 2072 *yyg->yy_c_buf_p = '\0'; 2073 2074 else 2075 { /* need more input */ 2076 yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 2077 ++yyg->yy_c_buf_p; 2078 2079 switch ( yy_get_next_buffer( yyscanner ) ) 2080 { 2081 case EOB_ACT_LAST_MATCH: 2082 /* This happens because yy_g_n_b() 2083 * sees that we've accumulated a 2084 * token and flags that we need to 2085 * try matching the token before 2086 * proceeding. But for input(), 2087 * there's no matching to consider. 2088 * So convert the EOB_ACT_LAST_MATCH 2089 * to EOB_ACT_END_OF_FILE. 2090 */ 2091 2092 /* Reset buffer status. */ 2093 yyrestart(yyin ,yyscanner); 2094 2095 /*FALLTHROUGH*/ 2096 2097 case EOB_ACT_END_OF_FILE: 2098 { 2099 if ( yywrap(yyscanner ) ) 2100 return EOF; 2101 2102 if ( ! yyg->yy_did_buffer_switch_on_eof ) 2103 YY_NEW_FILE; 2104 #ifdef __cplusplus 2105 return yyinput(yyscanner); 2106 #else 2107 return input(yyscanner); 2108 #endif 2109 } 2110 2111 case EOB_ACT_CONTINUE_SCAN: 2112 yyg->yy_c_buf_p = yyg->yytext_ptr + offset; 2113 break; 2114 } 2115 } 2116 } 2117 2118 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ 2119 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ 2120 yyg->yy_hold_char = *++yyg->yy_c_buf_p; 2121 2122 if ( c == '\n' ) 2123 2124 do{ yylineno++; 2125 yycolumn=0; 2126 }while(0) 2127 ; 2128 2129 return c; 2130 } 2131 #endif /* ifndef YY_NO_INPUT */ 2132 2133 /** Immediately switch to a different input stream. 2134 * @param input_file A readable stream. 2135 * @param yyscanner The scanner object. 2136 * @note This function does not reset the start condition to @c INITIAL . 2137 */ 2138 void yyrestart (FILE * input_file , yyscan_t yyscanner) 2139 { 2140 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2141 2142 if ( ! YY_CURRENT_BUFFER ){ 2143 yyensure_buffer_stack (yyscanner); 2144 YY_CURRENT_BUFFER_LVALUE = 2145 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 2146 } 2147 2148 yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); 2149 yy_load_buffer_state(yyscanner ); 2150 } 2151 2152 /** Switch to a different input buffer. 2153 * @param new_buffer The new input buffer. 2154 * @param yyscanner The scanner object. 2155 */ 2156 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 2157 { 2158 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2159 2160 /* TODO. We should be able to replace this entire function body 2161 * with 2162 * yypop_buffer_state(); 2163 * yypush_buffer_state(new_buffer); 2164 */ 2165 yyensure_buffer_stack (yyscanner); 2166 if ( YY_CURRENT_BUFFER == new_buffer ) 2167 return; 2168 2169 if ( YY_CURRENT_BUFFER ) 2170 { 2171 /* Flush out information for old buffer. */ 2172 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2173 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 2174 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 2175 } 2176 2177 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2178 yy_load_buffer_state(yyscanner ); 2179 2180 /* We don't actually know whether we did this switch during 2181 * EOF (yywrap()) processing, but the only time this flag 2182 * is looked at is after yywrap() is called, so it's safe 2183 * to go ahead and always set it. 2184 */ 2185 yyg->yy_did_buffer_switch_on_eof = 1; 2186 } 2187 2188 static void yy_load_buffer_state (yyscan_t yyscanner) 2189 { 2190 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2191 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 2192 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 2193 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 2194 yyg->yy_hold_char = *yyg->yy_c_buf_p; 2195 } 2196 2197 /** Allocate and initialize an input buffer state. 2198 * @param file A readable stream. 2199 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 2200 * @param yyscanner The scanner object. 2201 * @return the allocated buffer state. 2202 */ 2203 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) 2204 { 2205 YY_BUFFER_STATE b; 2206 2207 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 2208 if ( ! b ) 2209 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 2210 2211 b->yy_buf_size = size; 2212 2213 /* yy_ch_buf has to be 2 characters longer than the size given because 2214 * we need to put in 2 end-of-buffer characters. 2215 */ 2216 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner ); 2217 if ( ! b->yy_ch_buf ) 2218 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 2219 2220 b->yy_is_our_buffer = 1; 2221 2222 yy_init_buffer(b,file ,yyscanner); 2223 2224 return b; 2225 } 2226 2227 /** Destroy the buffer. 2228 * @param b a buffer created with yy_create_buffer() 2229 * @param yyscanner The scanner object. 2230 */ 2231 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 2232 { 2233 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2234 2235 if ( ! b ) 2236 return; 2237 2238 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 2239 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 2240 2241 if ( b->yy_is_our_buffer ) 2242 yyfree((void *) b->yy_ch_buf ,yyscanner ); 2243 2244 yyfree((void *) b ,yyscanner ); 2245 } 2246 2247 /* Initializes or reinitializes a buffer. 2248 * This function is sometimes called more than once on the same buffer, 2249 * such as during a yyrestart() or at EOF. 2250 */ 2251 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) 2252 2253 { 2254 int oerrno = errno; 2255 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2256 2257 yy_flush_buffer(b ,yyscanner); 2258 2259 b->yy_input_file = file; 2260 b->yy_fill_buffer = 1; 2261 2262 /* If b is the current buffer, then yy_init_buffer was _probably_ 2263 * called from yyrestart() or through yy_get_next_buffer. 2264 * In that case, we don't want to reset the lineno or column. 2265 */ 2266 if (b != YY_CURRENT_BUFFER){ 2267 b->yy_bs_lineno = 1; 2268 b->yy_bs_column = 0; 2269 } 2270 2271 b->yy_is_interactive = 0; 2272 2273 errno = oerrno; 2274 } 2275 2276 /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 2277 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 2278 * @param yyscanner The scanner object. 2279 */ 2280 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 2281 { 2282 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2283 if ( ! b ) 2284 return; 2285 2286 b->yy_n_chars = 0; 2287 2288 /* We always need two end-of-buffer characters. The first causes 2289 * a transition to the end-of-buffer state. The second causes 2290 * a jam in that state. 2291 */ 2292 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 2293 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 2294 2295 b->yy_buf_pos = &b->yy_ch_buf[0]; 2296 2297 b->yy_at_bol = 1; 2298 b->yy_buffer_status = YY_BUFFER_NEW; 2299 2300 if ( b == YY_CURRENT_BUFFER ) 2301 yy_load_buffer_state(yyscanner ); 2302 } 2303 2304 /** Pushes the new state onto the stack. The new state becomes 2305 * the current state. This function will allocate the stack 2306 * if necessary. 2307 * @param new_buffer The new state. 2308 * @param yyscanner The scanner object. 2309 */ 2310 void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 2311 { 2312 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2313 if (new_buffer == NULL) 2314 return; 2315 2316 yyensure_buffer_stack(yyscanner); 2317 2318 /* This block is copied from yy_switch_to_buffer. */ 2319 if ( YY_CURRENT_BUFFER ) 2320 { 2321 /* Flush out information for old buffer. */ 2322 *yyg->yy_c_buf_p = yyg->yy_hold_char; 2323 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 2324 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 2325 } 2326 2327 /* Only push if top exists. Otherwise, replace top. */ 2328 if (YY_CURRENT_BUFFER) 2329 yyg->yy_buffer_stack_top++; 2330 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2331 2332 /* copied from yy_switch_to_buffer. */ 2333 yy_load_buffer_state(yyscanner ); 2334 yyg->yy_did_buffer_switch_on_eof = 1; 2335 } 2336 2337 /** Removes and deletes the top of the stack, if present. 2338 * The next element becomes the new top. 2339 * @param yyscanner The scanner object. 2340 */ 2341 void yypop_buffer_state (yyscan_t yyscanner) 2342 { 2343 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2344 if (!YY_CURRENT_BUFFER) 2345 return; 2346 2347 yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); 2348 YY_CURRENT_BUFFER_LVALUE = NULL; 2349 if (yyg->yy_buffer_stack_top > 0) 2350 --yyg->yy_buffer_stack_top; 2351 2352 if (YY_CURRENT_BUFFER) { 2353 yy_load_buffer_state(yyscanner ); 2354 yyg->yy_did_buffer_switch_on_eof = 1; 2355 } 2356 } 2357 2358 /* Allocates the stack if it does not exist. 2359 * Guarantees space for at least one push. 2360 */ 2361 static void yyensure_buffer_stack (yyscan_t yyscanner) 2362 { 2363 yy_size_t num_to_alloc; 2364 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2365 2366 if (!yyg->yy_buffer_stack) { 2367 2368 /* First allocation is just for 2 elements, since we don't know if this 2369 * scanner will even need a stack. We use 2 instead of 1 to avoid an 2370 * immediate realloc on the next call. 2371 */ 2372 num_to_alloc = 1; 2373 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc 2374 (num_to_alloc * sizeof(struct yy_buffer_state*) 2375 , yyscanner); 2376 if ( ! yyg->yy_buffer_stack ) 2377 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 2378 2379 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 2380 2381 yyg->yy_buffer_stack_max = num_to_alloc; 2382 yyg->yy_buffer_stack_top = 0; 2383 return; 2384 } 2385 2386 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ 2387 2388 /* Increase the buffer to prepare for a possible push. */ 2389 int grow_size = 8 /* arbitrary grow size */; 2390 2391 num_to_alloc = yyg->yy_buffer_stack_max + grow_size; 2392 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc 2393 (yyg->yy_buffer_stack, 2394 num_to_alloc * sizeof(struct yy_buffer_state*) 2395 , yyscanner); 2396 if ( ! yyg->yy_buffer_stack ) 2397 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 2398 2399 /* zero only the new slots.*/ 2400 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); 2401 yyg->yy_buffer_stack_max = num_to_alloc; 2402 } 2403 } 2404 2405 /** Setup the input buffer state to scan directly from a user-specified character buffer. 2406 * @param base the character buffer 2407 * @param size the size in bytes of the character buffer 2408 * @param yyscanner The scanner object. 2409 * @return the newly allocated buffer state object. 2410 */ 2411 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) 2412 { 2413 YY_BUFFER_STATE b; 2414 2415 if ( size < 2 || 2416 base[size-2] != YY_END_OF_BUFFER_CHAR || 2417 base[size-1] != YY_END_OF_BUFFER_CHAR ) 2418 /* They forgot to leave room for the EOB's. */ 2419 return 0; 2420 2421 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 2422 if ( ! b ) 2423 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 2424 2425 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 2426 b->yy_buf_pos = b->yy_ch_buf = base; 2427 b->yy_is_our_buffer = 0; 2428 b->yy_input_file = 0; 2429 b->yy_n_chars = b->yy_buf_size; 2430 b->yy_is_interactive = 0; 2431 b->yy_at_bol = 1; 2432 b->yy_fill_buffer = 0; 2433 b->yy_buffer_status = YY_BUFFER_NEW; 2434 2435 yy_switch_to_buffer(b ,yyscanner ); 2436 2437 return b; 2438 } 2439 2440 /** Setup the input buffer state to scan a string. The next call to yylex() will 2441 * scan from a @e copy of @a str. 2442 * @param yystr a NUL-terminated string to scan 2443 * @param yyscanner The scanner object. 2444 * @return the newly allocated buffer state object. 2445 * @note If you want to scan bytes that may contain NUL values, then use 2446 * yy_scan_bytes() instead. 2447 */ 2448 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) 2449 { 2450 2451 return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); 2452 } 2453 2454 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will 2455 * scan from a @e copy of @a bytes. 2456 * @param bytes the byte buffer to scan 2457 * @param len the number of bytes in the buffer pointed to by @a bytes. 2458 * @param yyscanner The scanner object. 2459 * @return the newly allocated buffer state object. 2460 */ 2461 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) 2462 { 2463 YY_BUFFER_STATE b; 2464 char *buf; 2465 yy_size_t n, i; 2466 2467 /* Get memory for full buffer, including space for trailing EOB's. */ 2468 n = _yybytes_len + 2; 2469 buf = (char *) yyalloc(n ,yyscanner ); 2470 if ( ! buf ) 2471 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 2472 2473 for ( i = 0; i < _yybytes_len; ++i ) 2474 buf[i] = yybytes[i]; 2475 2476 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 2477 2478 b = yy_scan_buffer(buf,n ,yyscanner); 2479 if ( ! b ) 2480 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 2481 2482 /* It's okay to grow etc. this buffer, and we should throw it 2483 * away when we're done. 2484 */ 2485 b->yy_is_our_buffer = 1; 2486 2487 return b; 2488 } 2489 2490 #ifndef YY_EXIT_FAILURE 2491 #define YY_EXIT_FAILURE 2 2492 #endif 2493 2494 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) 2495 { 2496 (void) fprintf( stderr, "%s\n", msg ); 2497 exit( YY_EXIT_FAILURE ); 2498 } 2499 2500 /* Redefine yyless() so it works in section 3 code. */ 2501 2502 #undef yyless 2503 #define yyless(n) \ 2504 do \ 2505 { \ 2506 /* Undo effects of setting up yytext. */ \ 2507 int yyless_macro_arg = (n); \ 2508 YY_LESS_LINENO(yyless_macro_arg);\ 2509 yytext[yyleng] = yyg->yy_hold_char; \ 2510 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ 2511 yyg->yy_hold_char = *yyg->yy_c_buf_p; \ 2512 *yyg->yy_c_buf_p = '\0'; \ 2513 yyleng = yyless_macro_arg; \ 2514 } \ 2515 while ( 0 ) 2516 2517 /* Accessor methods (get/set functions) to struct members. */ 2518 2519 /** Get the user-defined data for this scanner. 2520 * @param yyscanner The scanner object. 2521 */ 2522 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) 2523 { 2524 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2525 return yyextra; 2526 } 2527 2528 /** Get the current line number. 2529 * @param yyscanner The scanner object. 2530 */ 2531 int yyget_lineno (yyscan_t yyscanner) 2532 { 2533 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2534 2535 if (! YY_CURRENT_BUFFER) 2536 return 0; 2537 2538 return yylineno; 2539 } 2540 2541 /** Get the current column number. 2542 * @param yyscanner The scanner object. 2543 */ 2544 int yyget_column (yyscan_t yyscanner) 2545 { 2546 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2547 2548 if (! YY_CURRENT_BUFFER) 2549 return 0; 2550 2551 return yycolumn; 2552 } 2553 2554 /** Get the input stream. 2555 * @param yyscanner The scanner object. 2556 */ 2557 FILE *yyget_in (yyscan_t yyscanner) 2558 { 2559 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2560 return yyin; 2561 } 2562 2563 /** Get the output stream. 2564 * @param yyscanner The scanner object. 2565 */ 2566 FILE *yyget_out (yyscan_t yyscanner) 2567 { 2568 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2569 return yyout; 2570 } 2571 2572 /** Get the length of the current token. 2573 * @param yyscanner The scanner object. 2574 */ 2575 yy_size_t yyget_leng (yyscan_t yyscanner) 2576 { 2577 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2578 return yyleng; 2579 } 2580 2581 /** Get the current token. 2582 * @param yyscanner The scanner object. 2583 */ 2584 2585 char *yyget_text (yyscan_t yyscanner) 2586 { 2587 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2588 return yytext; 2589 } 2590 2591 /** Set the user-defined data. This data is never touched by the scanner. 2592 * @param user_defined The data to be associated with this scanner. 2593 * @param yyscanner The scanner object. 2594 */ 2595 void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) 2596 { 2597 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2598 yyextra = user_defined ; 2599 } 2600 2601 /** Set the current line number. 2602 * @param line_number 2603 * @param yyscanner The scanner object. 2604 */ 2605 void yyset_lineno (int line_number , yyscan_t yyscanner) 2606 { 2607 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2608 2609 /* lineno is only valid if an input buffer exists. */ 2610 if (! YY_CURRENT_BUFFER ) 2611 yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner); 2612 2613 yylineno = line_number; 2614 } 2615 2616 /** Set the current column. 2617 * @param line_number 2618 * @param yyscanner The scanner object. 2619 */ 2620 void yyset_column (int column_no , yyscan_t yyscanner) 2621 { 2622 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2623 2624 /* column is only valid if an input buffer exists. */ 2625 if (! YY_CURRENT_BUFFER ) 2626 yy_fatal_error( "yyset_column called with no buffer" , yyscanner); 2627 2628 yycolumn = column_no; 2629 } 2630 2631 /** Set the input stream. This does not discard the current 2632 * input buffer. 2633 * @param in_str A readable stream. 2634 * @param yyscanner The scanner object. 2635 * @see yy_switch_to_buffer 2636 */ 2637 void yyset_in (FILE * in_str , yyscan_t yyscanner) 2638 { 2639 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2640 yyin = in_str ; 2641 } 2642 2643 void yyset_out (FILE * out_str , yyscan_t yyscanner) 2644 { 2645 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2646 yyout = out_str ; 2647 } 2648 2649 int yyget_debug (yyscan_t yyscanner) 2650 { 2651 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2652 return yy_flex_debug; 2653 } 2654 2655 void yyset_debug (int bdebug , yyscan_t yyscanner) 2656 { 2657 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2658 yy_flex_debug = bdebug ; 2659 } 2660 2661 /* Accessor methods for yylval and yylloc */ 2662 2663 YYSTYPE * yyget_lval (yyscan_t yyscanner) 2664 { 2665 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2666 return yylval; 2667 } 2668 2669 void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) 2670 { 2671 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2672 yylval = yylval_param; 2673 } 2674 2675 YYLTYPE *yyget_lloc (yyscan_t yyscanner) 2676 { 2677 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2678 return yylloc; 2679 } 2680 2681 void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) 2682 { 2683 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2684 yylloc = yylloc_param; 2685 } 2686 2687 /* User-visible API */ 2688 2689 /* yylex_init is special because it creates the scanner itself, so it is 2690 * the ONLY reentrant function that doesn't take the scanner as the last argument. 2691 * That's why we explicitly handle the declaration, instead of using our macros. 2692 */ 2693 2694 int yylex_init(yyscan_t* ptr_yy_globals) 2695 2696 { 2697 if (ptr_yy_globals == NULL){ 2698 errno = EINVAL; 2699 return 1; 2700 } 2701 2702 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); 2703 2704 if (*ptr_yy_globals == NULL){ 2705 errno = ENOMEM; 2706 return 1; 2707 } 2708 2709 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ 2710 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2711 2712 return yy_init_globals ( *ptr_yy_globals ); 2713 } 2714 2715 /* yylex_init_extra has the same functionality as yylex_init, but follows the 2716 * convention of taking the scanner as the last argument. Note however, that 2717 * this is a *pointer* to a scanner, as it will be allocated by this call (and 2718 * is the reason, too, why this function also must handle its own declaration). 2719 * The user defined value in the first argument will be available to yyalloc in 2720 * the yyextra field. 2721 */ 2722 2723 int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) 2724 2725 { 2726 struct yyguts_t dummy_yyguts; 2727 2728 yyset_extra (yy_user_defined, &dummy_yyguts); 2729 2730 if (ptr_yy_globals == NULL){ 2731 errno = EINVAL; 2732 return 1; 2733 } 2734 2735 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); 2736 2737 if (*ptr_yy_globals == NULL){ 2738 errno = ENOMEM; 2739 return 1; 2740 } 2741 2742 /* By setting to 0xAA, we expose bugs in 2743 yy_init_globals. Leave at 0x00 for releases. */ 2744 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2745 2746 yyset_extra (yy_user_defined, *ptr_yy_globals); 2747 2748 return yy_init_globals ( *ptr_yy_globals ); 2749 } 2750 2751 static int yy_init_globals (yyscan_t yyscanner) 2752 { 2753 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2754 /* Initialization is the same as for the non-reentrant scanner. 2755 * This function is called from yylex_destroy(), so don't allocate here. 2756 */ 2757 2758 yyg->yy_buffer_stack = 0; 2759 yyg->yy_buffer_stack_top = 0; 2760 yyg->yy_buffer_stack_max = 0; 2761 yyg->yy_c_buf_p = (char *) 0; 2762 yyg->yy_init = 0; 2763 yyg->yy_start = 0; 2764 2765 yyg->yy_start_stack_ptr = 0; 2766 yyg->yy_start_stack_depth = 0; 2767 yyg->yy_start_stack = NULL; 2768 2769 /* Defined in main.c */ 2770 #ifdef YY_STDINIT 2771 yyin = stdin; 2772 yyout = stdout; 2773 #else 2774 yyin = (FILE *) 0; 2775 yyout = (FILE *) 0; 2776 #endif 2777 2778 /* For future reference: Set errno on error, since we are called by 2779 * yylex_init() 2780 */ 2781 return 0; 2782 } 2783 2784 /* yylex_destroy is for both reentrant and non-reentrant scanners. */ 2785 int yylex_destroy (yyscan_t yyscanner) 2786 { 2787 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2788 2789 /* Pop the buffer stack, destroying each element. */ 2790 while(YY_CURRENT_BUFFER){ 2791 yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); 2792 YY_CURRENT_BUFFER_LVALUE = NULL; 2793 yypop_buffer_state(yyscanner); 2794 } 2795 2796 /* Destroy the stack itself. */ 2797 yyfree(yyg->yy_buffer_stack ,yyscanner); 2798 yyg->yy_buffer_stack = NULL; 2799 2800 /* Destroy the start condition stack. */ 2801 yyfree(yyg->yy_start_stack ,yyscanner ); 2802 yyg->yy_start_stack = NULL; 2803 2804 /* Reset the globals. This is important in a non-reentrant scanner so the next time 2805 * yylex() is called, initialization will occur. */ 2806 yy_init_globals( yyscanner); 2807 2808 /* Destroy the main struct (reentrant only). */ 2809 yyfree ( yyscanner , yyscanner ); 2810 yyscanner = NULL; 2811 return 0; 2812 } 2813 2814 /* 2815 * Internal utility routines. 2816 */ 2817 2818 #ifndef yytext_ptr 2819 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) 2820 { 2821 register int i; 2822 for ( i = 0; i < n; ++i ) 2823 s1[i] = s2[i]; 2824 } 2825 #endif 2826 2827 #ifdef YY_NEED_STRLEN 2828 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) 2829 { 2830 register int n; 2831 for ( n = 0; s[n]; ++n ) 2832 ; 2833 2834 return n; 2835 } 2836 #endif 2837 2838 void *yyalloc (yy_size_t size , yyscan_t yyscanner) 2839 { 2840 return (void *) malloc( size ); 2841 } 2842 2843 void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) 2844 { 2845 /* The cast to (char *) in the following accommodates both 2846 * implementations that use char* generic pointers, and those 2847 * that use void* generic pointers. It works with the latter 2848 * because both ANSI C and C++ allow castless assignment from 2849 * any pointer type to void*, and deal with argument conversions 2850 * as though doing an assignment. 2851 */ 2852 return (void *) realloc( (char *) ptr, size ); 2853 } 2854 2855 void yyfree (void * ptr , yyscan_t yyscanner) 2856 { 2857 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 2858 } 2859 2860 #define YYTABLES_NAME "yytables" 2861 2862 yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) { 2863 pp::Token token; 2864 yyget_extra(yyscanner)->preprocessor.lex(&token); 2865 yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size(); 2866 if (len < max_size) 2867 memcpy(buf, token.text.c_str(), len); 2868 yyset_column(token.location.file,yyscanner); 2869 yyset_lineno(token.location.line,yyscanner); 2870 2871 if (len >= max_size) 2872 YY_FATAL_ERROR("Input buffer overflow"); 2873 else if (len > 0) 2874 buf[len++] = ' '; 2875 return len; 2876 } 2877 2878 int check_type(yyscan_t yyscanner) { 2879 struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; 2880 2881 int token = IDENTIFIER; 2882 TSymbol* symbol = yyextra->symbolTable.find(yytext); 2883 if (symbol && symbol->isVariable()) { 2884 TVariable* variable = static_cast<TVariable*>(symbol); 2885 if (variable->isUserType()) 2886 token = TYPE_NAME; 2887 } 2888 yylval->lex.symbol = symbol; 2889 return token; 2890 } 2891 2892 int reserved_word(yyscan_t yyscanner) { 2893 struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; 2894 2895 yyextra->error(*yylloc, "Illegal use of reserved word", yytext, ""); 2896 yyextra->recover(); 2897 return 0; 2898 } 2899 2900 int glslang_initialize(TParseContext* context) { 2901 yyscan_t scanner = NULL; 2902 if (yylex_init_extra(context,&scanner)) 2903 return 1; 2904 2905 context->scanner = scanner; 2906 return 0; 2907 } 2908 2909 int glslang_finalize(TParseContext* context) { 2910 yyscan_t scanner = context->scanner; 2911 if (scanner == NULL) return 0; 2912 2913 context->scanner = NULL; 2914 yylex_destroy(scanner); 2915 2916 return 0; 2917 } 2918 2919 int glslang_scan(size_t count, const char* const string[], const int length[], 2920 TParseContext* context) { 2921 yyrestart(NULL,context->scanner); 2922 yyset_column(0,context->scanner); 2923 yyset_lineno(1,context->scanner); 2924 2925 // Initialize preprocessor. 2926 if (!context->preprocessor.init(count, string, length)) 2927 return 1; 2928 2929 // Define extension macros. 2930 const TExtensionBehavior& extBehavior = context->extensionBehavior(); 2931 for (TExtensionBehavior::const_iterator iter = extBehavior.begin(); 2932 iter != extBehavior.end(); ++iter) { 2933 context->preprocessor.predefineMacro(iter->first.c_str(), 1); 2934 } 2935 if (context->fragmentPrecisionHigh) 2936 context->preprocessor.predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1); 2937 2938 return 0; 2939 } 2940 2941