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