1 #line 2 "src/chromium_gensrc/mesa/glcpp-lex.c" 2 3 #line 4 "src/chromium_gensrc/mesa/glcpp-lex.c" 4 5 #define YY_INT_ALIGNED short int 6 7 /* A lexical scanner generated by flex */ 8 9 #define FLEX_SCANNER 10 #define YY_FLEX_MAJOR_VERSION 2 11 #define YY_FLEX_MINOR_VERSION 5 12 #define YY_FLEX_SUBMINOR_VERSION 35 13 #if YY_FLEX_SUBMINOR_VERSION > 0 14 #define FLEX_BETA 15 #endif 16 17 /* First, we deal with platform-specific or compiler-specific issues. */ 18 19 /* begin standard C headers. */ 20 #include <stdio.h> 21 #include <string.h> 22 #include <errno.h> 23 #include <stdlib.h> 24 25 /* end standard C headers. */ 26 27 /* flex integer type definitions */ 28 29 #ifndef FLEXINT_H 30 #define FLEXINT_H 31 32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 33 34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 35 36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 37 * if you want the limit (max/min) macros for int types. 38 */ 39 #ifndef __STDC_LIMIT_MACROS 40 #define __STDC_LIMIT_MACROS 1 41 #endif 42 43 #include <inttypes.h> 44 typedef int8_t flex_int8_t; 45 typedef uint8_t flex_uint8_t; 46 typedef int16_t flex_int16_t; 47 typedef uint16_t flex_uint16_t; 48 typedef int32_t flex_int32_t; 49 typedef uint32_t flex_uint32_t; 50 #else 51 typedef signed char flex_int8_t; 52 typedef short int flex_int16_t; 53 typedef int flex_int32_t; 54 typedef unsigned char flex_uint8_t; 55 typedef unsigned short int flex_uint16_t; 56 typedef unsigned int flex_uint32_t; 57 58 /* Limits of integral types. */ 59 #ifndef INT8_MIN 60 #define INT8_MIN (-128) 61 #endif 62 #ifndef INT16_MIN 63 #define INT16_MIN (-32767-1) 64 #endif 65 #ifndef INT32_MIN 66 #define INT32_MIN (-2147483647-1) 67 #endif 68 #ifndef INT8_MAX 69 #define INT8_MAX (127) 70 #endif 71 #ifndef INT16_MAX 72 #define INT16_MAX (32767) 73 #endif 74 #ifndef INT32_MAX 75 #define INT32_MAX (2147483647) 76 #endif 77 #ifndef UINT8_MAX 78 #define UINT8_MAX (255U) 79 #endif 80 #ifndef UINT16_MAX 81 #define UINT16_MAX (65535U) 82 #endif 83 #ifndef UINT32_MAX 84 #define UINT32_MAX (4294967295U) 85 #endif 86 87 #endif /* ! C99 */ 88 89 #endif /* ! FLEXINT_H */ 90 91 #ifdef __cplusplus 92 93 /* The "const" storage-class-modifier is valid. */ 94 #define YY_USE_CONST 95 96 #else /* ! __cplusplus */ 97 98 /* C99 requires __STDC__ to be defined as 1. */ 99 #if defined (__STDC__) 100 101 #define YY_USE_CONST 102 103 #endif /* defined (__STDC__) */ 104 #endif /* ! __cplusplus */ 105 106 #ifdef YY_USE_CONST 107 #define yyconst const 108 #else 109 #define yyconst 110 #endif 111 112 /* Returned upon end-of-file. */ 113 #define YY_NULL 0 114 115 /* Promotes a possibly negative, possibly signed char to an unsigned 116 * integer for use as an array index. If the signed char is negative, 117 * we want to instead treat it as an 8-bit unsigned char, hence the 118 * double cast. 119 */ 120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 121 122 /* An opaque pointer. */ 123 #ifndef YY_TYPEDEF_YY_SCANNER_T 124 #define YY_TYPEDEF_YY_SCANNER_T 125 typedef void* yyscan_t; 126 #endif 127 128 /* For convenience, these vars (plus the bison vars far below) 129 are macros in the reentrant scanner. */ 130 #define yyin yyg->yyin_r 131 #define yyout yyg->yyout_r 132 #define yyextra yyg->yyextra_r 133 #define yyleng yyg->yyleng_r 134 #define yytext yyg->yytext_r 135 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) 136 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) 137 #define yy_flex_debug yyg->yy_flex_debug_r 138 139 /* Enter a start condition. This macro really ought to take a parameter, 140 * but we do it the disgusting crufty way forced on us by the ()-less 141 * definition of BEGIN. 142 */ 143 #define BEGIN yyg->yy_start = 1 + 2 * 144 145 /* Translate the current start state into a value that can be later handed 146 * to BEGIN to return to the state. The YYSTATE alias is for lex 147 * compatibility. 148 */ 149 #define YY_START ((yyg->yy_start - 1) / 2) 150 #define YYSTATE YY_START 151 152 /* Action number for EOF rule of a given start state. */ 153 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 154 155 /* Special action meaning "start processing a new file". */ 156 #define YY_NEW_FILE glcpp_restart(yyin ,yyscanner ) 157 158 #define YY_END_OF_BUFFER_CHAR 0 159 160 /* Size of default input buffer. */ 161 #ifndef YY_BUF_SIZE 162 #ifdef __ia64__ 163 /* On IA-64, the buffer size is 16k, not 8k. 164 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 165 * Ditto for the __ia64__ case accordingly. 166 */ 167 #define YY_BUF_SIZE 32768 168 #else 169 #define YY_BUF_SIZE 16384 170 #endif /* __ia64__ */ 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 #define YY_LESS_LINENO(n) 187 188 /* Return all but the first "n" matched characters back to the input stream. */ 189 #define yyless(n) \ 190 do \ 191 { \ 192 /* Undo effects of setting up yytext. */ \ 193 int yyless_macro_arg = (n); \ 194 YY_LESS_LINENO(yyless_macro_arg);\ 195 *yy_cp = yyg->yy_hold_char; \ 196 YY_RESTORE_YY_MORE_OFFSET \ 197 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 198 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 199 } \ 200 while ( 0 ) 201 202 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) 203 204 #ifndef YY_TYPEDEF_YY_SIZE_T 205 #define YY_TYPEDEF_YY_SIZE_T 206 typedef size_t yy_size_t; 207 #endif 208 209 #ifndef YY_STRUCT_YY_BUFFER_STATE 210 #define YY_STRUCT_YY_BUFFER_STATE 211 struct yy_buffer_state 212 { 213 FILE *yy_input_file; 214 215 char *yy_ch_buf; /* input buffer */ 216 char *yy_buf_pos; /* current position in input buffer */ 217 218 /* Size of input buffer in bytes, not including room for EOB 219 * characters. 220 */ 221 yy_size_t yy_buf_size; 222 223 /* Number of characters read into yy_ch_buf, not including EOB 224 * characters. 225 */ 226 int yy_n_chars; 227 228 /* Whether we "own" the buffer - i.e., we know we created it, 229 * and can realloc() it to grow it, and should free() it to 230 * delete it. 231 */ 232 int yy_is_our_buffer; 233 234 /* Whether this is an "interactive" input source; if so, and 235 * if we're using stdio for input, then we want to use getc() 236 * instead of fread(), to make sure we stop fetching input after 237 * each newline. 238 */ 239 int yy_is_interactive; 240 241 /* Whether we're considered to be at the beginning of a line. 242 * If so, '^' rules will be active on the next match, otherwise 243 * not. 244 */ 245 int yy_at_bol; 246 247 int yy_bs_lineno; /**< The line count. */ 248 int yy_bs_column; /**< The column count. */ 249 250 /* Whether to try to fill the input buffer when we reach the 251 * end of it. 252 */ 253 int yy_fill_buffer; 254 255 int yy_buffer_status; 256 257 #define YY_BUFFER_NEW 0 258 #define YY_BUFFER_NORMAL 1 259 /* When an EOF's been seen but there's still some text to process 260 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 261 * shouldn't try reading from the input source any more. We might 262 * still have a bunch of tokens to match, though, because of 263 * possible backing-up. 264 * 265 * When we actually see the EOF, we change the status to "new" 266 * (via glcpp_restart()), so that the user can continue scanning by 267 * just pointing yyin at a new input file. 268 */ 269 #define YY_BUFFER_EOF_PENDING 2 270 271 }; 272 #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 273 274 /* We provide macros for accessing buffer states in case in the 275 * future we want to put the buffer states in a more general 276 * "scanner state". 277 * 278 * Returns the top of the stack, or NULL. 279 */ 280 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ 281 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ 282 : NULL) 283 284 /* Same as previous macro, but useful when we know that the buffer stack is not 285 * NULL or when we need an lvalue. For internal use only. 286 */ 287 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] 288 289 void glcpp_restart (FILE *input_file ,yyscan_t yyscanner ); 290 void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 291 YY_BUFFER_STATE glcpp__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); 292 void glcpp__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 293 void glcpp__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 294 void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 295 void glcpp_pop_buffer_state (yyscan_t yyscanner ); 296 297 static void glcpp_ensure_buffer_stack (yyscan_t yyscanner ); 298 static void glcpp__load_buffer_state (yyscan_t yyscanner ); 299 static void glcpp__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); 300 301 #define YY_FLUSH_BUFFER glcpp__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) 302 303 YY_BUFFER_STATE glcpp__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); 304 YY_BUFFER_STATE glcpp__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); 305 YY_BUFFER_STATE glcpp__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); 306 307 void *glcpp_alloc (yy_size_t ,yyscan_t yyscanner ); 308 void *glcpp_realloc (void *,yy_size_t ,yyscan_t yyscanner ); 309 void glcpp_free (void * ,yyscan_t yyscanner ); 310 311 #define yy_new_buffer glcpp__create_buffer 312 313 #define yy_set_interactive(is_interactive) \ 314 { \ 315 if ( ! YY_CURRENT_BUFFER ){ \ 316 glcpp_ensure_buffer_stack (yyscanner); \ 317 YY_CURRENT_BUFFER_LVALUE = \ 318 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 319 } \ 320 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 321 } 322 323 #define yy_set_bol(at_bol) \ 324 { \ 325 if ( ! YY_CURRENT_BUFFER ){\ 326 glcpp_ensure_buffer_stack (yyscanner); \ 327 YY_CURRENT_BUFFER_LVALUE = \ 328 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 329 } \ 330 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 331 } 332 333 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 334 335 /* Begin user sect3 */ 336 337 #define glcpp_wrap(n) 1 338 #define YY_SKIP_YYWRAP 339 340 typedef unsigned char YY_CHAR; 341 342 typedef int yy_state_type; 343 344 #define yytext_ptr yytext_r 345 346 static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); 347 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); 348 static int yy_get_next_buffer (yyscan_t yyscanner ); 349 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); 350 351 /* Done after the current pattern has been matched and before the 352 * corresponding action - sets up yytext. 353 */ 354 #define YY_DO_BEFORE_ACTION \ 355 yyg->yytext_ptr = yy_bp; \ 356 yyleng = (size_t) (yy_cp - yy_bp); \ 357 yyg->yy_hold_char = *yy_cp; \ 358 *yy_cp = '\0'; \ 359 yyg->yy_c_buf_p = yy_cp; 360 361 #define YY_NUM_RULES 43 362 #define YY_END_OF_BUFFER 44 363 /* This struct is not used in this scanner, 364 but its presence is necessary. */ 365 struct yy_trans_info 366 { 367 flex_int32_t yy_verify; 368 flex_int32_t yy_nxt; 369 }; 370 static yyconst flex_int16_t yy_accept[147] = 371 { 0, 372 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 373 0, 0, 44, 39, 40, 41, 43, 38, 43, 38, 374 38, 38, 25, 24, 38, 38, 38, 37, 37, 38, 375 40, 23, 3, 4, 5, 42, 17, 17, 17, 21, 376 39, 40, 32, 35, 33, 2, 1, 25, 25, 0, 377 24, 24, 27, 29, 31, 30, 28, 37, 37, 34, 378 40, 23, 23, 0, 0, 0, 0, 0, 0, 0, 379 3, 4, 5, 6, 5, 7, 0, 0, 0, 0, 380 20, 21, 1, 26, 37, 0, 0, 0, 0, 0, 381 0, 0, 0, 0, 0, 26, 37, 0, 0, 0, 382 383 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 384 37, 0, 14, 15, 0, 0, 0, 0, 0, 10, 385 0, 0, 0, 37, 0, 16, 18, 0, 11, 0, 386 0, 22, 0, 36, 0, 18, 0, 12, 0, 0, 387 19, 0, 9, 8, 0, 0 388 } ; 389 390 static yyconst flex_int32_t yy_ec[256] = 391 { 0, 392 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 393 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 394 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 395 1, 2, 5, 1, 6, 1, 7, 8, 1, 9, 396 7, 10, 7, 7, 7, 7, 11, 12, 13, 13, 397 13, 13, 13, 13, 13, 14, 14, 1, 7, 15, 398 16, 17, 1, 1, 18, 18, 18, 18, 18, 18, 399 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 400 19, 19, 19, 19, 20, 19, 19, 21, 19, 19, 401 7, 1, 7, 7, 19, 1, 22, 18, 18, 23, 402 403 24, 25, 26, 19, 27, 19, 19, 28, 29, 30, 404 31, 32, 19, 33, 34, 35, 36, 37, 19, 38, 405 19, 19, 7, 39, 7, 7, 1, 1, 1, 1, 406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 413 414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 418 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 419 1, 1, 1, 1, 1 420 } ; 421 422 static yyconst flex_int32_t yy_meta[40] = 423 { 0, 424 1, 1, 2, 1, 1, 1, 1, 1, 3, 4, 425 1, 5, 5, 5, 1, 1, 1, 5, 6, 6, 426 6, 5, 7, 5, 5, 6, 6, 6, 6, 8, 427 6, 6, 6, 6, 6, 6, 6, 6, 1 428 } ; 429 430 static yyconst flex_int16_t yy_base[160] = 431 { 0, 432 0, 38, 0, 0, 38, 39, 313, 312, 311, 44, 433 50, 0, 313, 311, 309, 317, 317, 294, 303, 317, 434 300, 80, 80, 83, 83, 291, 88, 0, 282, 266, 435 100, 118, 301, 317, 104, 317, 317, 106, 107, 294, 436 301, 299, 317, 317, 317, 317, 0, 113, 317, 0, 437 115, 317, 317, 317, 317, 317, 317, 0, 275, 317, 438 111, 293, 292, 273, 110, 271, 268, 261, 263, 268, 439 288, 317, 149, 317, 153, 317, 130, 120, 151, 15, 440 317, 281, 0, 74, 262, 263, 96, 264, 253, 250, 441 135, 254, 261, 259, 248, 317, 250, 252, 253, 253, 442 443 249, 244, 250, 317, 249, 249, 241, 231, 229, 218, 444 222, 208, 317, 317, 207, 185, 147, 151, 150, 317, 445 144, 147, 144, 147, 145, 317, 0, 134, 317, 142, 446 144, 317, 131, 0, 159, 0, 130, 317, 0, 109, 447 135, 90, 0, 317, 81, 317, 178, 186, 194, 202, 448 206, 214, 222, 228, 236, 240, 247, 255, 263 449 } ; 450 451 static yyconst flex_int16_t yy_def[160] = 452 { 0, 453 146, 1, 147, 147, 148, 148, 149, 149, 150, 150, 454 146, 11, 146, 146, 146, 146, 146, 146, 146, 146, 455 146, 146, 146, 146, 146, 146, 146, 151, 151, 146, 456 146, 146, 152, 146, 153, 146, 146, 146, 146, 154, 457 146, 146, 146, 146, 146, 146, 155, 146, 146, 156, 458 146, 146, 146, 146, 146, 146, 146, 151, 151, 146, 459 146, 32, 32, 146, 146, 146, 146, 146, 146, 146, 460 152, 146, 153, 146, 153, 146, 146, 146, 146, 146, 461 146, 154, 155, 156, 151, 146, 146, 146, 146, 146, 462 157, 146, 146, 146, 146, 146, 151, 146, 146, 146, 463 464 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 465 151, 146, 146, 146, 146, 146, 146, 146, 146, 146, 466 146, 146, 146, 151, 146, 146, 158, 146, 146, 146, 467 146, 146, 146, 151, 146, 158, 146, 146, 159, 146, 468 146, 146, 159, 146, 146, 0, 146, 146, 146, 146, 469 146, 146, 146, 146, 146, 146, 146, 146, 146 470 } ; 471 472 static yyconst flex_int16_t yy_nxt[357] = 473 { 0, 474 14, 15, 16, 17, 18, 19, 20, 21, 20, 20, 475 22, 23, 24, 24, 25, 26, 27, 28, 28, 28, 476 28, 28, 29, 28, 28, 28, 28, 28, 28, 28, 477 28, 28, 28, 28, 28, 28, 28, 28, 30, 31, 478 34, 34, 87, 32, 88, 38, 16, 35, 35, 39, 479 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 480 17, 17, 17, 17, 17, 17, 17, 40, 40, 40, 481 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 482 40, 40, 40, 40, 40, 40, 40, 40, 17, 46, 483 47, 48, 48, 96, 51, 51, 51, 53, 54, 49, 484 485 50, 61, 52, 56, 57, 62, 74, 77, 79, 96, 486 139, 78, 61, 75, 76, 49, 62, 50, 52, 63, 487 145, 79, 99, 44, 48, 48, 51, 51, 51, 100, 488 80, 77, 49, 66, 52, 78, 141, 87, 144, 88, 489 64, 65, 89, 80, 66, 67, 66, 90, 49, 68, 490 52, 74, 79, 69, 70, 74, 142, 105, 146, 146, 491 141, 140, 75, 76, 106, 139, 138, 137, 135, 134, 492 133, 132, 131, 130, 80, 129, 128, 66, 17, 17, 493 17, 17, 17, 17, 17, 17, 33, 33, 33, 33, 494 33, 33, 33, 33, 36, 36, 36, 36, 36, 36, 495 496 36, 36, 37, 37, 37, 37, 37, 37, 37, 37, 497 58, 58, 58, 58, 71, 71, 71, 127, 71, 71, 498 71, 71, 73, 73, 73, 73, 73, 73, 73, 73, 499 82, 126, 82, 82, 82, 82, 83, 125, 83, 83, 500 83, 83, 83, 83, 84, 124, 84, 104, 104, 104, 501 104, 123, 122, 104, 104, 136, 121, 136, 136, 136, 502 136, 136, 136, 143, 120, 143, 143, 143, 143, 143, 503 143, 119, 118, 117, 116, 115, 114, 113, 112, 111, 504 110, 109, 108, 107, 103, 102, 101, 98, 97, 81, 505 72, 95, 94, 93, 92, 91, 86, 146, 146, 85, 506 507 42, 41, 81, 72, 60, 59, 55, 45, 44, 43, 508 42, 41, 146, 16, 17, 17, 13, 146, 146, 146, 509 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 510 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 511 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 512 146, 146, 146, 146, 146, 146 513 } ; 514 515 static yyconst flex_int16_t yy_chk[357] = 516 { 0, 517 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 518 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 519 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 520 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 521 5, 6, 80, 2, 80, 10, 10, 5, 6, 10, 522 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 523 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 524 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 525 11, 11, 11, 11, 11, 11, 11, 11, 11, 22, 526 22, 23, 23, 84, 24, 24, 24, 25, 25, 23, 527 528 23, 31, 24, 27, 27, 31, 35, 38, 39, 84, 529 145, 38, 61, 35, 35, 23, 61, 23, 24, 32, 530 142, 78, 87, 32, 48, 48, 51, 51, 51, 87, 531 39, 77, 48, 39, 51, 77, 141, 65, 140, 65, 532 32, 32, 65, 78, 32, 32, 78, 65, 48, 32, 533 51, 73, 79, 32, 32, 75, 137, 91, 73, 73, 534 135, 133, 75, 75, 91, 131, 130, 128, 125, 124, 535 123, 122, 121, 119, 79, 118, 117, 79, 147, 147, 536 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 537 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 538 539 149, 149, 150, 150, 150, 150, 150, 150, 150, 150, 540 151, 151, 151, 151, 152, 152, 152, 116, 152, 152, 541 152, 152, 153, 153, 153, 153, 153, 153, 153, 153, 542 154, 115, 154, 154, 154, 154, 155, 112, 155, 155, 543 155, 155, 155, 155, 156, 111, 156, 157, 157, 157, 544 157, 110, 109, 157, 157, 158, 108, 158, 158, 158, 545 158, 158, 158, 159, 107, 159, 159, 159, 159, 159, 546 159, 106, 105, 103, 102, 101, 100, 99, 98, 97, 547 95, 94, 93, 92, 90, 89, 88, 86, 85, 82, 548 71, 70, 69, 68, 67, 66, 64, 63, 62, 59, 549 550 42, 41, 40, 33, 30, 29, 26, 21, 19, 18, 551 15, 14, 13, 9, 8, 7, 146, 146, 146, 146, 552 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 553 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 554 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 555 146, 146, 146, 146, 146, 146 556 } ; 557 558 /* The intent behind this definition is that it'll catch 559 * any uses of REJECT which flex missed. 560 */ 561 #define REJECT reject_used_but_not_detected 562 #define yymore() yymore_used_but_not_detected 563 #define YY_MORE_ADJ 0 564 #define YY_RESTORE_YY_MORE_OFFSET 565 #line 1 "src/src/glsl/glcpp/glcpp-lex.l" 566 #line 2 "src/src/glsl/glcpp/glcpp-lex.l" 567 /* 568 * Copyright 2010 Intel Corporation 569 * 570 * Permission is hereby granted, free of charge, to any person obtaining a 571 * copy of this software and associated documentation files (the "Software"), 572 * to deal in the Software without restriction, including without limitation 573 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 574 * and/or sell copies of the Software, and to permit persons to whom the 575 * Software is furnished to do so, subject to the following conditions: 576 * 577 * The above copyright notice and this permission notice (including the next 578 * paragraph) shall be included in all copies or substantial portions of the 579 * Software. 580 * 581 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 582 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 583 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 584 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 585 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 586 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 587 * DEALINGS IN THE SOFTWARE. 588 */ 589 590 #include <stdio.h> 591 #include <string.h> 592 #include <ctype.h> 593 594 #include "glcpp.h" 595 #include "glcpp-parse.h" 596 597 /* Flex annoyingly generates some functions without making them 598 * static. Let's declare them here. */ 599 int glcpp_get_column (yyscan_t yyscanner); 600 void glcpp_set_column (int column_no , yyscan_t yyscanner); 601 602 #ifdef _MSC_VER 603 #define YY_NO_UNISTD_H 604 #endif 605 606 #define YY_NO_INPUT 607 608 #define YY_USER_ACTION \ 609 do { \ 610 if (parser->has_new_line_number) \ 611 yylineno = parser->new_line_number; \ 612 if (parser->has_new_source_number) \ 613 yylloc->source = parser->new_source_number; \ 614 yylloc->first_column = yycolumn + 1; \ 615 yylloc->first_line = yylineno; \ 616 yycolumn += yyleng; \ 617 parser->has_new_line_number = 0; \ 618 parser->has_new_source_number = 0; \ 619 } while(0); 620 621 #define YY_USER_INIT \ 622 do { \ 623 yylineno = 1; \ 624 yycolumn = 1; \ 625 yylloc->source = 0; \ 626 } while(0) 627 628 /* The OTHER class is simply a catch-all for things that the CPP 629 parser just doesn't care about. Since flex regular expressions that 630 match longer strings take priority over those matching shorter 631 strings, we have to be careful to avoid OTHER matching and hiding 632 something that CPP does care about. So we simply exclude all 633 characters that appear in any other expressions. */ 634 #line 635 "src/chromium_gensrc/mesa/glcpp-lex.c" 635 636 #define INITIAL 0 637 #define DONE 1 638 #define COMMENT 2 639 #define UNREACHABLE 3 640 #define SKIP 4 641 #define DEFINE 5 642 643 #define YY_EXTRA_TYPE glcpp_parser_t * 644 645 /* Holds the entire state of the reentrant scanner. */ 646 struct yyguts_t 647 { 648 649 /* User-defined. Not touched by flex. */ 650 YY_EXTRA_TYPE yyextra_r; 651 652 /* The rest are the same as the globals declared in the non-reentrant scanner. */ 653 FILE *yyin_r, *yyout_r; 654 size_t yy_buffer_stack_top; /**< index of top of stack. */ 655 size_t yy_buffer_stack_max; /**< capacity of stack. */ 656 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ 657 char yy_hold_char; 658 int yy_n_chars; 659 int yyleng_r; 660 char *yy_c_buf_p; 661 int yy_init; 662 int yy_start; 663 int yy_did_buffer_switch_on_eof; 664 int yy_start_stack_ptr; 665 int yy_start_stack_depth; 666 int *yy_start_stack; 667 yy_state_type yy_last_accepting_state; 668 char* yy_last_accepting_cpos; 669 670 int yylineno_r; 671 int yy_flex_debug_r; 672 673 char *yytext_r; 674 int yy_more_flag; 675 int yy_more_len; 676 677 YYSTYPE * yylval_r; 678 679 YYLTYPE * yylloc_r; 680 681 }; /* end struct yyguts_t */ 682 683 static int yy_init_globals (yyscan_t yyscanner ); 684 685 /* This must go here because YYSTYPE and YYLTYPE are included 686 * from bison output in section 1.*/ 687 # define yylval yyg->yylval_r 688 689 # define yylloc yyg->yylloc_r 690 691 int glcpp_lex_init (yyscan_t* scanner); 692 693 int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); 694 695 /* Accessor methods to globals. 696 These are made visible to non-reentrant scanners for convenience. */ 697 698 int glcpp_lex_destroy (yyscan_t yyscanner ); 699 700 int glcpp_get_debug (yyscan_t yyscanner ); 701 702 void glcpp_set_debug (int debug_flag ,yyscan_t yyscanner ); 703 704 YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner ); 705 706 void glcpp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); 707 708 FILE *glcpp_get_in (yyscan_t yyscanner ); 709 710 void glcpp_set_in (FILE * in_str ,yyscan_t yyscanner ); 711 712 FILE *glcpp_get_out (yyscan_t yyscanner ); 713 714 void glcpp_set_out (FILE * out_str ,yyscan_t yyscanner ); 715 716 int glcpp_get_leng (yyscan_t yyscanner ); 717 718 char *glcpp_get_text (yyscan_t yyscanner ); 719 720 int glcpp_get_lineno (yyscan_t yyscanner ); 721 722 void glcpp_set_lineno (int line_number ,yyscan_t yyscanner ); 723 724 YYSTYPE * glcpp_get_lval (yyscan_t yyscanner ); 725 726 void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); 727 728 YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner ); 729 730 void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); 731 732 /* Macros after this point can all be overridden by user definitions in 733 * section 1. 734 */ 735 736 #ifndef YY_SKIP_YYWRAP 737 #ifdef __cplusplus 738 extern "C" int glcpp_wrap (yyscan_t yyscanner ); 739 #else 740 extern int glcpp_wrap (yyscan_t yyscanner ); 741 #endif 742 #endif 743 744 static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); 745 746 #ifndef yytext_ptr 747 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); 748 #endif 749 750 #ifdef YY_NEED_STRLEN 751 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); 752 #endif 753 754 #ifndef YY_NO_INPUT 755 756 #ifdef __cplusplus 757 static int yyinput (yyscan_t yyscanner ); 758 #else 759 static int input (yyscan_t yyscanner ); 760 #endif 761 762 #endif 763 764 static void yy_push_state (int new_state ,yyscan_t yyscanner); 765 766 static void yy_pop_state (yyscan_t yyscanner ); 767 768 static int yy_top_state (yyscan_t yyscanner ); 769 770 /* Amount of stuff to slurp up with each read. */ 771 #ifndef YY_READ_BUF_SIZE 772 #ifdef __ia64__ 773 /* On IA-64, the buffer size is 16k, not 8k */ 774 #define YY_READ_BUF_SIZE 16384 775 #else 776 #define YY_READ_BUF_SIZE 8192 777 #endif /* __ia64__ */ 778 #endif 779 780 /* Copy whatever the last rule matched to the standard output. */ 781 #ifndef ECHO 782 /* This used to be an fputs(), but since the string might contain NUL's, 783 * we now use fwrite(). 784 */ 785 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) 786 #endif 787 788 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 789 * is returned in "result". 790 */ 791 #ifndef YY_INPUT 792 #define YY_INPUT(buf,result,max_size) \ 793 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 794 { \ 795 int c = '*'; \ 796 size_t n; \ 797 for ( n = 0; n < max_size && \ 798 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 799 buf[n] = (char) c; \ 800 if ( c == '\n' ) \ 801 buf[n++] = (char) c; \ 802 if ( c == EOF && ferror( yyin ) ) \ 803 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 804 result = n; \ 805 } \ 806 else \ 807 { \ 808 errno=0; \ 809 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 810 { \ 811 if( errno != EINTR) \ 812 { \ 813 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 814 break; \ 815 } \ 816 errno=0; \ 817 clearerr(yyin); \ 818 } \ 819 }\ 820 \ 821 822 #endif 823 824 /* No semi-colon after return; correct usage is to write "yyterminate();" - 825 * we don't want an extra ';' after the "return" because that will cause 826 * some compilers to complain about unreachable statements. 827 */ 828 #ifndef yyterminate 829 #define yyterminate() return YY_NULL 830 #endif 831 832 /* Number of entries by which start-condition stack grows. */ 833 #ifndef YY_START_STACK_INCR 834 #define YY_START_STACK_INCR 25 835 #endif 836 837 /* Report a fatal error. */ 838 #ifndef YY_FATAL_ERROR 839 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) 840 #endif 841 842 /* end tables serialization structures and prototypes */ 843 844 /* Default declaration of generated scanner - a define so the user can 845 * easily add parameters. 846 */ 847 #ifndef YY_DECL 848 #define YY_DECL_IS_OURS 1 849 850 extern int glcpp_lex \ 851 (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); 852 853 #define YY_DECL int glcpp_lex \ 854 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) 855 #endif /* !YY_DECL */ 856 857 /* Code executed at the beginning of each rule, after yytext and yyleng 858 * have been set up. 859 */ 860 #ifndef YY_USER_ACTION 861 #define YY_USER_ACTION 862 #endif 863 864 /* Code executed at the end of each rule. */ 865 #ifndef YY_BREAK 866 #define YY_BREAK break; 867 #endif 868 869 #define YY_RULE_SETUP \ 870 if ( yyleng > 0 ) \ 871 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ 872 (yytext[yyleng - 1] == '\n'); \ 873 YY_USER_ACTION 874 875 /** The main scanner function which does all the work. 876 */ 877 YY_DECL 878 { 879 register yy_state_type yy_current_state; 880 register char *yy_cp, *yy_bp; 881 register int yy_act; 882 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 883 884 #line 94 "src/src/glsl/glcpp/glcpp-lex.l" 885 886 /* Implicitly switch between SKIP and INITIAL (non-skipping); 887 * don't switch if some other state was explicitly set. 888 */ 889 glcpp_parser_t *parser = yyextra; 890 if (YY_START == 0 || YY_START == SKIP) { 891 if (parser->lexing_if || parser->skip_stack == NULL || parser->skip_stack->type == SKIP_NO_SKIP) { 892 BEGIN 0; 893 } else { 894 BEGIN SKIP; 895 } 896 } 897 898 /* Single-line comments */ 899 #line 900 "src/chromium_gensrc/mesa/glcpp-lex.c" 900 901 yylval = yylval_param; 902 903 yylloc = yylloc_param; 904 905 if ( !yyg->yy_init ) 906 { 907 yyg->yy_init = 1; 908 909 #ifdef YY_USER_INIT 910 YY_USER_INIT; 911 #endif 912 913 if ( ! yyg->yy_start ) 914 yyg->yy_start = 1; /* first start state */ 915 916 if ( ! yyin ) 917 yyin = stdin; 918 919 if ( ! yyout ) 920 yyout = stdout; 921 922 if ( ! YY_CURRENT_BUFFER ) { 923 glcpp_ensure_buffer_stack (yyscanner); 924 YY_CURRENT_BUFFER_LVALUE = 925 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 926 } 927 928 glcpp__load_buffer_state(yyscanner ); 929 } 930 931 while ( 1 ) /* loops until end-of-file is reached */ 932 { 933 yy_cp = yyg->yy_c_buf_p; 934 935 /* Support of yytext. */ 936 *yy_cp = yyg->yy_hold_char; 937 938 /* yy_bp points to the position in yy_ch_buf of the start of 939 * the current run. 940 */ 941 yy_bp = yy_cp; 942 943 yy_current_state = yyg->yy_start; 944 yy_current_state += YY_AT_BOL(); 945 yy_match: 946 do 947 { 948 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 949 if ( yy_accept[yy_current_state] ) 950 { 951 yyg->yy_last_accepting_state = yy_current_state; 952 yyg->yy_last_accepting_cpos = yy_cp; 953 } 954 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 955 { 956 yy_current_state = (int) yy_def[yy_current_state]; 957 if ( yy_current_state >= 147 ) 958 yy_c = yy_meta[(unsigned int) yy_c]; 959 } 960 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 961 ++yy_cp; 962 } 963 while ( yy_current_state != 146 ); 964 yy_cp = yyg->yy_last_accepting_cpos; 965 yy_current_state = yyg->yy_last_accepting_state; 966 967 yy_find_action: 968 yy_act = yy_accept[yy_current_state]; 969 970 YY_DO_BEFORE_ACTION; 971 972 do_action: /* This label is used only to access EOF actions. */ 973 974 switch ( yy_act ) 975 { /* beginning of action switch */ 976 case 0: /* must back up */ 977 /* undo the effects of YY_DO_BEFORE_ACTION */ 978 *yy_cp = yyg->yy_hold_char; 979 yy_cp = yyg->yy_last_accepting_cpos; 980 yy_current_state = yyg->yy_last_accepting_state; 981 goto yy_find_action; 982 983 case 1: 984 YY_RULE_SETUP 985 #line 108 "src/src/glsl/glcpp/glcpp-lex.l" 986 { 987 } 988 YY_BREAK 989 /* Multi-line comments */ 990 case 2: 991 YY_RULE_SETUP 992 #line 112 "src/src/glsl/glcpp/glcpp-lex.l" 993 { yy_push_state(COMMENT, yyscanner); } 994 YY_BREAK 995 case 3: 996 YY_RULE_SETUP 997 #line 113 "src/src/glsl/glcpp/glcpp-lex.l" 998 999 YY_BREAK 1000 case 4: 1001 /* rule 4 can match eol */ 1002 YY_RULE_SETUP 1003 #line 114 "src/src/glsl/glcpp/glcpp-lex.l" 1004 { yylineno++; yycolumn = 0; return NEWLINE; } 1005 YY_BREAK 1006 case 5: 1007 YY_RULE_SETUP 1008 #line 115 "src/src/glsl/glcpp/glcpp-lex.l" 1009 1010 YY_BREAK 1011 case 6: 1012 /* rule 6 can match eol */ 1013 YY_RULE_SETUP 1014 #line 116 "src/src/glsl/glcpp/glcpp-lex.l" 1015 { yylineno++; yycolumn = 0; return NEWLINE; } 1016 YY_BREAK 1017 case 7: 1018 YY_RULE_SETUP 1019 #line 117 "src/src/glsl/glcpp/glcpp-lex.l" 1020 { 1021 yy_pop_state(yyscanner); 1022 if (yyextra->space_tokens) 1023 return SPACE; 1024 } 1025 YY_BREAK 1026 case 8: 1027 YY_RULE_SETUP 1028 #line 123 "src/src/glsl/glcpp/glcpp-lex.l" 1029 { 1030 yylval->str = ralloc_strdup (yyextra, yytext); 1031 yyextra->space_tokens = 0; 1032 return HASH_VERSION; 1033 } 1034 YY_BREAK 1035 /* glcpp doesn't handle #extension, #version, or #pragma directives. 1036 * Simply pass them through to the main compiler's lexer/parser. */ 1037 case 9: 1038 YY_RULE_SETUP 1039 #line 131 "src/src/glsl/glcpp/glcpp-lex.l" 1040 { 1041 yylval->str = ralloc_strdup (yyextra, yytext); 1042 yylineno++; 1043 yycolumn = 0; 1044 return OTHER; 1045 } 1046 YY_BREAK 1047 case 10: 1048 YY_RULE_SETUP 1049 #line 138 "src/src/glsl/glcpp/glcpp-lex.l" 1050 { 1051 return HASH_LINE; 1052 } 1053 YY_BREAK 1054 1055 case 11: 1056 YY_RULE_SETUP 1057 #line 143 "src/src/glsl/glcpp/glcpp-lex.l" 1058 { 1059 yyextra->lexing_if = 1; 1060 yyextra->space_tokens = 0; 1061 return HASH_IFDEF; 1062 } 1063 YY_BREAK 1064 case 12: 1065 YY_RULE_SETUP 1066 #line 149 "src/src/glsl/glcpp/glcpp-lex.l" 1067 { 1068 yyextra->lexing_if = 1; 1069 yyextra->space_tokens = 0; 1070 return HASH_IFNDEF; 1071 } 1072 YY_BREAK 1073 case 13: 1074 /* rule 13 can match eol */ 1075 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ 1076 yyg->yy_c_buf_p = yy_cp -= 1; 1077 YY_DO_BEFORE_ACTION; /* set up yytext again */ 1078 YY_RULE_SETUP 1079 #line 155 "src/src/glsl/glcpp/glcpp-lex.l" 1080 { 1081 yyextra->lexing_if = 1; 1082 yyextra->space_tokens = 0; 1083 return HASH_IF; 1084 } 1085 YY_BREAK 1086 case 14: 1087 YY_RULE_SETUP 1088 #line 161 "src/src/glsl/glcpp/glcpp-lex.l" 1089 { 1090 yyextra->lexing_if = 1; 1091 yyextra->space_tokens = 0; 1092 return HASH_ELIF; 1093 } 1094 YY_BREAK 1095 case 15: 1096 YY_RULE_SETUP 1097 #line 167 "src/src/glsl/glcpp/glcpp-lex.l" 1098 { 1099 yyextra->space_tokens = 0; 1100 return HASH_ELSE; 1101 } 1102 YY_BREAK 1103 case 16: 1104 YY_RULE_SETUP 1105 #line 172 "src/src/glsl/glcpp/glcpp-lex.l" 1106 { 1107 yyextra->space_tokens = 0; 1108 return HASH_ENDIF; 1109 } 1110 YY_BREAK 1111 1112 case 17: 1113 YY_RULE_SETUP 1114 #line 178 "src/src/glsl/glcpp/glcpp-lex.l" 1115 ; 1116 YY_BREAK 1117 case 18: 1118 YY_RULE_SETUP 1119 #line 180 "src/src/glsl/glcpp/glcpp-lex.l" 1120 { 1121 char *p; 1122 for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ 1123 p += 5; /* skip "error" */ 1124 glcpp_error(yylloc, yyextra, "#error%s", p); 1125 } 1126 YY_BREAK 1127 case 19: 1128 YY_RULE_SETUP 1129 #line 187 "src/src/glsl/glcpp/glcpp-lex.l" 1130 { 1131 yyextra->space_tokens = 0; 1132 yy_push_state(DEFINE, yyscanner); 1133 return HASH_DEFINE; 1134 } 1135 YY_BREAK 1136 case 20: 1137 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ 1138 yyg->yy_c_buf_p = yy_cp -= 1; 1139 YY_DO_BEFORE_ACTION; /* set up yytext again */ 1140 YY_RULE_SETUP 1141 #line 193 "src/src/glsl/glcpp/glcpp-lex.l" 1142 { 1143 yy_pop_state(yyscanner); 1144 yylval->str = ralloc_strdup (yyextra, yytext); 1145 return FUNC_IDENTIFIER; 1146 } 1147 YY_BREAK 1148 case 21: 1149 YY_RULE_SETUP 1150 #line 199 "src/src/glsl/glcpp/glcpp-lex.l" 1151 { 1152 yy_pop_state(yyscanner); 1153 yylval->str = ralloc_strdup (yyextra, yytext); 1154 return OBJ_IDENTIFIER; 1155 } 1156 YY_BREAK 1157 case 22: 1158 YY_RULE_SETUP 1159 #line 205 "src/src/glsl/glcpp/glcpp-lex.l" 1160 { 1161 yyextra->space_tokens = 0; 1162 return HASH_UNDEF; 1163 } 1164 YY_BREAK 1165 case 23: 1166 YY_RULE_SETUP 1167 #line 210 "src/src/glsl/glcpp/glcpp-lex.l" 1168 { 1169 yyextra->space_tokens = 0; 1170 return HASH; 1171 } 1172 YY_BREAK 1173 case 24: 1174 YY_RULE_SETUP 1175 #line 215 "src/src/glsl/glcpp/glcpp-lex.l" 1176 { 1177 yylval->str = ralloc_strdup (yyextra, yytext); 1178 return INTEGER_STRING; 1179 } 1180 YY_BREAK 1181 case 25: 1182 YY_RULE_SETUP 1183 #line 220 "src/src/glsl/glcpp/glcpp-lex.l" 1184 { 1185 yylval->str = ralloc_strdup (yyextra, yytext); 1186 return INTEGER_STRING; 1187 } 1188 YY_BREAK 1189 case 26: 1190 YY_RULE_SETUP 1191 #line 225 "src/src/glsl/glcpp/glcpp-lex.l" 1192 { 1193 yylval->str = ralloc_strdup (yyextra, yytext); 1194 return INTEGER_STRING; 1195 } 1196 YY_BREAK 1197 case 27: 1198 YY_RULE_SETUP 1199 #line 230 "src/src/glsl/glcpp/glcpp-lex.l" 1200 { 1201 return LEFT_SHIFT; 1202 } 1203 YY_BREAK 1204 case 28: 1205 YY_RULE_SETUP 1206 #line 234 "src/src/glsl/glcpp/glcpp-lex.l" 1207 { 1208 return RIGHT_SHIFT; 1209 } 1210 YY_BREAK 1211 case 29: 1212 YY_RULE_SETUP 1213 #line 238 "src/src/glsl/glcpp/glcpp-lex.l" 1214 { 1215 return LESS_OR_EQUAL; 1216 } 1217 YY_BREAK 1218 case 30: 1219 YY_RULE_SETUP 1220 #line 242 "src/src/glsl/glcpp/glcpp-lex.l" 1221 { 1222 return GREATER_OR_EQUAL; 1223 } 1224 YY_BREAK 1225 case 31: 1226 YY_RULE_SETUP 1227 #line 246 "src/src/glsl/glcpp/glcpp-lex.l" 1228 { 1229 return EQUAL; 1230 } 1231 YY_BREAK 1232 case 32: 1233 YY_RULE_SETUP 1234 #line 250 "src/src/glsl/glcpp/glcpp-lex.l" 1235 { 1236 return NOT_EQUAL; 1237 } 1238 YY_BREAK 1239 case 33: 1240 YY_RULE_SETUP 1241 #line 254 "src/src/glsl/glcpp/glcpp-lex.l" 1242 { 1243 return AND; 1244 } 1245 YY_BREAK 1246 case 34: 1247 YY_RULE_SETUP 1248 #line 258 "src/src/glsl/glcpp/glcpp-lex.l" 1249 { 1250 return OR; 1251 } 1252 YY_BREAK 1253 case 35: 1254 YY_RULE_SETUP 1255 #line 262 "src/src/glsl/glcpp/glcpp-lex.l" 1256 { 1257 return PASTE; 1258 } 1259 YY_BREAK 1260 case 36: 1261 YY_RULE_SETUP 1262 #line 266 "src/src/glsl/glcpp/glcpp-lex.l" 1263 { 1264 return DEFINED; 1265 } 1266 YY_BREAK 1267 case 37: 1268 YY_RULE_SETUP 1269 #line 270 "src/src/glsl/glcpp/glcpp-lex.l" 1270 { 1271 yylval->str = ralloc_strdup (yyextra, yytext); 1272 return IDENTIFIER; 1273 } 1274 YY_BREAK 1275 case 38: 1276 YY_RULE_SETUP 1277 #line 275 "src/src/glsl/glcpp/glcpp-lex.l" 1278 { 1279 return yytext[0]; 1280 } 1281 YY_BREAK 1282 case 39: 1283 YY_RULE_SETUP 1284 #line 279 "src/src/glsl/glcpp/glcpp-lex.l" 1285 { 1286 yylval->str = ralloc_strdup (yyextra, yytext); 1287 return OTHER; 1288 } 1289 YY_BREAK 1290 case 40: 1291 YY_RULE_SETUP 1292 #line 284 "src/src/glsl/glcpp/glcpp-lex.l" 1293 { 1294 if (yyextra->space_tokens) { 1295 return SPACE; 1296 } 1297 } 1298 YY_BREAK 1299 case 41: 1300 /* rule 41 can match eol */ 1301 YY_RULE_SETUP 1302 #line 290 "src/src/glsl/glcpp/glcpp-lex.l" 1303 { 1304 yyextra->lexing_if = 0; 1305 yylineno++; 1306 yycolumn = 0; 1307 return NEWLINE; 1308 } 1309 YY_BREAK 1310 /* Handle missing newline at EOF. */ 1311 case YY_STATE_EOF(INITIAL): 1312 #line 298 "src/src/glsl/glcpp/glcpp-lex.l" 1313 { 1314 BEGIN DONE; /* Don't keep matching this rule forever. */ 1315 yyextra->lexing_if = 0; 1316 return NEWLINE; 1317 } 1318 YY_BREAK 1319 /* We don't actually use the UNREACHABLE start condition. We 1320 only have this action here so that we can pretend to call some 1321 generated functions, (to avoid "defined but not used" 1322 warnings. */ 1323 case 42: 1324 YY_RULE_SETUP 1325 #line 308 "src/src/glsl/glcpp/glcpp-lex.l" 1326 { 1327 unput('.'); 1328 yy_top_state(yyextra); 1329 } 1330 YY_BREAK 1331 case 43: 1332 YY_RULE_SETUP 1333 #line 313 "src/src/glsl/glcpp/glcpp-lex.l" 1334 ECHO; 1335 YY_BREAK 1336 #line 1337 "src/chromium_gensrc/mesa/glcpp-lex.c" 1337 case YY_STATE_EOF(DONE): 1338 case YY_STATE_EOF(COMMENT): 1339 case YY_STATE_EOF(UNREACHABLE): 1340 case YY_STATE_EOF(SKIP): 1341 case YY_STATE_EOF(DEFINE): 1342 yyterminate(); 1343 1344 case YY_END_OF_BUFFER: 1345 { 1346 /* Amount of text matched not including the EOB char. */ 1347 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; 1348 1349 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1350 *yy_cp = yyg->yy_hold_char; 1351 YY_RESTORE_YY_MORE_OFFSET 1352 1353 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1354 { 1355 /* We're scanning a new file or input source. It's 1356 * possible that this happened because the user 1357 * just pointed yyin at a new source and called 1358 * glcpp_lex(). If so, then we have to assure 1359 * consistency between YY_CURRENT_BUFFER and our 1360 * globals. Here is the right place to do so, because 1361 * this is the first action (other than possibly a 1362 * back-up) that will match for the new input source. 1363 */ 1364 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1365 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 1366 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1367 } 1368 1369 /* Note that here we test for yy_c_buf_p "<=" to the position 1370 * of the first EOB in the buffer, since yy_c_buf_p will 1371 * already have been incremented past the NUL character 1372 * (since all states make transitions on EOB to the 1373 * end-of-buffer state). Contrast this with the test 1374 * in input(). 1375 */ 1376 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1377 { /* This was really a NUL. */ 1378 yy_state_type yy_next_state; 1379 1380 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; 1381 1382 yy_current_state = yy_get_previous_state( yyscanner ); 1383 1384 /* Okay, we're now positioned to make the NUL 1385 * transition. We couldn't have 1386 * yy_get_previous_state() go ahead and do it 1387 * for us because it doesn't know how to deal 1388 * with the possibility of jamming (and we don't 1389 * want to build jamming into it because then it 1390 * will run more slowly). 1391 */ 1392 1393 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); 1394 1395 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1396 1397 if ( yy_next_state ) 1398 { 1399 /* Consume the NUL. */ 1400 yy_cp = ++yyg->yy_c_buf_p; 1401 yy_current_state = yy_next_state; 1402 goto yy_match; 1403 } 1404 1405 else 1406 { 1407 yy_cp = yyg->yy_last_accepting_cpos; 1408 yy_current_state = yyg->yy_last_accepting_state; 1409 goto yy_find_action; 1410 } 1411 } 1412 1413 else switch ( yy_get_next_buffer( yyscanner ) ) 1414 { 1415 case EOB_ACT_END_OF_FILE: 1416 { 1417 yyg->yy_did_buffer_switch_on_eof = 0; 1418 1419 if ( glcpp_wrap(yyscanner ) ) 1420 { 1421 /* Note: because we've taken care in 1422 * yy_get_next_buffer() to have set up 1423 * yytext, we can now set up 1424 * yy_c_buf_p so that if some total 1425 * hoser (like flex itself) wants to 1426 * call the scanner after we return the 1427 * YY_NULL, it'll still work - another 1428 * YY_NULL will get returned. 1429 */ 1430 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; 1431 1432 yy_act = YY_STATE_EOF(YY_START); 1433 goto do_action; 1434 } 1435 1436 else 1437 { 1438 if ( ! yyg->yy_did_buffer_switch_on_eof ) 1439 YY_NEW_FILE; 1440 } 1441 break; 1442 } 1443 1444 case EOB_ACT_CONTINUE_SCAN: 1445 yyg->yy_c_buf_p = 1446 yyg->yytext_ptr + yy_amount_of_matched_text; 1447 1448 yy_current_state = yy_get_previous_state( yyscanner ); 1449 1450 yy_cp = yyg->yy_c_buf_p; 1451 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1452 goto yy_match; 1453 1454 case EOB_ACT_LAST_MATCH: 1455 yyg->yy_c_buf_p = 1456 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; 1457 1458 yy_current_state = yy_get_previous_state( yyscanner ); 1459 1460 yy_cp = yyg->yy_c_buf_p; 1461 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1462 goto yy_find_action; 1463 } 1464 break; 1465 } 1466 1467 default: 1468 YY_FATAL_ERROR( 1469 "fatal flex scanner internal error--no action found" ); 1470 } /* end of action switch */ 1471 } /* end of scanning one token */ 1472 } /* end of glcpp_lex */ 1473 1474 /* yy_get_next_buffer - try to read in a new buffer 1475 * 1476 * Returns a code representing an action: 1477 * EOB_ACT_LAST_MATCH - 1478 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1479 * EOB_ACT_END_OF_FILE - end of file 1480 */ 1481 static int yy_get_next_buffer (yyscan_t yyscanner) 1482 { 1483 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1484 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1485 register char *source = yyg->yytext_ptr; 1486 register int number_to_move, i; 1487 int ret_val; 1488 1489 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) 1490 YY_FATAL_ERROR( 1491 "fatal flex scanner internal error--end of buffer missed" ); 1492 1493 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1494 { /* Don't try to fill the buffer, so this is an EOF. */ 1495 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) 1496 { 1497 /* We matched a single character, the EOB, so 1498 * treat this as a final EOF. 1499 */ 1500 return EOB_ACT_END_OF_FILE; 1501 } 1502 1503 else 1504 { 1505 /* We matched some text prior to the EOB, first 1506 * process it. 1507 */ 1508 return EOB_ACT_LAST_MATCH; 1509 } 1510 } 1511 1512 /* Try to read more data. */ 1513 1514 /* First move last chars to start of buffer. */ 1515 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; 1516 1517 for ( i = 0; i < number_to_move; ++i ) 1518 *(dest++) = *(source++); 1519 1520 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1521 /* don't do the read, it's not guaranteed to return an EOF, 1522 * just force an EOF 1523 */ 1524 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; 1525 1526 else 1527 { 1528 int num_to_read = 1529 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1530 1531 while ( num_to_read <= 0 ) 1532 { /* Not enough room in the buffer - grow it. */ 1533 1534 /* just a shorter name for the current buffer */ 1535 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1536 1537 int yy_c_buf_p_offset = 1538 (int) (yyg->yy_c_buf_p - b->yy_ch_buf); 1539 1540 if ( b->yy_is_our_buffer ) 1541 { 1542 int new_size = b->yy_buf_size * 2; 1543 1544 if ( new_size <= 0 ) 1545 b->yy_buf_size += b->yy_buf_size / 8; 1546 else 1547 b->yy_buf_size *= 2; 1548 1549 b->yy_ch_buf = (char *) 1550 /* Include room in for 2 EOB chars. */ 1551 glcpp_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); 1552 } 1553 else 1554 /* Can't grow it, we don't own it. */ 1555 b->yy_ch_buf = 0; 1556 1557 if ( ! b->yy_ch_buf ) 1558 YY_FATAL_ERROR( 1559 "fatal error - scanner input buffer overflow" ); 1560 1561 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; 1562 1563 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1564 number_to_move - 1; 1565 1566 } 1567 1568 if ( num_to_read > YY_READ_BUF_SIZE ) 1569 num_to_read = YY_READ_BUF_SIZE; 1570 1571 /* Read in more data. */ 1572 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1573 yyg->yy_n_chars, (size_t) num_to_read ); 1574 1575 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1576 } 1577 1578 if ( yyg->yy_n_chars == 0 ) 1579 { 1580 if ( number_to_move == YY_MORE_ADJ ) 1581 { 1582 ret_val = EOB_ACT_END_OF_FILE; 1583 glcpp_restart(yyin ,yyscanner); 1584 } 1585 1586 else 1587 { 1588 ret_val = EOB_ACT_LAST_MATCH; 1589 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1590 YY_BUFFER_EOF_PENDING; 1591 } 1592 } 1593 1594 else 1595 ret_val = EOB_ACT_CONTINUE_SCAN; 1596 1597 if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1598 /* Extend the array by 50%, plus the number we really need. */ 1599 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); 1600 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); 1601 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1602 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1603 } 1604 1605 yyg->yy_n_chars += number_to_move; 1606 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; 1607 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; 1608 1609 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1610 1611 return ret_val; 1612 } 1613 1614 /* yy_get_previous_state - get the state just before the EOB char was reached */ 1615 1616 static yy_state_type yy_get_previous_state (yyscan_t yyscanner) 1617 { 1618 register yy_state_type yy_current_state; 1619 register char *yy_cp; 1620 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1621 1622 yy_current_state = yyg->yy_start; 1623 yy_current_state += YY_AT_BOL(); 1624 1625 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) 1626 { 1627 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1628 if ( yy_accept[yy_current_state] ) 1629 { 1630 yyg->yy_last_accepting_state = yy_current_state; 1631 yyg->yy_last_accepting_cpos = yy_cp; 1632 } 1633 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1634 { 1635 yy_current_state = (int) yy_def[yy_current_state]; 1636 if ( yy_current_state >= 147 ) 1637 yy_c = yy_meta[(unsigned int) yy_c]; 1638 } 1639 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1640 } 1641 1642 return yy_current_state; 1643 } 1644 1645 /* yy_try_NUL_trans - try to make a transition on the NUL character 1646 * 1647 * synopsis 1648 * next_state = yy_try_NUL_trans( current_state ); 1649 */ 1650 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) 1651 { 1652 register int yy_is_jam; 1653 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ 1654 register char *yy_cp = yyg->yy_c_buf_p; 1655 1656 register YY_CHAR yy_c = 1; 1657 if ( yy_accept[yy_current_state] ) 1658 { 1659 yyg->yy_last_accepting_state = yy_current_state; 1660 yyg->yy_last_accepting_cpos = yy_cp; 1661 } 1662 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1663 { 1664 yy_current_state = (int) yy_def[yy_current_state]; 1665 if ( yy_current_state >= 147 ) 1666 yy_c = yy_meta[(unsigned int) yy_c]; 1667 } 1668 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1669 yy_is_jam = (yy_current_state == 146); 1670 1671 return yy_is_jam ? 0 : yy_current_state; 1672 } 1673 1674 static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) 1675 { 1676 register char *yy_cp; 1677 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1678 1679 yy_cp = yyg->yy_c_buf_p; 1680 1681 /* undo effects of setting up yytext */ 1682 *yy_cp = yyg->yy_hold_char; 1683 1684 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1685 { /* need to shift things up to make room */ 1686 /* +2 for EOB chars. */ 1687 register int number_to_move = yyg->yy_n_chars + 2; 1688 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ 1689 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; 1690 register char *source = 1691 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; 1692 1693 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1694 *--dest = *--source; 1695 1696 yy_cp += (int) (dest - source); 1697 yy_bp += (int) (dest - source); 1698 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = 1699 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; 1700 1701 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1702 YY_FATAL_ERROR( "flex scanner push-back overflow" ); 1703 } 1704 1705 *--yy_cp = (char) c; 1706 1707 yyg->yytext_ptr = yy_bp; 1708 yyg->yy_hold_char = *yy_cp; 1709 yyg->yy_c_buf_p = yy_cp; 1710 } 1711 1712 #ifndef YY_NO_INPUT 1713 #ifdef __cplusplus 1714 static int yyinput (yyscan_t yyscanner) 1715 #else 1716 static int input (yyscan_t yyscanner) 1717 #endif 1718 1719 { 1720 int c; 1721 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1722 1723 *yyg->yy_c_buf_p = yyg->yy_hold_char; 1724 1725 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) 1726 { 1727 /* yy_c_buf_p now points to the character we want to return. 1728 * If this occurs *before* the EOB characters, then it's a 1729 * valid NUL; if not, then we've hit the end of the buffer. 1730 */ 1731 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1732 /* This was really a NUL. */ 1733 *yyg->yy_c_buf_p = '\0'; 1734 1735 else 1736 { /* need more input */ 1737 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 1738 ++yyg->yy_c_buf_p; 1739 1740 switch ( yy_get_next_buffer( yyscanner ) ) 1741 { 1742 case EOB_ACT_LAST_MATCH: 1743 /* This happens because yy_g_n_b() 1744 * sees that we've accumulated a 1745 * token and flags that we need to 1746 * try matching the token before 1747 * proceeding. But for input(), 1748 * there's no matching to consider. 1749 * So convert the EOB_ACT_LAST_MATCH 1750 * to EOB_ACT_END_OF_FILE. 1751 */ 1752 1753 /* Reset buffer status. */ 1754 glcpp_restart(yyin ,yyscanner); 1755 1756 /*FALLTHROUGH*/ 1757 1758 case EOB_ACT_END_OF_FILE: 1759 { 1760 if ( glcpp_wrap(yyscanner ) ) 1761 return EOF; 1762 1763 if ( ! yyg->yy_did_buffer_switch_on_eof ) 1764 YY_NEW_FILE; 1765 #ifdef __cplusplus 1766 return yyinput(yyscanner); 1767 #else 1768 return input(yyscanner); 1769 #endif 1770 } 1771 1772 case EOB_ACT_CONTINUE_SCAN: 1773 yyg->yy_c_buf_p = yyg->yytext_ptr + offset; 1774 break; 1775 } 1776 } 1777 } 1778 1779 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ 1780 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ 1781 yyg->yy_hold_char = *++yyg->yy_c_buf_p; 1782 1783 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); 1784 1785 return c; 1786 } 1787 #endif /* ifndef YY_NO_INPUT */ 1788 1789 /** Immediately switch to a different input stream. 1790 * @param input_file A readable stream. 1791 * @param yyscanner The scanner object. 1792 * @note This function does not reset the start condition to @c INITIAL . 1793 */ 1794 void glcpp_restart (FILE * input_file , yyscan_t yyscanner) 1795 { 1796 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1797 1798 if ( ! YY_CURRENT_BUFFER ){ 1799 glcpp_ensure_buffer_stack (yyscanner); 1800 YY_CURRENT_BUFFER_LVALUE = 1801 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 1802 } 1803 1804 glcpp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); 1805 glcpp__load_buffer_state(yyscanner ); 1806 } 1807 1808 /** Switch to a different input buffer. 1809 * @param new_buffer The new input buffer. 1810 * @param yyscanner The scanner object. 1811 */ 1812 void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 1813 { 1814 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1815 1816 /* TODO. We should be able to replace this entire function body 1817 * with 1818 * glcpp_pop_buffer_state(); 1819 * glcpp_push_buffer_state(new_buffer); 1820 */ 1821 glcpp_ensure_buffer_stack (yyscanner); 1822 if ( YY_CURRENT_BUFFER == new_buffer ) 1823 return; 1824 1825 if ( YY_CURRENT_BUFFER ) 1826 { 1827 /* Flush out information for old buffer. */ 1828 *yyg->yy_c_buf_p = yyg->yy_hold_char; 1829 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 1830 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1831 } 1832 1833 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1834 glcpp__load_buffer_state(yyscanner ); 1835 1836 /* We don't actually know whether we did this switch during 1837 * EOF (glcpp_wrap()) processing, but the only time this flag 1838 * is looked at is after glcpp_wrap() is called, so it's safe 1839 * to go ahead and always set it. 1840 */ 1841 yyg->yy_did_buffer_switch_on_eof = 1; 1842 } 1843 1844 static void glcpp__load_buffer_state (yyscan_t yyscanner) 1845 { 1846 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1847 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1848 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1849 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1850 yyg->yy_hold_char = *yyg->yy_c_buf_p; 1851 } 1852 1853 /** Allocate and initialize an input buffer state. 1854 * @param file A readable stream. 1855 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1856 * @param yyscanner The scanner object. 1857 * @return the allocated buffer state. 1858 */ 1859 YY_BUFFER_STATE glcpp__create_buffer (FILE * file, int size , yyscan_t yyscanner) 1860 { 1861 YY_BUFFER_STATE b; 1862 1863 b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 1864 if ( ! b ) 1865 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" ); 1866 1867 b->yy_buf_size = size; 1868 1869 /* yy_ch_buf has to be 2 characters longer than the size given because 1870 * we need to put in 2 end-of-buffer characters. 1871 */ 1872 b->yy_ch_buf = (char *) glcpp_alloc(b->yy_buf_size + 2 ,yyscanner ); 1873 if ( ! b->yy_ch_buf ) 1874 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" ); 1875 1876 b->yy_is_our_buffer = 1; 1877 1878 glcpp__init_buffer(b,file ,yyscanner); 1879 1880 return b; 1881 } 1882 1883 /** Destroy the buffer. 1884 * @param b a buffer created with glcpp__create_buffer() 1885 * @param yyscanner The scanner object. 1886 */ 1887 void glcpp__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 1888 { 1889 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1890 1891 if ( ! b ) 1892 return; 1893 1894 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1895 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1896 1897 if ( b->yy_is_our_buffer ) 1898 glcpp_free((void *) b->yy_ch_buf ,yyscanner ); 1899 1900 glcpp_free((void *) b ,yyscanner ); 1901 } 1902 1903 /* Initializes or reinitializes a buffer. 1904 * This function is sometimes called more than once on the same buffer, 1905 * such as during a glcpp_restart() or at EOF. 1906 */ 1907 static void glcpp__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) 1908 1909 { 1910 int oerrno = errno; 1911 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1912 1913 glcpp__flush_buffer(b ,yyscanner); 1914 1915 b->yy_input_file = file; 1916 b->yy_fill_buffer = 1; 1917 1918 /* If b is the current buffer, then glcpp__init_buffer was _probably_ 1919 * called from glcpp_restart() or through yy_get_next_buffer. 1920 * In that case, we don't want to reset the lineno or column. 1921 */ 1922 if (b != YY_CURRENT_BUFFER){ 1923 b->yy_bs_lineno = 1; 1924 b->yy_bs_column = 0; 1925 } 1926 1927 b->yy_is_interactive = 0; 1928 1929 errno = oerrno; 1930 } 1931 1932 /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1933 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1934 * @param yyscanner The scanner object. 1935 */ 1936 void glcpp__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 1937 { 1938 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1939 if ( ! b ) 1940 return; 1941 1942 b->yy_n_chars = 0; 1943 1944 /* We always need two end-of-buffer characters. The first causes 1945 * a transition to the end-of-buffer state. The second causes 1946 * a jam in that state. 1947 */ 1948 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1949 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1950 1951 b->yy_buf_pos = &b->yy_ch_buf[0]; 1952 1953 b->yy_at_bol = 1; 1954 b->yy_buffer_status = YY_BUFFER_NEW; 1955 1956 if ( b == YY_CURRENT_BUFFER ) 1957 glcpp__load_buffer_state(yyscanner ); 1958 } 1959 1960 /** Pushes the new state onto the stack. The new state becomes 1961 * the current state. This function will allocate the stack 1962 * if necessary. 1963 * @param new_buffer The new state. 1964 * @param yyscanner The scanner object. 1965 */ 1966 void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 1967 { 1968 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1969 if (new_buffer == NULL) 1970 return; 1971 1972 glcpp_ensure_buffer_stack(yyscanner); 1973 1974 /* This block is copied from glcpp__switch_to_buffer. */ 1975 if ( YY_CURRENT_BUFFER ) 1976 { 1977 /* Flush out information for old buffer. */ 1978 *yyg->yy_c_buf_p = yyg->yy_hold_char; 1979 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 1980 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1981 } 1982 1983 /* Only push if top exists. Otherwise, replace top. */ 1984 if (YY_CURRENT_BUFFER) 1985 yyg->yy_buffer_stack_top++; 1986 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1987 1988 /* copied from glcpp__switch_to_buffer. */ 1989 glcpp__load_buffer_state(yyscanner ); 1990 yyg->yy_did_buffer_switch_on_eof = 1; 1991 } 1992 1993 /** Removes and deletes the top of the stack, if present. 1994 * The next element becomes the new top. 1995 * @param yyscanner The scanner object. 1996 */ 1997 void glcpp_pop_buffer_state (yyscan_t yyscanner) 1998 { 1999 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2000 if (!YY_CURRENT_BUFFER) 2001 return; 2002 2003 glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); 2004 YY_CURRENT_BUFFER_LVALUE = NULL; 2005 if (yyg->yy_buffer_stack_top > 0) 2006 --yyg->yy_buffer_stack_top; 2007 2008 if (YY_CURRENT_BUFFER) { 2009 glcpp__load_buffer_state(yyscanner ); 2010 yyg->yy_did_buffer_switch_on_eof = 1; 2011 } 2012 } 2013 2014 /* Allocates the stack if it does not exist. 2015 * Guarantees space for at least one push. 2016 */ 2017 static void glcpp_ensure_buffer_stack (yyscan_t yyscanner) 2018 { 2019 int num_to_alloc; 2020 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2021 2022 if (!yyg->yy_buffer_stack) { 2023 2024 /* First allocation is just for 2 elements, since we don't know if this 2025 * scanner will even need a stack. We use 2 instead of 1 to avoid an 2026 * immediate realloc on the next call. 2027 */ 2028 num_to_alloc = 1; 2029 yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_alloc 2030 (num_to_alloc * sizeof(struct yy_buffer_state*) 2031 , yyscanner); 2032 if ( ! yyg->yy_buffer_stack ) 2033 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" ); 2034 2035 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 2036 2037 yyg->yy_buffer_stack_max = num_to_alloc; 2038 yyg->yy_buffer_stack_top = 0; 2039 return; 2040 } 2041 2042 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ 2043 2044 /* Increase the buffer to prepare for a possible push. */ 2045 int grow_size = 8 /* arbitrary grow size */; 2046 2047 num_to_alloc = yyg->yy_buffer_stack_max + grow_size; 2048 yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_realloc 2049 (yyg->yy_buffer_stack, 2050 num_to_alloc * sizeof(struct yy_buffer_state*) 2051 , yyscanner); 2052 if ( ! yyg->yy_buffer_stack ) 2053 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" ); 2054 2055 /* zero only the new slots.*/ 2056 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); 2057 yyg->yy_buffer_stack_max = num_to_alloc; 2058 } 2059 } 2060 2061 /** Setup the input buffer state to scan directly from a user-specified character buffer. 2062 * @param base the character buffer 2063 * @param size the size in bytes of the character buffer 2064 * @param yyscanner The scanner object. 2065 * @return the newly allocated buffer state object. 2066 */ 2067 YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) 2068 { 2069 YY_BUFFER_STATE b; 2070 2071 if ( size < 2 || 2072 base[size-2] != YY_END_OF_BUFFER_CHAR || 2073 base[size-1] != YY_END_OF_BUFFER_CHAR ) 2074 /* They forgot to leave room for the EOB's. */ 2075 return 0; 2076 2077 b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 2078 if ( ! b ) 2079 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" ); 2080 2081 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 2082 b->yy_buf_pos = b->yy_ch_buf = base; 2083 b->yy_is_our_buffer = 0; 2084 b->yy_input_file = 0; 2085 b->yy_n_chars = b->yy_buf_size; 2086 b->yy_is_interactive = 0; 2087 b->yy_at_bol = 1; 2088 b->yy_fill_buffer = 0; 2089 b->yy_buffer_status = YY_BUFFER_NEW; 2090 2091 glcpp__switch_to_buffer(b ,yyscanner ); 2092 2093 return b; 2094 } 2095 2096 /** Setup the input buffer state to scan a string. The next call to glcpp_lex() will 2097 * scan from a @e copy of @a str. 2098 * @param yystr a NUL-terminated string to scan 2099 * @param yyscanner The scanner object. 2100 * @return the newly allocated buffer state object. 2101 * @note If you want to scan bytes that may contain NUL values, then use 2102 * glcpp__scan_bytes() instead. 2103 */ 2104 YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner) 2105 { 2106 2107 return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner); 2108 } 2109 2110 /** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will 2111 * scan from a @e copy of @a bytes. 2112 * @param yybytes the byte buffer to scan 2113 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 2114 * @param yyscanner The scanner object. 2115 * @return the newly allocated buffer state object. 2116 */ 2117 YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) 2118 { 2119 YY_BUFFER_STATE b; 2120 char *buf; 2121 yy_size_t n; 2122 int i; 2123 2124 /* Get memory for full buffer, including space for trailing EOB's. */ 2125 n = _yybytes_len + 2; 2126 buf = (char *) glcpp_alloc(n ,yyscanner ); 2127 if ( ! buf ) 2128 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" ); 2129 2130 for ( i = 0; i < _yybytes_len; ++i ) 2131 buf[i] = yybytes[i]; 2132 2133 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 2134 2135 b = glcpp__scan_buffer(buf,n ,yyscanner); 2136 if ( ! b ) 2137 YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" ); 2138 2139 /* It's okay to grow etc. this buffer, and we should throw it 2140 * away when we're done. 2141 */ 2142 b->yy_is_our_buffer = 1; 2143 2144 return b; 2145 } 2146 2147 static void yy_push_state (int new_state , yyscan_t yyscanner) 2148 { 2149 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2150 if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) 2151 { 2152 yy_size_t new_size; 2153 2154 yyg->yy_start_stack_depth += YY_START_STACK_INCR; 2155 new_size = yyg->yy_start_stack_depth * sizeof( int ); 2156 2157 if ( ! yyg->yy_start_stack ) 2158 yyg->yy_start_stack = (int *) glcpp_alloc(new_size ,yyscanner ); 2159 2160 else 2161 yyg->yy_start_stack = (int *) glcpp_realloc((void *) yyg->yy_start_stack,new_size ,yyscanner ); 2162 2163 if ( ! yyg->yy_start_stack ) 2164 YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); 2165 } 2166 2167 yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; 2168 2169 BEGIN(new_state); 2170 } 2171 2172 static void yy_pop_state (yyscan_t yyscanner) 2173 { 2174 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2175 if ( --yyg->yy_start_stack_ptr < 0 ) 2176 YY_FATAL_ERROR( "start-condition stack underflow" ); 2177 2178 BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); 2179 } 2180 2181 static int yy_top_state (yyscan_t yyscanner) 2182 { 2183 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2184 return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1]; 2185 } 2186 2187 #ifndef YY_EXIT_FAILURE 2188 #define YY_EXIT_FAILURE 2 2189 #endif 2190 2191 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) 2192 { 2193 (void) fprintf( stderr, "%s\n", msg ); 2194 exit( YY_EXIT_FAILURE ); 2195 } 2196 2197 /* Redefine yyless() so it works in section 3 code. */ 2198 2199 #undef yyless 2200 #define yyless(n) \ 2201 do \ 2202 { \ 2203 /* Undo effects of setting up yytext. */ \ 2204 int yyless_macro_arg = (n); \ 2205 YY_LESS_LINENO(yyless_macro_arg);\ 2206 yytext[yyleng] = yyg->yy_hold_char; \ 2207 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ 2208 yyg->yy_hold_char = *yyg->yy_c_buf_p; \ 2209 *yyg->yy_c_buf_p = '\0'; \ 2210 yyleng = yyless_macro_arg; \ 2211 } \ 2212 while ( 0 ) 2213 2214 /* Accessor methods (get/set functions) to struct members. */ 2215 2216 /** Get the user-defined data for this scanner. 2217 * @param yyscanner The scanner object. 2218 */ 2219 YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner) 2220 { 2221 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2222 return yyextra; 2223 } 2224 2225 /** Get the current line number. 2226 * @param yyscanner The scanner object. 2227 */ 2228 int glcpp_get_lineno (yyscan_t yyscanner) 2229 { 2230 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2231 2232 if (! YY_CURRENT_BUFFER) 2233 return 0; 2234 2235 return yylineno; 2236 } 2237 2238 /** Get the current column number. 2239 * @param yyscanner The scanner object. 2240 */ 2241 int glcpp_get_column (yyscan_t yyscanner) 2242 { 2243 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2244 2245 if (! YY_CURRENT_BUFFER) 2246 return 0; 2247 2248 return yycolumn; 2249 } 2250 2251 /** Get the input stream. 2252 * @param yyscanner The scanner object. 2253 */ 2254 FILE *glcpp_get_in (yyscan_t yyscanner) 2255 { 2256 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2257 return yyin; 2258 } 2259 2260 /** Get the output stream. 2261 * @param yyscanner The scanner object. 2262 */ 2263 FILE *glcpp_get_out (yyscan_t yyscanner) 2264 { 2265 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2266 return yyout; 2267 } 2268 2269 /** Get the length of the current token. 2270 * @param yyscanner The scanner object. 2271 */ 2272 int glcpp_get_leng (yyscan_t yyscanner) 2273 { 2274 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2275 return yyleng; 2276 } 2277 2278 /** Get the current token. 2279 * @param yyscanner The scanner object. 2280 */ 2281 2282 char *glcpp_get_text (yyscan_t yyscanner) 2283 { 2284 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2285 return yytext; 2286 } 2287 2288 /** Set the user-defined data. This data is never touched by the scanner. 2289 * @param user_defined The data to be associated with this scanner. 2290 * @param yyscanner The scanner object. 2291 */ 2292 void glcpp_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) 2293 { 2294 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2295 yyextra = user_defined ; 2296 } 2297 2298 /** Set the current line number. 2299 * @param line_number 2300 * @param yyscanner The scanner object. 2301 */ 2302 void glcpp_set_lineno (int line_number , yyscan_t yyscanner) 2303 { 2304 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2305 2306 /* lineno is only valid if an input buffer exists. */ 2307 if (! YY_CURRENT_BUFFER ) 2308 yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner); 2309 2310 yylineno = line_number; 2311 } 2312 2313 /** Set the current column. 2314 * @param line_number 2315 * @param yyscanner The scanner object. 2316 */ 2317 void glcpp_set_column (int column_no , yyscan_t yyscanner) 2318 { 2319 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2320 2321 /* column is only valid if an input buffer exists. */ 2322 if (! YY_CURRENT_BUFFER ) 2323 yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner); 2324 2325 yycolumn = column_no; 2326 } 2327 2328 /** Set the input stream. This does not discard the current 2329 * input buffer. 2330 * @param in_str A readable stream. 2331 * @param yyscanner The scanner object. 2332 * @see glcpp__switch_to_buffer 2333 */ 2334 void glcpp_set_in (FILE * in_str , yyscan_t yyscanner) 2335 { 2336 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2337 yyin = in_str ; 2338 } 2339 2340 void glcpp_set_out (FILE * out_str , yyscan_t yyscanner) 2341 { 2342 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2343 yyout = out_str ; 2344 } 2345 2346 int glcpp_get_debug (yyscan_t yyscanner) 2347 { 2348 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2349 return yy_flex_debug; 2350 } 2351 2352 void glcpp_set_debug (int bdebug , yyscan_t yyscanner) 2353 { 2354 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2355 yy_flex_debug = bdebug ; 2356 } 2357 2358 /* Accessor methods for yylval and yylloc */ 2359 2360 YYSTYPE * glcpp_get_lval (yyscan_t yyscanner) 2361 { 2362 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2363 return yylval; 2364 } 2365 2366 void glcpp_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) 2367 { 2368 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2369 yylval = yylval_param; 2370 } 2371 2372 YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner) 2373 { 2374 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2375 return yylloc; 2376 } 2377 2378 void glcpp_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) 2379 { 2380 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2381 yylloc = yylloc_param; 2382 } 2383 2384 /* User-visible API */ 2385 2386 /* glcpp_lex_init is special because it creates the scanner itself, so it is 2387 * the ONLY reentrant function that doesn't take the scanner as the last argument. 2388 * That's why we explicitly handle the declaration, instead of using our macros. 2389 */ 2390 2391 int glcpp_lex_init(yyscan_t* ptr_yy_globals) 2392 2393 { 2394 if (ptr_yy_globals == NULL){ 2395 errno = EINVAL; 2396 return 1; 2397 } 2398 2399 *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), NULL ); 2400 2401 if (*ptr_yy_globals == NULL){ 2402 errno = ENOMEM; 2403 return 1; 2404 } 2405 2406 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ 2407 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2408 2409 return yy_init_globals ( *ptr_yy_globals ); 2410 } 2411 2412 /* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the 2413 * convention of taking the scanner as the last argument. Note however, that 2414 * this is a *pointer* to a scanner, as it will be allocated by this call (and 2415 * is the reason, too, why this function also must handle its own declaration). 2416 * The user defined value in the first argument will be available to glcpp_alloc in 2417 * the yyextra field. 2418 */ 2419 2420 int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) 2421 2422 { 2423 struct yyguts_t dummy_yyguts; 2424 2425 glcpp_set_extra (yy_user_defined, &dummy_yyguts); 2426 2427 if (ptr_yy_globals == NULL){ 2428 errno = EINVAL; 2429 return 1; 2430 } 2431 2432 *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); 2433 2434 if (*ptr_yy_globals == NULL){ 2435 errno = ENOMEM; 2436 return 1; 2437 } 2438 2439 /* By setting to 0xAA, we expose bugs in 2440 yy_init_globals. Leave at 0x00 for releases. */ 2441 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 2442 2443 glcpp_set_extra (yy_user_defined, *ptr_yy_globals); 2444 2445 return yy_init_globals ( *ptr_yy_globals ); 2446 } 2447 2448 static int yy_init_globals (yyscan_t yyscanner) 2449 { 2450 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2451 /* Initialization is the same as for the non-reentrant scanner. 2452 * This function is called from glcpp_lex_destroy(), so don't allocate here. 2453 */ 2454 2455 yyg->yy_buffer_stack = 0; 2456 yyg->yy_buffer_stack_top = 0; 2457 yyg->yy_buffer_stack_max = 0; 2458 yyg->yy_c_buf_p = (char *) 0; 2459 yyg->yy_init = 0; 2460 yyg->yy_start = 0; 2461 2462 yyg->yy_start_stack_ptr = 0; 2463 yyg->yy_start_stack_depth = 0; 2464 yyg->yy_start_stack = NULL; 2465 2466 /* Defined in main.c */ 2467 #ifdef YY_STDINIT 2468 yyin = stdin; 2469 yyout = stdout; 2470 #else 2471 yyin = (FILE *) 0; 2472 yyout = (FILE *) 0; 2473 #endif 2474 2475 /* For future reference: Set errno on error, since we are called by 2476 * glcpp_lex_init() 2477 */ 2478 return 0; 2479 } 2480 2481 /* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */ 2482 int glcpp_lex_destroy (yyscan_t yyscanner) 2483 { 2484 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2485 2486 /* Pop the buffer stack, destroying each element. */ 2487 while(YY_CURRENT_BUFFER){ 2488 glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); 2489 YY_CURRENT_BUFFER_LVALUE = NULL; 2490 glcpp_pop_buffer_state(yyscanner); 2491 } 2492 2493 /* Destroy the stack itself. */ 2494 glcpp_free(yyg->yy_buffer_stack ,yyscanner); 2495 yyg->yy_buffer_stack = NULL; 2496 2497 /* Destroy the start condition stack. */ 2498 glcpp_free(yyg->yy_start_stack ,yyscanner ); 2499 yyg->yy_start_stack = NULL; 2500 2501 /* Reset the globals. This is important in a non-reentrant scanner so the next time 2502 * glcpp_lex() is called, initialization will occur. */ 2503 yy_init_globals( yyscanner); 2504 2505 /* Destroy the main struct (reentrant only). */ 2506 glcpp_free ( yyscanner , yyscanner ); 2507 yyscanner = NULL; 2508 return 0; 2509 } 2510 2511 /* 2512 * Internal utility routines. 2513 */ 2514 2515 #ifndef yytext_ptr 2516 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) 2517 { 2518 register int i; 2519 for ( i = 0; i < n; ++i ) 2520 s1[i] = s2[i]; 2521 } 2522 #endif 2523 2524 #ifdef YY_NEED_STRLEN 2525 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) 2526 { 2527 register int n; 2528 for ( n = 0; s[n]; ++n ) 2529 ; 2530 2531 return n; 2532 } 2533 #endif 2534 2535 void *glcpp_alloc (yy_size_t size , yyscan_t yyscanner) 2536 { 2537 return (void *) malloc( size ); 2538 } 2539 2540 void *glcpp_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) 2541 { 2542 /* The cast to (char *) in the following accommodates both 2543 * implementations that use char* generic pointers, and those 2544 * that use void* generic pointers. It works with the latter 2545 * because both ANSI C and C++ allow castless assignment from 2546 * any pointer type to void*, and deal with argument conversions 2547 * as though doing an assignment. 2548 */ 2549 return (void *) realloc( (char *) ptr, size ); 2550 } 2551 2552 void glcpp_free (void * ptr , yyscan_t yyscanner) 2553 { 2554 free( (char *) ptr ); /* see glcpp_realloc() for (char *) cast */ 2555 } 2556 2557 #define YYTABLES_NAME "yytables" 2558 2559 #line 313 "src/src/glsl/glcpp/glcpp-lex.l" 2560 2561 2562 2563 void 2564 glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader) 2565 { 2566 glcpp__scan_string(shader,parser->scanner); 2567 } 2568 2569