flex.skl (34485B)
1 /* $OpenBSD: flex.skl,v 1.12 2013/11/04 17:03:32 millert Exp $ */ 2 3 /* A lexical scanner generated by flex */ 4 5 /* Scanner skeleton version: 6 * $Header: /cvs/src/usr.bin/lex/flex.skl,v 1.12 2013/11/04 17:03:32 millert Exp $ 7 */ 8 9 #define FLEX_SCANNER 10 #define YY_FLEX_MAJOR_VERSION 2 11 #define YY_FLEX_MINOR_VERSION 5 12 13 %- 14 #include <stdio.h> 15 #include <errno.h> 16 %+ 17 #include <cerrno> 18 %* 19 20 21 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ 22 #ifdef c_plusplus 23 #ifndef __cplusplus 24 #define __cplusplus 25 #endif 26 #endif 27 28 29 #ifdef __cplusplus 30 31 #include <stdlib.h> 32 %+ 33 #include <iosfwd> 34 %* 35 #include <unistd.h> 36 37 /* Use prototypes in function declarations. */ 38 #define YY_USE_PROTOS 39 40 /* The "const" storage-class-modifier is valid. */ 41 #define YY_USE_CONST 42 43 #else /* ! __cplusplus */ 44 45 #ifdef __STDC__ 46 47 #define YY_USE_PROTOS 48 #define YY_USE_CONST 49 50 #endif /* __STDC__ */ 51 #endif /* ! __cplusplus */ 52 53 #ifdef __TURBOC__ 54 #pragma warn -rch 55 #pragma warn -use 56 #include <io.h> 57 #include <stdlib.h> 58 #define YY_USE_CONST 59 #define YY_USE_PROTOS 60 #endif 61 62 #ifdef YY_USE_CONST 63 #define yyconst const 64 #else 65 #define yyconst 66 #endif 67 68 69 #ifdef YY_USE_PROTOS 70 #define YY_PROTO(proto) proto 71 #else 72 #define YY_PROTO(proto) () 73 #endif 74 75 /* Returned upon end-of-file. */ 76 #define YY_NULL 0 77 78 /* Promotes a possibly negative, possibly signed char to an unsigned 79 * integer for use as an array index. If the signed char is negative, 80 * we want to instead treat it as an 8-bit unsigned char, hence the 81 * double cast. 82 */ 83 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 84 85 /* Enter a start condition. This macro really ought to take a parameter, 86 * but we do it the disgusting crufty way forced on us by the ()-less 87 * definition of BEGIN. 88 */ 89 #define BEGIN yy_start = 1 + 2 * 90 91 /* Translate the current start state into a value that can be later handed 92 * to BEGIN to return to the state. The YYSTATE alias is for lex 93 * compatibility. 94 */ 95 #define YY_START ((yy_start - 1) / 2) 96 #define YYSTATE YY_START 97 98 /* Action number for EOF rule of a given start state. */ 99 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 100 101 /* Special action meaning "start processing a new file". */ 102 #define YY_NEW_FILE yyrestart( yyin ) 103 104 #define YY_END_OF_BUFFER_CHAR 0 105 106 /* Size of default input buffer. */ 107 #define YY_BUF_SIZE 16384 108 109 typedef struct yy_buffer_state *YY_BUFFER_STATE; 110 111 extern int yyleng; 112 %- 113 extern FILE *yyin, *yyout; 114 %* 115 116 #define EOB_ACT_CONTINUE_SCAN 0 117 #define EOB_ACT_END_OF_FILE 1 118 #define EOB_ACT_LAST_MATCH 2 119 120 /* The funky do-while in the following #define is used to turn the definition 121 * int a single C statement (which needs a semi-colon terminator). This 122 * avoids problems with code like: 123 * 124 * if ( condition_holds ) 125 * yyless( 5 ); 126 * else 127 * do_something_else(); 128 * 129 * Prior to using the do-while the compiler would get upset at the 130 * "else" because it interpreted the "if" statement as being all 131 * done when it reached the ';' after the yyless() call. 132 */ 133 134 /* Return all but the first 'n' matched characters back to the input stream. */ 135 136 #define yyless(n) \ 137 do \ 138 { \ 139 /* Undo effects of setting up yytext. */ \ 140 *yy_cp = yy_hold_char; \ 141 YY_RESTORE_YY_MORE_OFFSET \ 142 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ 143 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 144 } \ 145 while ( 0 ) 146 147 #define unput(c) yyunput( c, yytext_ptr ) 148 149 /* The following is because we cannot portably get our hands on size_t 150 * (without autoconf's help, which isn't available because we want 151 * flex-generated scanners to compile on their own). 152 */ 153 typedef unsigned int yy_size_t; 154 155 156 struct yy_buffer_state 157 { 158 %- 159 FILE *yy_input_file; 160 %+ 161 std::istream* yy_input_file; 162 %* 163 164 char *yy_ch_buf; /* input buffer */ 165 char *yy_buf_pos; /* current position in input buffer */ 166 167 /* Size of input buffer in bytes, not including room for EOB 168 * characters. 169 */ 170 yy_size_t yy_buf_size; 171 172 /* Number of characters read into yy_ch_buf, not including EOB 173 * characters. 174 */ 175 int yy_n_chars; 176 177 /* Whether we "own" the buffer - i.e., we know we created it, 178 * and can realloc() it to grow it, and should free() it to 179 * delete it. 180 */ 181 int yy_is_our_buffer; 182 183 /* Whether this is an "interactive" input source; if so, and 184 * if we're using stdio for input, then we want to use getc() 185 * instead of fread(), to make sure we stop fetching input after 186 * each newline. 187 */ 188 int yy_is_interactive; 189 190 /* Whether we're considered to be at the beginning of a line. 191 * If so, '^' rules will be active on the next match, otherwise 192 * not. 193 */ 194 int yy_at_bol; 195 196 /* Whether to try to fill the input buffer when we reach the 197 * end of it. 198 */ 199 int yy_fill_buffer; 200 201 int yy_buffer_status; 202 #define YY_BUFFER_NEW 0 203 #define YY_BUFFER_NORMAL 1 204 /* When an EOF's been seen but there's still some text to process 205 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 206 * shouldn't try reading from the input source any more. We might 207 * still have a bunch of tokens to match, though, because of 208 * possible backing-up. 209 * 210 * When we actually see the EOF, we change the status to "new" 211 * (via yyrestart()), so that the user can continue scanning by 212 * just pointing yyin at a new input file. 213 */ 214 #define YY_BUFFER_EOF_PENDING 2 215 }; 216 217 %- Standard (non-C++) definition 218 static YY_BUFFER_STATE yy_current_buffer = 0; 219 %* 220 221 /* We provide macros for accessing buffer states in case in the 222 * future we want to put the buffer states in a more general 223 * "scanner state". 224 */ 225 #define YY_CURRENT_BUFFER yy_current_buffer 226 227 228 %- Standard (non-C++) definition 229 /* yy_hold_char holds the character lost when yytext is formed. */ 230 static char yy_hold_char; 231 232 static int yy_n_chars; /* number of characters read into yy_ch_buf */ 233 234 235 int yyleng; 236 237 /* Points to current character in buffer. */ 238 static char *yy_c_buf_p = (char *) 0; 239 static int yy_init = 1; /* whether we need to initialize */ 240 static int yy_start = 0; /* start state number */ 241 242 /* Flag which is used to allow yywrap()'s to do buffer switches 243 * instead of setting up a fresh yyin. A bit of a hack ... 244 */ 245 static int yy_did_buffer_switch_on_eof; 246 247 void yyrestart YY_PROTO(( FILE *input_file )); 248 249 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); 250 void yy_load_buffer_state YY_PROTO(( void )); 251 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); 252 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); 253 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); 254 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); 255 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) 256 257 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); 258 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); 259 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); 260 %* 261 262 static void *yy_flex_alloc YY_PROTO(( yy_size_t )); 263 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); 264 static void yy_flex_free YY_PROTO(( void * )); 265 266 #define yy_new_buffer yy_create_buffer 267 268 #define yy_set_interactive(is_interactive) \ 269 { \ 270 if ( ! yy_current_buffer ) \ 271 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ 272 yy_current_buffer->yy_is_interactive = is_interactive; \ 273 } 274 275 #define yy_set_bol(at_bol) \ 276 { \ 277 if ( ! yy_current_buffer ) \ 278 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ 279 yy_current_buffer->yy_at_bol = at_bol; \ 280 } 281 282 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) 283 284 %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here 285 286 %- Standard (non-C++) definition 287 static yy_state_type yy_get_previous_state YY_PROTO(( void )); 288 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); 289 static int yy_get_next_buffer YY_PROTO(( void )); 290 static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); 291 %* 292 293 /* Done after the current pattern has been matched and before the 294 * corresponding action - sets up yytext. 295 */ 296 #define YY_DO_BEFORE_ACTION \ 297 yytext_ptr = yy_bp; \ 298 %% code to fiddle yytext and yyleng for yymore() goes here 299 yy_hold_char = *yy_cp; \ 300 *yy_cp = '\0'; \ 301 %% code to copy yytext_ptr to yytext[] goes here, if %array 302 yy_c_buf_p = yy_cp; 303 304 %% data tables for the DFA and the user's section 1 definitions go here 305 306 /* Macros after this point can all be overridden by user definitions in 307 * section 1. 308 */ 309 310 #ifndef YY_SKIP_YYWRAP 311 #ifdef __cplusplus 312 extern "C" int yywrap YY_PROTO(( void )); 313 #else 314 extern int yywrap YY_PROTO(( void )); 315 #endif 316 #endif 317 318 %- 319 #ifndef YY_NO_UNPUT 320 static void yyunput YY_PROTO(( int c, char *buf_ptr )); 321 #endif 322 %* 323 324 #ifndef yytext_ptr 325 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); 326 #endif 327 328 #ifdef YY_NEED_STRLEN 329 static int yy_flex_strlen YY_PROTO(( yyconst char * )); 330 #endif 331 332 #ifndef YY_NO_INPUT 333 %- Standard (non-C++) definition 334 #ifdef __cplusplus 335 static int yyinput YY_PROTO(( void )); 336 #else 337 static int input YY_PROTO(( void )); 338 #endif 339 %* 340 #endif 341 342 #if defined(YY_STACK_USED) && YY_STACK_USED 343 static int yy_start_stack_ptr = 0; 344 static int yy_start_stack_depth = 0; 345 static int *yy_start_stack = 0; 346 #ifndef YY_NO_PUSH_STATE 347 static void yy_push_state YY_PROTO(( int new_state )); 348 #endif 349 #ifndef YY_NO_POP_STATE 350 static void yy_pop_state YY_PROTO(( void )); 351 #endif 352 #ifndef YY_NO_TOP_STATE 353 static int yy_top_state YY_PROTO(( void )); 354 #endif 355 356 #else 357 #define YY_NO_PUSH_STATE 1 358 #define YY_NO_POP_STATE 1 359 #define YY_NO_TOP_STATE 1 360 #endif 361 362 #ifdef YY_MALLOC_DECL 363 YY_MALLOC_DECL 364 #else 365 #ifdef __STDC__ 366 #ifndef __cplusplus 367 #include <stdlib.h> 368 #endif 369 #else 370 /* Just try to get by without declaring the routines. This will fail 371 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) 372 * or sizeof(void*) != sizeof(int). 373 */ 374 #endif 375 #endif 376 377 /* Amount of stuff to slurp up with each read. */ 378 #ifndef YY_READ_BUF_SIZE 379 #define YY_READ_BUF_SIZE 8192 380 #endif 381 382 /* Copy whatever the last rule matched to the standard output. */ 383 384 #ifndef ECHO 385 %- Standard (non-C++) definition 386 /* This used to be an fputs(), but since the string might contain NUL's, 387 * we now use fwrite(). 388 */ 389 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) 390 %+ C++ definition 391 #define ECHO LexerOutput( yytext, yyleng ) 392 %* 393 #endif 394 395 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 396 * is returned in "result". 397 */ 398 #ifndef YY_INPUT 399 #define YY_INPUT(buf,result,max_size) \ 400 %% fread()/read() definition of YY_INPUT goes here unless we're doing C++ 401 %+ C++ definition 402 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ 403 YY_FATAL_ERROR( "input in flex scanner failed" ); 404 %* 405 #endif 406 407 /* No semi-colon after return; correct usage is to write "yyterminate();" - 408 * we don't want an extra ';' after the "return" because that will cause 409 * some compilers to complain about unreachable statements. 410 */ 411 #ifndef yyterminate 412 #define yyterminate() return YY_NULL 413 #endif 414 415 /* Number of entries by which start-condition stack grows. */ 416 #ifndef YY_START_STACK_INCR 417 #define YY_START_STACK_INCR 25 418 #endif 419 420 /* Report a fatal error. */ 421 #ifndef YY_FATAL_ERROR 422 %- 423 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 424 %+ 425 #define YY_FATAL_ERROR(msg) LexerError( msg ) 426 %* 427 #endif 428 429 /* Default declaration of generated scanner - a define so the user can 430 * easily add parameters. 431 */ 432 #ifndef YY_DECL 433 %- Standard (non-C++) definition 434 #define YY_DECL int yylex YY_PROTO(( void )) 435 %+ C++ definition 436 #define YY_DECL int yyFlexLexer::yylex() 437 %* 438 #endif 439 440 /* Code executed at the beginning of each rule, after yytext and yyleng 441 * have been set up. 442 */ 443 #ifndef YY_USER_ACTION 444 #define YY_USER_ACTION 445 #endif 446 447 /* Code executed at the end of each rule. */ 448 #ifndef YY_BREAK 449 #define YY_BREAK break; 450 #endif 451 452 %% YY_RULE_SETUP definition goes here 453 454 YY_DECL 455 { 456 register yy_state_type yy_current_state; 457 register char *yy_cp, *yy_bp; 458 register int yy_act; 459 460 %% user's declarations go here 461 462 if ( yy_init ) 463 { 464 yy_init = 0; 465 466 #ifdef YY_USER_INIT 467 YY_USER_INIT; 468 #endif 469 470 if ( ! yy_start ) 471 yy_start = 1; /* first start state */ 472 473 if ( ! yyin ) 474 %- 475 yyin = stdin; 476 %+ 477 yyin = &std::cin; 478 %* 479 480 if ( ! yyout ) 481 %- 482 yyout = stdout; 483 %+ 484 yyout = &std::cout; 485 %* 486 487 if ( ! yy_current_buffer ) 488 yy_current_buffer = 489 yy_create_buffer( yyin, YY_BUF_SIZE ); 490 491 yy_load_buffer_state(); 492 } 493 494 while ( 1 ) /* loops until end-of-file is reached */ 495 { 496 %% yymore()-related code goes here 497 yy_cp = yy_c_buf_p; 498 499 /* Support of yytext. */ 500 *yy_cp = yy_hold_char; 501 502 /* yy_bp points to the position in yy_ch_buf of the start of 503 * the current run. 504 */ 505 yy_bp = yy_cp; 506 507 %% code to set up and find next match goes here 508 509 yy_find_action: 510 %% code to find the action number goes here 511 512 YY_DO_BEFORE_ACTION; 513 514 %% code for yylineno update goes here 515 516 do_action: /* This label is used only to access EOF actions. */ 517 518 %% debug code goes here 519 520 switch ( yy_act ) 521 { /* beginning of action switch */ 522 %% actions go here 523 524 case YY_END_OF_BUFFER: 525 { 526 /* Amount of text matched not including the EOB char. */ 527 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; 528 529 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 530 *yy_cp = yy_hold_char; 531 YY_RESTORE_YY_MORE_OFFSET 532 533 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) 534 { 535 /* We're scanning a new file or input source. It's 536 * possible that this happened because the user 537 * just pointed yyin at a new source and called 538 * yylex(). If so, then we have to assure 539 * consistency between yy_current_buffer and our 540 * globals. Here is the right place to do so, because 541 * this is the first action (other than possibly a 542 * back-up) that will match for the new input source. 543 */ 544 yy_n_chars = yy_current_buffer->yy_n_chars; 545 yy_current_buffer->yy_input_file = yyin; 546 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; 547 } 548 549 /* Note that here we test for yy_c_buf_p "<=" to the position 550 * of the first EOB in the buffer, since yy_c_buf_p will 551 * already have been incremented past the NUL character 552 * (since all states make transitions on EOB to the 553 * end-of-buffer state). Contrast this with the test 554 * in input(). 555 */ 556 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) 557 { /* This was really a NUL. */ 558 yy_state_type yy_next_state; 559 560 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; 561 562 yy_current_state = yy_get_previous_state(); 563 564 /* Okay, we're now positioned to make the NUL 565 * transition. We couldn't have 566 * yy_get_previous_state() go ahead and do it 567 * for us because it doesn't know how to deal 568 * with the possibility of jamming (and we don't 569 * want to build jamming into it because then it 570 * will run more slowly). 571 */ 572 573 yy_next_state = yy_try_NUL_trans( yy_current_state ); 574 575 yy_bp = yytext_ptr + YY_MORE_ADJ; 576 577 if ( yy_next_state ) 578 { 579 /* Consume the NUL. */ 580 yy_cp = ++yy_c_buf_p; 581 yy_current_state = yy_next_state; 582 goto yy_match; 583 } 584 585 else 586 { 587 %% code to do back-up for compressed tables and set up yy_cp goes here 588 goto yy_find_action; 589 } 590 } 591 592 else switch ( yy_get_next_buffer() ) 593 { 594 case EOB_ACT_END_OF_FILE: 595 { 596 yy_did_buffer_switch_on_eof = 0; 597 598 if ( yywrap() ) 599 { 600 /* Note: because we've taken care in 601 * yy_get_next_buffer() to have set up 602 * yytext, we can now set up 603 * yy_c_buf_p so that if some total 604 * hoser (like flex itself) wants to 605 * call the scanner after we return the 606 * YY_NULL, it'll still work - another 607 * YY_NULL will get returned. 608 */ 609 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; 610 611 yy_act = YY_STATE_EOF(YY_START); 612 goto do_action; 613 } 614 615 else 616 { 617 if ( ! yy_did_buffer_switch_on_eof ) 618 YY_NEW_FILE; 619 } 620 break; 621 } 622 623 case EOB_ACT_CONTINUE_SCAN: 624 yy_c_buf_p = 625 yytext_ptr + yy_amount_of_matched_text; 626 627 yy_current_state = yy_get_previous_state(); 628 629 yy_cp = yy_c_buf_p; 630 yy_bp = yytext_ptr + YY_MORE_ADJ; 631 goto yy_match; 632 633 case EOB_ACT_LAST_MATCH: 634 yy_c_buf_p = 635 &yy_current_buffer->yy_ch_buf[yy_n_chars]; 636 637 yy_current_state = yy_get_previous_state(); 638 639 yy_cp = yy_c_buf_p; 640 yy_bp = yytext_ptr + YY_MORE_ADJ; 641 goto yy_find_action; 642 } 643 break; 644 } 645 646 default: 647 YY_FATAL_ERROR( 648 "fatal flex scanner internal error--no action found" ); 649 } /* end of action switch */ 650 } /* end of scanning one token */ 651 } /* end of yylex */ 652 653 %+ 654 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout ) 655 { 656 yyin = arg_yyin; 657 yyout = arg_yyout; 658 yy_c_buf_p = 0; 659 yy_init = 1; 660 yy_start = 0; 661 yy_flex_debug = 0; 662 yylineno = 1; // this will only get updated if %option yylineno 663 664 yy_did_buffer_switch_on_eof = 0; 665 666 yy_looking_for_trail_begin = 0; 667 yy_more_flag = 0; 668 yy_more_len = 0; 669 yy_more_offset = yy_prev_more_offset = 0; 670 671 yy_start_stack_ptr = yy_start_stack_depth = 0; 672 yy_start_stack = 0; 673 674 yy_current_buffer = 0; 675 676 #ifdef YY_USES_REJECT 677 yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; 678 #else 679 yy_state_buf = 0; 680 #endif 681 } 682 683 yyFlexLexer::~yyFlexLexer() 684 { 685 delete yy_state_buf; 686 yy_delete_buffer( yy_current_buffer ); 687 } 688 689 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out ) 690 { 691 if ( new_in ) 692 { 693 yy_delete_buffer( yy_current_buffer ); 694 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); 695 } 696 697 if ( new_out ) 698 yyout = new_out; 699 } 700 701 #ifdef YY_INTERACTIVE 702 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) 703 #else 704 int yyFlexLexer::LexerInput( char* buf, int max_size ) 705 #endif 706 { 707 if ( yyin->eof() || yyin->fail() ) 708 return 0; 709 710 #ifdef YY_INTERACTIVE 711 yyin->get( buf[0] ); 712 713 if ( yyin->eof() ) 714 return 0; 715 716 if ( yyin->bad() ) 717 return -1; 718 719 return 1; 720 721 #else 722 (void) yyin->read( buf, max_size ); 723 724 if ( yyin->bad() ) 725 return -1; 726 else 727 return yyin->gcount(); 728 #endif 729 } 730 731 void yyFlexLexer::LexerOutput( const char* buf, int size ) 732 { 733 (void) yyout->write( buf, size ); 734 } 735 %* 736 737 /* yy_get_next_buffer - try to read in a new buffer 738 * 739 * Returns a code representing an action: 740 * EOB_ACT_LAST_MATCH - 741 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 742 * EOB_ACT_END_OF_FILE - end of file 743 */ 744 745 %- 746 static int yy_get_next_buffer YY_PROTO(( void )) 747 %+ 748 int yyFlexLexer::yy_get_next_buffer YY_PROTO(( void )) 749 %* 750 { 751 register char *dest = yy_current_buffer->yy_ch_buf; 752 register char *source = yytext_ptr; 753 register int number_to_move, i; 754 int ret_val; 755 756 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) 757 YY_FATAL_ERROR( 758 "fatal flex scanner internal error--end of buffer missed" ); 759 760 if ( yy_current_buffer->yy_fill_buffer == 0 ) 761 { /* Don't try to fill the buffer, so this is an EOF. */ 762 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) 763 { 764 /* We matched a single character, the EOB, so 765 * treat this as a final EOF. 766 */ 767 return EOB_ACT_END_OF_FILE; 768 } 769 770 else 771 { 772 /* We matched some text prior to the EOB, first 773 * process it. 774 */ 775 return EOB_ACT_LAST_MATCH; 776 } 777 } 778 779 /* Try to read more data. */ 780 781 /* First move last chars to start of buffer. */ 782 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; 783 784 for ( i = 0; i < number_to_move; ++i ) 785 *(dest++) = *(source++); 786 787 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 788 /* don't do the read, it's not guaranteed to return an EOF, 789 * just force an EOF 790 */ 791 yy_current_buffer->yy_n_chars = yy_n_chars = 0; 792 793 else 794 { 795 int num_to_read = 796 yy_current_buffer->yy_buf_size - number_to_move - 1; 797 798 while ( num_to_read <= 0 ) 799 { /* Not enough room in the buffer - grow it. */ 800 #ifdef YY_USES_REJECT 801 YY_FATAL_ERROR( 802 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); 803 #else 804 805 /* just a shorter name for the current buffer */ 806 YY_BUFFER_STATE b = yy_current_buffer; 807 808 int yy_c_buf_p_offset = 809 (int) (yy_c_buf_p - b->yy_ch_buf); 810 811 if ( b->yy_is_our_buffer ) 812 { 813 int new_size = b->yy_buf_size * 2; 814 815 if ( new_size <= 0 ) 816 b->yy_buf_size += b->yy_buf_size / 8; 817 else 818 b->yy_buf_size *= 2; 819 820 b->yy_ch_buf = (char *) 821 /* Include room in for 2 EOB chars. */ 822 yy_flex_realloc( (void *) b->yy_ch_buf, 823 b->yy_buf_size + 2 ); 824 } 825 else 826 /* Can't grow it, we don't own it. */ 827 b->yy_ch_buf = 0; 828 829 if ( ! b->yy_ch_buf ) 830 YY_FATAL_ERROR( 831 "fatal error - scanner input buffer overflow" ); 832 833 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; 834 835 num_to_read = yy_current_buffer->yy_buf_size - 836 number_to_move - 1; 837 #endif 838 } 839 840 if ( num_to_read > YY_READ_BUF_SIZE ) 841 num_to_read = YY_READ_BUF_SIZE; 842 843 /* Read in more data. */ 844 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), 845 yy_n_chars, num_to_read ); 846 847 yy_current_buffer->yy_n_chars = yy_n_chars; 848 } 849 850 if ( yy_n_chars == 0 ) 851 { 852 if ( number_to_move == YY_MORE_ADJ ) 853 { 854 ret_val = EOB_ACT_END_OF_FILE; 855 yyrestart( yyin ); 856 } 857 858 else 859 { 860 ret_val = EOB_ACT_LAST_MATCH; 861 yy_current_buffer->yy_buffer_status = 862 YY_BUFFER_EOF_PENDING; 863 } 864 } 865 866 else 867 ret_val = EOB_ACT_CONTINUE_SCAN; 868 869 yy_n_chars += number_to_move; 870 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; 871 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; 872 873 yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; 874 875 return ret_val; 876 } 877 878 879 /* yy_get_previous_state - get the state just before the EOB char was reached */ 880 881 %- 882 static yy_state_type yy_get_previous_state YY_PROTO(( void )) 883 %+ 884 yy_state_type yyFlexLexer::yy_get_previous_state YY_PROTO(( void )) 885 %* 886 { 887 register yy_state_type yy_current_state; 888 register char *yy_cp; 889 890 %% code to get the start state into yy_current_state goes here 891 892 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) 893 { 894 %% code to find the next state goes here 895 } 896 897 return yy_current_state; 898 } 899 900 901 /* yy_try_NUL_trans - try to make a transition on the NUL character 902 * 903 * synopsis 904 * next_state = yy_try_NUL_trans( current_state ); 905 */ 906 907 %- 908 #ifdef YY_USE_PROTOS 909 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) 910 #else 911 static yy_state_type yy_try_NUL_trans( yy_current_state ) 912 yy_state_type yy_current_state; 913 #endif 914 %+ 915 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) 916 %* 917 { 918 register int yy_is_jam; 919 %% code to find the next state, and perhaps do backing up, goes here 920 921 return yy_is_jam ? 0 : yy_current_state; 922 } 923 924 925 %- 926 #ifndef YY_NO_UNPUT 927 #ifdef YY_USE_PROTOS 928 static void yyunput( int c, register char *yy_bp ) 929 #else 930 static void yyunput( c, yy_bp ) 931 int c; 932 register char *yy_bp; 933 #endif 934 %+ 935 void yyFlexLexer::yyunput( int c, register char* yy_bp ) 936 %* 937 { 938 register char *yy_cp = yy_c_buf_p; 939 940 /* undo effects of setting up yytext */ 941 *yy_cp = yy_hold_char; 942 943 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) 944 { /* need to shift things up to make room */ 945 /* +2 for EOB chars. */ 946 register int number_to_move = yy_n_chars + 2; 947 register char *dest = &yy_current_buffer->yy_ch_buf[ 948 yy_current_buffer->yy_buf_size + 2]; 949 register char *source = 950 &yy_current_buffer->yy_ch_buf[number_to_move]; 951 952 while ( source > yy_current_buffer->yy_ch_buf ) 953 *--dest = *--source; 954 955 yy_cp += (int) (dest - source); 956 yy_bp += (int) (dest - source); 957 yy_current_buffer->yy_n_chars = 958 yy_n_chars = yy_current_buffer->yy_buf_size; 959 960 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) 961 YY_FATAL_ERROR( "flex scanner push-back overflow" ); 962 } 963 964 *--yy_cp = (char) c; 965 966 %% update yylineno here 967 968 yytext_ptr = yy_bp; 969 yy_hold_char = *yy_cp; 970 yy_c_buf_p = yy_cp; 971 } 972 %- 973 #endif /* ifndef YY_NO_UNPUT */ 974 %* 975 976 977 %- 978 #ifndef YY_NO_INPUT 979 #ifdef __cplusplus 980 static int yyinput YY_PROTO(( void )) 981 #else 982 static int input YY_PROTO(( void )) 983 #endif 984 %+ 985 int yyFlexLexer::yyinput() 986 %* 987 { 988 int c; 989 990 *yy_c_buf_p = yy_hold_char; 991 992 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) 993 { 994 /* yy_c_buf_p now points to the character we want to return. 995 * If this occurs *before* the EOB characters, then it's a 996 * valid NUL; if not, then we've hit the end of the buffer. 997 */ 998 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) 999 /* This was really a NUL. */ 1000 *yy_c_buf_p = '\0'; 1001 1002 else 1003 { /* need more input */ 1004 int offset = yy_c_buf_p - yytext_ptr; 1005 ++yy_c_buf_p; 1006 1007 switch ( yy_get_next_buffer() ) 1008 { 1009 case EOB_ACT_LAST_MATCH: 1010 /* This happens because yy_g_n_b() 1011 * sees that we've accumulated a 1012 * token and flags that we need to 1013 * try matching the token before 1014 * proceeding. But for input(), 1015 * there's no matching to consider. 1016 * So convert the EOB_ACT_LAST_MATCH 1017 * to EOB_ACT_END_OF_FILE. 1018 */ 1019 1020 /* Reset buffer status. */ 1021 yyrestart( yyin ); 1022 1023 /* fall through */ 1024 1025 case EOB_ACT_END_OF_FILE: 1026 { 1027 if ( yywrap() ) 1028 return EOF; 1029 1030 if ( ! yy_did_buffer_switch_on_eof ) 1031 YY_NEW_FILE; 1032 #ifdef __cplusplus 1033 return yyinput(); 1034 #else 1035 return input(); 1036 #endif 1037 } 1038 1039 case EOB_ACT_CONTINUE_SCAN: 1040 yy_c_buf_p = yytext_ptr + offset; 1041 break; 1042 } 1043 } 1044 } 1045 1046 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ 1047 *yy_c_buf_p = '\0'; /* preserve yytext */ 1048 yy_hold_char = *++yy_c_buf_p; 1049 1050 %% update BOL and yylineno 1051 1052 return c; 1053 } 1054 %- 1055 #endif /* ifndef YY_NO_INPUT */ 1056 %* 1057 1058 1059 %- 1060 #ifdef YY_USE_PROTOS 1061 void yyrestart( FILE *input_file ) 1062 #else 1063 void yyrestart( input_file ) 1064 FILE *input_file; 1065 #endif 1066 %+ 1067 void yyFlexLexer::yyrestart( std::istream* input_file ) 1068 %* 1069 { 1070 if ( ! yy_current_buffer ) 1071 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); 1072 1073 yy_init_buffer( yy_current_buffer, input_file ); 1074 yy_load_buffer_state(); 1075 } 1076 1077 1078 %- 1079 #ifdef YY_USE_PROTOS 1080 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) 1081 #else 1082 void yy_switch_to_buffer( new_buffer ) 1083 YY_BUFFER_STATE new_buffer; 1084 #endif 1085 %+ 1086 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) 1087 %* 1088 { 1089 if ( yy_current_buffer == new_buffer ) 1090 return; 1091 1092 if ( yy_current_buffer ) 1093 { 1094 /* Flush out information for old buffer. */ 1095 *yy_c_buf_p = yy_hold_char; 1096 yy_current_buffer->yy_buf_pos = yy_c_buf_p; 1097 yy_current_buffer->yy_n_chars = yy_n_chars; 1098 } 1099 1100 yy_current_buffer = new_buffer; 1101 yy_load_buffer_state(); 1102 1103 /* We don't actually know whether we did this switch during 1104 * EOF (yywrap()) processing, but the only time this flag 1105 * is looked at is after yywrap() is called, so it's safe 1106 * to go ahead and always set it. 1107 */ 1108 yy_did_buffer_switch_on_eof = 1; 1109 } 1110 1111 1112 %- 1113 #ifdef YY_USE_PROTOS 1114 void yy_load_buffer_state( void ) 1115 #else 1116 void yy_load_buffer_state() 1117 #endif 1118 %+ 1119 void yyFlexLexer::yy_load_buffer_state() 1120 %* 1121 { 1122 yy_n_chars = yy_current_buffer->yy_n_chars; 1123 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; 1124 yyin = yy_current_buffer->yy_input_file; 1125 yy_hold_char = *yy_c_buf_p; 1126 } 1127 1128 1129 %- 1130 #ifdef YY_USE_PROTOS 1131 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) 1132 #else 1133 YY_BUFFER_STATE yy_create_buffer( file, size ) 1134 FILE *file; 1135 int size; 1136 #endif 1137 %+ 1138 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) 1139 %* 1140 { 1141 YY_BUFFER_STATE b; 1142 1143 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); 1144 if ( ! b ) 1145 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1146 1147 b->yy_buf_size = size; 1148 1149 /* yy_ch_buf has to be 2 characters longer than the size given because 1150 * we need to put in 2 end-of-buffer characters. 1151 */ 1152 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); 1153 if ( ! b->yy_ch_buf ) 1154 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1155 1156 b->yy_is_our_buffer = 1; 1157 1158 yy_init_buffer( b, file ); 1159 1160 return b; 1161 } 1162 1163 1164 %- 1165 #ifdef YY_USE_PROTOS 1166 void yy_delete_buffer( YY_BUFFER_STATE b ) 1167 #else 1168 void yy_delete_buffer( b ) 1169 YY_BUFFER_STATE b; 1170 #endif 1171 %+ 1172 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) 1173 %* 1174 { 1175 if ( ! b ) 1176 return; 1177 1178 if ( b == yy_current_buffer ) 1179 yy_current_buffer = (YY_BUFFER_STATE) 0; 1180 1181 if ( b->yy_is_our_buffer ) 1182 yy_flex_free( (void *) b->yy_ch_buf ); 1183 1184 yy_flex_free( (void *) b ); 1185 } 1186 1187 1188 %- 1189 #ifndef YY_ALWAYS_INTERACTIVE 1190 #ifndef YY_NEVER_INTERACTIVE 1191 #include <unistd.h> 1192 #endif 1193 #endif 1194 1195 #ifdef YY_USE_PROTOS 1196 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) 1197 #else 1198 void yy_init_buffer( b, file ) 1199 YY_BUFFER_STATE b; 1200 FILE *file; 1201 #endif 1202 1203 %+ 1204 extern "C" int isatty YY_PROTO(( int )); 1205 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file ) 1206 %* 1207 1208 { 1209 int oerrno = errno; 1210 1211 yy_flush_buffer( b ); 1212 1213 b->yy_input_file = file; 1214 b->yy_fill_buffer = 1; 1215 1216 %- 1217 #if defined(YY_ALWAYS_INTERACTIVE) && YY_ALWAYS_INTERACTIVE 1218 b->yy_is_interactive = 1; 1219 #else 1220 #if defined(YY_NEVER_INTERACTIVE) && YY_NEVER_INTERACTIVE 1221 b->yy_is_interactive = 0; 1222 #else 1223 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 1224 #endif 1225 #endif 1226 %+ 1227 b->yy_is_interactive = 0; 1228 %* 1229 errno = oerrno; 1230 } 1231 1232 1233 %- 1234 #ifdef YY_USE_PROTOS 1235 void yy_flush_buffer( YY_BUFFER_STATE b ) 1236 #else 1237 void yy_flush_buffer( b ) 1238 YY_BUFFER_STATE b; 1239 #endif 1240 1241 %+ 1242 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) 1243 %* 1244 { 1245 if ( ! b ) 1246 return; 1247 1248 b->yy_n_chars = 0; 1249 1250 /* We always need two end-of-buffer characters. The first causes 1251 * a transition to the end-of-buffer state. The second causes 1252 * a jam in that state. 1253 */ 1254 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1255 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1256 1257 b->yy_buf_pos = &b->yy_ch_buf[0]; 1258 1259 b->yy_at_bol = 1; 1260 b->yy_buffer_status = YY_BUFFER_NEW; 1261 1262 if ( b == yy_current_buffer ) 1263 yy_load_buffer_state(); 1264 } 1265 %* 1266 1267 1268 #ifndef YY_NO_SCAN_BUFFER 1269 %- 1270 #ifdef YY_USE_PROTOS 1271 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) 1272 #else 1273 YY_BUFFER_STATE yy_scan_buffer( base, size ) 1274 char *base; 1275 yy_size_t size; 1276 #endif 1277 { 1278 YY_BUFFER_STATE b; 1279 1280 if ( size < 2 || 1281 base[size-2] != YY_END_OF_BUFFER_CHAR || 1282 base[size-1] != YY_END_OF_BUFFER_CHAR ) 1283 /* They forgot to leave room for the EOB's. */ 1284 return 0; 1285 1286 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); 1287 if ( ! b ) 1288 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 1289 1290 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 1291 b->yy_buf_pos = b->yy_ch_buf = base; 1292 b->yy_is_our_buffer = 0; 1293 b->yy_input_file = 0; 1294 b->yy_n_chars = b->yy_buf_size; 1295 b->yy_is_interactive = 0; 1296 b->yy_at_bol = 1; 1297 b->yy_fill_buffer = 0; 1298 b->yy_buffer_status = YY_BUFFER_NEW; 1299 1300 yy_switch_to_buffer( b ); 1301 1302 return b; 1303 } 1304 %* 1305 #endif 1306 1307 1308 #ifndef YY_NO_SCAN_STRING 1309 %- 1310 #ifdef YY_USE_PROTOS 1311 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) 1312 #else 1313 YY_BUFFER_STATE yy_scan_string( yy_str ) 1314 yyconst char *yy_str; 1315 #endif 1316 { 1317 int len; 1318 for ( len = 0; yy_str[len]; ++len ) 1319 ; 1320 1321 return yy_scan_bytes( yy_str, len ); 1322 } 1323 %* 1324 #endif 1325 1326 1327 #ifndef YY_NO_SCAN_BYTES 1328 %- 1329 #ifdef YY_USE_PROTOS 1330 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) 1331 #else 1332 YY_BUFFER_STATE yy_scan_bytes( bytes, len ) 1333 yyconst char *bytes; 1334 int len; 1335 #endif 1336 { 1337 YY_BUFFER_STATE b; 1338 char *buf; 1339 yy_size_t n; 1340 int i; 1341 1342 /* Get memory for full buffer, including space for trailing EOB's. */ 1343 n = len + 2; 1344 buf = (char *) yy_flex_alloc( n ); 1345 if ( ! buf ) 1346 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 1347 1348 for ( i = 0; i < len; ++i ) 1349 buf[i] = bytes[i]; 1350 1351 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; 1352 1353 b = yy_scan_buffer( buf, n ); 1354 if ( ! b ) 1355 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 1356 1357 /* It's okay to grow etc. this buffer, and we should throw it 1358 * away when we're done. 1359 */ 1360 b->yy_is_our_buffer = 1; 1361 1362 return b; 1363 } 1364 %* 1365 #endif 1366 1367 1368 #ifndef YY_NO_PUSH_STATE 1369 %- 1370 #ifdef YY_USE_PROTOS 1371 static void yy_push_state( int new_state ) 1372 #else 1373 static void yy_push_state( new_state ) 1374 int new_state; 1375 #endif 1376 %+ 1377 void yyFlexLexer::yy_push_state( int new_state ) 1378 %* 1379 { 1380 if ( yy_start_stack_ptr >= yy_start_stack_depth ) 1381 { 1382 yy_size_t new_size; 1383 1384 yy_start_stack_depth += YY_START_STACK_INCR; 1385 new_size = yy_start_stack_depth * sizeof( int ); 1386 1387 if ( ! yy_start_stack ) 1388 yy_start_stack = (int *) yy_flex_alloc( new_size ); 1389 1390 else 1391 yy_start_stack = (int *) yy_flex_realloc( 1392 (void *) yy_start_stack, new_size ); 1393 1394 if ( ! yy_start_stack ) 1395 YY_FATAL_ERROR( 1396 "out of memory expanding start-condition stack" ); 1397 } 1398 1399 yy_start_stack[yy_start_stack_ptr++] = YY_START; 1400 1401 BEGIN(new_state); 1402 } 1403 #endif 1404 1405 1406 #ifndef YY_NO_POP_STATE 1407 %- 1408 static void yy_pop_state YY_PROTO(( void )) 1409 %+ 1410 void yyFlexLexer::yy_pop_state YY_PROTO(( void )) 1411 %* 1412 { 1413 if ( --yy_start_stack_ptr < 0 ) 1414 YY_FATAL_ERROR( "start-condition stack underflow" ); 1415 1416 BEGIN(yy_start_stack[yy_start_stack_ptr]); 1417 } 1418 #endif 1419 1420 1421 #ifndef YY_NO_TOP_STATE 1422 %- 1423 static int yy_top_state YY_PROTO(( void )) 1424 %+ 1425 int yyFlexLexer::yy_top_state YY_PROTO(( void )) 1426 %* 1427 { 1428 return yy_start_stack[yy_start_stack_ptr - 1]; 1429 } 1430 #endif 1431 1432 #ifndef YY_EXIT_FAILURE 1433 #define YY_EXIT_FAILURE 2 1434 #endif 1435 1436 %- 1437 #ifdef YY_USE_PROTOS 1438 static void yy_fatal_error( yyconst char msg[] ) 1439 #else 1440 static void yy_fatal_error( msg ) 1441 char msg[]; 1442 #endif 1443 { 1444 (void) fprintf( stderr, "%s\n", msg ); 1445 exit( YY_EXIT_FAILURE ); 1446 } 1447 1448 %+ 1449 1450 void yyFlexLexer::LexerError( yyconst char msg[] ) 1451 { 1452 std::cerr << msg << '\n'; 1453 exit( YY_EXIT_FAILURE ); 1454 } 1455 %* 1456 1457 1458 /* Redefine yyless() so it works in section 3 code. */ 1459 1460 #undef yyless 1461 #define yyless(n) \ 1462 do \ 1463 { \ 1464 /* Undo effects of setting up yytext. */ \ 1465 yytext[yyleng] = yy_hold_char; \ 1466 yy_c_buf_p = yytext + n; \ 1467 yy_hold_char = *yy_c_buf_p; \ 1468 *yy_c_buf_p = '\0'; \ 1469 yyleng = n; \ 1470 } \ 1471 while ( 0 ) 1472 1473 1474 /* Internal utility routines. */ 1475 1476 #ifndef yytext_ptr 1477 #ifdef YY_USE_PROTOS 1478 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) 1479 #else 1480 static void yy_flex_strncpy( s1, s2, n ) 1481 char *s1; 1482 yyconst char *s2; 1483 int n; 1484 #endif 1485 { 1486 register int i; 1487 for ( i = 0; i < n; ++i ) 1488 s1[i] = s2[i]; 1489 } 1490 #endif 1491 1492 #ifdef YY_NEED_STRLEN 1493 #ifdef YY_USE_PROTOS 1494 static int yy_flex_strlen( yyconst char *s ) 1495 #else 1496 static int yy_flex_strlen( s ) 1497 yyconst char *s; 1498 #endif 1499 { 1500 register int n; 1501 for ( n = 0; s[n]; ++n ) 1502 ; 1503 1504 return n; 1505 } 1506 #endif 1507 1508 1509 #ifdef YY_USE_PROTOS 1510 static void *yy_flex_alloc( yy_size_t size ) 1511 #else 1512 static void *yy_flex_alloc( size ) 1513 yy_size_t size; 1514 #endif 1515 { 1516 return (void *) malloc( size ); 1517 } 1518 1519 #ifdef YY_USE_PROTOS 1520 static void *yy_flex_realloc( void *ptr, yy_size_t size ) 1521 #else 1522 static void *yy_flex_realloc( ptr, size ) 1523 void *ptr; 1524 yy_size_t size; 1525 #endif 1526 { 1527 /* The cast to (char *) in the following accommodates both 1528 * implementations that use char* generic pointers, and those 1529 * that use void* generic pointers. It works with the latter 1530 * because both ANSI C and C++ allow castless assignment from 1531 * any pointer type to void*, and deal with argument conversions 1532 * as though doing an assignment. 1533 */ 1534 return (void *) realloc( (char *) ptr, size ); 1535 } 1536 1537 #ifdef YY_USE_PROTOS 1538 static void yy_flex_free( void *ptr ) 1539 #else 1540 static void yy_flex_free( ptr ) 1541 void *ptr; 1542 #endif 1543 { 1544 free( ptr ); 1545 } 1546 1547 #if defined(YY_MAIN) && YY_MAIN 1548 int main() 1549 { 1550 yylex(); 1551 return 0; 1552 } 1553 #endif