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