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