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