#line 2 "scan-gram.c" #line 4 "scan-gram.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 31 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* %if-c++-only */ /* %endif */ /* %if-c-only */ /* %endif */ /* %if-c-only */ /* %endif */ /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ /* %if-c-only */ #include #include #include #include /* %endif */ /* %if-tables-serialization */ /* %endif */ /* end standard C headers. */ /* %if-c-or-c++ */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! FLEXINT_H */ /* %endif */ /* %if-c++-only */ /* %endif */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* %not-for-header */ /* Returned upon end-of-file. */ #define YY_NULL 0 /* %ok-for-header */ /* %not-for-header */ /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* %ok-for-header */ /* %if-reentrant */ /* %endif */ /* %if-not-reentrant */ /* %endif */ /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE gram_restart(gram_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 #endif #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif /* %if-not-reentrant */ extern int gram_leng; /* %endif */ /* %if-c-only */ /* %if-not-reentrant */ extern FILE *gram_in, *gram_out; /* %endif */ /* %endif */ #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up gram_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up gram_text again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef unsigned int yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { /* %if-c-only */ FILE *yy_input_file; /* %endif */ /* %if-c++-only */ /* %endif */ char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via gram_restart()), so that the user can continue scanning by * just pointing gram_in at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* %if-c-only Standard (non-C++) definition */ /* %not-for-header */ /* %if-not-reentrant */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* %endif */ /* %ok-for-header */ /* %endif */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* %if-c-only Standard (non-C++) definition */ /* %if-not-reentrant */ /* %not-for-header */ /* yy_hold_char holds the character lost when gram_text is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int gram_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow gram_wrap()'s to do buffer switches * instead of setting up a fresh gram_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; /* %ok-for-header */ /* %endif */ void gram_restart (FILE *input_file ); void gram__switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE gram__create_buffer (FILE *file,int size ); void gram__delete_buffer (YY_BUFFER_STATE b ); void gram__flush_buffer (YY_BUFFER_STATE b ); void gram_push_buffer_state (YY_BUFFER_STATE new_buffer ); void gram_pop_buffer_state (void ); static void gram_ensure_buffer_stack (void ); static void gram__load_buffer_state (void ); static void gram__init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER gram__flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE gram__scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE gram__scan_string (yyconst char *yy_str ); YY_BUFFER_STATE gram__scan_bytes (yyconst char *bytes,int len ); /* %endif */ void *gram_alloc (yy_size_t ); void *gram_realloc (void *,yy_size_t ); void gram_free (void * ); #define yy_new_buffer gram__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ gram_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ gram__create_buffer(gram_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ gram_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ gram__create_buffer(gram_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* %% [1.0] gram_text/gram_in/gram_out/yy_state_type/gram_lineno etc. def's & init go here */ /* Begin user sect3 */ #define gram_wrap(n) 1 #define YY_SKIP_YYWRAP #define FLEX_DEBUG typedef unsigned char YY_CHAR; FILE *gram_in = (FILE *) 0, *gram_out = (FILE *) 0; typedef int yy_state_type; extern int gram_lineno; int gram_lineno = 1; extern char *gram_text; #define yytext_ptr gram_text /* %if-c-only Standard (non-C++) definition */ static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* %endif */ /* Done after the current pattern has been matched and before the * corresponding action - sets up gram_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ /* %% [2.0] code to fiddle gram_text and gram_leng for yymore() goes here \ */\ gram_leng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ /* %% [3.0] code to copy yytext_ptr to gram_text[] goes here, if %array \ */\ (yy_c_buf_p) = yy_cp; /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ #define YY_NUM_RULES 109 #define YY_END_OF_BUFFER 110 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[461] = { 0, 0, 0, 0, 0, 66, 66, 0, 0, 84, 84, 84, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 110, 59, 2, 2, 54, 59, 53, 1, 50, 59, 51, 51, 49, 59, 47, 56, 48, 59, 107, 108, 103, 107, 104, 105, 106, 65, 107, 63, 63, 88, 87, 107, 86, 85, 61, 2, 1, 61, 60, 61, 68, 67, 107, 71, 70, 69, 93, 2, 1, 93, 93, 90, 100, 107, 89, 107, 107, 101, 94, 96, 107, 58, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 55, 50, 4, 3, 51, 0, 0, 0, 64, 0, 0, 66, 62, 84, 84, 84, 84, 83, 81, 72, 83, 74, 75, 76, 77, 78, 79, 83, 80, 83, 98, 0, 98, 0, 95, 0, 91, 92, 0, 94, 97, 0, 99, 0, 99, 102, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 3, 52, 57, 0, 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 0, 72, 0, 0, 0, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 20, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 32, 46, 46, 46, 46, 46, 46, 39, 46, 42, 46, 46, 45, 0, 0, 0, 46, 7, 46, 46, 46, 12, 46, 46, 46, 46, 46, 46, 46, 46, 23, 46, 46, 46, 46, 46, 29, 46, 46, 46, 46, 46, 36, 46, 38, 40, 43, 46, 0, 0, 82, 6, 46, 9, 46, 46, 14, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 30, 46, 46, 46, 46, 46, 46, 46, 0, 46, 10, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 33, 46, 35, 46, 46, 44, 0, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 26, 27, 46, 46, 46, 37, 46, 0, 46, 46, 46, 15, 46, 46, 46, 46, 21, 22, 46, 46, 46, 46, 46, 46, 0, 0, 46, 11, 46, 46, 46, 19, 46, 46, 46, 46, 46, 46, 46, 5, 46, 46, 16, 46, 46, 24, 46, 46, 31, 34, 41, 8, 46, 46, 46, 46, 46, 13, 46, 46, 46, 46, 46, 18, 46, 46, 46, 25, 46, 46, 46, 46, 46, 17, 46, 46, 46, 46, 46, 28, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 5, 6, 7, 8, 1, 9, 1, 1, 10, 1, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 25, 25, 25, 25, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 26, 13, 13, 27, 13, 13, 28, 29, 30, 1, 31, 1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 13, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 13, 53, 54, 13, 55, 56, 57, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[59] = { 0, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 4, 5, 1, 6, 6, 6, 1, 1, 1, 1, 7, 1, 3, 6, 5, 5, 3, 1, 3, 5, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 7 } ; static yyconst flex_int16_t yy_base[483] = { 0, 0, 733, 56, 57, 65, 68, 728, 727, 96, 99, 106, 109, 138, 144, 85, 102, 142, 150, 161, 174, 206, 0, 162, 182, 220, 225, 736, 740, 740, 740, 740, 275, 740, 740, 0, 51, 176, 61, 740, 0, 740, 740, 740, 693, 740, 740, 740, 103, 740, 740, 740, 740, 164, 740, 720, 740, 740, 192, 740, 740, 740, 740, 740, 59, 740, 691, 740, 740, 326, 740, 740, 740, 740, 740, 740, 60, 690, 740, 231, 132, 740, 187, 71, 243, 740, 740, 674, 740, 0, 690, 75, 151, 689, 686, 683, 74, 690, 173, 674, 220, 147, 157, 220, 680, 687, 690, 740, 0, 740, 0, 269, 0, 699, 680, 740, 287, 290, 690, 740, 740, 293, 689, 301, 740, 740, 67, 0, 740, 740, 740, 740, 740, 740, 0, 740, 0, 740, 317, 321, 0, 740, 341, 740, 740, 344, 740, 740, 358, 740, 349, 352, 740, 0, 673, 220, 668, 667, 668, 131, 665, 672, 188, 677, 662, 666, 223, 672, 657, 658, 226, 657, 657, 665, 666, 669, 652, 658, 652, 657, 648, 661, 0, 0, 740, 650, 369, 250, 378, 381, 384, 387, 269, 324, 0, 0, 0, 671, 390, 152, 393, 388, 397, 202, 660, 640, 238, 640, 653, 643, 651, 650, 649, 672, 633, 632, 669, 648, 641, 642, 315, 241, 629, 630, 626, 640, 629, 636, 620, 631, 627, 620, 624, 630, 629, 619, 630, 628, 625, 740, 0, 0, 396, 612, 621, 607, 613, 608, 621, 606, 619, 640, 616, 604, 609, 0, 602, 597, 610, 344, 609, 604, 594, 606, 598, 589, 603, 0, 588, 392, 597, 586, 599, 584, 0, 589, 0, 588, 586, 0, 626, 0, 0, 575, 0, 586, 591, 575, 0, 393, 575, 578, 394, 591, 590, 589, 580, 0, 573, 581, 573, 567, 565, 0, 564, 601, 576, 565, 562, 0, 559, 0, 395, 0, 559, 399, 0, 740, 0, 557, 557, 571, 552, 397, 555, 557, 553, 558, 551, 553, 549, 564, 559, 549, 557, 0, 546, 543, 558, 553, 543, 537, 550, 414, 407, 0, 535, 548, 535, 546, 530, 531, 567, 546, 533, 540, 524, 525, 539, 524, 539, 0, 522, 0, 525, 536, 0, 562, 520, 520, 516, 515, 525, 511, 524, 527, 515, 508, 519, 513, 0, 0, 511, 505, 503, 0, 518, 545, 501, 500, 514, 0, 506, 499, 496, 509, 0, 0, 502, 491, 500, 507, 502, 495, 531, 348, 499, 0, 489, 480, 481, 0, 481, 477, 408, 485, 485, 479, 490, 740, 491, 475, 0, 473, 482, 0, 475, 480, 0, 0, 0, 0, 483, 409, 473, 469, 467, 0, 478, 470, 472, 452, 455, 0, 445, 432, 395, 0, 402, 399, 422, 384, 386, 0, 395, 374, 361, 318, 251, 0, 740, 440, 447, 454, 461, 464, 470, 476, 483, 487, 493, 281, 275, 236, 218, 500, 206, 151, 138, 116, 102, 56, 506 } ; static yyconst flex_int16_t yy_def[483] = { 0, 460, 1, 461, 461, 461, 461, 462, 462, 461, 461, 461, 461, 463, 463, 461, 461, 461, 461, 464, 464, 461, 21, 21, 21, 21, 21, 460, 460, 460, 460, 460, 460, 460, 460, 465, 460, 460, 460, 460, 466, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 467, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 468, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 460, 465, 460, 470, 460, 471, 466, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 472, 460, 460, 460, 460, 460, 460, 473, 460, 474, 460, 460, 460, 475, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 470, 471, 460, 460, 460, 460, 460, 460, 460, 460, 467, 460, 476, 477, 474, 475, 460, 460, 460, 460, 460, 460, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 460, 460, 478, 479, 460, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 460, 480, 481, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 460, 473, 460, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 460, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 460, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 482, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 482, 482, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 460, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 0, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460 } ; static yyconst flex_int16_t yy_nxt[799] = { 0, 28, 29, 30, 29, 31, 28, 28, 32, 33, 28, 34, 28, 35, 36, 37, 38, 38, 28, 39, 40, 41, 28, 28, 28, 35, 35, 35, 28, 28, 28, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 42, 43, 28, 28, 46, 46, 109, 317, 47, 47, 110, 48, 48, 52, 109, 109, 52, 47, 110, 110, 47, 111, 111, 111, 146, 49, 49, 193, 193, 50, 50, 51, 51, 67, 49, 68, 147, 49, 50, 53, 51, 50, 53, 51, 56, 148, 57, 56, 47, 57, 67, 47, 68, 316, 59, 162, 155, 59, 47, 69, 60, 47, 115, 60, 163, 49, 156, 282, 49, 50, 58, 51, 50, 58, 51, 49, 69, 116, 49, 50, 58, 51, 50, 58, 51, 62, 30, 62, 70, 281, 71, 62, 30, 62, 63, 66, 72, 64, 71, 141, 63, 65, 241, 64, 72, 70, 142, 65, 74, 30, 74, 117, 118, 117, 47, 87, 69, 75, 211, 141, 76, 74, 30, 74, 69, 77, 142, 45, 172, 212, 75, 49, 173, 76, 47, 87, 111, 111, 111, 121, 122, 121, 143, 174, 157, 70, 144, 45, 112, 158, 165, 49, 175, 70, 46, 146, 78, 240, 79, 80, 81, 145, 45, 166, 45, 82, 123, 147, 167, 196, 215, 83, 47, 45, 112, 84, 148, 47, 45, 50, 220, 51, 45, 137, 45, 45, 216, 195, 138, 49, 45, 139, 139, 139, 49, 149, 140, 169, 205, 220, 150, 176, 206, 151, 151, 151, 85, 225, 86, 115, 177, 226, 221, 170, 207, 245, 171, 460, 262, 178, 45, 263, 45, 246, 116, 45, 194, 45, 88, 111, 111, 111, 183, 89, 186, 187, 186, 117, 118, 117, 189, 122, 189, 123, 459, 89, 89, 89, 191, 192, 191, 89, 89, 90, 89, 91, 92, 93, 94, 89, 95, 89, 96, 97, 98, 99, 100, 89, 101, 102, 103, 104, 105, 89, 106, 107, 125, 139, 139, 139, 125, 139, 139, 139, 239, 239, 126, 126, 198, 199, 198, 200, 201, 200, 125, 260, 419, 127, 405, 458, 125, 298, 261, 128, 129, 202, 203, 202, 130, 151, 151, 151, 151, 151, 151, 131, 186, 187, 186, 132, 298, 133, 134, 135, 136, 117, 118, 117, 189, 122, 189, 189, 122, 189, 191, 192, 191, 198, 199, 198, 200, 201, 200, 143, 202, 203, 202, 144, 137, 307, 322, 325, 341, 138, 348, 457, 139, 139, 139, 343, 343, 343, 145, 367, 368, 426, 438, 456, 307, 322, 325, 341, 455, 348, 343, 343, 343, 454, 453, 452, 451, 450, 449, 368, 426, 438, 45, 45, 45, 45, 45, 45, 45, 54, 54, 54, 54, 54, 54, 54, 61, 61, 61, 61, 61, 61, 61, 73, 73, 73, 73, 73, 73, 73, 108, 108, 113, 448, 113, 113, 113, 113, 120, 120, 447, 120, 120, 120, 120, 124, 124, 124, 124, 124, 124, 124, 153, 153, 153, 182, 446, 182, 182, 182, 182, 182, 197, 445, 197, 197, 197, 197, 404, 444, 404, 404, 404, 404, 404, 443, 442, 441, 440, 439, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 425, 424, 423, 422, 421, 420, 405, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 347, 346, 345, 344, 342, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 324, 323, 321, 320, 319, 318, 315, 314, 313, 312, 311, 310, 309, 308, 306, 305, 304, 303, 302, 301, 300, 299, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 244, 243, 242, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 224, 223, 222, 219, 218, 217, 214, 213, 210, 209, 208, 204, 190, 188, 185, 184, 181, 180, 179, 168, 164, 161, 160, 159, 154, 152, 114, 114, 119, 114, 460, 55, 55, 44, 27, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460 } ; static yyconst flex_int16_t yy_chk[799] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 36, 481, 3, 4, 36, 3, 4, 5, 64, 76, 6, 5, 64, 76, 6, 38, 38, 38, 83, 3, 4, 126, 126, 3, 4, 3, 4, 15, 5, 15, 83, 6, 5, 5, 5, 6, 6, 6, 9, 83, 9, 10, 9, 10, 16, 10, 16, 480, 11, 96, 91, 12, 11, 15, 11, 12, 48, 12, 96, 9, 91, 479, 10, 9, 9, 9, 10, 10, 10, 11, 16, 48, 12, 11, 11, 11, 12, 12, 12, 13, 13, 13, 15, 478, 17, 14, 14, 14, 13, 14, 17, 13, 18, 80, 14, 13, 477, 14, 18, 16, 80, 14, 19, 19, 19, 53, 53, 53, 23, 23, 17, 19, 159, 199, 19, 20, 20, 20, 18, 20, 199, 23, 101, 159, 20, 23, 101, 20, 24, 24, 37, 37, 37, 58, 58, 58, 82, 102, 92, 17, 82, 24, 37, 92, 98, 24, 102, 18, 21, 203, 21, 476, 21, 21, 21, 82, 23, 98, 23, 21, 58, 203, 98, 474, 162, 21, 25, 25, 37, 21, 203, 26, 26, 21, 166, 21, 24, 79, 24, 25, 162, 473, 79, 25, 26, 79, 79, 79, 26, 84, 79, 100, 155, 166, 84, 103, 155, 84, 84, 84, 21, 170, 21, 187, 103, 170, 166, 100, 155, 206, 100, 192, 221, 103, 25, 221, 25, 206, 187, 26, 472, 26, 32, 111, 111, 111, 471, 32, 116, 116, 116, 117, 117, 117, 121, 121, 121, 192, 458, 32, 32, 32, 123, 123, 123, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 69, 138, 138, 138, 69, 139, 139, 139, 193, 193, 69, 69, 142, 142, 142, 145, 145, 145, 69, 220, 405, 69, 405, 457, 69, 259, 220, 69, 69, 148, 148, 148, 69, 150, 150, 150, 151, 151, 151, 69, 186, 186, 186, 69, 259, 69, 69, 69, 69, 188, 188, 188, 189, 189, 189, 190, 190, 190, 191, 191, 191, 198, 198, 198, 200, 200, 200, 201, 202, 202, 202, 201, 242, 269, 289, 292, 312, 242, 323, 456, 242, 242, 242, 315, 315, 315, 201, 343, 344, 414, 433, 455, 269, 289, 292, 312, 454, 323, 343, 343, 343, 452, 451, 450, 449, 448, 446, 344, 414, 433, 461, 461, 461, 461, 461, 461, 461, 462, 462, 462, 462, 462, 462, 462, 463, 463, 463, 463, 463, 463, 463, 464, 464, 464, 464, 464, 464, 464, 465, 465, 466, 445, 466, 466, 466, 466, 467, 467, 444, 467, 467, 467, 467, 468, 468, 468, 468, 468, 468, 468, 469, 469, 469, 470, 442, 470, 470, 470, 470, 470, 475, 441, 475, 475, 475, 475, 482, 440, 482, 482, 482, 482, 482, 439, 438, 436, 435, 434, 432, 427, 426, 424, 423, 421, 420, 418, 417, 416, 415, 413, 412, 410, 409, 408, 406, 404, 403, 402, 401, 400, 399, 398, 395, 394, 393, 392, 390, 389, 388, 387, 386, 384, 383, 382, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 365, 364, 362, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 342, 341, 340, 339, 338, 337, 336, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 322, 321, 320, 319, 314, 310, 308, 307, 306, 305, 304, 302, 301, 300, 299, 298, 296, 295, 294, 293, 291, 290, 287, 286, 285, 283, 280, 278, 277, 275, 273, 272, 271, 270, 268, 266, 265, 264, 263, 262, 261, 260, 258, 257, 256, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 205, 204, 197, 185, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 169, 168, 167, 165, 164, 163, 161, 160, 158, 157, 156, 154, 122, 118, 114, 113, 106, 105, 104, 99, 97, 95, 94, 93, 90, 87, 77, 66, 55, 44, 27, 8, 7, 2, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int gram__flex_debug; int gram__flex_debug = 1; static yyconst flex_int16_t yy_rule_linenum[109] = { 0, 197, 198, 199, 200, 208, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 260, 264, 265, 266, 268, 275, 279, 285, 288, 291, 294, 305, 313, 320, 337, 343, 364, 365, 376, 387, 388, 400, 408, 419, 435, 441, 451, 461, 472, 473, 474, 475, 476, 477, 478, 481, 483, 492, 504, 509, 510, 516, 517, 528, 534, 540, 546, 562, 596, 597, 598, 634, 636, 637, 639, 643, 658, 693, 694, 695, 696, 704, 705 } ; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *gram_text; #line 1 "scan-gram.l" /* Bison Grammar Scanner -*- C -*- Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #line 27 "scan-gram.l" /* Work around a bug in flex 2.5.31. See Debian bug 333231 . */ #undef gram_wrap #define gram_wrap() 1 #include "system.h" #include #include #include "complain.h" #include "files.h" #include "getargs.h" #include "gram.h" #include "quotearg.h" #include "reader.h" #include "uniqstr.h" #define YY_USER_INIT \ do \ { \ scanner_cursor.file = current_file; \ scanner_cursor.line = 1; \ scanner_cursor.column = 1; \ code_start = scanner_cursor; \ } \ while (0) /* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ int gram_get_lineno (void); FILE *gram_get_in (void); FILE *gram_get_out (void); int gram_get_leng (void); char *gram_get_text (void); void gram_set_lineno (int); void gram_set_in (FILE *); void gram_set_out (FILE *); int gram_get_debug (void); void gram_set_debug (int); int gram_lex_destroy (void); /* Location of scanner cursor. */ boundary scanner_cursor; static void adjust_location (location *, char const *, size_t); #define YY_USER_ACTION adjust_location (loc, gram_text, gram_leng); static size_t no_cr_read (FILE *, char *, size_t); #define YY_INPUT(buf, result, size) ((result) = no_cr_read (gram_in, buf, size)) /* OBSTACK_FOR_STRING -- Used to store all the characters that we need to keep (to construct ID, STRINGS etc.). Use the following macros to use it. Use STRING_GROW to append what has just been matched, and STRING_FINISH to end the string (it puts the ending 0). STRING_FINISH also stores this string in LAST_STRING, which can be used, and which is used by STRING_FREE to free the last string. */ static struct obstack obstack_for_string; /* A string representing the most recently saved token. */ char *last_string; /* The location of the most recently saved token, if it was a BRACED_CODE token; otherwise, this has an unspecified value. */ location last_braced_code_loc; #define STRING_GROW \ obstack_grow (&obstack_for_string, gram_text, gram_leng) #define STRING_FINISH \ do { \ obstack_1grow (&obstack_for_string, '\0'); \ last_string = obstack_finish (&obstack_for_string); \ } while (0) #define STRING_FREE \ obstack_free (&obstack_for_string, last_string) void scanner_last_string_free (void) { STRING_FREE; } /* Within well-formed rules, RULE_LENGTH is the number of values in the current rule so far, which says where to find `$0' with respect to the top of the stack. It is not the same as the rule->length in the case of mid rule actions. Outside of well-formed rules, RULE_LENGTH has an undefined value. */ static int rule_length; static void rule_length_overflow (location) __attribute__ ((__noreturn__)); /* Increment the rule length by one, checking for overflow. */ static inline void increment_rule_length (location loc) { rule_length++; /* Don't allow rule_length == INT_MAX, since that might cause confusion with strtol if INT_MAX == LONG_MAX. */ if (rule_length == INT_MAX) rule_length_overflow (loc); } static void handle_dollar (int token_type, char *cp, location loc); static void handle_at (int token_type, char *cp, location loc); static void handle_syncline (char *, location); static unsigned long int scan_integer (char const *p, int base, location loc); static int convert_ucn_to_byte (char const *hex_text); static void unexpected_eof (boundary, char const *); static void unexpected_newline (boundary, char const *); /* POSIX says that a tag must be both an id and a C union member, but historically almost any character is allowed in a tag. We disallow NUL and newline, as this simplifies our implementation. */ /* Zero or more instances of backslash-newline. Following GCC, allow white space between the backslash and the newline. */ #line 1016 "scan-gram.c" #define INITIAL 0 #define SC_COMMENT 1 #define SC_LINE_COMMENT 2 #define SC_YACC_COMMENT 3 #define SC_STRING 4 #define SC_CHARACTER 5 #define SC_AFTER_IDENTIFIER 6 #define SC_ESCAPED_STRING 7 #define SC_ESCAPED_CHARACTER 8 #define SC_PRE_CODE 9 #define SC_BRACED_CODE 10 #define SC_PROLOGUE 11 #define SC_EPILOGUE 12 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ /* %if-c-only */ #include /* %endif */ /* %if-c++-only */ /* %endif */ #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif /* %if-c-only Reentrant structure and macros (non-C++). */ /* %if-reentrant */ /* %if-reentrant */ /* %endif */ /* %if-bison-bridge */ /* %endif */ /* %endif End reentrant structures and macros. */ /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int gram_wrap (void ); #else extern int gram_wrap (void ); #endif #endif /* %not-for-header */ /* %ok-for-header */ /* %endif */ #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT /* %if-c-only Standard (non-C++) definition */ /* %not-for-header */ #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif /* %ok-for-header */ /* %endif */ #endif /* %if-c-only */ /* %endif */ /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* %if-c-only Standard (non-C++) definition */ /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( gram_text, gram_leng, 1, gram_out ) /* %endif */ /* %if-c++-only C++ definition */ /* %endif */ #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( gram_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( gram_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, gram_in))==0 && ferror(gram_in)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(gram_in); \ } \ }\ \ /* %if-c++-only C++ definition \ */\ /* %endif */ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR /* %if-c-only */ #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) /* %endif */ /* %if-c++-only */ /* %endif */ #endif /* %if-tables-serialization structures and prototypes */ /* %not-for-header */ /* %ok-for-header */ /* %not-for-header */ /* %tables-yydmap generated elements */ /* %endif */ /* end tables serialization structures and prototypes */ /* %ok-for-header */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 /* %if-c-only Standard (non-C++) definition */ extern int gram_lex (void); #define YY_DECL int gram_lex (void) /* %endif */ /* %if-c++-only C++ definition */ /* %endif */ #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after gram_text and gram_leng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif /* %% [6.0] YY_RULE_SETUP definition goes here */ #define YY_RULE_SETUP \ if ( gram_leng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (gram_text[gram_leng - 1] == '\n'); \ YY_USER_ACTION /* %not-for-header */ /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; /* %% [7.0] user's declarations go here */ #line 165 "scan-gram.l" /* Nesting level of the current code in braces. */ int braces_level IF_LINT (= 0); /* Parent context state, when applicable. */ int context_state IF_LINT (= 0); /* Token type to return, when applicable. */ int token_type IF_LINT (= 0); /* Location of most recent identifier, when applicable. */ location id_loc IF_LINT (= empty_location); /* Where containing code started, when applicable. Its initial value is relevant only when gram_lex is invoked in the SC_EPILOGUE start condition. */ boundary code_start = scanner_cursor; /* Where containing comment or string or character literal started, when applicable. */ boundary token_start IF_LINT (= scanner_cursor); /*-----------------------. | Scanning white space. | `-----------------------*/ #line 1266 "scan-gram.c" if ( (yy_init) ) { (yy_init) = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! gram_in ) /* %if-c-only */ gram_in = stdin; /* %endif */ /* %if-c++-only */ /* %endif */ if ( ! gram_out ) /* %if-c-only */ gram_out = stdout; /* %endif */ /* %if-c++-only */ /* %endif */ if ( ! YY_CURRENT_BUFFER ) { gram_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = gram__create_buffer(gram_in,YY_BUF_SIZE ); } gram__load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { /* %% [8.0] yymore()-related code goes here */ yy_cp = (yy_c_buf_p); /* Support of gram_text. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; /* %% [9.0] code to set up and find next match goes here */ yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 461 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_current_state != 460 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_find_action: /* %% [10.0] code to find the action number goes here */ yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; /* %% [11.0] code for gram_lineno update goes here */ do_action: /* This label is used only to access EOF actions. */ /* %% [12.0] debug code goes here */ if ( gram__flex_debug ) { if ( yy_act == 0 ) fprintf( stderr, "--scanner backing up\n" ); else if ( yy_act < 109 ) fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", (long)yy_rule_linenum[yy_act], gram_text ); else if ( yy_act == 109 ) fprintf( stderr, "--accepting default rule (\"%s\")\n", gram_text ); else if ( yy_act == 110 ) fprintf( stderr, "--(end of buffer or a NUL)\n" ); else fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); } switch ( yy_act ) { /* beginning of action switch */ /* %% [13.0] actions go here */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; /* Comments and white space. */ case 1: YY_RULE_SETUP #line 197 "scan-gram.l" warn_at (*loc, _("stray `,' treated as white space")); YY_BREAK case 2: /* rule 2 can match eol */ #line 199 "scan-gram.l" case 3: /* rule 3 can match eol */ YY_RULE_SETUP #line 199 "scan-gram.l" ; YY_BREAK case 4: YY_RULE_SETUP #line 200 "scan-gram.l" { token_start = loc->start; context_state = YY_START; BEGIN SC_YACC_COMMENT; } YY_BREAK /* #line directives are not documented, and may be withdrawn or modified in future versions of Bison. */ case 5: /* rule 5 can match eol */ YY_RULE_SETUP #line 208 "scan-gram.l" { handle_syncline (gram_text + sizeof "#line " - 1, *loc); } YY_BREAK /*----------------------------. | Scanning Bison directives. | `----------------------------*/ case 6: YY_RULE_SETUP #line 219 "scan-gram.l" return PERCENT_NONASSOC; YY_BREAK case 7: YY_RULE_SETUP #line 220 "scan-gram.l" return PERCENT_DEBUG; YY_BREAK case 8: YY_RULE_SETUP #line 221 "scan-gram.l" return PERCENT_DEFAULT_PREC; YY_BREAK case 9: YY_RULE_SETUP #line 222 "scan-gram.l" return PERCENT_DEFINE; YY_BREAK case 10: YY_RULE_SETUP #line 223 "scan-gram.l" return PERCENT_DEFINES; YY_BREAK case 11: YY_RULE_SETUP #line 224 "scan-gram.l" token_type = PERCENT_DESTRUCTOR; BEGIN SC_PRE_CODE; YY_BREAK case 12: YY_RULE_SETUP #line 225 "scan-gram.l" return PERCENT_DPREC; YY_BREAK case 13: YY_RULE_SETUP #line 226 "scan-gram.l" return PERCENT_ERROR_VERBOSE; YY_BREAK case 14: YY_RULE_SETUP #line 227 "scan-gram.l" return PERCENT_EXPECT; YY_BREAK case 15: YY_RULE_SETUP #line 228 "scan-gram.l" return PERCENT_EXPECT_RR; YY_BREAK case 16: YY_RULE_SETUP #line 229 "scan-gram.l" return PERCENT_FILE_PREFIX; YY_BREAK case 17: YY_RULE_SETUP #line 230 "scan-gram.l" return PERCENT_YACC; YY_BREAK case 18: YY_RULE_SETUP #line 231 "scan-gram.l" token_type = PERCENT_INITIAL_ACTION; BEGIN SC_PRE_CODE; YY_BREAK case 19: YY_RULE_SETUP #line 232 "scan-gram.l" return PERCENT_GLR_PARSER; YY_BREAK case 20: YY_RULE_SETUP #line 233 "scan-gram.l" return PERCENT_LEFT; YY_BREAK case 21: YY_RULE_SETUP #line 234 "scan-gram.l" token_type = PERCENT_LEX_PARAM; BEGIN SC_PRE_CODE; YY_BREAK case 22: YY_RULE_SETUP #line 235 "scan-gram.l" return PERCENT_LOCATIONS; YY_BREAK case 23: YY_RULE_SETUP #line 236 "scan-gram.l" return PERCENT_MERGE; YY_BREAK case 24: YY_RULE_SETUP #line 237 "scan-gram.l" return PERCENT_NAME_PREFIX; YY_BREAK case 25: YY_RULE_SETUP #line 238 "scan-gram.l" return PERCENT_NO_DEFAULT_PREC; YY_BREAK case 26: YY_RULE_SETUP #line 239 "scan-gram.l" return PERCENT_NO_LINES; YY_BREAK case 27: YY_RULE_SETUP #line 240 "scan-gram.l" return PERCENT_NONASSOC; YY_BREAK case 28: YY_RULE_SETUP #line 241 "scan-gram.l" return PERCENT_NONDETERMINISTIC_PARSER; YY_BREAK case 29: YY_RULE_SETUP #line 242 "scan-gram.l" return PERCENT_NTERM; YY_BREAK case 30: YY_RULE_SETUP #line 243 "scan-gram.l" return PERCENT_OUTPUT; YY_BREAK case 31: YY_RULE_SETUP #line 244 "scan-gram.l" token_type = PERCENT_PARSE_PARAM; BEGIN SC_PRE_CODE; YY_BREAK case 32: YY_RULE_SETUP #line 245 "scan-gram.l" rule_length--; return PERCENT_PREC; YY_BREAK case 33: YY_RULE_SETUP #line 246 "scan-gram.l" token_type = PERCENT_PRINTER; BEGIN SC_PRE_CODE; YY_BREAK case 34: YY_RULE_SETUP #line 247 "scan-gram.l" return PERCENT_PURE_PARSER; YY_BREAK case 35: YY_RULE_SETUP #line 248 "scan-gram.l" return PERCENT_REQUIRE; YY_BREAK case 36: YY_RULE_SETUP #line 249 "scan-gram.l" return PERCENT_RIGHT; YY_BREAK case 37: YY_RULE_SETUP #line 250 "scan-gram.l" return PERCENT_SKELETON; YY_BREAK case 38: YY_RULE_SETUP #line 251 "scan-gram.l" return PERCENT_START; YY_BREAK case 39: YY_RULE_SETUP #line 252 "scan-gram.l" return PERCENT_TOKEN; YY_BREAK case 40: YY_RULE_SETUP #line 253 "scan-gram.l" return PERCENT_TOKEN; YY_BREAK case 41: YY_RULE_SETUP #line 254 "scan-gram.l" return PERCENT_TOKEN_TABLE; YY_BREAK case 42: YY_RULE_SETUP #line 255 "scan-gram.l" return PERCENT_TYPE; YY_BREAK case 43: YY_RULE_SETUP #line 256 "scan-gram.l" token_type = PERCENT_UNION; BEGIN SC_PRE_CODE; YY_BREAK case 44: YY_RULE_SETUP #line 257 "scan-gram.l" return PERCENT_VERBOSE; YY_BREAK case 45: YY_RULE_SETUP #line 258 "scan-gram.l" return PERCENT_YACC; YY_BREAK case 46: YY_RULE_SETUP #line 260 "scan-gram.l" { complain_at (*loc, _("invalid directive: %s"), quote (gram_text)); } YY_BREAK case 47: YY_RULE_SETUP #line 264 "scan-gram.l" return EQUAL; YY_BREAK case 48: YY_RULE_SETUP #line 265 "scan-gram.l" rule_length = 0; return PIPE; YY_BREAK case 49: YY_RULE_SETUP #line 266 "scan-gram.l" return SEMICOLON; YY_BREAK case 50: YY_RULE_SETUP #line 268 "scan-gram.l" { val->symbol = symbol_get (gram_text, *loc); id_loc = *loc; increment_rule_length (*loc); BEGIN SC_AFTER_IDENTIFIER; } YY_BREAK case 51: YY_RULE_SETUP #line 275 "scan-gram.l" { val->integer = scan_integer (gram_text, 10, *loc); return INT; } YY_BREAK case 52: YY_RULE_SETUP #line 279 "scan-gram.l" { val->integer = scan_integer (gram_text, 16, *loc); return INT; } YY_BREAK /* Characters. We don't check there is only one. */ case 53: YY_RULE_SETUP #line 285 "scan-gram.l" STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; YY_BREAK /* Strings. */ case 54: YY_RULE_SETUP #line 288 "scan-gram.l" token_start = loc->start; BEGIN SC_ESCAPED_STRING; YY_BREAK /* Prologue. */ case 55: YY_RULE_SETUP #line 291 "scan-gram.l" code_start = loc->start; BEGIN SC_PROLOGUE; YY_BREAK /* Code in between braces. */ case 56: YY_RULE_SETUP #line 294 "scan-gram.l" { if (current_rule && current_rule->action) grammar_midrule_action (); STRING_GROW; token_type = BRACED_CODE; braces_level = 0; code_start = loc->start; BEGIN SC_BRACED_CODE; } YY_BREAK /* A type. */ case 57: YY_RULE_SETUP #line 305 "scan-gram.l" { obstack_grow (&obstack_for_string, gram_text + 1, gram_leng - 2); STRING_FINISH; val->uniqstr = uniqstr_new (last_string); STRING_FREE; return TYPE; } YY_BREAK case 58: YY_RULE_SETUP #line 313 "scan-gram.l" { static int percent_percent_count; if (++percent_percent_count == 2) BEGIN SC_EPILOGUE; return PERCENT_PERCENT; } YY_BREAK case 59: YY_RULE_SETUP #line 320 "scan-gram.l" { complain_at (*loc, _("invalid character: %s"), quote (gram_text)); } YY_BREAK case YY_STATE_EOF(INITIAL): #line 324 "scan-gram.l" { loc->start = loc->end = scanner_cursor; yyterminate (); } YY_BREAK /*-----------------------------------------------------------------. | Scanning after an identifier, checking whether a colon is next. | `-----------------------------------------------------------------*/ case 60: YY_RULE_SETUP #line 337 "scan-gram.l" { rule_length = 0; *loc = id_loc; BEGIN INITIAL; return ID_COLON; } YY_BREAK case 61: YY_RULE_SETUP #line 343 "scan-gram.l" { scanner_cursor.column -= mbsnwidth (gram_text, gram_leng, 0); yyless (0); *loc = id_loc; BEGIN INITIAL; return ID; } YY_BREAK case YY_STATE_EOF(SC_AFTER_IDENTIFIER): #line 350 "scan-gram.l" { *loc = id_loc; BEGIN INITIAL; return ID; } YY_BREAK /*---------------------------------------------------------------. | Scanning a Yacc comment. The initial `/ *' is already eaten. | `---------------------------------------------------------------*/ case 62: YY_RULE_SETUP #line 364 "scan-gram.l" BEGIN context_state; YY_BREAK case 63: /* rule 63 can match eol */ YY_RULE_SETUP #line 365 "scan-gram.l" ; YY_BREAK case YY_STATE_EOF(SC_YACC_COMMENT): #line 366 "scan-gram.l" unexpected_eof (token_start, "*/"); BEGIN context_state; YY_BREAK /*------------------------------------------------------------. | Scanning a C comment. The initial `/ *' is already eaten. | `------------------------------------------------------------*/ case 64: /* rule 64 can match eol */ YY_RULE_SETUP #line 376 "scan-gram.l" STRING_GROW; BEGIN context_state; YY_BREAK case YY_STATE_EOF(SC_COMMENT): #line 377 "scan-gram.l" unexpected_eof (token_start, "*/"); BEGIN context_state; YY_BREAK /*--------------------------------------------------------------. | Scanning a line comment. The initial `//' is already eaten. | `--------------------------------------------------------------*/ case 65: /* rule 65 can match eol */ YY_RULE_SETUP #line 387 "scan-gram.l" STRING_GROW; BEGIN context_state; YY_BREAK case 66: /* rule 66 can match eol */ YY_RULE_SETUP #line 388 "scan-gram.l" STRING_GROW; YY_BREAK case YY_STATE_EOF(SC_LINE_COMMENT): #line 389 "scan-gram.l" BEGIN context_state; YY_BREAK /*------------------------------------------------. | Scanning a Bison string, including its escapes. | | The initial quote is already eaten. | `------------------------------------------------*/ case 67: YY_RULE_SETUP #line 400 "scan-gram.l" { STRING_FINISH; loc->start = token_start; val->chars = last_string; increment_rule_length (*loc); BEGIN INITIAL; return STRING; } YY_BREAK case 68: /* rule 68 can match eol */ YY_RULE_SETUP #line 408 "scan-gram.l" unexpected_newline (token_start, "\""); BEGIN INITIAL; YY_BREAK case YY_STATE_EOF(SC_ESCAPED_STRING): #line 409 "scan-gram.l" unexpected_eof (token_start, "\""); BEGIN INITIAL; YY_BREAK /*----------------------------------------------------------. | Scanning a Bison character literal, decoding its escapes. | | The initial quote is already eaten. | `----------------------------------------------------------*/ case 69: YY_RULE_SETUP #line 419 "scan-gram.l" { unsigned char last_string_1; STRING_GROW; STRING_FINISH; loc->start = token_start; val->symbol = symbol_get (quotearg_style (escape_quoting_style, last_string), *loc); symbol_class_set (val->symbol, token_sym, *loc, false); last_string_1 = last_string[1]; symbol_user_token_number_set (val->symbol, last_string_1, *loc); STRING_FREE; increment_rule_length (*loc); BEGIN INITIAL; return ID; } YY_BREAK case 70: /* rule 70 can match eol */ YY_RULE_SETUP #line 435 "scan-gram.l" unexpected_newline (token_start, "'"); BEGIN INITIAL; YY_BREAK case YY_STATE_EOF(SC_ESCAPED_CHARACTER): #line 436 "scan-gram.l" unexpected_eof (token_start, "'"); BEGIN INITIAL; YY_BREAK case 71: YY_RULE_SETUP #line 441 "scan-gram.l" complain_at (*loc, _("invalid null character")); YY_BREAK /*----------------------------. | Decode escaped characters. | `----------------------------*/ case 72: YY_RULE_SETUP #line 451 "scan-gram.l" { unsigned long int c = strtoul (gram_text + 1, NULL, 8); if (UCHAR_MAX < c) complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text)); else if (! c) complain_at (*loc, _("invalid null character: %s"), quote (gram_text)); else obstack_1grow (&obstack_for_string, c); } YY_BREAK case 73: YY_RULE_SETUP #line 461 "scan-gram.l" { verify (UCHAR_MAX < ULONG_MAX); unsigned long int c = strtoul (gram_text + 2, NULL, 16); if (UCHAR_MAX < c) complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text)); else if (! c) complain_at (*loc, _("invalid null character: %s"), quote (gram_text)); else obstack_1grow (&obstack_for_string, c); } YY_BREAK case 74: YY_RULE_SETUP #line 472 "scan-gram.l" obstack_1grow (&obstack_for_string, '\a'); YY_BREAK case 75: YY_RULE_SETUP #line 473 "scan-gram.l" obstack_1grow (&obstack_for_string, '\b'); YY_BREAK case 76: YY_RULE_SETUP #line 474 "scan-gram.l" obstack_1grow (&obstack_for_string, '\f'); YY_BREAK case 77: YY_RULE_SETUP #line 475 "scan-gram.l" obstack_1grow (&obstack_for_string, '\n'); YY_BREAK case 78: YY_RULE_SETUP #line 476 "scan-gram.l" obstack_1grow (&obstack_for_string, '\r'); YY_BREAK case 79: YY_RULE_SETUP #line 477 "scan-gram.l" obstack_1grow (&obstack_for_string, '\t'); YY_BREAK case 80: YY_RULE_SETUP #line 478 "scan-gram.l" obstack_1grow (&obstack_for_string, '\v'); YY_BREAK /* \\[\"\'?\\] would be shorter, but it confuses xgettext. */ case 81: YY_RULE_SETUP #line 481 "scan-gram.l" obstack_1grow (&obstack_for_string, gram_text[1]); YY_BREAK case 82: YY_RULE_SETUP #line 483 "scan-gram.l" { int c = convert_ucn_to_byte (gram_text); if (c < 0) complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text)); else if (! c) complain_at (*loc, _("invalid null character: %s"), quote (gram_text)); else obstack_1grow (&obstack_for_string, c); } YY_BREAK case 83: /* rule 83 can match eol */ YY_RULE_SETUP #line 492 "scan-gram.l" { complain_at (*loc, _("unrecognized escape sequence: %s"), quote (gram_text)); STRING_GROW; } YY_BREAK /*--------------------------------------------. | Scanning user-code characters and strings. | `--------------------------------------------*/ case 84: /* rule 84 can match eol */ YY_RULE_SETUP #line 504 "scan-gram.l" STRING_GROW; YY_BREAK case 85: YY_RULE_SETUP #line 509 "scan-gram.l" STRING_GROW; BEGIN context_state; YY_BREAK case 86: /* rule 86 can match eol */ YY_RULE_SETUP #line 510 "scan-gram.l" unexpected_newline (token_start, "'"); BEGIN context_state; YY_BREAK case YY_STATE_EOF(SC_CHARACTER): #line 511 "scan-gram.l" unexpected_eof (token_start, "'"); BEGIN context_state; YY_BREAK case 87: YY_RULE_SETUP #line 516 "scan-gram.l" STRING_GROW; BEGIN context_state; YY_BREAK case 88: /* rule 88 can match eol */ YY_RULE_SETUP #line 517 "scan-gram.l" unexpected_newline (token_start, "\""); BEGIN context_state; YY_BREAK case YY_STATE_EOF(SC_STRING): #line 518 "scan-gram.l" unexpected_eof (token_start, "\""); BEGIN context_state; YY_BREAK /*---------------------------------------------------. | Strings, comments etc. can be found in user code. | `---------------------------------------------------*/ case 89: YY_RULE_SETUP #line 528 "scan-gram.l" { STRING_GROW; context_state = YY_START; token_start = loc->start; BEGIN SC_CHARACTER; } YY_BREAK case 90: YY_RULE_SETUP #line 534 "scan-gram.l" { STRING_GROW; context_state = YY_START; token_start = loc->start; BEGIN SC_STRING; } YY_BREAK case 91: /* rule 91 can match eol */ YY_RULE_SETUP #line 540 "scan-gram.l" { STRING_GROW; context_state = YY_START; token_start = loc->start; BEGIN SC_COMMENT; } YY_BREAK case 92: /* rule 92 can match eol */ YY_RULE_SETUP #line 546 "scan-gram.l" { STRING_GROW; context_state = YY_START; BEGIN SC_LINE_COMMENT; } YY_BREAK /*---------------------------------------------------------------. | Scanning after %union etc., possibly followed by white space. | | For %union only, allow arbitrary C code to appear before the | | following brace, as an extension to POSIX. | `---------------------------------------------------------------*/ case 93: YY_RULE_SETUP #line 562 "scan-gram.l" { bool valid = gram_text[0] == '{' || token_type == PERCENT_UNION; scanner_cursor.column -= mbsnwidth (gram_text, gram_leng, 0); yyless (0); if (valid) { braces_level = -1; code_start = loc->start; BEGIN SC_BRACED_CODE; } else { complain_at (*loc, _("missing `{' in %s"), token_name (token_type)); obstack_sgrow (&obstack_for_string, "{}"); STRING_FINISH; val->chars = last_string; BEGIN INITIAL; return token_type; } } YY_BREAK case YY_STATE_EOF(SC_PRE_CODE): #line 585 "scan-gram.l" unexpected_eof (scanner_cursor, "{}"); BEGIN INITIAL; YY_BREAK /*---------------------------------------------------------------. | Scanning some code in braces (%union and actions). The initial | | "{" is already eaten. | `---------------------------------------------------------------*/ case 94: /* rule 94 can match eol */ YY_RULE_SETUP #line 596 "scan-gram.l" STRING_GROW; braces_level++; YY_BREAK case 95: /* rule 95 can match eol */ YY_RULE_SETUP #line 597 "scan-gram.l" STRING_GROW; braces_level--; YY_BREAK case 96: YY_RULE_SETUP #line 598 "scan-gram.l" { bool outer_brace = --braces_level < 0; /* As an undocumented Bison extension, append `;' before the last brace in braced code, so that the user code can omit trailing `;'. But do not append `;' if emulating Yacc, since Yacc does not append one. FIXME: Bison should warn if a semicolon seems to be necessary here, and should omit the semicolon if it seems unnecessary (e.g., after ';', '{', or '}', each followed by comments or white space). Such a warning shouldn't depend on --yacc; it should depend on a new --pedantic option, which would cause Bison to warn if it detects an extension to POSIX. --pedantic should also diagnose other Bison extensions like %yacc. Perhaps there should also be a GCC-style --pedantic-errors option, so that such warnings are diagnosed as errors. */ if (outer_brace && token_type == BRACED_CODE && ! yacc_flag) obstack_1grow (&obstack_for_string, ';'); obstack_1grow (&obstack_for_string, '}'); if (outer_brace) { STRING_FINISH; loc->start = code_start; val->chars = last_string; increment_rule_length (*loc); last_braced_code_loc = *loc; BEGIN INITIAL; return token_type; } } YY_BREAK /* Tokenize `<<%' correctly (as `<<' `%') rather than incorrrectly (as `<' `<%'). */ case 97: /* rule 97 can match eol */ YY_RULE_SETUP #line 634 "scan-gram.l" STRING_GROW; YY_BREAK case 98: YY_RULE_SETUP #line 636 "scan-gram.l" handle_dollar (token_type, gram_text, *loc); YY_BREAK case 99: YY_RULE_SETUP #line 637 "scan-gram.l" handle_at (token_type, gram_text, *loc); YY_BREAK case 100: YY_RULE_SETUP #line 639 "scan-gram.l" { warn_at (*loc, _("stray `$'")); obstack_sgrow (&obstack_for_string, "$]["); } YY_BREAK case 101: YY_RULE_SETUP #line 643 "scan-gram.l" { warn_at (*loc, _("stray `@'")); obstack_sgrow (&obstack_for_string, "@@"); } YY_BREAK case YY_STATE_EOF(SC_BRACED_CODE): #line 648 "scan-gram.l" unexpected_eof (code_start, "}"); BEGIN INITIAL; YY_BREAK /*--------------------------------------------------------------. | Scanning some prologue: from "%{" (already scanned) to "%}". | `--------------------------------------------------------------*/ case 102: YY_RULE_SETUP #line 658 "scan-gram.l" { STRING_FINISH; loc->start = code_start; val->chars = last_string; BEGIN INITIAL; return PROLOGUE; } YY_BREAK case YY_STATE_EOF(SC_PROLOGUE): #line 666 "scan-gram.l" unexpected_eof (code_start, "%}"); BEGIN INITIAL; YY_BREAK /*---------------------------------------------------------------. | Scanning the epilogue (everything after the second "%%", which | | has already been eaten). | `---------------------------------------------------------------*/ case YY_STATE_EOF(SC_EPILOGUE): #line 677 "scan-gram.l" { STRING_FINISH; loc->start = code_start; val->chars = last_string; BEGIN INITIAL; return EPILOGUE; } YY_BREAK /*-----------------------------------------. | Escape M4 quoting characters in C code. | `-----------------------------------------*/ case 103: YY_RULE_SETUP #line 693 "scan-gram.l" obstack_sgrow (&obstack_for_string, "$]["); YY_BREAK case 104: YY_RULE_SETUP #line 694 "scan-gram.l" obstack_sgrow (&obstack_for_string, "@@"); YY_BREAK case 105: YY_RULE_SETUP #line 695 "scan-gram.l" obstack_sgrow (&obstack_for_string, "@{"); YY_BREAK case 106: YY_RULE_SETUP #line 696 "scan-gram.l" obstack_sgrow (&obstack_for_string, "@}"); YY_BREAK /*-----------------------------------------------------. | By default, grow the string obstack with the input. | `-----------------------------------------------------*/ case 107: #line 705 "scan-gram.l" case 108: /* rule 108 can match eol */ YY_RULE_SETUP #line 705 "scan-gram.l" STRING_GROW; YY_BREAK case 109: YY_RULE_SETUP #line 707 "scan-gram.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 2305 "scan-gram.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed gram_in at a new source and called * gram_lex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = gram_in; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( gram_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * gram_text, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of gram_lex */ /* %ok-for-header */ /* %if-c++-only */ /* %not-for-header */ /* %ok-for-header */ /* %endif */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ /* %if-c-only */ static int yy_get_next_buffer (void) /* %endif */ /* %if-c++-only */ /* %endif */ { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ gram_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; gram_restart(gram_in ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ /* %if-c-only */ /* %not-for-header */ static yy_state_type yy_get_previous_state (void) /* %endif */ /* %if-c++-only */ /* %endif */ { register yy_state_type yy_current_state; register char *yy_cp; /* %% [15.0] code to get the start state into yy_current_state goes here */ yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { /* %% [16.0] code to find the next state goes here */ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 58); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 461 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ /* %if-c-only */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) /* %endif */ /* %if-c++-only */ /* %endif */ { register int yy_is_jam; /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 58; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 461 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 460); return yy_is_jam ? 0 : yy_current_state; } /* %if-c-only */ /* %endif */ /* %if-c-only */ #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif /* %endif */ /* %if-c++-only */ /* %endif */ { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ gram_restart(gram_in ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( gram_wrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve gram_text */ (yy_hold_char) = *++(yy_c_buf_p); /* %% [19.0] update BOL and gram_lineno */ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; } /* %if-c-only */ #endif /* ifndef YY_NO_INPUT */ /* %endif */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ /* %if-c-only */ void gram_restart (FILE * input_file ) /* %endif */ /* %if-c++-only */ /* %endif */ { if ( ! YY_CURRENT_BUFFER ){ gram_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = gram__create_buffer(gram_in,YY_BUF_SIZE ); } gram__init_buffer(YY_CURRENT_BUFFER,input_file ); gram__load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ /* %if-c-only */ void gram__switch_to_buffer (YY_BUFFER_STATE new_buffer ) /* %endif */ /* %if-c++-only */ /* %endif */ { /* TODO. We should be able to replace this entire function body * with * gram_pop_buffer_state(); * gram_push_buffer_state(new_buffer); */ gram_ensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; gram__load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (gram_wrap()) processing, but the only time this flag * is looked at is after gram_wrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } /* %if-c-only */ static void gram__load_buffer_state (void) /* %endif */ /* %if-c++-only */ /* %endif */ { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; gram_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ /* %if-c-only */ YY_BUFFER_STATE gram__create_buffer (FILE * file, int size ) /* %endif */ /* %if-c++-only */ /* %endif */ { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) gram_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in gram__create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) gram_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in gram__create_buffer()" ); b->yy_is_our_buffer = 1; gram__init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with gram__create_buffer() * */ /* %if-c-only */ void gram__delete_buffer (YY_BUFFER_STATE b ) /* %endif */ /* %if-c++-only */ /* %endif */ { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) gram_free((void *) b->yy_ch_buf ); gram_free((void *) b ); } /* %if-c-only */ /* %endif */ /* %if-c++-only */ /* %endif */ /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a gram_restart() or at EOF. */ /* %if-c-only */ static void gram__init_buffer (YY_BUFFER_STATE b, FILE * file ) /* %endif */ /* %if-c++-only */ /* %endif */ { int oerrno = errno; gram__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then gram__init_buffer was _probably_ * called from gram_restart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } /* %if-c-only */ b->yy_is_interactive = 0; /* %endif */ /* %if-c++-only */ /* %endif */ errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ /* %if-c-only */ void gram__flush_buffer (YY_BUFFER_STATE b ) /* %endif */ /* %if-c++-only */ /* %endif */ { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) gram__load_buffer_state( ); } /* %if-c-or-c++ */ /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ /* %if-c-only */ void gram_push_buffer_state (YY_BUFFER_STATE new_buffer ) /* %endif */ /* %if-c++-only */ /* %endif */ { if (new_buffer == NULL) return; gram_ensure_buffer_stack(); /* This block is copied from gram__switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from gram__switch_to_buffer. */ gram__load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /* %endif */ /* %if-c-or-c++ */ /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ /* %if-c-only */ void gram_pop_buffer_state (void) /* %endif */ /* %if-c++-only */ /* %endif */ { if (!YY_CURRENT_BUFFER) return; gram__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { gram__load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* %endif */ /* %if-c-or-c++ */ /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ /* %if-c-only */ static void gram_ensure_buffer_stack (void) /* %endif */ /* %if-c++-only */ /* %endif */ { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)gram_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)gram_realloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /* %endif */ /* %if-c-only */ /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE gram__scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) gram_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in gram__scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; gram__switch_to_buffer(b ); return b; } /* %endif */ /* %if-c-only */ /** Setup the input buffer state to scan a string. The next call to gram_lex() will * scan from a @e copy of @a str. * @param str a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * gram__scan_bytes() instead. */ YY_BUFFER_STATE gram__scan_string (yyconst char * yy_str ) { return gram__scan_bytes(yy_str,strlen(yy_str) ); } /* %endif */ /* %if-c-only */ /** Setup the input buffer state to scan the given bytes. The next call to gram_lex() will * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE gram__scan_bytes (yyconst char * bytes, int len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) gram_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in gram__scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = gram__scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in gram__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } /* %endif */ #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif /* %if-c-only */ static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* %endif */ /* %if-c++-only */ /* %endif */ /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up gram_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ gram_text[gram_leng] = (yy_hold_char); \ (yy_c_buf_p) = gram_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ gram_leng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /* %if-c-only */ /* %if-reentrant */ /* %endif */ /** Get the current line number. * */ int gram_get_lineno (void) { return gram_lineno; } /** Get the input stream. * */ FILE *gram_get_in (void) { return gram_in; } /** Get the output stream. * */ FILE *gram_get_out (void) { return gram_out; } /** Get the length of the current token. * */ int gram_get_leng (void) { return gram_leng; } /** Get the current token. * */ char *gram_get_text (void) { return gram_text; } /* %if-reentrant */ /* %endif */ /** Set the current line number. * @param line_number * */ void gram_set_lineno (int line_number ) { gram_lineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see gram__switch_to_buffer */ void gram_set_in (FILE * in_str ) { gram_in = in_str ; } void gram_set_out (FILE * out_str ) { gram_out = out_str ; } int gram_get_debug (void) { return gram__flex_debug; } void gram_set_debug (int bdebug ) { gram__flex_debug = bdebug ; } /* %endif */ /* %if-reentrant */ /* %if-bison-bridge */ /* %endif */ /* %endif */ /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ /* gram_lex_destroy is for both reentrant and non-reentrant scanners. */ int gram_lex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ gram__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; gram_pop_buffer_state(); } /* Destroy the stack itself. */ gram_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* %if-reentrant */ /* %endif */ return 0; } /* %endif */ /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *gram_alloc (yy_size_t size ) { return (void *) malloc( size ); } void *gram_realloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void gram_free (void * ptr ) { free( (char *) ptr ); /* see gram_realloc() for (char *) cast */ } /* %if-tables-serialization definitions */ /* %define-yytables The name for this specific scanner's tables. */ #define YYTABLES_NAME "yytables" /* %endif */ /* %ok-for-header */ #undef YY_NEW_FILE #undef YY_FLUSH_BUFFER #undef yy_set_bol #undef yy_new_buffer #undef yy_set_interactive #undef yytext_ptr #undef YY_DO_BEFORE_ACTION #ifdef YY_DECL_IS_OURS #undef YY_DECL_IS_OURS #undef YY_DECL #endif #line 707 "scan-gram.l" /* Keeps track of the maximum number of semantic values to the left of a handle (those referenced by $0, $-1, etc.) are required by the semantic actions of this grammar. */ int max_left_semantic_context = 0; /* If BUF is null, add BUFSIZE (which in this case must be less than INT_MAX) to COLUMN; otherwise, add mbsnwidth (BUF, BUFSIZE, 0) to COLUMN. If an overflow occurs, or might occur but is undetectable, return INT_MAX. Assume COLUMN is nonnegative. */ static inline int add_column_width (int column, char const *buf, size_t bufsize) { size_t width; unsigned int remaining_columns = INT_MAX - column; if (buf) { if (INT_MAX / 2 <= bufsize) return INT_MAX; width = mbsnwidth (buf, bufsize, 0); } else width = bufsize; return width <= remaining_columns ? column + width : INT_MAX; } /* Set *LOC and adjust scanner cursor to account for token TOKEN of size SIZE. */ static void adjust_location (location *loc, char const *token, size_t size) { int line = scanner_cursor.line; int column = scanner_cursor.column; char const *p0 = token; char const *p = token; char const *lim = token + size; loc->start = scanner_cursor; for (p = token; p < lim; p++) switch (*p) { case '\n': line += line < INT_MAX; column = 1; p0 = p + 1; break; case '\t': column = add_column_width (column, p0, p - p0); column = add_column_width (column, NULL, 8 - ((column - 1) & 7)); p0 = p + 1; break; default: break; } scanner_cursor.line = line; scanner_cursor.column = column = add_column_width (column, p0, p - p0); loc->end = scanner_cursor; if (line == INT_MAX && loc->start.line != INT_MAX) warn_at (*loc, _("line number overflow")); if (column == INT_MAX && loc->start.column != INT_MAX) warn_at (*loc, _("column number overflow")); } /* Read bytes from FP into buffer BUF of size SIZE. Return the number of bytes read. Remove '\r' from input, treating \r\n and isolated \r as \n. */ static size_t no_cr_read (FILE *fp, char *buf, size_t size) { size_t bytes_read = fread (buf, 1, size, fp); if (bytes_read) { char *w = memchr (buf, '\r', bytes_read); if (w) { char const *r = ++w; char const *lim = buf + bytes_read; for (;;) { /* Found an '\r'. Treat it like '\n', but ignore any '\n' that immediately follows. */ w[-1] = '\n'; if (r == lim) { int ch = getc (fp); if (ch != '\n' && ungetc (ch, fp) != ch) break; } else if (*r == '\n') r++; /* Copy until the next '\r'. */ do { if (r == lim) return w - buf; } while ((*w++ = *r++) != '\r'); } return w - buf; } } return bytes_read; } /*------------------------------------------------------------------. | TEXT is pointing to a wannabee semantic value (i.e., a `$'). | | | | Possible inputs: $[]($|integer) | | | | Output to OBSTACK_FOR_STRING a reference to this semantic value. | `------------------------------------------------------------------*/ static inline bool handle_action_dollar (char *text, location loc) { const char *type_name = NULL; char *cp = text + 1; if (! current_rule) return false; /* Get the type name if explicit. */ if (*cp == '<') { type_name = ++cp; while (*cp != '>') ++cp; *cp = '\0'; ++cp; } if (*cp == '$') { if (!type_name) type_name = symbol_list_n_type_name_get (current_rule, loc, 0); if (!type_name && typed) complain_at (loc, _("$$ of `%s' has no declared type"), current_rule->sym->tag); if (!type_name) type_name = ""; obstack_fgrow1 (&obstack_for_string, "]b4_lhs_value([%s])[", type_name); current_rule->used = true; } else { long int num = strtol (cp, NULL, 10); if (1 - INT_MAX + rule_length <= num && num <= rule_length) { int n = num; if (max_left_semantic_context < 1 - n) max_left_semantic_context = 1 - n; if (!type_name && 0 < n) type_name = symbol_list_n_type_name_get (current_rule, loc, n); if (!type_name && typed) complain_at (loc, _("$%d of `%s' has no declared type"), n, current_rule->sym->tag); if (!type_name) type_name = ""; obstack_fgrow3 (&obstack_for_string, "]b4_rhs_value(%d, %d, [%s])[", rule_length, n, type_name); symbol_list_n_used_set (current_rule, n, true); } else complain_at (loc, _("integer out of range: %s"), quote (text)); } return true; } /*----------------------------------------------------------------. | Map `$?' onto the proper M4 symbol, depending on its TOKEN_TYPE | | (are we in an action?). | `----------------------------------------------------------------*/ static void handle_dollar (int token_type, char *text, location loc) { switch (token_type) { case BRACED_CODE: if (handle_action_dollar (text, loc)) return; break; case PERCENT_DESTRUCTOR: case PERCENT_INITIAL_ACTION: case PERCENT_PRINTER: if (text[1] == '$') { obstack_sgrow (&obstack_for_string, "]b4_dollar_dollar["); return; } break; default: break; } complain_at (loc, _("invalid value: %s"), quote (text)); } /*------------------------------------------------------. | TEXT is a location token (i.e., a `@...'). Output to | | OBSTACK_FOR_STRING a reference to this location. | `------------------------------------------------------*/ static inline bool handle_action_at (char *text, location loc) { char *cp = text + 1; locations_flag = true; if (! current_rule) return false; if (*cp == '$') obstack_sgrow (&obstack_for_string, "]b4_lhs_location["); else { long int num = strtol (cp, NULL, 10); if (1 - INT_MAX + rule_length <= num && num <= rule_length) { int n = num; obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location(%d, %d)[", rule_length, n); } else complain_at (loc, _("integer out of range: %s"), quote (text)); } return true; } /*----------------------------------------------------------------. | Map `@?' onto the proper M4 symbol, depending on its TOKEN_TYPE | | (are we in an action?). | `----------------------------------------------------------------*/ static void handle_at (int token_type, char *text, location loc) { switch (token_type) { case BRACED_CODE: handle_action_at (text, loc); return; case PERCENT_INITIAL_ACTION: case PERCENT_DESTRUCTOR: case PERCENT_PRINTER: if (text[1] == '$') { obstack_sgrow (&obstack_for_string, "]b4_at_dollar["); return; } break; default: break; } complain_at (loc, _("invalid value: %s"), quote (text)); } /*------------------------------------------------------. | Scan NUMBER for a base-BASE integer at location LOC. | `------------------------------------------------------*/ static unsigned long int scan_integer (char const *number, int base, location loc) { verify (INT_MAX < ULONG_MAX); unsigned long int num = strtoul (number, NULL, base); if (INT_MAX < num) { complain_at (loc, _("integer out of range: %s"), quote (number)); num = INT_MAX; } return num; } /*------------------------------------------------------------------. | Convert universal character name UCN to a single-byte character, | | and return that character. Return -1 if UCN does not correspond | | to a single-byte character. | `------------------------------------------------------------------*/ static int convert_ucn_to_byte (char const *ucn) { verify (UCHAR_MAX <= INT_MAX); unsigned long int code = strtoul (ucn + 2, NULL, 16); /* FIXME: Currently we assume Unicode-compatible unibyte characters on ASCII hosts (i.e., Latin-1 on hosts with 8-bit bytes). On non-ASCII hosts we support only the portable C character set. These limitations should be removed once we add support for multibyte characters. */ if (UCHAR_MAX < code) return -1; #if ! ('$' == 0x24 && '@' == 0x40 && '`' == 0x60 && '~' == 0x7e) { /* A non-ASCII host. Use CODE to index into a table of the C basic execution character set, which is guaranteed to exist on all Standard C platforms. This table also includes '$', '@', and '`', which are not in the basic execution character set but which are unibyte characters on all the platforms that we know about. */ static signed char const table[] = { '\0', -1, -1, -1, -1, -1, -1, '\a', '\b', '\t', '\n', '\v', '\f', '\r', -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~' }; code = code < sizeof table ? table[code] : -1; } #endif return code; } /*----------------------------------------------------------------. | Handle `#line INT "FILE"'. ARGS has already skipped `#line '. | `----------------------------------------------------------------*/ static void handle_syncline (char *args, location loc) { char *after_num; unsigned long int lineno = strtoul (args, &after_num, 10); char *file = strchr (after_num, '"') + 1; *strchr (file, '"') = '\0'; if (INT_MAX <= lineno) { warn_at (loc, _("line number overflow")); lineno = INT_MAX; } scanner_cursor.file = current_file = uniqstr_new (file); scanner_cursor.line = lineno; scanner_cursor.column = 1; } /*---------------------------------. | Report a rule that is too long. | `---------------------------------*/ static void rule_length_overflow (location loc) { fatal_at (loc, _("rule is too long")); } /*----------------------------------------------------------------. | For a token or comment starting at START, report message MSGID, | | which should say that an end marker was found before | | the expected TOKEN_END. | `----------------------------------------------------------------*/ static void unexpected_end (boundary start, char const *msgid, char const *token_end) { location loc; loc.start = start; loc.end = scanner_cursor; complain_at (loc, _(msgid), token_end); } /*------------------------------------------------------------------------. | Report an unexpected EOF in a token or comment starting at START. | | An end of file was encountered and the expected TOKEN_END was missing. | `------------------------------------------------------------------------*/ static void unexpected_eof (boundary start, char const *token_end) { unexpected_end (start, N_("missing `%s' at end of file"), token_end); } /*----------------------------------------. | Likewise, but for unexpected newlines. | `----------------------------------------*/ static void unexpected_newline (boundary start, char const *token_end) { unexpected_end (start, N_("missing `%s' at end of line"), token_end); } /*-------------------------. | Initialize the scanner. | `-------------------------*/ void scanner_initialize (void) { obstack_init (&obstack_for_string); } /*-----------------------------------------------. | Free all the memory allocated to the scanner. | `-----------------------------------------------*/ void scanner_free (void) { obstack_free (&obstack_for_string, 0); /* Reclaim Flex's buffers. */ gram__delete_buffer (YY_CURRENT_BUFFER); }