1 #line 2 "scan-gram.c" 2 3 #line 4 "scan-gram.c" 4 5 #define YY_INT_ALIGNED short int 6 7 /* A lexical scanner generated by flex */ 8 9 /* %not-for-header */ 10 11 /* %if-c-only */ 12 /* %if-not-reentrant */ 13 #define yy_create_buffer gram__create_buffer 14 #define yy_delete_buffer gram__delete_buffer 15 #define yy_flex_debug gram__flex_debug 16 #define yy_init_buffer gram__init_buffer 17 #define yy_flush_buffer gram__flush_buffer 18 #define yy_load_buffer_state gram__load_buffer_state 19 #define yy_switch_to_buffer gram__switch_to_buffer 20 #define yyin gram_in 21 #define yyleng gram_leng 22 #define yylex gram_lex 23 #define yylineno gram_lineno 24 #define yyout gram_out 25 #define yyrestart gram_restart 26 #define yytext gram_text 27 #define yywrap gram_wrap 28 #define yyalloc gram_alloc 29 #define yyrealloc gram_realloc 30 #define yyfree gram_free 31 32 /* %endif */ 33 /* %endif */ 34 /* %ok-for-header */ 35 36 #define FLEX_SCANNER 37 #define YY_FLEX_MAJOR_VERSION 2 38 #define YY_FLEX_MINOR_VERSION 5 39 #define YY_FLEX_SUBMINOR_VERSION 37 40 #if YY_FLEX_SUBMINOR_VERSION > 0 41 #define FLEX_BETA 42 #endif 43 44 /* %if-c++-only */ 45 /* %endif */ 46 47 /* %if-c-only */ 48 49 /* %endif */ 50 51 /* %if-c-only */ 52 53 /* %endif */ 54 55 /* First, we deal with platform-specific or compiler-specific issues. */ 56 57 /* begin standard C headers. */ 58 /* %if-c-only */ 59 #include <stdio.h> 60 #include <string.h> 61 #include <errno.h> 62 #include <stdlib.h> 63 /* %endif */ 64 65 /* %if-tables-serialization */ 66 /* %endif */ 67 /* end standard C headers. */ 68 69 /* %if-c-or-c++ */ 70 /* flex integer type definitions */ 71 72 #ifndef FLEXINT_H 73 #define FLEXINT_H 74 75 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 76 77 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 78 79 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 80 * if you want the limit (max/min) macros for int types. 81 */ 82 #ifndef __STDC_LIMIT_MACROS 83 #define __STDC_LIMIT_MACROS 1 84 #endif 85 86 #include <inttypes.h> 87 typedef int8_t flex_int8_t; 88 typedef uint8_t flex_uint8_t; 89 typedef int16_t flex_int16_t; 90 typedef uint16_t flex_uint16_t; 91 typedef int32_t flex_int32_t; 92 typedef uint32_t flex_uint32_t; 93 #else 94 typedef signed char flex_int8_t; 95 typedef short int flex_int16_t; 96 typedef int flex_int32_t; 97 typedef unsigned char flex_uint8_t; 98 typedef unsigned short int flex_uint16_t; 99 typedef unsigned int flex_uint32_t; 100 101 /* Limits of integral types. */ 102 #ifndef INT8_MIN 103 #define INT8_MIN (-128) 104 #endif 105 #ifndef INT16_MIN 106 #define INT16_MIN (-32767-1) 107 #endif 108 #ifndef INT32_MIN 109 #define INT32_MIN (-2147483647-1) 110 #endif 111 #ifndef INT8_MAX 112 #define INT8_MAX (127) 113 #endif 114 #ifndef INT16_MAX 115 #define INT16_MAX (32767) 116 #endif 117 #ifndef INT32_MAX 118 #define INT32_MAX (2147483647) 119 #endif 120 #ifndef UINT8_MAX 121 #define UINT8_MAX (255U) 122 #endif 123 #ifndef UINT16_MAX 124 #define UINT16_MAX (65535U) 125 #endif 126 #ifndef UINT32_MAX 127 #define UINT32_MAX (4294967295U) 128 #endif 129 130 #endif /* ! C99 */ 131 132 #endif /* ! FLEXINT_H */ 133 134 /* %endif */ 135 136 /* %if-c++-only */ 137 /* %endif */ 138 139 #ifdef __cplusplus 140 141 /* The "const" storage-class-modifier is valid. */ 142 #define YY_USE_CONST 143 144 #else /* ! __cplusplus */ 145 146 /* C99 requires __STDC__ to be defined as 1. */ 147 #if defined (__STDC__) 148 149 #define YY_USE_CONST 150 151 #endif /* defined (__STDC__) */ 152 #endif /* ! __cplusplus */ 153 154 #ifdef YY_USE_CONST 155 #define yyconst const 156 #else 157 #define yyconst 158 #endif 159 160 /* %not-for-header */ 161 162 /* Returned upon end-of-file. */ 163 #define YY_NULL 0 164 /* %ok-for-header */ 165 166 /* %not-for-header */ 167 168 /* Promotes a possibly negative, possibly signed char to an unsigned 169 * integer for use as an array index. If the signed char is negative, 170 * we want to instead treat it as an 8-bit unsigned char, hence the 171 * double cast. 172 */ 173 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 174 /* %ok-for-header */ 175 176 /* %if-reentrant */ 177 /* %endif */ 178 179 /* %if-not-reentrant */ 180 181 /* %endif */ 182 183 /* Enter a start condition. This macro really ought to take a parameter, 184 * but we do it the disgusting crufty way forced on us by the ()-less 185 * definition of BEGIN. 186 */ 187 #define BEGIN (yy_start) = 1 + 2 * 188 189 /* Translate the current start state into a value that can be later handed 190 * to BEGIN to return to the state. The YYSTATE alias is for lex 191 * compatibility. 192 */ 193 #define YY_START (((yy_start) - 1) / 2) 194 #define YYSTATE YY_START 195 196 /* Action number for EOF rule of a given start state. */ 197 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 198 199 /* Special action meaning "start processing a new file". */ 200 #define YY_NEW_FILE gram_restart(gram_in ) 201 202 #define YY_END_OF_BUFFER_CHAR 0 203 204 /* Size of default input buffer. */ 205 #ifndef YY_BUF_SIZE 206 #define YY_BUF_SIZE 16384 207 #endif 208 209 /* The state buf must be large enough to hold one state per character in the main buffer. 210 */ 211 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 212 213 #ifndef YY_TYPEDEF_YY_BUFFER_STATE 214 #define YY_TYPEDEF_YY_BUFFER_STATE 215 typedef struct yy_buffer_state *YY_BUFFER_STATE; 216 #endif 217 218 #ifndef YY_TYPEDEF_YY_SIZE_T 219 #define YY_TYPEDEF_YY_SIZE_T 220 typedef size_t yy_size_t; 221 #endif 222 223 /* %if-not-reentrant */ 224 extern yy_size_t gram_leng; 225 /* %endif */ 226 227 /* %if-c-only */ 228 /* %if-not-reentrant */ 229 extern FILE *gram_in, *gram_out; 230 /* %endif */ 231 /* %endif */ 232 233 #define EOB_ACT_CONTINUE_SCAN 0 234 #define EOB_ACT_END_OF_FILE 1 235 #define EOB_ACT_LAST_MATCH 2 236 237 #define YY_LESS_LINENO(n) 238 239 /* Return all but the first "n" matched characters back to the input stream. */ 240 #define yyless(n) \ 241 do \ 242 { \ 243 /* Undo effects of setting up gram_text. */ \ 244 int yyless_macro_arg = (n); \ 245 YY_LESS_LINENO(yyless_macro_arg);\ 246 *yy_cp = (yy_hold_char); \ 247 YY_RESTORE_YY_MORE_OFFSET \ 248 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 249 YY_DO_BEFORE_ACTION; /* set up gram_text again */ \ 250 } \ 251 while ( 0 ) 252 253 #define unput(c) yyunput( c, (yytext_ptr) ) 254 255 #ifndef YY_STRUCT_YY_BUFFER_STATE 256 #define YY_STRUCT_YY_BUFFER_STATE 257 struct yy_buffer_state 258 { 259 /* %if-c-only */ 260 FILE *yy_input_file; 261 /* %endif */ 262 263 /* %if-c++-only */ 264 /* %endif */ 265 266 char *yy_ch_buf; /* input buffer */ 267 char *yy_buf_pos; /* current position in input buffer */ 268 269 /* Size of input buffer in bytes, not including room for EOB 270 * characters. 271 */ 272 yy_size_t yy_buf_size; 273 274 /* Number of characters read into yy_ch_buf, not including EOB 275 * characters. 276 */ 277 yy_size_t yy_n_chars; 278 279 /* Whether we "own" the buffer - i.e., we know we created it, 280 * and can realloc() it to grow it, and should free() it to 281 * delete it. 282 */ 283 int yy_is_our_buffer; 284 285 /* Whether this is an "interactive" input source; if so, and 286 * if we're using stdio for input, then we want to use getc() 287 * instead of fread(), to make sure we stop fetching input after 288 * each newline. 289 */ 290 int yy_is_interactive; 291 292 /* Whether we're considered to be at the beginning of a line. 293 * If so, '^' rules will be active on the next match, otherwise 294 * not. 295 */ 296 int yy_at_bol; 297 298 int yy_bs_lineno; /**< The line count. */ 299 int yy_bs_column; /**< The column count. */ 300 301 /* Whether to try to fill the input buffer when we reach the 302 * end of it. 303 */ 304 int yy_fill_buffer; 305 306 int yy_buffer_status; 307 308 #define YY_BUFFER_NEW 0 309 #define YY_BUFFER_NORMAL 1 310 /* When an EOF's been seen but there's still some text to process 311 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 312 * shouldn't try reading from the input source any more. We might 313 * still have a bunch of tokens to match, though, because of 314 * possible backing-up. 315 * 316 * When we actually see the EOF, we change the status to "new" 317 * (via gram_restart()), so that the user can continue scanning by 318 * just pointing gram_in at a new input file. 319 */ 320 #define YY_BUFFER_EOF_PENDING 2 321 322 }; 323 #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 324 325 /* %if-c-only Standard (non-C++) definition */ 326 /* %not-for-header */ 327 328 /* %if-not-reentrant */ 329 330 /* Stack of input buffers. */ 331 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ 332 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 333 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ 334 /* %endif */ 335 /* %ok-for-header */ 336 337 /* %endif */ 338 339 /* We provide macros for accessing buffer states in case in the 340 * future we want to put the buffer states in a more general 341 * "scanner state". 342 * 343 * Returns the top of the stack, or NULL. 344 */ 345 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 346 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 347 : NULL) 348 349 /* Same as previous macro, but useful when we know that the buffer stack is not 350 * NULL or when we need an lvalue. For internal use only. 351 */ 352 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 353 354 /* %if-c-only Standard (non-C++) definition */ 355 356 /* %if-not-reentrant */ 357 /* %not-for-header */ 358 359 /* yy_hold_char holds the character lost when gram_text is formed. */ 360 static char yy_hold_char; 361 static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ 362 yy_size_t gram_leng; 363 364 /* Points to current character in buffer. */ 365 static char *yy_c_buf_p = (char *) 0; 366 static int yy_init = 0; /* whether we need to initialize */ 367 static int yy_start = 0; /* start state number */ 368 369 /* Flag which is used to allow gram_wrap()'s to do buffer switches 370 * instead of setting up a fresh gram_in. A bit of a hack ... 371 */ 372 static int yy_did_buffer_switch_on_eof; 373 /* %ok-for-header */ 374 375 /* %endif */ 376 377 void gram_restart (FILE *input_file ); 378 void gram__switch_to_buffer (YY_BUFFER_STATE new_buffer ); 379 YY_BUFFER_STATE gram__create_buffer (FILE *file,int size ); 380 void gram__delete_buffer (YY_BUFFER_STATE b ); 381 void gram__flush_buffer (YY_BUFFER_STATE b ); 382 void gram_push_buffer_state (YY_BUFFER_STATE new_buffer ); 383 void gram_pop_buffer_state (void ); 384 385 static void gram_ensure_buffer_stack (void ); 386 static void gram__load_buffer_state (void ); 387 static void gram__init_buffer (YY_BUFFER_STATE b,FILE *file ); 388 389 #define YY_FLUSH_BUFFER gram__flush_buffer(YY_CURRENT_BUFFER ) 390 391 YY_BUFFER_STATE gram__scan_buffer (char *base,yy_size_t size ); 392 YY_BUFFER_STATE gram__scan_string (yyconst char *yy_str ); 393 YY_BUFFER_STATE gram__scan_bytes (yyconst char *bytes,yy_size_t len ); 394 395 /* %endif */ 396 397 void *gram_alloc (yy_size_t ); 398 void *gram_realloc (void *,yy_size_t ); 399 void gram_free (void * ); 400 401 #define yy_new_buffer gram__create_buffer 402 403 #define yy_set_interactive(is_interactive) \ 404 { \ 405 if ( ! YY_CURRENT_BUFFER ){ \ 406 gram_ensure_buffer_stack (); \ 407 YY_CURRENT_BUFFER_LVALUE = \ 408 gram__create_buffer(gram_in,YY_BUF_SIZE ); \ 409 } \ 410 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 411 } 412 413 #define yy_set_bol(at_bol) \ 414 { \ 415 if ( ! YY_CURRENT_BUFFER ){\ 416 gram_ensure_buffer_stack (); \ 417 YY_CURRENT_BUFFER_LVALUE = \ 418 gram__create_buffer(gram_in,YY_BUF_SIZE ); \ 419 } \ 420 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 421 } 422 423 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 424 425 /* %% [1.0] gram_text/gram_in/gram_out/yy_state_type/gram_lineno etc. def's & init go here */ 426 /* Begin user sect3 */ 427 428 #define gram_wrap() 1 429 #define YY_SKIP_YYWRAP 430 431 #define FLEX_DEBUG 432 433 typedef unsigned char YY_CHAR; 434 435 FILE *gram_in = (FILE *) 0, *gram_out = (FILE *) 0; 436 437 typedef int yy_state_type; 438 439 extern int gram_lineno; 440 441 int gram_lineno = 1; 442 443 extern char *gram_text; 444 #define yytext_ptr gram_text 445 446 /* %if-c-only Standard (non-C++) definition */ 447 448 static yy_state_type yy_get_previous_state (void ); 449 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); 450 static int yy_get_next_buffer (void ); 451 static void yy_fatal_error (yyconst char msg[] ); 452 453 /* %endif */ 454 455 /* Done after the current pattern has been matched and before the 456 * corresponding action - sets up gram_text. 457 */ 458 #define YY_DO_BEFORE_ACTION \ 459 (yytext_ptr) = yy_bp; \ 460 /* %% [2.0] code to fiddle gram_text and gram_leng for yymore() goes here \ */\ 461 gram_leng = (size_t) (yy_cp - yy_bp); \ 462 (yy_hold_char) = *yy_cp; \ 463 *yy_cp = '\0'; \ 464 /* %% [3.0] code to copy yytext_ptr to gram_text[] goes here, if %array \ */\ 465 (yy_c_buf_p) = yy_cp; 466 467 /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ 468 #define YY_NUM_RULES 109 469 #define YY_END_OF_BUFFER 110 470 /* This struct is not used in this scanner, 471 but its presence is necessary. */ 472 struct yy_trans_info 473 { 474 flex_int32_t yy_verify; 475 flex_int32_t yy_nxt; 476 }; 477 static yyconst flex_int16_t yy_accept[482] = 478 { 0, 479 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480 0, 0, 0, 0, 0, 0, 0, 0, 77, 77, 481 93, 93, 93, 93, 0, 0, 0, 0, 110, 65, 482 2, 2, 59, 65, 58, 65, 1, 54, 65, 55, 483 55, 51, 65, 49, 54, 64, 61, 50, 65, 74, 484 74, 107, 78, 78, 107, 80, 79, 79, 68, 2, 485 1, 68, 67, 66, 68, 108, 99, 107, 98, 107, 486 107, 107, 102, 104, 107, 76, 107, 97, 96, 107, 487 95, 94, 71, 2, 1, 69, 71, 71, 70, 71, 488 72, 2, 1, 72, 72, 65, 0, 63, 48, 48, 489 490 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 491 48, 48, 48, 48, 48, 48, 48, 60, 54, 54, 492 4, 3, 57, 55, 57, 0, 0, 53, 0, 73, 493 92, 90, 81, 92, 83, 84, 85, 86, 87, 88, 494 92, 89, 92, 106, 100, 101, 0, 103, 0, 102, 495 105, 0, 75, 0, 0, 77, 93, 93, 93, 93, 496 71, 69, 48, 48, 48, 48, 48, 48, 48, 48, 497 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 498 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 499 48, 48, 48, 48, 3, 57, 56, 62, 52, 0, 500 501 81, 0, 0, 82, 0, 0, 0, 0, 0, 0, 502 0, 0, 0, 0, 0, 0, 0, 48, 48, 48, 503 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 504 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 505 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 506 48, 48, 48, 0, 81, 0, 0, 48, 7, 48, 507 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 508 48, 22, 48, 48, 48, 48, 48, 48, 48, 48, 509 48, 48, 48, 34, 48, 48, 48, 48, 48, 48, 510 41, 48, 44, 48, 48, 47, 0, 0, 0, 48, 511 512 8, 48, 48, 48, 13, 48, 48, 48, 48, 48, 513 48, 48, 48, 48, 25, 48, 48, 48, 48, 48, 514 31, 48, 48, 48, 48, 48, 38, 48, 40, 42, 515 45, 48, 0, 0, 91, 6, 48, 10, 48, 48, 516 15, 48, 48, 48, 48, 48, 48, 48, 48, 48, 517 48, 48, 48, 32, 48, 48, 48, 48, 48, 48, 518 48, 0, 48, 11, 48, 48, 48, 48, 48, 48, 519 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 520 35, 48, 37, 48, 48, 46, 5, 0, 48, 48, 521 48, 48, 48, 48, 48, 48, 21, 48, 48, 48, 522 523 48, 28, 29, 48, 48, 48, 39, 48, 0, 48, 524 48, 48, 16, 48, 48, 48, 48, 23, 24, 48, 525 48, 48, 48, 48, 48, 0, 0, 48, 12, 48, 526 48, 48, 20, 48, 48, 48, 48, 48, 48, 48, 527 48, 48, 17, 48, 48, 26, 48, 48, 33, 36, 528 43, 9, 48, 48, 48, 48, 48, 14, 48, 48, 529 48, 48, 48, 19, 48, 48, 48, 27, 48, 48, 530 48, 48, 48, 18, 48, 48, 48, 48, 48, 30, 531 0 532 } ; 533 534 static yyconst flex_int32_t yy_ec[256] = 535 { 0, 536 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 537 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 538 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 539 1, 4, 5, 6, 7, 5, 8, 5, 9, 5, 540 5, 10, 5, 11, 12, 13, 14, 15, 16, 16, 541 16, 16, 16, 16, 16, 17, 17, 18, 19, 20, 542 21, 22, 23, 5, 24, 24, 24, 24, 24, 24, 543 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 544 25, 25, 25, 25, 26, 25, 25, 27, 25, 25, 545 28, 29, 30, 5, 31, 5, 32, 33, 34, 35, 546 547 36, 37, 38, 39, 40, 25, 41, 42, 43, 44, 548 45, 46, 47, 48, 49, 50, 51, 52, 25, 53, 549 54, 25, 55, 56, 57, 5, 1, 1, 1, 1, 550 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 551 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 552 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 553 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 554 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 555 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 556 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 557 558 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 559 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 560 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 561 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 562 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 563 1, 1, 1, 1, 1 564 } ; 565 566 static yyconst flex_int32_t yy_meta[59] = 567 { 0, 568 1, 2, 3, 2, 4, 5, 4, 5, 5, 5, 569 5, 6, 7, 8, 9, 9, 9, 4, 5, 5, 570 5, 5, 4, 9, 10, 10, 10, 11, 4, 12, 571 10, 9, 9, 9, 9, 9, 9, 10, 10, 10, 572 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 573 10, 10, 10, 10, 5, 5, 5, 13 574 } ; 575 576 static yyconst flex_int16_t yy_base[508] = 577 { 0, 578 0, 899, 895, 894, 56, 57, 58, 61, 70, 89, 579 96, 115, 119, 128, 62, 129, 72, 91, 66, 77, 580 138, 143, 80, 142, 185, 896, 150, 155, 902, 0, 581 907, 907, 907, 243, 907, 907, 907, 301, 98, 288, 582 62, 907, 146, 907, 315, 907, 907, 907, 859, 907, 583 886, 907, 907, 907, 368, 907, 907, 907, 907, 907, 584 907, 116, 907, 907, 857, 907, 907, 841, 907, 297, 585 91, 155, 907, 907, 126, 907, 175, 907, 907, 325, 586 907, 907, 0, 907, 0, 0, 307, 907, 907, 855, 587 907, 907, 907, 322, 854, 0, 0, 907, 0, 855, 588 589 849, 114, 117, 853, 850, 847, 303, 854, 302, 838, 590 305, 306, 132, 304, 844, 851, 854, 907, 421, 0, 591 907, 0, 0, 345, 465, 863, 862, 907, 843, 907, 592 907, 907, 165, 0, 907, 907, 907, 907, 907, 907, 593 0, 907, 0, 907, 907, 907, 361, 907, 364, 907, 594 907, 367, 907, 376, 383, 853, 907, 386, 852, 400, 595 0, 0, 0, 0, 836, 844, 359, 830, 829, 830, 596 270, 827, 834, 829, 272, 838, 823, 827, 383, 833, 597 818, 819, 315, 818, 818, 826, 827, 830, 813, 819, 598 813, 818, 809, 822, 0, 0, 0, 907, 907, 811, 599 600 360, 0, 0, 0, 407, 403, 421, 321, 427, 427, 601 434, 343, 438, 450, 455, 458, 378, 822, 817, 801, 602 278, 801, 814, 804, 812, 811, 810, 833, 794, 805, 603 792, 829, 808, 801, 802, 364, 411, 789, 790, 786, 604 800, 789, 796, 780, 791, 787, 780, 784, 790, 789, 605 779, 790, 788, 785, 907, 0, 0, 772, 0, 781, 606 767, 773, 768, 781, 766, 779, 800, 776, 764, 769, 607 757, 0, 761, 756, 769, 433, 768, 763, 753, 765, 608 757, 748, 762, 0, 747, 436, 756, 745, 758, 743, 609 0, 748, 0, 747, 745, 0, 785, 0, 0, 734, 610 611 0, 745, 750, 734, 0, 437, 734, 737, 443, 750, 612 749, 748, 747, 738, 0, 731, 739, 731, 725, 723, 613 0, 722, 759, 734, 723, 720, 0, 717, 0, 453, 614 0, 717, 454, 0, 907, 0, 715, 715, 729, 710, 615 454, 713, 715, 711, 716, 719, 708, 710, 706, 721, 616 716, 706, 714, 0, 703, 700, 715, 710, 700, 694, 617 707, 488, 463, 0, 692, 705, 692, 703, 687, 688, 618 724, 699, 702, 689, 696, 680, 681, 695, 680, 695, 619 0, 678, 0, 681, 692, 0, 907, 717, 676, 676, 620 672, 671, 681, 667, 680, 683, 0, 671, 664, 675, 621 622 669, 0, 0, 667, 661, 659, 0, 674, 700, 657, 623 656, 670, 0, 662, 655, 652, 665, 0, 0, 658, 624 647, 656, 663, 658, 651, 686, 470, 655, 0, 645, 625 626, 623, 0, 611, 603, 465, 598, 595, 588, 599, 626 600, 584, 0, 579, 588, 0, 579, 584, 0, 0, 627 0, 0, 555, 475, 541, 534, 530, 0, 539, 530, 628 537, 519, 528, 0, 533, 526, 521, 0, 527, 524, 629 483, 444, 444, 0, 456, 438, 434, 442, 424, 0, 630 907, 506, 519, 532, 545, 558, 571, 578, 588, 600, 631 613, 626, 634, 641, 648, 658, 666, 454, 406, 389, 632 633 384, 373, 138, 102, 88, 57, 676 634 } ; 635 636 static yyconst flex_int16_t yy_def[508] = 637 { 0, 638 481, 1, 482, 482, 483, 483, 483, 483, 484, 484, 639 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, 640 483, 483, 483, 483, 481, 25, 485, 485, 481, 486, 641 481, 481, 481, 481, 481, 481, 481, 487, 481, 488, 642 488, 481, 489, 481, 487, 481, 481, 481, 486, 481, 643 481, 481, 481, 481, 490, 481, 481, 481, 481, 481, 644 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 645 481, 481, 481, 481, 481, 481, 481, 481, 481, 491, 646 481, 481, 492, 481, 492, 493, 481, 481, 481, 492, 647 481, 481, 481, 481, 481, 486, 494, 481, 495, 495, 648 649 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 650 495, 495, 495, 495, 495, 495, 495, 481, 487, 45, 651 481, 496, 497, 488, 497, 489, 489, 481, 481, 481, 652 481, 481, 481, 498, 481, 481, 481, 481, 481, 481, 653 499, 481, 500, 481, 481, 481, 481, 481, 481, 481, 654 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 655 492, 493, 494, 495, 495, 495, 495, 495, 495, 495, 656 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 657 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 658 495, 495, 495, 495, 496, 497, 125, 481, 481, 481, 659 660 481, 501, 502, 500, 481, 481, 481, 481, 481, 481, 661 481, 481, 481, 481, 481, 481, 491, 495, 495, 495, 662 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 663 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 664 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 665 495, 495, 495, 481, 481, 503, 504, 495, 495, 495, 666 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 667 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 668 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 669 495, 495, 495, 495, 495, 495, 481, 505, 506, 495, 670 671 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 672 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 673 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 674 495, 495, 481, 499, 481, 495, 495, 495, 495, 495, 675 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 676 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 677 495, 481, 495, 495, 495, 495, 495, 495, 495, 495, 678 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 679 495, 495, 495, 495, 495, 495, 481, 481, 495, 495, 680 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 681 682 495, 495, 495, 495, 495, 495, 495, 495, 507, 495, 683 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 684 495, 495, 495, 495, 495, 507, 507, 495, 495, 495, 685 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 686 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 687 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 688 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 689 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 690 0, 481, 481, 481, 481, 481, 481, 481, 481, 481, 691 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 692 693 481, 481, 481, 481, 481, 481, 481 694 } ; 695 696 static yyconst flex_int16_t yy_nxt[966] = 697 { 0, 698 30, 31, 32, 31, 30, 33, 30, 34, 35, 36, 699 37, 30, 38, 39, 40, 41, 41, 30, 42, 43, 700 44, 36, 30, 45, 45, 45, 45, 46, 30, 30, 701 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 702 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 703 45, 45, 45, 45, 47, 48, 36, 30, 53, 53, 704 57, 54, 54, 57, 66, 335, 58, 67, 76, 58, 705 69, 60, 32, 60, 66, 70, 124, 124, 124, 76, 706 61, 75, 81, 62, 55, 55, 55, 63, 82, 55, 707 60, 32, 60, 66, 77, 65, 334, 64, 66, 61, 708 709 75, 67, 62, 68, 69, 77, 63, 121, 80, 70, 710 299, 122, 148, 56, 56, 56, 64, 66, 56, 149, 711 67, 66, 68, 69, 67, 121, 71, 69, 70, 122, 712 66, 66, 70, 67, 67, 71, 69, 69, 72, 153, 713 78, 70, 70, 79, 81, 78, 298, 72, 79, 167, 714 82, 92, 32, 92, 154, 127, 92, 32, 92, 168, 715 93, 95, 150, 94, 169, 93, 80, 128, 94, 170, 716 80, 80, 187, 73, 151, 74, 155, 156, 155, 201, 717 201, 188, 73, 152, 74, 83, 84, 32, 84, 83, 718 83, 83, 83, 83, 83, 85, 83, 86, 87, 88, 719 720 88, 88, 83, 83, 83, 83, 83, 83, 86, 86, 721 86, 86, 83, 83, 89, 86, 86, 86, 86, 86, 722 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 723 86, 86, 86, 86, 86, 86, 86, 86, 86, 83, 724 83, 83, 83, 97, 97, 97, 97, 97, 97, 97, 725 98, 97, 97, 97, 97, 99, 97, 97, 97, 97, 726 97, 97, 97, 97, 97, 97, 99, 99, 99, 99, 727 97, 97, 97, 99, 99, 100, 101, 102, 103, 104, 728 105, 99, 106, 99, 107, 108, 109, 110, 111, 99, 729 112, 113, 114, 115, 116, 99, 117, 118, 97, 97, 730 731 97, 96, 124, 124, 124, 96, 145, 96, 231, 261, 732 146, 226, 119, 119, 125, 481, 121, 262, 96, 481, 733 122, 481, 227, 96, 232, 147, 158, 159, 158, 96, 734 96, 121, 481, 178, 174, 122, 182, 481, 175, 189, 735 125, 185, 148, 481, 481, 186, 179, 176, 190, 149, 736 241, 180, 183, 160, 242, 184, 153, 191, 96, 124, 737 124, 124, 205, 206, 205, 207, 208, 207, 209, 210, 738 209, 154, 481, 132, 255, 255, 132, 211, 212, 211, 739 481, 257, 133, 133, 155, 156, 155, 214, 159, 214, 740 132, 220, 256, 134, 236, 221, 132, 204, 277, 135, 741 742 136, 216, 217, 216, 137, 278, 160, 222, 205, 206, 743 205, 138, 145, 236, 203, 139, 146, 140, 141, 142, 744 143, 96, 207, 208, 207, 96, 237, 96, 209, 210, 745 209, 147, 119, 119, 150, 211, 212, 211, 96, 155, 746 156, 155, 279, 96, 316, 280, 151, 325, 340, 96, 747 96, 214, 159, 214, 343, 152, 214, 159, 214, 216, 748 217, 216, 202, 316, 360, 367, 325, 340, 362, 362, 749 362, 480, 387, 343, 389, 427, 447, 479, 96, 197, 750 197, 197, 478, 360, 367, 477, 459, 476, 197, 475, 751 387, 388, 474, 389, 473, 447, 197, 197, 197, 197, 752 753 197, 197, 362, 362, 362, 459, 50, 50, 50, 50, 754 50, 50, 50, 50, 50, 50, 50, 50, 50, 52, 755 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 756 52, 52, 59, 59, 59, 59, 59, 59, 59, 59, 757 59, 59, 59, 59, 59, 91, 91, 91, 91, 91, 758 91, 91, 91, 91, 91, 91, 91, 91, 96, 472, 759 471, 96, 470, 96, 96, 469, 468, 467, 466, 96, 760 96, 120, 465, 464, 120, 463, 120, 120, 462, 120, 761 120, 461, 120, 120, 123, 460, 123, 123, 126, 126, 762 458, 126, 126, 126, 126, 126, 126, 126, 126, 126, 763 764 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 765 131, 131, 131, 157, 157, 157, 157, 157, 157, 157, 766 157, 157, 157, 457, 456, 157, 161, 455, 454, 161, 767 161, 161, 453, 452, 451, 450, 161, 449, 161, 162, 768 162, 448, 162, 162, 163, 163, 163, 163, 163, 163, 769 163, 163, 163, 164, 164, 446, 164, 164, 195, 195, 770 445, 195, 195, 195, 195, 195, 195, 195, 195, 195, 771 195, 196, 196, 444, 196, 196, 426, 426, 443, 426, 772 426, 426, 426, 426, 426, 426, 426, 426, 426, 442, 773 441, 427, 440, 439, 438, 437, 436, 435, 434, 433, 774 775 432, 431, 430, 429, 428, 427, 425, 424, 423, 422, 776 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 777 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 778 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 779 391, 390, 386, 385, 384, 383, 382, 381, 380, 379, 780 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 781 368, 366, 365, 364, 363, 361, 359, 358, 357, 356, 782 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 783 345, 344, 342, 341, 339, 338, 337, 336, 333, 332, 784 331, 330, 329, 328, 327, 326, 324, 323, 322, 321, 785 786 320, 319, 318, 317, 315, 314, 313, 312, 311, 310, 787 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 788 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 789 287, 286, 285, 284, 283, 282, 281, 276, 275, 274, 790 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 791 263, 260, 259, 258, 254, 253, 252, 251, 250, 249, 792 248, 247, 246, 245, 244, 243, 240, 239, 238, 235, 793 234, 233, 230, 229, 228, 225, 224, 223, 219, 218, 794 215, 213, 200, 199, 198, 194, 193, 192, 181, 177, 795 173, 172, 171, 166, 165, 129, 129, 144, 129, 130, 796 797 129, 481, 90, 51, 51, 49, 29, 481, 481, 481, 798 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 799 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 800 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 801 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 802 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 803 481, 481, 481, 481, 481 804 } ; 805 806 static yyconst flex_int16_t yy_chk[966] = 807 { 0, 808 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 809 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 810 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 811 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 812 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 813 1, 1, 1, 1, 1, 1, 1, 1, 5, 6, 814 7, 5, 6, 8, 15, 506, 7, 15, 19, 8, 815 15, 9, 9, 9, 17, 15, 41, 41, 41, 20, 816 9, 17, 23, 9, 5, 6, 7, 9, 23, 8, 817 10, 10, 10, 18, 19, 10, 505, 9, 11, 10, 818 819 18, 11, 10, 11, 11, 20, 10, 39, 23, 11, 820 504, 39, 71, 5, 6, 7, 10, 12, 8, 71, 821 12, 13, 12, 12, 13, 62, 13, 13, 12, 62, 822 14, 16, 13, 14, 16, 14, 14, 16, 13, 75, 823 21, 14, 16, 21, 24, 22, 503, 14, 22, 102, 824 24, 27, 27, 27, 75, 43, 28, 28, 28, 102, 825 27, 28, 72, 27, 103, 28, 21, 43, 28, 103, 826 24, 22, 113, 13, 72, 13, 77, 77, 77, 133, 827 133, 113, 14, 72, 14, 25, 25, 25, 25, 25, 828 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 829 830 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 831 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 832 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 833 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 834 25, 25, 25, 34, 34, 34, 34, 34, 34, 34, 835 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 836 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 837 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 838 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 839 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 840 841 34, 38, 40, 40, 40, 38, 70, 38, 175, 221, 842 70, 171, 38, 38, 40, 45, 87, 221, 38, 45, 843 87, 45, 171, 38, 175, 70, 80, 80, 80, 38, 844 38, 94, 45, 109, 107, 94, 111, 45, 107, 114, 845 40, 112, 208, 45, 45, 112, 109, 107, 114, 208, 846 183, 109, 111, 80, 183, 111, 212, 114, 38, 124, 847 124, 124, 147, 147, 147, 149, 149, 149, 152, 152, 848 152, 212, 45, 55, 201, 201, 55, 154, 154, 154, 849 217, 502, 55, 55, 155, 155, 155, 158, 158, 158, 850 55, 167, 501, 55, 179, 167, 55, 500, 236, 55, 851 852 55, 160, 160, 160, 55, 236, 217, 167, 205, 205, 853 205, 55, 206, 179, 499, 55, 206, 55, 55, 55, 854 55, 119, 207, 207, 207, 119, 179, 119, 209, 209, 855 209, 206, 119, 119, 210, 211, 211, 211, 119, 213, 856 213, 213, 237, 119, 276, 237, 210, 286, 306, 119, 857 119, 214, 214, 214, 309, 210, 215, 215, 215, 216, 858 216, 216, 498, 276, 330, 341, 286, 306, 333, 333, 859 333, 479, 427, 309, 363, 427, 436, 478, 119, 125, 860 125, 125, 477, 330, 341, 476, 454, 475, 125, 473, 861 362, 362, 472, 363, 471, 436, 125, 125, 125, 125, 862 863 125, 125, 362, 362, 362, 454, 482, 482, 482, 482, 864 482, 482, 482, 482, 482, 482, 482, 482, 482, 483, 865 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, 866 483, 483, 484, 484, 484, 484, 484, 484, 484, 484, 867 484, 484, 484, 484, 484, 485, 485, 485, 485, 485, 868 485, 485, 485, 485, 485, 485, 485, 485, 486, 470, 869 469, 486, 467, 486, 486, 466, 465, 463, 462, 486, 870 486, 487, 461, 460, 487, 459, 487, 487, 457, 487, 871 487, 456, 487, 487, 488, 455, 488, 488, 489, 489, 872 453, 489, 489, 489, 489, 489, 489, 489, 489, 489, 873 874 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, 875 490, 490, 490, 491, 491, 491, 491, 491, 491, 491, 876 491, 491, 491, 448, 447, 491, 492, 445, 444, 492, 877 492, 492, 442, 441, 440, 439, 492, 438, 492, 493, 878 493, 437, 493, 493, 494, 494, 494, 494, 494, 494, 879 494, 494, 494, 495, 495, 435, 495, 495, 496, 496, 880 434, 496, 496, 496, 496, 496, 496, 496, 496, 496, 881 496, 497, 497, 432, 497, 497, 507, 507, 431, 507, 882 507, 507, 507, 507, 507, 507, 507, 507, 507, 430, 883 428, 426, 425, 424, 423, 422, 421, 420, 417, 416, 884 885 415, 414, 412, 411, 410, 409, 408, 406, 405, 404, 886 401, 400, 399, 398, 396, 395, 394, 393, 392, 391, 887 390, 389, 388, 385, 384, 382, 380, 379, 378, 377, 888 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 889 366, 365, 361, 360, 359, 358, 357, 356, 355, 353, 890 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 891 342, 340, 339, 338, 337, 332, 328, 326, 325, 324, 892 323, 322, 320, 319, 318, 317, 316, 314, 313, 312, 893 311, 310, 308, 307, 304, 303, 302, 300, 297, 295, 894 294, 292, 290, 289, 288, 287, 285, 283, 282, 281, 895 896 280, 279, 278, 277, 275, 274, 273, 271, 270, 269, 897 268, 267, 266, 265, 264, 263, 262, 261, 260, 258, 898 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 899 244, 243, 242, 241, 240, 239, 238, 235, 234, 233, 900 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 901 222, 220, 219, 218, 200, 194, 193, 192, 191, 190, 902 189, 188, 187, 186, 185, 184, 182, 181, 180, 178, 903 177, 176, 174, 173, 172, 170, 169, 168, 166, 165, 904 159, 156, 129, 127, 126, 117, 116, 115, 110, 108, 905 106, 105, 104, 101, 100, 95, 90, 68, 65, 51, 906 907 49, 29, 26, 4, 3, 2, 481, 481, 481, 481, 908 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 909 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 910 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 911 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 912 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, 913 481, 481, 481, 481, 481 914 } ; 915 916 static yy_state_type yy_last_accepting_state; 917 static char *yy_last_accepting_cpos; 918 919 extern int gram__flex_debug; 920 int gram__flex_debug = 1; 921 922 static yyconst flex_int16_t yy_rule_linenum[109] = 923 { 0, 924 149, 150, 151, 152, 160, 178, 179, 180, 181, 182, 925 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 926 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 927 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 928 213, 214, 215, 216, 217, 218, 219, 221, 225, 226, 929 227, 228, 229, 231, 238, 242, 249, 254, 257, 260, 930 263, 271, 279, 286, 293, 312, 327, 332, 351, 363, 931 379, 394, 411, 412, 423, 434, 435, 447, 473, 518, 932 528, 537, 547, 548, 549, 550, 551, 552, 553, 556, 933 558, 566, 583, 588, 589, 595, 596, 607, 613, 619, 934 935 625, 641, 642, 643, 659, 678, 718, 719 936 } ; 937 938 /* The intent behind this definition is that it'll catch 939 * any uses of REJECT which flex missed. 940 */ 941 #define REJECT reject_used_but_not_detected 942 #define yymore() yymore_used_but_not_detected 943 #define YY_MORE_ADJ 0 944 #define YY_RESTORE_YY_MORE_OFFSET 945 char *gram_text; 946 #line 1 "scan-gram.l" 947 /* Bison Grammar Scanner -*- C -*- 948 949 Copyright (C) 2002-2012 Free Software Foundation, Inc. 950 951 This file is part of Bison, the GNU Compiler Compiler. 952 953 This program is free software: you can redistribute it and/or modify 954 it under the terms of the GNU General Public License as published by 955 the Free Software Foundation, either version 3 of the License, or 956 (at your option) any later version. 957 958 This program is distributed in the hope that it will be useful, 959 but WITHOUT ANY WARRANTY; without even the implied warranty of 960 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 961 GNU General Public License for more details. 962 963 You should have received a copy of the GNU General Public License 964 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 965 #define YY_NO_INPUT 1 966 #line 24 "scan-gram.l" 967 /* Work around a bug in flex 2.5.31. See Debian bug 333231 968 <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>. */ 969 #undef gram_wrap 970 #define gram_wrap() 1 971 972 #define FLEX_PREFIX(Id) gram_ ## Id 973 #include "flex-scanner.h" 974 975 #include "complain.h" 976 #include "files.h" 977 #include "gram.h" 978 #include "quotearg.h" 979 #include "reader.h" 980 #include "uniqstr.h" 981 982 #include <c-ctype.h> 983 #include <mbswidth.h> 984 #include <quote.h> 985 986 #include "scan-gram.h" 987 988 #define YY_DECL GRAM_LEX_DECL 989 990 #define YY_USER_INIT \ 991 code_start = scanner_cursor = loc->start; \ 992 993 /* Location of scanner cursor. */ 994 static boundary scanner_cursor; 995 996 #define YY_USER_ACTION location_compute (loc, &scanner_cursor, gram_text, gram_leng); 997 998 static size_t no_cr_read (FILE *, char *, size_t); 999 #define YY_INPUT(buf, result, size) ((result) = no_cr_read (gram_in, buf, size)) 1000 1001 #define ROLLBACK_CURRENT_TOKEN \ 1002 do { \ 1003 scanner_cursor.column -= mbsnwidth (gram_text, gram_leng, 0); \ 1004 yyless (0); \ 1005 } while (0) 1006 1007 /* A string representing the most recently saved token. */ 1008 static char *last_string; 1009 1010 /* Bracketed identifier. */ 1011 static uniqstr bracketed_id_str = 0; 1012 static location bracketed_id_loc; 1013 static boundary bracketed_id_start; 1014 static int bracketed_id_context_state = 0; 1015 1016 void 1017 gram_scanner_last_string_free (void) 1018 { 1019 STRING_FREE; 1020 } 1021 1022 static void handle_syncline (char *, location); 1023 static unsigned long int scan_integer (char const *p, int base, location loc); 1024 static int convert_ucn_to_byte (char const *hex_text); 1025 static void unexpected_eof (boundary, char const *); 1026 static void unexpected_newline (boundary, char const *); 1027 1028 /* A C-like comment in directives/rules. */ 1029 1030 /* Strings and characters in directives/rules. */ 1031 1032 /* A identifier was just read in directives/rules. Special state 1033 to capture the sequence 'identifier :'. */ 1034 1035 /* Three types of user code: 1036 - prologue (code between '%{' '%}' in the first section, before %%); 1037 - actions, printers, union, etc, (between braced in the middle section); 1038 - epilogue (everything after the second %%). */ 1039 1040 /* C and C++ comments in code. */ 1041 1042 /* Strings and characters in code. */ 1043 1044 /* Bracketed identifiers support. */ 1045 1046 /* POSIX says that a tag must be both an id and a C union member, but 1047 historically almost any character is allowed in a tag. We disallow 1048 NUL and newline, as this simplifies our implementation. */ 1049 /* Zero or more instances of backslash-newline. Following GCC, allow 1050 white space between the backslash and the newline. */ 1051 #line 1052 "scan-gram.c" 1052 1053 #define INITIAL 0 1054 #define SC_YACC_COMMENT 1 1055 #define SC_ESCAPED_STRING 2 1056 #define SC_ESCAPED_CHARACTER 3 1057 #define SC_AFTER_IDENTIFIER 4 1058 #define SC_PROLOGUE 5 1059 #define SC_BRACED_CODE 6 1060 #define SC_EPILOGUE 7 1061 #define SC_COMMENT 8 1062 #define SC_LINE_COMMENT 9 1063 #define SC_STRING 10 1064 #define SC_CHARACTER 11 1065 #define SC_BRACKETED_ID 12 1066 #define SC_RETURN_BRACKETED_ID 13 1067 1068 #ifndef YY_NO_UNISTD_H 1069 /* Special case for "unistd.h", since it is non-ANSI. We include it way 1070 * down here because we want the user's section 1 to have been scanned first. 1071 * The user has a chance to override it with an option. 1072 */ 1073 /* %if-c-only */ 1074 #include <unistd.h> 1075 /* %endif */ 1076 /* %if-c++-only */ 1077 /* %endif */ 1078 #endif 1079 1080 #ifndef YY_EXTRA_TYPE 1081 #define YY_EXTRA_TYPE void * 1082 #endif 1083 1084 /* %if-c-only Reentrant structure and macros (non-C++). */ 1085 /* %if-reentrant */ 1086 /* %if-c-only */ 1087 1088 static int yy_init_globals (void ); 1089 1090 /* %endif */ 1091 /* %if-reentrant */ 1092 /* %endif */ 1093 /* %endif End reentrant structures and macros. */ 1094 1095 /* Accessor methods to globals. 1096 These are made visible to non-reentrant scanners for convenience. */ 1097 1098 int gram_lex_destroy (void ); 1099 1100 int gram_get_debug (void ); 1101 1102 void gram_set_debug (int debug_flag ); 1103 1104 YY_EXTRA_TYPE gram_get_extra (void ); 1105 1106 void gram_set_extra (YY_EXTRA_TYPE user_defined ); 1107 1108 FILE *gram_get_in (void ); 1109 1110 void gram_set_in (FILE * in_str ); 1111 1112 FILE *gram_get_out (void ); 1113 1114 void gram_set_out (FILE * out_str ); 1115 1116 yy_size_t gram_get_leng (void ); 1117 1118 char *gram_get_text (void ); 1119 1120 int gram_get_lineno (void ); 1121 1122 void gram_set_lineno (int line_number ); 1123 1124 /* %if-bison-bridge */ 1125 /* %endif */ 1126 1127 /* Macros after this point can all be overridden by user definitions in 1128 * section 1. 1129 */ 1130 1131 #ifndef YY_SKIP_YYWRAP 1132 #ifdef __cplusplus 1133 extern "C" int gram_wrap (void ); 1134 #else 1135 extern int gram_wrap (void ); 1136 #endif 1137 #endif 1138 1139 /* %not-for-header */ 1140 1141 /* %ok-for-header */ 1142 1143 /* %endif */ 1144 1145 #ifndef yytext_ptr 1146 static void yy_flex_strncpy (char *,yyconst char *,int ); 1147 #endif 1148 1149 #ifdef YY_NEED_STRLEN 1150 static int yy_flex_strlen (yyconst char * ); 1151 #endif 1152 1153 #ifndef YY_NO_INPUT 1154 /* %if-c-only Standard (non-C++) definition */ 1155 /* %not-for-header */ 1156 1157 #ifdef __cplusplus 1158 static int yyinput (void ); 1159 #else 1160 static int input (void ); 1161 #endif 1162 /* %ok-for-header */ 1163 1164 /* %endif */ 1165 #endif 1166 1167 /* %if-c-only */ 1168 1169 /* %endif */ 1170 1171 /* Amount of stuff to slurp up with each read. */ 1172 #ifndef YY_READ_BUF_SIZE 1173 #define YY_READ_BUF_SIZE 8192 1174 #endif 1175 1176 /* Copy whatever the last rule matched to the standard output. */ 1177 #ifndef ECHO 1178 /* %if-c-only Standard (non-C++) definition */ 1179 /* This used to be an fputs(), but since the string might contain NUL's, 1180 * we now use fwrite(). 1181 */ 1182 #define ECHO do { if (fwrite( gram_text, gram_leng, 1, gram_out )) {} } while (0) 1183 /* %endif */ 1184 /* %if-c++-only C++ definition */ 1185 /* %endif */ 1186 #endif 1187 1188 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 1189 * is returned in "result". 1190 */ 1191 #ifndef YY_INPUT 1192 #define YY_INPUT(buf,result,max_size) \ 1193 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ 1194 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 1195 { \ 1196 int c = '*'; \ 1197 size_t n; \ 1198 for ( n = 0; n < max_size && \ 1199 (c = getc( gram_in )) != EOF && c != '\n'; ++n ) \ 1200 buf[n] = (char) c; \ 1201 if ( c == '\n' ) \ 1202 buf[n++] = (char) c; \ 1203 if ( c == EOF && ferror( gram_in ) ) \ 1204 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 1205 result = n; \ 1206 } \ 1207 else \ 1208 { \ 1209 errno=0; \ 1210 while ( (result = fread(buf, 1, max_size, gram_in))==0 && ferror(gram_in)) \ 1211 { \ 1212 if( errno != EINTR) \ 1213 { \ 1214 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 1215 break; \ 1216 } \ 1217 errno=0; \ 1218 clearerr(gram_in); \ 1219 } \ 1220 }\ 1221 \ 1222 /* %if-c++-only C++ definition \ */\ 1223 /* %endif */ 1224 1225 #endif 1226 1227 /* No semi-colon after return; correct usage is to write "yyterminate();" - 1228 * we don't want an extra ';' after the "return" because that will cause 1229 * some compilers to complain about unreachable statements. 1230 */ 1231 #ifndef yyterminate 1232 #define yyterminate() return YY_NULL 1233 #endif 1234 1235 /* Number of entries by which start-condition stack grows. */ 1236 #ifndef YY_START_STACK_INCR 1237 #define YY_START_STACK_INCR 25 1238 #endif 1239 1240 /* Report a fatal error. */ 1241 #ifndef YY_FATAL_ERROR 1242 /* %if-c-only */ 1243 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 1244 /* %endif */ 1245 /* %if-c++-only */ 1246 /* %endif */ 1247 #endif 1248 1249 /* %if-tables-serialization structures and prototypes */ 1250 /* %not-for-header */ 1251 1252 /* %ok-for-header */ 1253 1254 /* %not-for-header */ 1255 1256 /* %tables-yydmap generated elements */ 1257 /* %endif */ 1258 /* end tables serialization structures and prototypes */ 1259 1260 /* %ok-for-header */ 1261 1262 /* Default declaration of generated scanner - a define so the user can 1263 * easily add parameters. 1264 */ 1265 #ifndef YY_DECL 1266 #define YY_DECL_IS_OURS 1 1267 /* %if-c-only Standard (non-C++) definition */ 1268 1269 extern int gram_lex (void); 1270 1271 #define YY_DECL int gram_lex (void) 1272 /* %endif */ 1273 /* %if-c++-only C++ definition */ 1274 /* %endif */ 1275 #endif /* !YY_DECL */ 1276 1277 /* Code executed at the beginning of each rule, after gram_text and gram_leng 1278 * have been set up. 1279 */ 1280 #ifndef YY_USER_ACTION 1281 #define YY_USER_ACTION 1282 #endif 1283 1284 /* Code executed at the end of each rule. */ 1285 #ifndef YY_BREAK 1286 #define YY_BREAK break; 1287 #endif 1288 1289 /* %% [6.0] YY_RULE_SETUP definition goes here */ 1290 #define YY_RULE_SETUP \ 1291 if ( gram_leng > 0 ) \ 1292 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ 1293 (gram_text[gram_leng - 1] == '\n'); \ 1294 YY_USER_ACTION 1295 1296 /* %not-for-header */ 1297 1298 /** The main scanner function which does all the work. 1299 */ 1300 YY_DECL 1301 { 1302 register yy_state_type yy_current_state; 1303 register char *yy_cp, *yy_bp; 1304 register int yy_act; 1305 1306 /* %% [7.0] user's declarations go here */ 1307 #line 120 "scan-gram.l" 1308 1309 1310 /* Nesting level of the current code in braces. */ 1311 int braces_level PACIFY_CC (= 0); 1312 1313 /* Parent context state, when applicable. */ 1314 int context_state PACIFY_CC (= 0); 1315 1316 /* Location of most recent identifier, when applicable. */ 1317 location id_loc PACIFY_CC (= empty_location); 1318 1319 /* Where containing code started, when applicable. Its initial 1320 value is relevant only when gram_lex is invoked in the SC_EPILOGUE 1321 start condition. */ 1322 boundary code_start = scanner_cursor; 1323 1324 /* Where containing comment or string or character literal started, 1325 when applicable. */ 1326 boundary token_start PACIFY_CC (= scanner_cursor); 1327 1328 1329 1330 /*-----------------------. 1331 | Scanning white space. | 1332 `-----------------------*/ 1333 1334 #line 1335 "scan-gram.c" 1335 1336 if ( !(yy_init) ) 1337 { 1338 (yy_init) = 1; 1339 1340 #ifdef YY_USER_INIT 1341 YY_USER_INIT; 1342 #endif 1343 1344 if ( ! (yy_start) ) 1345 (yy_start) = 1; /* first start state */ 1346 1347 if ( ! gram_in ) 1348 /* %if-c-only */ 1349 gram_in = stdin; 1350 /* %endif */ 1351 /* %if-c++-only */ 1352 /* %endif */ 1353 1354 if ( ! gram_out ) 1355 /* %if-c-only */ 1356 gram_out = stdout; 1357 /* %endif */ 1358 /* %if-c++-only */ 1359 /* %endif */ 1360 1361 if ( ! YY_CURRENT_BUFFER ) { 1362 gram_ensure_buffer_stack (); 1363 YY_CURRENT_BUFFER_LVALUE = 1364 gram__create_buffer(gram_in,YY_BUF_SIZE ); 1365 } 1366 1367 gram__load_buffer_state( ); 1368 } 1369 1370 while ( 1 ) /* loops until end-of-file is reached */ 1371 { 1372 /* %% [8.0] yymore()-related code goes here */ 1373 yy_cp = (yy_c_buf_p); 1374 1375 /* Support of gram_text. */ 1376 *yy_cp = (yy_hold_char); 1377 1378 /* yy_bp points to the position in yy_ch_buf of the start of 1379 * the current run. 1380 */ 1381 yy_bp = yy_cp; 1382 1383 /* %% [9.0] code to set up and find next match goes here */ 1384 yy_current_state = (yy_start); 1385 yy_current_state += YY_AT_BOL(); 1386 yy_match: 1387 do 1388 { 1389 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 1390 if ( yy_accept[yy_current_state] ) 1391 { 1392 (yy_last_accepting_state) = yy_current_state; 1393 (yy_last_accepting_cpos) = yy_cp; 1394 } 1395 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1396 { 1397 yy_current_state = (int) yy_def[yy_current_state]; 1398 if ( yy_current_state >= 482 ) 1399 yy_c = yy_meta[(unsigned int) yy_c]; 1400 } 1401 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1402 ++yy_cp; 1403 } 1404 while ( yy_current_state != 481 ); 1405 yy_cp = (yy_last_accepting_cpos); 1406 yy_current_state = (yy_last_accepting_state); 1407 1408 yy_find_action: 1409 /* %% [10.0] code to find the action number goes here */ 1410 yy_act = yy_accept[yy_current_state]; 1411 1412 YY_DO_BEFORE_ACTION; 1413 1414 /* %% [11.0] code for gram_lineno update goes here */ 1415 1416 do_action: /* This label is used only to access EOF actions. */ 1417 1418 /* %% [12.0] debug code goes here */ 1419 if ( gram__flex_debug ) 1420 { 1421 if ( yy_act == 0 ) 1422 fprintf( stderr, "--scanner backing up\n" ); 1423 else if ( yy_act < 109 ) 1424 fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", 1425 (long)yy_rule_linenum[yy_act], gram_text ); 1426 else if ( yy_act == 109 ) 1427 fprintf( stderr, "--accepting default rule (\"%s\")\n", 1428 gram_text ); 1429 else if ( yy_act == 110 ) 1430 fprintf( stderr, "--(end of buffer or a NUL)\n" ); 1431 else 1432 fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); 1433 } 1434 1435 switch ( yy_act ) 1436 { /* beginning of action switch */ 1437 /* %% [13.0] actions go here */ 1438 case 0: /* must back up */ 1439 /* undo the effects of YY_DO_BEFORE_ACTION */ 1440 *yy_cp = (yy_hold_char); 1441 yy_cp = (yy_last_accepting_cpos); 1442 yy_current_state = (yy_last_accepting_state); 1443 goto yy_find_action; 1444 1445 /* Comments and white space. */ 1446 case 1: 1447 YY_RULE_SETUP 1448 #line 149 "scan-gram.l" 1449 warn_at (*loc, _("stray ',' treated as white space")); 1450 YY_BREAK 1451 case 2: 1452 /* rule 2 can match eol */ 1453 #line 151 "scan-gram.l" 1454 case 3: 1455 /* rule 3 can match eol */ 1456 YY_RULE_SETUP 1457 #line 151 "scan-gram.l" 1458 continue; 1459 YY_BREAK 1460 case 4: 1461 YY_RULE_SETUP 1462 #line 152 "scan-gram.l" 1463 { 1464 token_start = loc->start; 1465 context_state = YY_START; 1466 BEGIN SC_YACC_COMMENT; 1467 } 1468 YY_BREAK 1469 /* #line directives are not documented, and may be withdrawn or 1470 modified in future versions of Bison. */ 1471 case 5: 1472 /* rule 5 can match eol */ 1473 YY_RULE_SETUP 1474 #line 160 "scan-gram.l" 1475 { 1476 handle_syncline (gram_text + sizeof "#line " - 1, *loc); 1477 } 1478 YY_BREAK 1479 1480 /*----------------------------. 1481 | Scanning Bison directives. | 1482 `----------------------------*/ 1483 /* For directives that are also command line options, the regex must be 1484 "%..." 1485 after "[-_]"s are removed, and the directive must match the --long 1486 option name, with a single string argument. Otherwise, add exceptions 1487 to ../build-aux/cross-options.pl. */ 1488 1489 1490 case 6: 1491 YY_RULE_SETUP 1492 #line 178 "scan-gram.l" 1493 return PERCENT_NONASSOC; 1494 YY_BREAK 1495 case 7: 1496 YY_RULE_SETUP 1497 #line 179 "scan-gram.l" 1498 return PERCENT_CODE; 1499 YY_BREAK 1500 case 8: 1501 YY_RULE_SETUP 1502 #line 180 "scan-gram.l" 1503 return PERCENT_DEBUG; 1504 YY_BREAK 1505 case 9: 1506 YY_RULE_SETUP 1507 #line 181 "scan-gram.l" 1508 return PERCENT_DEFAULT_PREC; 1509 YY_BREAK 1510 case 10: 1511 YY_RULE_SETUP 1512 #line 182 "scan-gram.l" 1513 return PERCENT_DEFINE; 1514 YY_BREAK 1515 case 11: 1516 YY_RULE_SETUP 1517 #line 183 "scan-gram.l" 1518 return PERCENT_DEFINES; 1519 YY_BREAK 1520 case 12: 1521 YY_RULE_SETUP 1522 #line 184 "scan-gram.l" 1523 return PERCENT_DESTRUCTOR; 1524 YY_BREAK 1525 case 13: 1526 YY_RULE_SETUP 1527 #line 185 "scan-gram.l" 1528 return PERCENT_DPREC; 1529 YY_BREAK 1530 case 14: 1531 YY_RULE_SETUP 1532 #line 186 "scan-gram.l" 1533 return PERCENT_ERROR_VERBOSE; 1534 YY_BREAK 1535 case 15: 1536 YY_RULE_SETUP 1537 #line 187 "scan-gram.l" 1538 return PERCENT_EXPECT; 1539 YY_BREAK 1540 case 16: 1541 YY_RULE_SETUP 1542 #line 188 "scan-gram.l" 1543 return PERCENT_EXPECT_RR; 1544 YY_BREAK 1545 case 17: 1546 YY_RULE_SETUP 1547 #line 189 "scan-gram.l" 1548 return PERCENT_FILE_PREFIX; 1549 YY_BREAK 1550 case 18: 1551 YY_RULE_SETUP 1552 #line 190 "scan-gram.l" 1553 return PERCENT_YACC; 1554 YY_BREAK 1555 case 19: 1556 YY_RULE_SETUP 1557 #line 191 "scan-gram.l" 1558 return PERCENT_INITIAL_ACTION; 1559 YY_BREAK 1560 case 20: 1561 YY_RULE_SETUP 1562 #line 192 "scan-gram.l" 1563 return PERCENT_GLR_PARSER; 1564 YY_BREAK 1565 case 21: 1566 YY_RULE_SETUP 1567 #line 193 "scan-gram.l" 1568 return PERCENT_LANGUAGE; 1569 YY_BREAK 1570 case 22: 1571 YY_RULE_SETUP 1572 #line 194 "scan-gram.l" 1573 return PERCENT_LEFT; 1574 YY_BREAK 1575 case 23: 1576 YY_RULE_SETUP 1577 #line 195 "scan-gram.l" 1578 return PERCENT_LEX_PARAM; 1579 YY_BREAK 1580 case 24: 1581 YY_RULE_SETUP 1582 #line 196 "scan-gram.l" 1583 return PERCENT_LOCATIONS; 1584 YY_BREAK 1585 case 25: 1586 YY_RULE_SETUP 1587 #line 197 "scan-gram.l" 1588 return PERCENT_MERGE; 1589 YY_BREAK 1590 case 26: 1591 YY_RULE_SETUP 1592 #line 198 "scan-gram.l" 1593 return PERCENT_NAME_PREFIX; 1594 YY_BREAK 1595 case 27: 1596 YY_RULE_SETUP 1597 #line 199 "scan-gram.l" 1598 return PERCENT_NO_DEFAULT_PREC; 1599 YY_BREAK 1600 case 28: 1601 YY_RULE_SETUP 1602 #line 200 "scan-gram.l" 1603 return PERCENT_NO_LINES; 1604 YY_BREAK 1605 case 29: 1606 YY_RULE_SETUP 1607 #line 201 "scan-gram.l" 1608 return PERCENT_NONASSOC; 1609 YY_BREAK 1610 case 30: 1611 YY_RULE_SETUP 1612 #line 202 "scan-gram.l" 1613 return PERCENT_NONDETERMINISTIC_PARSER; 1614 YY_BREAK 1615 case 31: 1616 YY_RULE_SETUP 1617 #line 203 "scan-gram.l" 1618 return PERCENT_NTERM; 1619 YY_BREAK 1620 case 32: 1621 YY_RULE_SETUP 1622 #line 204 "scan-gram.l" 1623 return PERCENT_OUTPUT; 1624 YY_BREAK 1625 case 33: 1626 YY_RULE_SETUP 1627 #line 205 "scan-gram.l" 1628 return PERCENT_PARSE_PARAM; 1629 YY_BREAK 1630 case 34: 1631 YY_RULE_SETUP 1632 #line 206 "scan-gram.l" 1633 return PERCENT_PREC; 1634 YY_BREAK 1635 case 35: 1636 YY_RULE_SETUP 1637 #line 207 "scan-gram.l" 1638 return PERCENT_PRINTER; 1639 YY_BREAK 1640 case 36: 1641 YY_RULE_SETUP 1642 #line 208 "scan-gram.l" 1643 return PERCENT_PURE_PARSER; 1644 YY_BREAK 1645 case 37: 1646 YY_RULE_SETUP 1647 #line 209 "scan-gram.l" 1648 return PERCENT_REQUIRE; 1649 YY_BREAK 1650 case 38: 1651 YY_RULE_SETUP 1652 #line 210 "scan-gram.l" 1653 return PERCENT_RIGHT; 1654 YY_BREAK 1655 case 39: 1656 YY_RULE_SETUP 1657 #line 211 "scan-gram.l" 1658 return PERCENT_SKELETON; 1659 YY_BREAK 1660 case 40: 1661 YY_RULE_SETUP 1662 #line 212 "scan-gram.l" 1663 return PERCENT_START; 1664 YY_BREAK 1665 case 41: 1666 YY_RULE_SETUP 1667 #line 213 "scan-gram.l" 1668 return PERCENT_TOKEN; 1669 YY_BREAK 1670 case 42: 1671 YY_RULE_SETUP 1672 #line 214 "scan-gram.l" 1673 return PERCENT_TOKEN; 1674 YY_BREAK 1675 case 43: 1676 YY_RULE_SETUP 1677 #line 215 "scan-gram.l" 1678 return PERCENT_TOKEN_TABLE; 1679 YY_BREAK 1680 case 44: 1681 YY_RULE_SETUP 1682 #line 216 "scan-gram.l" 1683 return PERCENT_TYPE; 1684 YY_BREAK 1685 case 45: 1686 YY_RULE_SETUP 1687 #line 217 "scan-gram.l" 1688 return PERCENT_UNION; 1689 YY_BREAK 1690 case 46: 1691 YY_RULE_SETUP 1692 #line 218 "scan-gram.l" 1693 return PERCENT_VERBOSE; 1694 YY_BREAK 1695 case 47: 1696 YY_RULE_SETUP 1697 #line 219 "scan-gram.l" 1698 return PERCENT_YACC; 1699 YY_BREAK 1700 case 48: 1701 /* rule 48 can match eol */ 1702 YY_RULE_SETUP 1703 #line 221 "scan-gram.l" 1704 { 1705 complain_at (*loc, _("invalid directive: %s"), quote (gram_text)); 1706 } 1707 YY_BREAK 1708 case 49: 1709 YY_RULE_SETUP 1710 #line 225 "scan-gram.l" 1711 return EQUAL; 1712 YY_BREAK 1713 case 50: 1714 YY_RULE_SETUP 1715 #line 226 "scan-gram.l" 1716 return PIPE; 1717 YY_BREAK 1718 case 51: 1719 YY_RULE_SETUP 1720 #line 227 "scan-gram.l" 1721 return SEMICOLON; 1722 YY_BREAK 1723 case 52: 1724 YY_RULE_SETUP 1725 #line 228 "scan-gram.l" 1726 return TYPE_TAG_ANY; 1727 YY_BREAK 1728 case 53: 1729 YY_RULE_SETUP 1730 #line 229 "scan-gram.l" 1731 return TYPE_TAG_NONE; 1732 YY_BREAK 1733 case 54: 1734 YY_RULE_SETUP 1735 #line 231 "scan-gram.l" 1736 { 1737 val->uniqstr = uniqstr_new (gram_text); 1738 id_loc = *loc; 1739 bracketed_id_str = NULL; 1740 BEGIN SC_AFTER_IDENTIFIER; 1741 } 1742 YY_BREAK 1743 case 55: 1744 YY_RULE_SETUP 1745 #line 238 "scan-gram.l" 1746 { 1747 val->integer = scan_integer (gram_text, 10, *loc); 1748 return INT; 1749 } 1750 YY_BREAK 1751 case 56: 1752 YY_RULE_SETUP 1753 #line 242 "scan-gram.l" 1754 { 1755 val->integer = scan_integer (gram_text, 16, *loc); 1756 return INT; 1757 } 1758 YY_BREAK 1759 /* Identifiers may not start with a digit. Yet, don't silently 1760 accept "1FOO" as "1 FOO". */ 1761 case 57: 1762 YY_RULE_SETUP 1763 #line 249 "scan-gram.l" 1764 { 1765 complain_at (*loc, _("invalid identifier: %s"), quote (gram_text)); 1766 } 1767 YY_BREAK 1768 /* Characters. */ 1769 case 58: 1770 YY_RULE_SETUP 1771 #line 254 "scan-gram.l" 1772 token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; 1773 YY_BREAK 1774 /* Strings. */ 1775 case 59: 1776 YY_RULE_SETUP 1777 #line 257 "scan-gram.l" 1778 token_start = loc->start; BEGIN SC_ESCAPED_STRING; 1779 YY_BREAK 1780 /* Prologue. */ 1781 case 60: 1782 YY_RULE_SETUP 1783 #line 260 "scan-gram.l" 1784 code_start = loc->start; BEGIN SC_PROLOGUE; 1785 YY_BREAK 1786 /* Code in between braces. */ 1787 case 61: 1788 YY_RULE_SETUP 1789 #line 263 "scan-gram.l" 1790 { 1791 STRING_GROW; 1792 braces_level = 0; 1793 code_start = loc->start; 1794 BEGIN SC_BRACED_CODE; 1795 } 1796 YY_BREAK 1797 /* A type. */ 1798 case 62: 1799 YY_RULE_SETUP 1800 #line 271 "scan-gram.l" 1801 { 1802 obstack_grow (&obstack_for_string, gram_text + 1, gram_leng - 2); 1803 STRING_FINISH; 1804 val->uniqstr = uniqstr_new (last_string); 1805 STRING_FREE; 1806 return TYPE; 1807 } 1808 YY_BREAK 1809 case 63: 1810 YY_RULE_SETUP 1811 #line 279 "scan-gram.l" 1812 { 1813 static int percent_percent_count; 1814 if (++percent_percent_count == 2) 1815 BEGIN SC_EPILOGUE; 1816 return PERCENT_PERCENT; 1817 } 1818 YY_BREAK 1819 case 64: 1820 YY_RULE_SETUP 1821 #line 286 "scan-gram.l" 1822 { 1823 bracketed_id_str = NULL; 1824 bracketed_id_start = loc->start; 1825 bracketed_id_context_state = YY_START; 1826 BEGIN SC_BRACKETED_ID; 1827 } 1828 YY_BREAK 1829 case 65: 1830 YY_RULE_SETUP 1831 #line 293 "scan-gram.l" 1832 { 1833 complain_at (*loc, "%s: %s", 1834 ngettext ("invalid character", "invalid characters", gram_leng), 1835 quote_mem (gram_text, gram_leng)); 1836 } 1837 YY_BREAK 1838 case YY_STATE_EOF(INITIAL): 1839 #line 299 "scan-gram.l" 1840 { 1841 loc->start = loc->end = scanner_cursor; 1842 yyterminate (); 1843 } 1844 YY_BREAK 1845 1846 /*-----------------------------------------------------------------. 1847 | Scanning after an identifier, checking whether a colon is next. | 1848 `-----------------------------------------------------------------*/ 1849 1850 1851 case 66: 1852 YY_RULE_SETUP 1853 #line 312 "scan-gram.l" 1854 { 1855 if (bracketed_id_str) 1856 { 1857 ROLLBACK_CURRENT_TOKEN; 1858 BEGIN SC_RETURN_BRACKETED_ID; 1859 *loc = id_loc; 1860 return ID; 1861 } 1862 else 1863 { 1864 bracketed_id_start = loc->start; 1865 bracketed_id_context_state = YY_START; 1866 BEGIN SC_BRACKETED_ID; 1867 } 1868 } 1869 YY_BREAK 1870 case 67: 1871 YY_RULE_SETUP 1872 #line 327 "scan-gram.l" 1873 { 1874 BEGIN (bracketed_id_str ? SC_RETURN_BRACKETED_ID : INITIAL); 1875 *loc = id_loc; 1876 return ID_COLON; 1877 } 1878 YY_BREAK 1879 case 68: 1880 YY_RULE_SETUP 1881 #line 332 "scan-gram.l" 1882 { 1883 ROLLBACK_CURRENT_TOKEN; 1884 BEGIN (bracketed_id_str ? SC_RETURN_BRACKETED_ID : INITIAL); 1885 *loc = id_loc; 1886 return ID; 1887 } 1888 YY_BREAK 1889 case YY_STATE_EOF(SC_AFTER_IDENTIFIER): 1890 #line 338 "scan-gram.l" 1891 { 1892 BEGIN (bracketed_id_str ? SC_RETURN_BRACKETED_ID : INITIAL); 1893 *loc = id_loc; 1894 return ID; 1895 } 1896 YY_BREAK 1897 1898 /*--------------------------------. 1899 | Scanning bracketed identifiers. | 1900 `--------------------------------*/ 1901 1902 1903 case 69: 1904 YY_RULE_SETUP 1905 #line 351 "scan-gram.l" 1906 { 1907 if (bracketed_id_str) 1908 { 1909 complain_at (*loc, _("unexpected identifier in bracketed name: %s"), 1910 quote (gram_text)); 1911 } 1912 else 1913 { 1914 bracketed_id_str = uniqstr_new (gram_text); 1915 bracketed_id_loc = *loc; 1916 } 1917 } 1918 YY_BREAK 1919 case 70: 1920 YY_RULE_SETUP 1921 #line 363 "scan-gram.l" 1922 { 1923 BEGIN bracketed_id_context_state; 1924 if (bracketed_id_str) 1925 { 1926 if (INITIAL == bracketed_id_context_state) 1927 { 1928 val->uniqstr = bracketed_id_str; 1929 bracketed_id_str = 0; 1930 *loc = bracketed_id_loc; 1931 return BRACKETED_ID; 1932 } 1933 } 1934 else 1935 complain_at (*loc, _("an identifier expected")); 1936 } 1937 YY_BREAK 1938 case 71: 1939 YY_RULE_SETUP 1940 #line 379 "scan-gram.l" 1941 { 1942 complain_at (*loc, "%s: %s", 1943 ngettext ("invalid character in bracketed name", 1944 "invalid characters in bracketed name", gram_leng), 1945 quote_mem (gram_text, gram_leng)); 1946 } 1947 YY_BREAK 1948 case YY_STATE_EOF(SC_BRACKETED_ID): 1949 #line 386 "scan-gram.l" 1950 { 1951 BEGIN bracketed_id_context_state; 1952 unexpected_eof (bracketed_id_start, "]"); 1953 } 1954 YY_BREAK 1955 1956 1957 1958 case 72: 1959 YY_RULE_SETUP 1960 #line 394 "scan-gram.l" 1961 { 1962 ROLLBACK_CURRENT_TOKEN; 1963 val->uniqstr = bracketed_id_str; 1964 bracketed_id_str = 0; 1965 *loc = bracketed_id_loc; 1966 BEGIN INITIAL; 1967 return BRACKETED_ID; 1968 } 1969 YY_BREAK 1970 1971 /*---------------------------------------------------------------. 1972 | Scanning a Yacc comment. The initial '/ *' is already eaten. | 1973 `---------------------------------------------------------------*/ 1974 1975 1976 case 73: 1977 YY_RULE_SETUP 1978 #line 411 "scan-gram.l" 1979 BEGIN context_state; 1980 YY_BREAK 1981 case 74: 1982 /* rule 74 can match eol */ 1983 YY_RULE_SETUP 1984 #line 412 "scan-gram.l" 1985 continue; 1986 YY_BREAK 1987 case YY_STATE_EOF(SC_YACC_COMMENT): 1988 #line 413 "scan-gram.l" 1989 unexpected_eof (token_start, "*/"); BEGIN context_state; 1990 YY_BREAK 1991 1992 /*------------------------------------------------------------. 1993 | Scanning a C comment. The initial '/ *' is already eaten. | 1994 `------------------------------------------------------------*/ 1995 1996 1997 case 75: 1998 /* rule 75 can match eol */ 1999 YY_RULE_SETUP 2000 #line 423 "scan-gram.l" 2001 STRING_GROW; BEGIN context_state; 2002 YY_BREAK 2003 case YY_STATE_EOF(SC_COMMENT): 2004 #line 424 "scan-gram.l" 2005 unexpected_eof (token_start, "*/"); BEGIN context_state; 2006 YY_BREAK 2007 2008 /*--------------------------------------------------------------. 2009 | Scanning a line comment. The initial '//' is already eaten. | 2010 `--------------------------------------------------------------*/ 2011 2012 2013 case 76: 2014 /* rule 76 can match eol */ 2015 YY_RULE_SETUP 2016 #line 434 "scan-gram.l" 2017 STRING_GROW; BEGIN context_state; 2018 YY_BREAK 2019 case 77: 2020 /* rule 77 can match eol */ 2021 YY_RULE_SETUP 2022 #line 435 "scan-gram.l" 2023 STRING_GROW; 2024 YY_BREAK 2025 case YY_STATE_EOF(SC_LINE_COMMENT): 2026 #line 436 "scan-gram.l" 2027 BEGIN context_state; 2028 YY_BREAK 2029 2030 /*------------------------------------------------. 2031 | Scanning a Bison string, including its escapes. | 2032 | The initial quote is already eaten. | 2033 `------------------------------------------------*/ 2034 2035 2036 case 78: 2037 /* rule 78 can match eol */ 2038 YY_RULE_SETUP 2039 #line 447 "scan-gram.l" 2040 { 2041 if (gram_text[0] == '\n') 2042 unexpected_newline (token_start, "\""); 2043 STRING_FINISH; 2044 loc->start = token_start; 2045 val->chars = last_string; 2046 BEGIN INITIAL; 2047 return STRING; 2048 } 2049 YY_BREAK 2050 case YY_STATE_EOF(SC_ESCAPED_STRING): 2051 #line 456 "scan-gram.l" 2052 { 2053 unexpected_eof (token_start, "\""); 2054 STRING_FINISH; 2055 loc->start = token_start; 2056 val->chars = last_string; 2057 BEGIN INITIAL; 2058 return STRING; 2059 } 2060 YY_BREAK 2061 2062 /*----------------------------------------------------------. 2063 | Scanning a Bison character literal, decoding its escapes. | 2064 | The initial quote is already eaten. | 2065 `----------------------------------------------------------*/ 2066 2067 2068 case 79: 2069 /* rule 79 can match eol */ 2070 YY_RULE_SETUP 2071 #line 473 "scan-gram.l" 2072 { 2073 STRING_FINISH; 2074 loc->start = token_start; 2075 val->character = last_string[0]; 2076 { 2077 /* FIXME: Eventually, make these errors. */ 2078 if (last_string[0] == '\0') 2079 { 2080 warn_at (*loc, _("empty character literal")); 2081 /* '\0' seems dangerous even if we are about to complain. */ 2082 val->character = '\''; 2083 } 2084 else if (last_string[1] != '\0') 2085 warn_at (*loc, _("extra characters in character literal")); 2086 } 2087 if (gram_text[0] == '\n') 2088 unexpected_newline (token_start, "'"); 2089 STRING_FREE; 2090 BEGIN INITIAL; 2091 return CHAR; 2092 } 2093 YY_BREAK 2094 case YY_STATE_EOF(SC_ESCAPED_CHARACTER): 2095 #line 494 "scan-gram.l" 2096 { 2097 STRING_FINISH; 2098 loc->start = token_start; 2099 val->character = last_string[0]; 2100 { 2101 /* FIXME: Eventually, make these errors. */ 2102 if (last_string[0] == '\0') 2103 { 2104 warn_at (*loc, _("empty character literal")); 2105 /* '\0' seems dangerous even if we are about to complain. */ 2106 val->character = '\''; 2107 } 2108 else if (last_string[1] != '\0') 2109 warn_at (*loc, _("extra characters in character literal")); 2110 } 2111 unexpected_eof (token_start, "'"); 2112 STRING_FREE; 2113 BEGIN INITIAL; 2114 return CHAR; 2115 } 2116 YY_BREAK 2117 2118 2119 2120 case 80: 2121 YY_RULE_SETUP 2122 #line 518 "scan-gram.l" 2123 complain_at (*loc, _("invalid null character")); 2124 YY_BREAK 2125 2126 /*----------------------------. 2127 | Decode escaped characters. | 2128 `----------------------------*/ 2129 2130 2131 case 81: 2132 YY_RULE_SETUP 2133 #line 528 "scan-gram.l" 2134 { 2135 unsigned long int c = strtoul (gram_text + 1, NULL, 8); 2136 if (!c || UCHAR_MAX < c) 2137 complain_at (*loc, _("invalid number after \\-escape: %s"), 2138 gram_text+1); 2139 else 2140 obstack_1grow (&obstack_for_string, c); 2141 } 2142 YY_BREAK 2143 case 82: 2144 YY_RULE_SETUP 2145 #line 537 "scan-gram.l" 2146 { 2147 verify (UCHAR_MAX < ULONG_MAX); 2148 unsigned long int c = strtoul (gram_text + 2, NULL, 16); 2149 if (!c || UCHAR_MAX < c) 2150 complain_at (*loc, _("invalid number after \\-escape: %s"), 2151 gram_text+1); 2152 else 2153 obstack_1grow (&obstack_for_string, c); 2154 } 2155 YY_BREAK 2156 case 83: 2157 YY_RULE_SETUP 2158 #line 547 "scan-gram.l" 2159 obstack_1grow (&obstack_for_string, '\a'); 2160 YY_BREAK 2161 case 84: 2162 YY_RULE_SETUP 2163 #line 548 "scan-gram.l" 2164 obstack_1grow (&obstack_for_string, '\b'); 2165 YY_BREAK 2166 case 85: 2167 YY_RULE_SETUP 2168 #line 549 "scan-gram.l" 2169 obstack_1grow (&obstack_for_string, '\f'); 2170 YY_BREAK 2171 case 86: 2172 YY_RULE_SETUP 2173 #line 550 "scan-gram.l" 2174 obstack_1grow (&obstack_for_string, '\n'); 2175 YY_BREAK 2176 case 87: 2177 YY_RULE_SETUP 2178 #line 551 "scan-gram.l" 2179 obstack_1grow (&obstack_for_string, '\r'); 2180 YY_BREAK 2181 case 88: 2182 YY_RULE_SETUP 2183 #line 552 "scan-gram.l" 2184 obstack_1grow (&obstack_for_string, '\t'); 2185 YY_BREAK 2186 case 89: 2187 YY_RULE_SETUP 2188 #line 553 "scan-gram.l" 2189 obstack_1grow (&obstack_for_string, '\v'); 2190 YY_BREAK 2191 /* \\[\"\'?\\] would be shorter, but it confuses xgettext. */ 2192 case 90: 2193 YY_RULE_SETUP 2194 #line 556 "scan-gram.l" 2195 obstack_1grow (&obstack_for_string, gram_text[1]); 2196 YY_BREAK 2197 case 91: 2198 YY_RULE_SETUP 2199 #line 558 "scan-gram.l" 2200 { 2201 int c = convert_ucn_to_byte (gram_text); 2202 if (c <= 0) 2203 complain_at (*loc, _("invalid number after \\-escape: %s"), 2204 gram_text+1); 2205 else 2206 obstack_1grow (&obstack_for_string, c); 2207 } 2208 YY_BREAK 2209 case 92: 2210 /* rule 92 can match eol */ 2211 YY_RULE_SETUP 2212 #line 566 "scan-gram.l" 2213 { 2214 char const *p = gram_text + 1; 2215 /* Quote only if escaping won't make the character visible. */ 2216 if (c_isspace ((unsigned char) *p) && c_isprint ((unsigned char) *p)) 2217 p = quote (p); 2218 else 2219 p = quotearg_style_mem (escape_quoting_style, p, 1); 2220 complain_at (*loc, _("invalid character after \\-escape: %s"), p); 2221 } 2222 YY_BREAK 2223 2224 /*--------------------------------------------. 2225 | Scanning user-code characters and strings. | 2226 `--------------------------------------------*/ 2227 2228 2229 case 93: 2230 /* rule 93 can match eol */ 2231 YY_RULE_SETUP 2232 #line 583 "scan-gram.l" 2233 STRING_GROW; 2234 YY_BREAK 2235 2236 2237 2238 case 94: 2239 YY_RULE_SETUP 2240 #line 588 "scan-gram.l" 2241 STRING_GROW; BEGIN context_state; 2242 YY_BREAK 2243 case 95: 2244 /* rule 95 can match eol */ 2245 YY_RULE_SETUP 2246 #line 589 "scan-gram.l" 2247 unexpected_newline (token_start, "'"); BEGIN context_state; 2248 YY_BREAK 2249 case YY_STATE_EOF(SC_CHARACTER): 2250 #line 590 "scan-gram.l" 2251 unexpected_eof (token_start, "'"); BEGIN context_state; 2252 YY_BREAK 2253 2254 2255 2256 case 96: 2257 YY_RULE_SETUP 2258 #line 595 "scan-gram.l" 2259 STRING_GROW; BEGIN context_state; 2260 YY_BREAK 2261 case 97: 2262 /* rule 97 can match eol */ 2263 YY_RULE_SETUP 2264 #line 596 "scan-gram.l" 2265 unexpected_newline (token_start, "\""); BEGIN context_state; 2266 YY_BREAK 2267 case YY_STATE_EOF(SC_STRING): 2268 #line 597 "scan-gram.l" 2269 unexpected_eof (token_start, "\""); BEGIN context_state; 2270 YY_BREAK 2271 2272 /*---------------------------------------------------. 2273 | Strings, comments etc. can be found in user code. | 2274 `---------------------------------------------------*/ 2275 2276 2277 case 98: 2278 YY_RULE_SETUP 2279 #line 607 "scan-gram.l" 2280 { 2281 STRING_GROW; 2282 context_state = YY_START; 2283 token_start = loc->start; 2284 BEGIN SC_CHARACTER; 2285 } 2286 YY_BREAK 2287 case 99: 2288 YY_RULE_SETUP 2289 #line 613 "scan-gram.l" 2290 { 2291 STRING_GROW; 2292 context_state = YY_START; 2293 token_start = loc->start; 2294 BEGIN SC_STRING; 2295 } 2296 YY_BREAK 2297 case 100: 2298 /* rule 100 can match eol */ 2299 YY_RULE_SETUP 2300 #line 619 "scan-gram.l" 2301 { 2302 STRING_GROW; 2303 context_state = YY_START; 2304 token_start = loc->start; 2305 BEGIN SC_COMMENT; 2306 } 2307 YY_BREAK 2308 case 101: 2309 /* rule 101 can match eol */ 2310 YY_RULE_SETUP 2311 #line 625 "scan-gram.l" 2312 { 2313 STRING_GROW; 2314 context_state = YY_START; 2315 BEGIN SC_LINE_COMMENT; 2316 } 2317 YY_BREAK 2318 2319 /*-----------------------------------------------------------. 2320 | Scanning some code in braces (actions). The initial "{" is | 2321 | already eaten. | 2322 `-----------------------------------------------------------*/ 2323 2324 2325 case 102: 2326 /* rule 102 can match eol */ 2327 YY_RULE_SETUP 2328 #line 641 "scan-gram.l" 2329 STRING_GROW; braces_level++; 2330 YY_BREAK 2331 case 103: 2332 /* rule 103 can match eol */ 2333 YY_RULE_SETUP 2334 #line 642 "scan-gram.l" 2335 STRING_GROW; braces_level--; 2336 YY_BREAK 2337 case 104: 2338 YY_RULE_SETUP 2339 #line 643 "scan-gram.l" 2340 { 2341 obstack_1grow (&obstack_for_string, '}'); 2342 2343 --braces_level; 2344 if (braces_level < 0) 2345 { 2346 STRING_FINISH; 2347 loc->start = code_start; 2348 val->code = last_string; 2349 BEGIN INITIAL; 2350 return BRACED_CODE; 2351 } 2352 } 2353 YY_BREAK 2354 /* Tokenize '<<%' correctly (as '<<' '%') rather than incorrrectly 2355 (as '<' '<%'). */ 2356 case 105: 2357 /* rule 105 can match eol */ 2358 YY_RULE_SETUP 2359 #line 659 "scan-gram.l" 2360 STRING_GROW; 2361 YY_BREAK 2362 case YY_STATE_EOF(SC_BRACED_CODE): 2363 #line 661 "scan-gram.l" 2364 { 2365 unexpected_eof (code_start, "}"); 2366 STRING_FINISH; 2367 loc->start = code_start; 2368 val->code = last_string; 2369 BEGIN INITIAL; 2370 return BRACED_CODE; 2371 } 2372 YY_BREAK 2373 2374 /*--------------------------------------------------------------. 2375 | Scanning some prologue: from "%{" (already scanned) to "%}". | 2376 `--------------------------------------------------------------*/ 2377 2378 2379 case 106: 2380 YY_RULE_SETUP 2381 #line 678 "scan-gram.l" 2382 { 2383 STRING_FINISH; 2384 loc->start = code_start; 2385 val->chars = last_string; 2386 BEGIN INITIAL; 2387 return PROLOGUE; 2388 } 2389 YY_BREAK 2390 case YY_STATE_EOF(SC_PROLOGUE): 2391 #line 686 "scan-gram.l" 2392 { 2393 unexpected_eof (code_start, "%}"); 2394 STRING_FINISH; 2395 loc->start = code_start; 2396 val->chars = last_string; 2397 BEGIN INITIAL; 2398 return PROLOGUE; 2399 } 2400 YY_BREAK 2401 2402 /*---------------------------------------------------------------. 2403 | Scanning the epilogue (everything after the second "%%", which | 2404 | has already been eaten). | 2405 `---------------------------------------------------------------*/ 2406 2407 2408 case YY_STATE_EOF(SC_EPILOGUE): 2409 #line 704 "scan-gram.l" 2410 { 2411 STRING_FINISH; 2412 loc->start = code_start; 2413 val->chars = last_string; 2414 BEGIN INITIAL; 2415 return EPILOGUE; 2416 } 2417 YY_BREAK 2418 2419 /*-----------------------------------------------------. 2420 | By default, grow the string obstack with the input. | 2421 `-----------------------------------------------------*/ 2422 case 107: 2423 #line 719 "scan-gram.l" 2424 case 108: 2425 /* rule 108 can match eol */ 2426 YY_RULE_SETUP 2427 #line 719 "scan-gram.l" 2428 STRING_GROW; 2429 YY_BREAK 2430 case 109: 2431 YY_RULE_SETUP 2432 #line 721 "scan-gram.l" 2433 YY_FATAL_ERROR( "flex scanner jammed" ); 2434 YY_BREAK 2435 #line 2436 "scan-gram.c" 2436 case YY_STATE_EOF(SC_RETURN_BRACKETED_ID): 2437 yyterminate(); 2438 2439 case YY_END_OF_BUFFER: 2440 { 2441 /* Amount of text matched not including the EOB char. */ 2442 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 2443 2444 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 2445 *yy_cp = (yy_hold_char); 2446 YY_RESTORE_YY_MORE_OFFSET 2447 2448 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 2449 { 2450 /* We're scanning a new file or input source. It's 2451 * possible that this happened because the user 2452 * just pointed gram_in at a new source and called 2453 * gram_lex(). If so, then we have to assure 2454 * consistency between YY_CURRENT_BUFFER and our 2455 * globals. Here is the right place to do so, because 2456 * this is the first action (other than possibly a 2457 * back-up) that will match for the new input source. 2458 */ 2459 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 2460 YY_CURRENT_BUFFER_LVALUE->yy_input_file = gram_in; 2461 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 2462 } 2463 2464 /* Note that here we test for yy_c_buf_p "<=" to the position 2465 * of the first EOB in the buffer, since yy_c_buf_p will 2466 * already have been incremented past the NUL character 2467 * (since all states make transitions on EOB to the 2468 * end-of-buffer state). Contrast this with the test 2469 * in input(). 2470 */ 2471 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 2472 { /* This was really a NUL. */ 2473 yy_state_type yy_next_state; 2474 2475 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 2476 2477 yy_current_state = yy_get_previous_state( ); 2478 2479 /* Okay, we're now positioned to make the NUL 2480 * transition. We couldn't have 2481 * yy_get_previous_state() go ahead and do it 2482 * for us because it doesn't know how to deal 2483 * with the possibility of jamming (and we don't 2484 * want to build jamming into it because then it 2485 * will run more slowly). 2486 */ 2487 2488 yy_next_state = yy_try_NUL_trans( yy_current_state ); 2489 2490 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 2491 2492 if ( yy_next_state ) 2493 { 2494 /* Consume the NUL. */ 2495 yy_cp = ++(yy_c_buf_p); 2496 yy_current_state = yy_next_state; 2497 goto yy_match; 2498 } 2499 2500 else 2501 { 2502 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ 2503 yy_cp = (yy_last_accepting_cpos); 2504 yy_current_state = (yy_last_accepting_state); 2505 goto yy_find_action; 2506 } 2507 } 2508 2509 else switch ( yy_get_next_buffer( ) ) 2510 { 2511 case EOB_ACT_END_OF_FILE: 2512 { 2513 (yy_did_buffer_switch_on_eof) = 0; 2514 2515 if ( gram_wrap( ) ) 2516 { 2517 /* Note: because we've taken care in 2518 * yy_get_next_buffer() to have set up 2519 * gram_text, we can now set up 2520 * yy_c_buf_p so that if some total 2521 * hoser (like flex itself) wants to 2522 * call the scanner after we return the 2523 * YY_NULL, it'll still work - another 2524 * YY_NULL will get returned. 2525 */ 2526 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 2527 2528 yy_act = YY_STATE_EOF(YY_START); 2529 goto do_action; 2530 } 2531 2532 else 2533 { 2534 if ( ! (yy_did_buffer_switch_on_eof) ) 2535 YY_NEW_FILE; 2536 } 2537 break; 2538 } 2539 2540 case EOB_ACT_CONTINUE_SCAN: 2541 (yy_c_buf_p) = 2542 (yytext_ptr) + yy_amount_of_matched_text; 2543 2544 yy_current_state = yy_get_previous_state( ); 2545 2546 yy_cp = (yy_c_buf_p); 2547 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 2548 goto yy_match; 2549 2550 case EOB_ACT_LAST_MATCH: 2551 (yy_c_buf_p) = 2552 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 2553 2554 yy_current_state = yy_get_previous_state( ); 2555 2556 yy_cp = (yy_c_buf_p); 2557 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 2558 goto yy_find_action; 2559 } 2560 break; 2561 } 2562 2563 default: 2564 YY_FATAL_ERROR( 2565 "fatal flex scanner internal error--no action found" ); 2566 } /* end of action switch */ 2567 } /* end of scanning one token */ 2568 } /* end of gram_lex */ 2569 /* %ok-for-header */ 2570 2571 /* %if-c++-only */ 2572 /* %not-for-header */ 2573 2574 /* %ok-for-header */ 2575 2576 /* %endif */ 2577 2578 /* yy_get_next_buffer - try to read in a new buffer 2579 * 2580 * Returns a code representing an action: 2581 * EOB_ACT_LAST_MATCH - 2582 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 2583 * EOB_ACT_END_OF_FILE - end of file 2584 */ 2585 /* %if-c-only */ 2586 static int yy_get_next_buffer (void) 2587 /* %endif */ 2588 /* %if-c++-only */ 2589 /* %endif */ 2590 { 2591 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 2592 register char *source = (yytext_ptr); 2593 register int number_to_move, i; 2594 int ret_val; 2595 2596 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 2597 YY_FATAL_ERROR( 2598 "fatal flex scanner internal error--end of buffer missed" ); 2599 2600 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 2601 { /* Don't try to fill the buffer, so this is an EOF. */ 2602 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 2603 { 2604 /* We matched a single character, the EOB, so 2605 * treat this as a final EOF. 2606 */ 2607 return EOB_ACT_END_OF_FILE; 2608 } 2609 2610 else 2611 { 2612 /* We matched some text prior to the EOB, first 2613 * process it. 2614 */ 2615 return EOB_ACT_LAST_MATCH; 2616 } 2617 } 2618 2619 /* Try to read more data. */ 2620 2621 /* First move last chars to start of buffer. */ 2622 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; 2623 2624 for ( i = 0; i < number_to_move; ++i ) 2625 *(dest++) = *(source++); 2626 2627 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 2628 /* don't do the read, it's not guaranteed to return an EOF, 2629 * just force an EOF 2630 */ 2631 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 2632 2633 else 2634 { 2635 yy_size_t num_to_read = 2636 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 2637 2638 while ( num_to_read <= 0 ) 2639 { /* Not enough room in the buffer - grow it. */ 2640 2641 /* just a shorter name for the current buffer */ 2642 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; 2643 2644 int yy_c_buf_p_offset = 2645 (int) ((yy_c_buf_p) - b->yy_ch_buf); 2646 2647 if ( b->yy_is_our_buffer ) 2648 { 2649 yy_size_t new_size = b->yy_buf_size * 2; 2650 2651 if ( new_size <= 0 ) 2652 b->yy_buf_size += b->yy_buf_size / 8; 2653 else 2654 b->yy_buf_size *= 2; 2655 2656 b->yy_ch_buf = (char *) 2657 /* Include room in for 2 EOB chars. */ 2658 gram_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); 2659 } 2660 else 2661 /* Can't grow it, we don't own it. */ 2662 b->yy_ch_buf = 0; 2663 2664 if ( ! b->yy_ch_buf ) 2665 YY_FATAL_ERROR( 2666 "fatal error - scanner input buffer overflow" ); 2667 2668 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 2669 2670 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 2671 number_to_move - 1; 2672 2673 } 2674 2675 if ( num_to_read > YY_READ_BUF_SIZE ) 2676 num_to_read = YY_READ_BUF_SIZE; 2677 2678 /* Read in more data. */ 2679 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 2680 (yy_n_chars), num_to_read ); 2681 2682 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 2683 } 2684 2685 if ( (yy_n_chars) == 0 ) 2686 { 2687 if ( number_to_move == YY_MORE_ADJ ) 2688 { 2689 ret_val = EOB_ACT_END_OF_FILE; 2690 gram_restart(gram_in ); 2691 } 2692 2693 else 2694 { 2695 ret_val = EOB_ACT_LAST_MATCH; 2696 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 2697 YY_BUFFER_EOF_PENDING; 2698 } 2699 } 2700 2701 else 2702 ret_val = EOB_ACT_CONTINUE_SCAN; 2703 2704 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 2705 /* Extend the array by 50%, plus the number we really need. */ 2706 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 2707 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gram_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); 2708 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 2709 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 2710 } 2711 2712 (yy_n_chars) += number_to_move; 2713 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 2714 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 2715 2716 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 2717 2718 return ret_val; 2719 } 2720 2721 /* yy_get_previous_state - get the state just before the EOB char was reached */ 2722 2723 /* %if-c-only */ 2724 /* %not-for-header */ 2725 2726 static yy_state_type yy_get_previous_state (void) 2727 /* %endif */ 2728 /* %if-c++-only */ 2729 /* %endif */ 2730 { 2731 register yy_state_type yy_current_state; 2732 register char *yy_cp; 2733 2734 /* %% [15.0] code to get the start state into yy_current_state goes here */ 2735 yy_current_state = (yy_start); 2736 yy_current_state += YY_AT_BOL(); 2737 2738 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 2739 { 2740 /* %% [16.0] code to find the next state goes here */ 2741 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 58); 2742 if ( yy_accept[yy_current_state] ) 2743 { 2744 (yy_last_accepting_state) = yy_current_state; 2745 (yy_last_accepting_cpos) = yy_cp; 2746 } 2747 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 2748 { 2749 yy_current_state = (int) yy_def[yy_current_state]; 2750 if ( yy_current_state >= 482 ) 2751 yy_c = yy_meta[(unsigned int) yy_c]; 2752 } 2753 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 2754 } 2755 2756 return yy_current_state; 2757 } 2758 2759 /* yy_try_NUL_trans - try to make a transition on the NUL character 2760 * 2761 * synopsis 2762 * next_state = yy_try_NUL_trans( current_state ); 2763 */ 2764 /* %if-c-only */ 2765 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 2766 /* %endif */ 2767 /* %if-c++-only */ 2768 /* %endif */ 2769 { 2770 register int yy_is_jam; 2771 /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ 2772 register char *yy_cp = (yy_c_buf_p); 2773 2774 register YY_CHAR yy_c = 58; 2775 if ( yy_accept[yy_current_state] ) 2776 { 2777 (yy_last_accepting_state) = yy_current_state; 2778 (yy_last_accepting_cpos) = yy_cp; 2779 } 2780 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 2781 { 2782 yy_current_state = (int) yy_def[yy_current_state]; 2783 if ( yy_current_state >= 482 ) 2784 yy_c = yy_meta[(unsigned int) yy_c]; 2785 } 2786 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 2787 yy_is_jam = (yy_current_state == 481); 2788 2789 return yy_is_jam ? 0 : yy_current_state; 2790 } 2791 2792 /* %if-c-only */ 2793 2794 /* %endif */ 2795 2796 /* %if-c-only */ 2797 #ifndef YY_NO_INPUT 2798 #ifdef __cplusplus 2799 static int yyinput (void) 2800 #else 2801 static int input (void) 2802 #endif 2803 2804 /* %endif */ 2805 /* %if-c++-only */ 2806 /* %endif */ 2807 { 2808 int c; 2809 2810 *(yy_c_buf_p) = (yy_hold_char); 2811 2812 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 2813 { 2814 /* yy_c_buf_p now points to the character we want to return. 2815 * If this occurs *before* the EOB characters, then it's a 2816 * valid NUL; if not, then we've hit the end of the buffer. 2817 */ 2818 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 2819 /* This was really a NUL. */ 2820 *(yy_c_buf_p) = '\0'; 2821 2822 else 2823 { /* need more input */ 2824 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); 2825 ++(yy_c_buf_p); 2826 2827 switch ( yy_get_next_buffer( ) ) 2828 { 2829 case EOB_ACT_LAST_MATCH: 2830 /* This happens because yy_g_n_b() 2831 * sees that we've accumulated a 2832 * token and flags that we need to 2833 * try matching the token before 2834 * proceeding. But for input(), 2835 * there's no matching to consider. 2836 * So convert the EOB_ACT_LAST_MATCH 2837 * to EOB_ACT_END_OF_FILE. 2838 */ 2839 2840 /* Reset buffer status. */ 2841 gram_restart(gram_in ); 2842 2843 /*FALLTHROUGH*/ 2844 2845 case EOB_ACT_END_OF_FILE: 2846 { 2847 if ( gram_wrap( ) ) 2848 return EOF; 2849 2850 if ( ! (yy_did_buffer_switch_on_eof) ) 2851 YY_NEW_FILE; 2852 #ifdef __cplusplus 2853 return yyinput(); 2854 #else 2855 return input(); 2856 #endif 2857 } 2858 2859 case EOB_ACT_CONTINUE_SCAN: 2860 (yy_c_buf_p) = (yytext_ptr) + offset; 2861 break; 2862 } 2863 } 2864 } 2865 2866 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 2867 *(yy_c_buf_p) = '\0'; /* preserve gram_text */ 2868 (yy_hold_char) = *++(yy_c_buf_p); 2869 2870 /* %% [19.0] update BOL and gram_lineno */ 2871 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); 2872 2873 return c; 2874 } 2875 /* %if-c-only */ 2876 #endif /* ifndef YY_NO_INPUT */ 2877 /* %endif */ 2878 2879 /** Immediately switch to a different input stream. 2880 * @param input_file A readable stream. 2881 * 2882 * @note This function does not reset the start condition to @c INITIAL . 2883 */ 2884 /* %if-c-only */ 2885 void gram_restart (FILE * input_file ) 2886 /* %endif */ 2887 /* %if-c++-only */ 2888 /* %endif */ 2889 { 2890 2891 if ( ! YY_CURRENT_BUFFER ){ 2892 gram_ensure_buffer_stack (); 2893 YY_CURRENT_BUFFER_LVALUE = 2894 gram__create_buffer(gram_in,YY_BUF_SIZE ); 2895 } 2896 2897 gram__init_buffer(YY_CURRENT_BUFFER,input_file ); 2898 gram__load_buffer_state( ); 2899 } 2900 2901 /** Switch to a different input buffer. 2902 * @param new_buffer The new input buffer. 2903 * 2904 */ 2905 /* %if-c-only */ 2906 void gram__switch_to_buffer (YY_BUFFER_STATE new_buffer ) 2907 /* %endif */ 2908 /* %if-c++-only */ 2909 /* %endif */ 2910 { 2911 2912 /* TODO. We should be able to replace this entire function body 2913 * with 2914 * gram_pop_buffer_state(); 2915 * gram_push_buffer_state(new_buffer); 2916 */ 2917 gram_ensure_buffer_stack (); 2918 if ( YY_CURRENT_BUFFER == new_buffer ) 2919 return; 2920 2921 if ( YY_CURRENT_BUFFER ) 2922 { 2923 /* Flush out information for old buffer. */ 2924 *(yy_c_buf_p) = (yy_hold_char); 2925 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 2926 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 2927 } 2928 2929 YY_CURRENT_BUFFER_LVALUE = new_buffer; 2930 gram__load_buffer_state( ); 2931 2932 /* We don't actually know whether we did this switch during 2933 * EOF (gram_wrap()) processing, but the only time this flag 2934 * is looked at is after gram_wrap() is called, so it's safe 2935 * to go ahead and always set it. 2936 */ 2937 (yy_did_buffer_switch_on_eof) = 1; 2938 } 2939 2940 /* %if-c-only */ 2941 static void gram__load_buffer_state (void) 2942 /* %endif */ 2943 /* %if-c++-only */ 2944 /* %endif */ 2945 { 2946 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 2947 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 2948 gram_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 2949 (yy_hold_char) = *(yy_c_buf_p); 2950 } 2951 2952 /** Allocate and initialize an input buffer state. 2953 * @param file A readable stream. 2954 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 2955 * 2956 * @return the allocated buffer state. 2957 */ 2958 /* %if-c-only */ 2959 YY_BUFFER_STATE gram__create_buffer (FILE * file, int size ) 2960 /* %endif */ 2961 /* %if-c++-only */ 2962 /* %endif */ 2963 { 2964 YY_BUFFER_STATE b; 2965 2966 b = (YY_BUFFER_STATE) gram_alloc(sizeof( struct yy_buffer_state ) ); 2967 if ( ! b ) 2968 YY_FATAL_ERROR( "out of dynamic memory in gram__create_buffer()" ); 2969 2970 b->yy_buf_size = size; 2971 2972 /* yy_ch_buf has to be 2 characters longer than the size given because 2973 * we need to put in 2 end-of-buffer characters. 2974 */ 2975 b->yy_ch_buf = (char *) gram_alloc(b->yy_buf_size + 2 ); 2976 if ( ! b->yy_ch_buf ) 2977 YY_FATAL_ERROR( "out of dynamic memory in gram__create_buffer()" ); 2978 2979 b->yy_is_our_buffer = 1; 2980 2981 gram__init_buffer(b,file ); 2982 2983 return b; 2984 } 2985 2986 /** Destroy the buffer. 2987 * @param b a buffer created with gram__create_buffer() 2988 * 2989 */ 2990 /* %if-c-only */ 2991 void gram__delete_buffer (YY_BUFFER_STATE b ) 2992 /* %endif */ 2993 /* %if-c++-only */ 2994 /* %endif */ 2995 { 2996 2997 if ( ! b ) 2998 return; 2999 3000 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 3001 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 3002 3003 if ( b->yy_is_our_buffer ) 3004 gram_free((void *) b->yy_ch_buf ); 3005 3006 gram_free((void *) b ); 3007 } 3008 3009 /* Initializes or reinitializes a buffer. 3010 * This function is sometimes called more than once on the same buffer, 3011 * such as during a gram_restart() or at EOF. 3012 */ 3013 /* %if-c-only */ 3014 static void gram__init_buffer (YY_BUFFER_STATE b, FILE * file ) 3015 /* %endif */ 3016 /* %if-c++-only */ 3017 /* %endif */ 3018 3019 { 3020 int oerrno = errno; 3021 3022 gram__flush_buffer(b ); 3023 3024 b->yy_input_file = file; 3025 b->yy_fill_buffer = 1; 3026 3027 /* If b is the current buffer, then gram__init_buffer was _probably_ 3028 * called from gram_restart() or through yy_get_next_buffer. 3029 * In that case, we don't want to reset the lineno or column. 3030 */ 3031 if (b != YY_CURRENT_BUFFER){ 3032 b->yy_bs_lineno = 1; 3033 b->yy_bs_column = 0; 3034 } 3035 3036 /* %if-c-only */ 3037 3038 b->yy_is_interactive = 0; 3039 3040 /* %endif */ 3041 /* %if-c++-only */ 3042 /* %endif */ 3043 errno = oerrno; 3044 } 3045 3046 /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 3047 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 3048 * 3049 */ 3050 /* %if-c-only */ 3051 void gram__flush_buffer (YY_BUFFER_STATE b ) 3052 /* %endif */ 3053 /* %if-c++-only */ 3054 /* %endif */ 3055 { 3056 if ( ! b ) 3057 return; 3058 3059 b->yy_n_chars = 0; 3060 3061 /* We always need two end-of-buffer characters. The first causes 3062 * a transition to the end-of-buffer state. The second causes 3063 * a jam in that state. 3064 */ 3065 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 3066 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 3067 3068 b->yy_buf_pos = &b->yy_ch_buf[0]; 3069 3070 b->yy_at_bol = 1; 3071 b->yy_buffer_status = YY_BUFFER_NEW; 3072 3073 if ( b == YY_CURRENT_BUFFER ) 3074 gram__load_buffer_state( ); 3075 } 3076 3077 /* %if-c-or-c++ */ 3078 /** Pushes the new state onto the stack. The new state becomes 3079 * the current state. This function will allocate the stack 3080 * if necessary. 3081 * @param new_buffer The new state. 3082 * 3083 */ 3084 /* %if-c-only */ 3085 void gram_push_buffer_state (YY_BUFFER_STATE new_buffer ) 3086 /* %endif */ 3087 /* %if-c++-only */ 3088 /* %endif */ 3089 { 3090 if (new_buffer == NULL) 3091 return; 3092 3093 gram_ensure_buffer_stack(); 3094 3095 /* This block is copied from gram__switch_to_buffer. */ 3096 if ( YY_CURRENT_BUFFER ) 3097 { 3098 /* Flush out information for old buffer. */ 3099 *(yy_c_buf_p) = (yy_hold_char); 3100 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 3101 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 3102 } 3103 3104 /* Only push if top exists. Otherwise, replace top. */ 3105 if (YY_CURRENT_BUFFER) 3106 (yy_buffer_stack_top)++; 3107 YY_CURRENT_BUFFER_LVALUE = new_buffer; 3108 3109 /* copied from gram__switch_to_buffer. */ 3110 gram__load_buffer_state( ); 3111 (yy_did_buffer_switch_on_eof) = 1; 3112 } 3113 /* %endif */ 3114 3115 /* %if-c-or-c++ */ 3116 /** Removes and deletes the top of the stack, if present. 3117 * The next element becomes the new top. 3118 * 3119 */ 3120 /* %if-c-only */ 3121 void gram_pop_buffer_state (void) 3122 /* %endif */ 3123 /* %if-c++-only */ 3124 /* %endif */ 3125 { 3126 if (!YY_CURRENT_BUFFER) 3127 return; 3128 3129 gram__delete_buffer(YY_CURRENT_BUFFER ); 3130 YY_CURRENT_BUFFER_LVALUE = NULL; 3131 if ((yy_buffer_stack_top) > 0) 3132 --(yy_buffer_stack_top); 3133 3134 if (YY_CURRENT_BUFFER) { 3135 gram__load_buffer_state( ); 3136 (yy_did_buffer_switch_on_eof) = 1; 3137 } 3138 } 3139 /* %endif */ 3140 3141 /* %if-c-or-c++ */ 3142 /* Allocates the stack if it does not exist. 3143 * Guarantees space for at least one push. 3144 */ 3145 /* %if-c-only */ 3146 static void gram_ensure_buffer_stack (void) 3147 /* %endif */ 3148 /* %if-c++-only */ 3149 /* %endif */ 3150 { 3151 yy_size_t num_to_alloc; 3152 3153 if (!(yy_buffer_stack)) { 3154 3155 /* First allocation is just for 2 elements, since we don't know if this 3156 * scanner will even need a stack. We use 2 instead of 1 to avoid an 3157 * immediate realloc on the next call. 3158 */ 3159 num_to_alloc = 1; 3160 (yy_buffer_stack) = (struct yy_buffer_state**)gram_alloc 3161 (num_to_alloc * sizeof(struct yy_buffer_state*) 3162 ); 3163 if ( ! (yy_buffer_stack) ) 3164 YY_FATAL_ERROR( "out of dynamic memory in gram_ensure_buffer_stack()" ); 3165 3166 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 3167 3168 (yy_buffer_stack_max) = num_to_alloc; 3169 (yy_buffer_stack_top) = 0; 3170 return; 3171 } 3172 3173 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 3174 3175 /* Increase the buffer to prepare for a possible push. */ 3176 int grow_size = 8 /* arbitrary grow size */; 3177 3178 num_to_alloc = (yy_buffer_stack_max) + grow_size; 3179 (yy_buffer_stack) = (struct yy_buffer_state**)gram_realloc 3180 ((yy_buffer_stack), 3181 num_to_alloc * sizeof(struct yy_buffer_state*) 3182 ); 3183 if ( ! (yy_buffer_stack) ) 3184 YY_FATAL_ERROR( "out of dynamic memory in gram_ensure_buffer_stack()" ); 3185 3186 /* zero only the new slots.*/ 3187 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 3188 (yy_buffer_stack_max) = num_to_alloc; 3189 } 3190 } 3191 /* %endif */ 3192 3193 /* %if-c-only */ 3194 /** Setup the input buffer state to scan directly from a user-specified character buffer. 3195 * @param base the character buffer 3196 * @param size the size in bytes of the character buffer 3197 * 3198 * @return the newly allocated buffer state object. 3199 */ 3200 YY_BUFFER_STATE gram__scan_buffer (char * base, yy_size_t size ) 3201 { 3202 YY_BUFFER_STATE b; 3203 3204 if ( size < 2 || 3205 base[size-2] != YY_END_OF_BUFFER_CHAR || 3206 base[size-1] != YY_END_OF_BUFFER_CHAR ) 3207 /* They forgot to leave room for the EOB's. */ 3208 return 0; 3209 3210 b = (YY_BUFFER_STATE) gram_alloc(sizeof( struct yy_buffer_state ) ); 3211 if ( ! b ) 3212 YY_FATAL_ERROR( "out of dynamic memory in gram__scan_buffer()" ); 3213 3214 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 3215 b->yy_buf_pos = b->yy_ch_buf = base; 3216 b->yy_is_our_buffer = 0; 3217 b->yy_input_file = 0; 3218 b->yy_n_chars = b->yy_buf_size; 3219 b->yy_is_interactive = 0; 3220 b->yy_at_bol = 1; 3221 b->yy_fill_buffer = 0; 3222 b->yy_buffer_status = YY_BUFFER_NEW; 3223 3224 gram__switch_to_buffer(b ); 3225 3226 return b; 3227 } 3228 /* %endif */ 3229 3230 /* %if-c-only */ 3231 /** Setup the input buffer state to scan a string. The next call to gram_lex() will 3232 * scan from a @e copy of @a str. 3233 * @param yystr a NUL-terminated string to scan 3234 * 3235 * @return the newly allocated buffer state object. 3236 * @note If you want to scan bytes that may contain NUL values, then use 3237 * gram__scan_bytes() instead. 3238 */ 3239 YY_BUFFER_STATE gram__scan_string (yyconst char * yystr ) 3240 { 3241 3242 return gram__scan_bytes(yystr,strlen(yystr) ); 3243 } 3244 /* %endif */ 3245 3246 /* %if-c-only */ 3247 /** Setup the input buffer state to scan the given bytes. The next call to gram_lex() will 3248 * scan from a @e copy of @a bytes. 3249 * @param yybytes the byte buffer to scan 3250 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 3251 * 3252 * @return the newly allocated buffer state object. 3253 */ 3254 YY_BUFFER_STATE gram__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) 3255 { 3256 YY_BUFFER_STATE b; 3257 char *buf; 3258 yy_size_t n; 3259 int i; 3260 3261 /* Get memory for full buffer, including space for trailing EOB's. */ 3262 n = _yybytes_len + 2; 3263 buf = (char *) gram_alloc(n ); 3264 if ( ! buf ) 3265 YY_FATAL_ERROR( "out of dynamic memory in gram__scan_bytes()" ); 3266 3267 for ( i = 0; i < _yybytes_len; ++i ) 3268 buf[i] = yybytes[i]; 3269 3270 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 3271 3272 b = gram__scan_buffer(buf,n ); 3273 if ( ! b ) 3274 YY_FATAL_ERROR( "bad buffer in gram__scan_bytes()" ); 3275 3276 /* It's okay to grow etc. this buffer, and we should throw it 3277 * away when we're done. 3278 */ 3279 b->yy_is_our_buffer = 1; 3280 3281 return b; 3282 } 3283 /* %endif */ 3284 3285 #ifndef YY_EXIT_FAILURE 3286 #define YY_EXIT_FAILURE 2 3287 #endif 3288 3289 /* %if-c-only */ 3290 static void yy_fatal_error (yyconst char* msg ) 3291 { 3292 (void) fprintf( stderr, "%s\n", msg ); 3293 exit( YY_EXIT_FAILURE ); 3294 } 3295 /* %endif */ 3296 /* %if-c++-only */ 3297 /* %endif */ 3298 3299 /* Redefine yyless() so it works in section 3 code. */ 3300 3301 #undef yyless 3302 #define yyless(n) \ 3303 do \ 3304 { \ 3305 /* Undo effects of setting up gram_text. */ \ 3306 int yyless_macro_arg = (n); \ 3307 YY_LESS_LINENO(yyless_macro_arg);\ 3308 gram_text[gram_leng] = (yy_hold_char); \ 3309 (yy_c_buf_p) = gram_text + yyless_macro_arg; \ 3310 (yy_hold_char) = *(yy_c_buf_p); \ 3311 *(yy_c_buf_p) = '\0'; \ 3312 gram_leng = yyless_macro_arg; \ 3313 } \ 3314 while ( 0 ) 3315 3316 /* Accessor methods (get/set functions) to struct members. */ 3317 3318 /* %if-c-only */ 3319 /* %if-reentrant */ 3320 /* %endif */ 3321 3322 /** Get the current line number. 3323 * 3324 */ 3325 int gram_get_lineno (void) 3326 { 3327 3328 return gram_lineno; 3329 } 3330 3331 /** Get the input stream. 3332 * 3333 */ 3334 FILE *gram_get_in (void) 3335 { 3336 return gram_in; 3337 } 3338 3339 /** Get the output stream. 3340 * 3341 */ 3342 FILE *gram_get_out (void) 3343 { 3344 return gram_out; 3345 } 3346 3347 /** Get the length of the current token. 3348 * 3349 */ 3350 yy_size_t gram_get_leng (void) 3351 { 3352 return gram_leng; 3353 } 3354 3355 /** Get the current token. 3356 * 3357 */ 3358 3359 char *gram_get_text (void) 3360 { 3361 return gram_text; 3362 } 3363 3364 /* %if-reentrant */ 3365 /* %endif */ 3366 3367 /** Set the current line number. 3368 * @param line_number 3369 * 3370 */ 3371 void gram_set_lineno (int line_number ) 3372 { 3373 3374 gram_lineno = line_number; 3375 } 3376 3377 /** Set the input stream. This does not discard the current 3378 * input buffer. 3379 * @param in_str A readable stream. 3380 * 3381 * @see gram__switch_to_buffer 3382 */ 3383 void gram_set_in (FILE * in_str ) 3384 { 3385 gram_in = in_str ; 3386 } 3387 3388 void gram_set_out (FILE * out_str ) 3389 { 3390 gram_out = out_str ; 3391 } 3392 3393 int gram_get_debug (void) 3394 { 3395 return gram__flex_debug; 3396 } 3397 3398 void gram_set_debug (int bdebug ) 3399 { 3400 gram__flex_debug = bdebug ; 3401 } 3402 3403 /* %endif */ 3404 3405 /* %if-reentrant */ 3406 /* %if-bison-bridge */ 3407 /* %endif */ 3408 /* %endif if-c-only */ 3409 3410 /* %if-c-only */ 3411 static int yy_init_globals (void) 3412 { 3413 /* Initialization is the same as for the non-reentrant scanner. 3414 * This function is called from gram_lex_destroy(), so don't allocate here. 3415 */ 3416 3417 (yy_buffer_stack) = 0; 3418 (yy_buffer_stack_top) = 0; 3419 (yy_buffer_stack_max) = 0; 3420 (yy_c_buf_p) = (char *) 0; 3421 (yy_init) = 0; 3422 (yy_start) = 0; 3423 3424 /* Defined in main.c */ 3425 #ifdef YY_STDINIT 3426 gram_in = stdin; 3427 gram_out = stdout; 3428 #else 3429 gram_in = (FILE *) 0; 3430 gram_out = (FILE *) 0; 3431 #endif 3432 3433 /* For future reference: Set errno on error, since we are called by 3434 * gram_lex_init() 3435 */ 3436 return 0; 3437 } 3438 /* %endif */ 3439 3440 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ 3441 /* gram_lex_destroy is for both reentrant and non-reentrant scanners. */ 3442 int gram_lex_destroy (void) 3443 { 3444 3445 /* Pop the buffer stack, destroying each element. */ 3446 while(YY_CURRENT_BUFFER){ 3447 gram__delete_buffer(YY_CURRENT_BUFFER ); 3448 YY_CURRENT_BUFFER_LVALUE = NULL; 3449 gram_pop_buffer_state(); 3450 } 3451 3452 /* Destroy the stack itself. */ 3453 gram_free((yy_buffer_stack) ); 3454 (yy_buffer_stack) = NULL; 3455 3456 /* Reset the globals. This is important in a non-reentrant scanner so the next time 3457 * gram_lex() is called, initialization will occur. */ 3458 yy_init_globals( ); 3459 3460 /* %if-reentrant */ 3461 /* %endif */ 3462 return 0; 3463 } 3464 /* %endif */ 3465 3466 /* 3467 * Internal utility routines. 3468 */ 3469 3470 #ifndef yytext_ptr 3471 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) 3472 { 3473 register int i; 3474 for ( i = 0; i < n; ++i ) 3475 s1[i] = s2[i]; 3476 } 3477 #endif 3478 3479 #ifdef YY_NEED_STRLEN 3480 static int yy_flex_strlen (yyconst char * s ) 3481 { 3482 register int n; 3483 for ( n = 0; s[n]; ++n ) 3484 ; 3485 3486 return n; 3487 } 3488 #endif 3489 3490 void *gram_alloc (yy_size_t size ) 3491 { 3492 return (void *) malloc( size ); 3493 } 3494 3495 void *gram_realloc (void * ptr, yy_size_t size ) 3496 { 3497 /* The cast to (char *) in the following accommodates both 3498 * implementations that use char* generic pointers, and those 3499 * that use void* generic pointers. It works with the latter 3500 * because both ANSI C and C++ allow castless assignment from 3501 * any pointer type to void*, and deal with argument conversions 3502 * as though doing an assignment. 3503 */ 3504 return (void *) realloc( (char *) ptr, size ); 3505 } 3506 3507 void gram_free (void * ptr ) 3508 { 3509 free( (char *) ptr ); /* see gram_realloc() for (char *) cast */ 3510 } 3511 3512 /* %if-tables-serialization definitions */ 3513 /* %define-yytables The name for this specific scanner's tables. */ 3514 #define YYTABLES_NAME "yytables" 3515 /* %endif */ 3516 3517 /* %ok-for-header */ 3518 3519 #line 721 "scan-gram.l" 3520 3521 3522 3523 /* Read bytes from FP into buffer BUF of size SIZE. Return the 3524 number of bytes read. Remove '\r' from input, treating \r\n 3525 and isolated \r as \n. */ 3526 3527 static size_t 3528 no_cr_read (FILE *fp, char *buf, size_t size) 3529 { 3530 size_t bytes_read = fread (buf, 1, size, fp); 3531 if (bytes_read) 3532 { 3533 char *w = memchr (buf, '\r', bytes_read); 3534 if (w) 3535 { 3536 char const *r = ++w; 3537 char const *lim = buf + bytes_read; 3538 3539 for (;;) 3540 { 3541 /* Found an '\r'. Treat it like '\n', but ignore any 3542 '\n' that immediately follows. */ 3543 w[-1] = '\n'; 3544 if (r == lim) 3545 { 3546 int ch = getc (fp); 3547 if (ch != '\n' && ungetc (ch, fp) != ch) 3548 break; 3549 } 3550 else if (*r == '\n') 3551 r++; 3552 3553 /* Copy until the next '\r'. */ 3554 do 3555 { 3556 if (r == lim) 3557 return w - buf; 3558 } 3559 while ((*w++ = *r++) != '\r'); 3560 } 3561 3562 return w - buf; 3563 } 3564 } 3565 3566 return bytes_read; 3567 } 3568 3569 3570 3571 /*------------------------------------------------------. 3572 | Scan NUMBER for a base-BASE integer at location LOC. | 3573 `------------------------------------------------------*/ 3574 3575 static unsigned long int 3576 scan_integer (char const *number, int base, location loc) 3577 { 3578 verify (INT_MAX < ULONG_MAX); 3579 unsigned long int num = strtoul (number, NULL, base); 3580 3581 if (INT_MAX < num) 3582 { 3583 complain_at (loc, _("integer out of range: %s"), quote (number)); 3584 num = INT_MAX; 3585 } 3586 3587 return num; 3588 } 3589 3590 3591 /*------------------------------------------------------------------. 3592 | Convert universal character name UCN to a single-byte character, | 3593 | and return that character. Return -1 if UCN does not correspond | 3594 | to a single-byte character. | 3595 `------------------------------------------------------------------*/ 3596 3597 static int 3598 convert_ucn_to_byte (char const *ucn) 3599 { 3600 verify (UCHAR_MAX <= INT_MAX); 3601 unsigned long int code = strtoul (ucn + 2, NULL, 16); 3602 3603 /* FIXME: Currently we assume Unicode-compatible unibyte characters 3604 on ASCII hosts (i.e., Latin-1 on hosts with 8-bit bytes). On 3605 non-ASCII hosts we support only the portable C character set. 3606 These limitations should be removed once we add support for 3607 multibyte characters. */ 3608 3609 if (UCHAR_MAX < code) 3610 return -1; 3611 3612 #if ! ('$' == 0x24 && '@' == 0x40 && '`' == 0x60 && '~' == 0x7e) 3613 { 3614 /* A non-ASCII host. Use CODE to index into a table of the C 3615 basic execution character set, which is guaranteed to exist on 3616 all Standard C platforms. This table also includes '$', '@', 3617 and '`', which are not in the basic execution character set but 3618 which are unibyte characters on all the platforms that we know 3619 about. */ 3620 static signed char const table[] = 3621 { 3622 '\0', -1, -1, -1, -1, -1, -1, '\a', 3623 '\b', '\t', '\n', '\v', '\f', '\r', -1, -1, 3624 -1, -1, -1, -1, -1, -1, -1, -1, 3625 -1, -1, -1, -1, -1, -1, -1, -1, 3626 ' ', '!', '"', '#', '$', '%', '&', '\'', 3627 '(', ')', '*', '+', ',', '-', '.', '/', 3628 '0', '1', '2', '3', '4', '5', '6', '7', 3629 '8', '9', ':', ';', '<', '=', '>', '?', 3630 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 3631 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 3632 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 3633 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', 3634 '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 3635 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 3636 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 3637 'x', 'y', 'z', '{', '|', '}', '~' 3638 }; 3639 3640 code = code < sizeof table ? table[code] : -1; 3641 } 3642 #endif 3643 3644 return code; 3645 } 3646 3647 3648 /*---------------------------------------------------------------------. 3649 | Handle '#line INT( "FILE")?\n'. ARGS has already skipped '#line '. | 3650 `---------------------------------------------------------------------*/ 3651 3652 static void 3653 handle_syncline (char *args, location loc) 3654 { 3655 char *file; 3656 unsigned long int lineno = strtoul (args, &file, 10); 3657 if (INT_MAX <= lineno) 3658 { 3659 warn_at (loc, _("line number overflow")); 3660 lineno = INT_MAX; 3661 } 3662 3663 file = mbschr (file, '"'); 3664 if (file) 3665 { 3666 *mbschr (file + 1, '"') = '\0'; 3667 current_file = uniqstr_new (file + 1); 3668 } 3669 boundary_set (&scanner_cursor, current_file, lineno, 1); 3670 } 3671 3672 3673 /*----------------------------------------------------------------. 3674 | For a token or comment starting at START, report message MSGID, | 3675 | which should say that an end marker was found before | 3676 | the expected TOKEN_END. | 3677 `----------------------------------------------------------------*/ 3678 3679 static void 3680 unexpected_end (boundary start, char const *msgid, char const *token_end) 3681 { 3682 location loc; 3683 loc.start = start; 3684 loc.end = scanner_cursor; 3685 token_end = quote (token_end); 3686 /* Instead of '\'', display "'". */ 3687 if (!strcmp (token_end, "'\\''")) 3688 token_end = "\"'\""; 3689 complain_at (loc, _(msgid), token_end); 3690 } 3691 3692 3693 /*------------------------------------------------------------------------. 3694 | Report an unexpected EOF in a token or comment starting at START. | 3695 | An end of file was encountered and the expected TOKEN_END was missing. | 3696 `------------------------------------------------------------------------*/ 3697 3698 static void 3699 unexpected_eof (boundary start, char const *token_end) 3700 { 3701 unexpected_end (start, N_("missing %s at end of file"), token_end); 3702 } 3703 3704 3705 /*----------------------------------------. 3706 | Likewise, but for unexpected newlines. | 3707 `----------------------------------------*/ 3708 3709 static void 3710 unexpected_newline (boundary start, char const *token_end) 3711 { 3712 unexpected_end (start, N_("missing %s at end of line"), token_end); 3713 } 3714 3715 3716 /*-------------------------. 3717 | Initialize the scanner. | 3718 `-------------------------*/ 3719 3720 void 3721 gram_scanner_initialize (void) 3722 { 3723 obstack_init (&obstack_for_string); 3724 } 3725 3726 3727 /*-----------------------------------------------. 3728 | Free all the memory allocated to the scanner. | 3729 `-----------------------------------------------*/ 3730 3731 void 3732 gram_scanner_free (void) 3733 { 3734 obstack_free (&obstack_for_string, 0); 3735 /* Reclaim Flex's buffers. */ 3736 gram_lex_destroy (); 3737 } 3738 3739