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