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