1 #line 2 "pbc/lex.yy.c" 2 3 #line 4 "pbc/lex.yy.c" 4 5 #define YY_INT_ALIGNED short int 6 7 /* A lexical scanner generated by flex */ 8 9 #define FLEX_SCANNER 10 #define YY_FLEX_MAJOR_VERSION 2 11 #define YY_FLEX_MINOR_VERSION 5 12 #define YY_FLEX_SUBMINOR_VERSION 35 13 #if YY_FLEX_SUBMINOR_VERSION > 0 14 #define FLEX_BETA 15 #endif 16 17 /* First, we deal with platform-specific or compiler-specific issues. */ 18 19 /* begin standard C headers. */ 20 #include <stdio.h> 21 #include <string.h> 22 #include <errno.h> 23 #include <stdlib.h> 24 25 /* end standard C headers. */ 26 27 /* flex integer type definitions */ 28 29 #ifndef FLEXINT_H 30 #define FLEXINT_H 31 32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 33 34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 35 36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 37 * if you want the limit (max/min) macros for int types. 38 */ 39 #ifndef __STDC_LIMIT_MACROS 40 #define __STDC_LIMIT_MACROS 1 41 #endif 42 43 #include <inttypes.h> 44 typedef int8_t flex_int8_t; 45 typedef uint8_t flex_uint8_t; 46 typedef int16_t flex_int16_t; 47 typedef uint16_t flex_uint16_t; 48 typedef int32_t flex_int32_t; 49 typedef uint32_t flex_uint32_t; 50 #else 51 typedef signed char flex_int8_t; 52 typedef short int flex_int16_t; 53 typedef int flex_int32_t; 54 typedef unsigned char flex_uint8_t; 55 typedef unsigned short int flex_uint16_t; 56 typedef unsigned int flex_uint32_t; 57 58 /* Limits of integral types. */ 59 #ifndef INT8_MIN 60 #define INT8_MIN (-128) 61 #endif 62 #ifndef INT16_MIN 63 #define INT16_MIN (-32767-1) 64 #endif 65 #ifndef INT32_MIN 66 #define INT32_MIN (-2147483647-1) 67 #endif 68 #ifndef INT8_MAX 69 #define INT8_MAX (127) 70 #endif 71 #ifndef INT16_MAX 72 #define INT16_MAX (32767) 73 #endif 74 #ifndef INT32_MAX 75 #define INT32_MAX (2147483647) 76 #endif 77 #ifndef UINT8_MAX 78 #define UINT8_MAX (255U) 79 #endif 80 #ifndef UINT16_MAX 81 #define UINT16_MAX (65535U) 82 #endif 83 #ifndef UINT32_MAX 84 #define UINT32_MAX (4294967295U) 85 #endif 86 87 #endif /* ! C99 */ 88 89 #endif /* ! FLEXINT_H */ 90 91 #ifdef __cplusplus 92 93 /* The "const" storage-class-modifier is valid. */ 94 #define YY_USE_CONST 95 96 #else /* ! __cplusplus */ 97 98 /* C99 requires __STDC__ to be defined as 1. */ 99 #if defined (__STDC__) 100 101 #define YY_USE_CONST 102 103 #endif /* defined (__STDC__) */ 104 #endif /* ! __cplusplus */ 105 106 #ifdef YY_USE_CONST 107 #define yyconst const 108 #else 109 #define yyconst 110 #endif 111 112 /* Returned upon end-of-file. */ 113 #define YY_NULL 0 114 115 /* Promotes a possibly negative, possibly signed char to an unsigned 116 * integer for use as an array index. If the signed char is negative, 117 * we want to instead treat it as an 8-bit unsigned char, hence the 118 * double cast. 119 */ 120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 121 122 /* Enter a start condition. This macro really ought to take a parameter, 123 * but we do it the disgusting crufty way forced on us by the ()-less 124 * definition of BEGIN. 125 */ 126 #define BEGIN (yy_start) = 1 + 2 * 127 128 /* Translate the current start state into a value that can be later handed 129 * to BEGIN to return to the state. The YYSTATE alias is for lex 130 * compatibility. 131 */ 132 #define YY_START (((yy_start) - 1) / 2) 133 #define YYSTATE YY_START 134 135 /* Action number for EOF rule of a given start state. */ 136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 137 138 /* Special action meaning "start processing a new file". */ 139 #define YY_NEW_FILE yyrestart(yyin ) 140 141 #define YY_END_OF_BUFFER_CHAR 0 142 143 /* Size of default input buffer. */ 144 #ifndef YY_BUF_SIZE 145 #ifdef __ia64__ 146 /* On IA-64, the buffer size is 16k, not 8k. 147 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 148 * Ditto for the __ia64__ case accordingly. 149 */ 150 #define YY_BUF_SIZE 32768 151 #else 152 #define YY_BUF_SIZE 16384 153 #endif /* __ia64__ */ 154 #endif 155 156 /* The state buf must be large enough to hold one state per character in the main buffer. 157 */ 158 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 159 160 #ifndef YY_TYPEDEF_YY_BUFFER_STATE 161 #define YY_TYPEDEF_YY_BUFFER_STATE 162 typedef struct yy_buffer_state *YY_BUFFER_STATE; 163 #endif 164 165 extern int yyleng; 166 167 extern FILE *yyin, *yyout; 168 169 #define EOB_ACT_CONTINUE_SCAN 0 170 #define EOB_ACT_END_OF_FILE 1 171 #define EOB_ACT_LAST_MATCH 2 172 173 #define YY_LESS_LINENO(n) 174 175 /* Return all but the first "n" matched characters back to the input stream. */ 176 #define yyless(n) \ 177 do \ 178 { \ 179 /* Undo effects of setting up yytext. */ \ 180 int yyless_macro_arg = (n); \ 181 YY_LESS_LINENO(yyless_macro_arg);\ 182 *yy_cp = (yy_hold_char); \ 183 YY_RESTORE_YY_MORE_OFFSET \ 184 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 185 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 186 } \ 187 while ( 0 ) 188 189 #define unput(c) yyunput( c, (yytext_ptr) ) 190 191 #ifndef YY_TYPEDEF_YY_SIZE_T 192 #define YY_TYPEDEF_YY_SIZE_T 193 typedef size_t yy_size_t; 194 #endif 195 196 #ifndef YY_STRUCT_YY_BUFFER_STATE 197 #define YY_STRUCT_YY_BUFFER_STATE 198 struct yy_buffer_state 199 { 200 FILE *yy_input_file; 201 202 char *yy_ch_buf; /* input buffer */ 203 char *yy_buf_pos; /* current position in input buffer */ 204 205 /* Size of input buffer in bytes, not including room for EOB 206 * characters. 207 */ 208 yy_size_t yy_buf_size; 209 210 /* Number of characters read into yy_ch_buf, not including EOB 211 * characters. 212 */ 213 int yy_n_chars; 214 215 /* Whether we "own" the buffer - i.e., we know we created it, 216 * and can realloc() it to grow it, and should free() it to 217 * delete it. 218 */ 219 int yy_is_our_buffer; 220 221 /* Whether this is an "interactive" input source; if so, and 222 * if we're using stdio for input, then we want to use getc() 223 * instead of fread(), to make sure we stop fetching input after 224 * each newline. 225 */ 226 int yy_is_interactive; 227 228 /* Whether we're considered to be at the beginning of a line. 229 * If so, '^' rules will be active on the next match, otherwise 230 * not. 231 */ 232 int yy_at_bol; 233 234 int yy_bs_lineno; /**< The line count. */ 235 int yy_bs_column; /**< The column count. */ 236 237 /* Whether to try to fill the input buffer when we reach the 238 * end of it. 239 */ 240 int yy_fill_buffer; 241 242 int yy_buffer_status; 243 244 #define YY_BUFFER_NEW 0 245 #define YY_BUFFER_NORMAL 1 246 /* When an EOF's been seen but there's still some text to process 247 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 248 * shouldn't try reading from the input source any more. We might 249 * still have a bunch of tokens to match, though, because of 250 * possible backing-up. 251 * 252 * When we actually see the EOF, we change the status to "new" 253 * (via yyrestart()), so that the user can continue scanning by 254 * just pointing yyin at a new input file. 255 */ 256 #define YY_BUFFER_EOF_PENDING 2 257 258 }; 259 #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 260 261 /* Stack of input buffers. */ 262 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ 263 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 264 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ 265 266 /* We provide macros for accessing buffer states in case in the 267 * future we want to put the buffer states in a more general 268 * "scanner state". 269 * 270 * Returns the top of the stack, or NULL. 271 */ 272 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 273 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 274 : NULL) 275 276 /* Same as previous macro, but useful when we know that the buffer stack is not 277 * NULL or when we need an lvalue. For internal use only. 278 */ 279 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 280 281 /* yy_hold_char holds the character lost when yytext is formed. */ 282 static char yy_hold_char; 283 static int yy_n_chars; /* number of characters read into yy_ch_buf */ 284 int yyleng; 285 286 /* Points to current character in buffer. */ 287 static char *yy_c_buf_p = (char *) 0; 288 static int yy_init = 0; /* whether we need to initialize */ 289 static int yy_start = 0; /* start state number */ 290 291 /* Flag which is used to allow yywrap()'s to do buffer switches 292 * instead of setting up a fresh yyin. A bit of a hack ... 293 */ 294 static int yy_did_buffer_switch_on_eof; 295 296 void yyrestart (FILE *input_file ); 297 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); 298 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); 299 void yy_delete_buffer (YY_BUFFER_STATE b ); 300 void yy_flush_buffer (YY_BUFFER_STATE b ); 301 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); 302 void yypop_buffer_state (void ); 303 304 static void yyensure_buffer_stack (void ); 305 static void yy_load_buffer_state (void ); 306 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); 307 308 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) 309 310 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); 311 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); 312 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); 313 314 void *yyalloc (yy_size_t ); 315 void *yyrealloc (void *,yy_size_t ); 316 void yyfree (void * ); 317 318 #define yy_new_buffer yy_create_buffer 319 320 #define yy_set_interactive(is_interactive) \ 321 { \ 322 if ( ! YY_CURRENT_BUFFER ){ \ 323 yyensure_buffer_stack (); \ 324 YY_CURRENT_BUFFER_LVALUE = \ 325 yy_create_buffer(yyin,YY_BUF_SIZE ); \ 326 } \ 327 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 328 } 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 340 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 341 342 /* Begin user sect3 */ 343 344 typedef unsigned char YY_CHAR; 345 346 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; 347 348 typedef int yy_state_type; 349 350 extern int yylineno; 351 352 int yylineno = 1; 353 354 extern char *yytext; 355 #define yytext_ptr yytext 356 357 static yy_state_type yy_get_previous_state (void ); 358 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); 359 static int yy_get_next_buffer (void ); 360 static void yy_fatal_error (yyconst char msg[] ); 361 362 /* Done after the current pattern has been matched and before the 363 * corresponding action - sets up yytext. 364 */ 365 #define YY_DO_BEFORE_ACTION \ 366 (yytext_ptr) = yy_bp; \ 367 yyleng = (size_t) (yy_cp - yy_bp); \ 368 (yy_hold_char) = *yy_cp; \ 369 *yy_cp = '\0'; \ 370 (yy_c_buf_p) = yy_cp; 371 372 #define YY_NUM_RULES 35 373 #define YY_END_OF_BUFFER 36 374 /* This struct is not used in this scanner, 375 but its presence is necessary. */ 376 struct yy_trans_info 377 { 378 flex_int32_t yy_verify; 379 flex_int32_t yy_nxt; 380 }; 381 static yyconst flex_int16_t yy_accept[53] = 382 { 0, 383 6, 6, 0, 0, 36, 34, 6, 32, 34, 34, 384 26, 27, 20, 17, 23, 18, 19, 8, 25, 22, 385 13, 33, 14, 24, 9, 28, 29, 21, 9, 30, 386 31, 3, 4, 3, 6, 12, 0, 5, 1, 8, 387 10, 15, 11, 16, 9, 9, 2, 9, 9, 9, 388 7, 0 389 } ; 390 391 static yyconst flex_int32_t yy_ec[256] = 392 { 0, 393 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 394 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 395 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 396 1, 2, 4, 1, 5, 1, 1, 1, 1, 6, 397 7, 8, 9, 10, 11, 1, 12, 13, 13, 13, 398 13, 13, 13, 13, 13, 13, 13, 14, 15, 16, 399 17, 18, 19, 1, 20, 20, 20, 20, 20, 20, 400 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 401 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 402 21, 1, 22, 23, 20, 1, 20, 20, 20, 24, 403 404 25, 26, 20, 20, 27, 20, 20, 20, 20, 28, 405 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 406 20, 20, 29, 1, 30, 1, 1, 1, 1, 1, 407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 413 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 414 415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 418 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 419 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 420 1, 1, 1, 1, 1 421 } ; 422 423 static yyconst flex_int32_t yy_meta[31] = 424 { 0, 425 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 426 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 427 1, 1, 1, 2, 2, 2, 2, 2, 1, 1 428 } ; 429 430 static yyconst flex_int16_t yy_base[56] = 431 { 0, 432 0, 0, 28, 29, 58, 59, 55, 59, 39, 52, 433 59, 59, 59, 59, 59, 59, 46, 40, 35, 59, 434 34, 33, 32, 59, 0, 59, 59, 59, 23, 59, 435 59, 59, 59, 35, 44, 59, 42, 59, 59, 31, 436 59, 59, 59, 59, 0, 17, 59, 15, 7, 9, 437 0, 59, 37, 39, 31 438 } ; 439 440 static yyconst flex_int16_t yy_def[56] = 441 { 0, 442 52, 1, 53, 53, 52, 52, 52, 52, 52, 54, 443 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 444 52, 52, 52, 52, 55, 52, 52, 52, 55, 52, 445 52, 52, 52, 52, 52, 52, 54, 52, 52, 52, 446 52, 52, 52, 52, 55, 55, 52, 55, 55, 55, 447 55, 0, 52, 52, 52 448 } ; 449 450 static yyconst flex_int16_t yy_nxt[90] = 451 { 0, 452 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 453 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 454 26, 27, 28, 29, 25, 25, 25, 25, 30, 31, 455 33, 33, 45, 51, 50, 34, 34, 32, 32, 37, 456 37, 49, 48, 40, 38, 35, 47, 46, 44, 43, 457 42, 41, 40, 39, 38, 36, 35, 52, 5, 52, 458 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 459 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 460 52, 52, 52, 52, 52, 52, 52, 52, 52 461 } ; 462 463 static yyconst flex_int16_t yy_chk[90] = 464 { 0, 465 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 466 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 467 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 468 3, 4, 55, 50, 49, 3, 4, 53, 53, 54, 469 54, 48, 46, 40, 37, 35, 34, 29, 23, 22, 470 21, 19, 18, 17, 10, 9, 7, 5, 52, 52, 471 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 472 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 473 52, 52, 52, 52, 52, 52, 52, 52, 52 474 } ; 475 476 static yy_state_type yy_last_accepting_state; 477 static char *yy_last_accepting_cpos; 478 479 extern int yy_flex_debug; 480 int yy_flex_debug = 0; 481 482 /* The intent behind this definition is that it'll catch 483 * any uses of REJECT which flex missed. 484 */ 485 #define REJECT reject_used_but_not_detected 486 #define yymore() yymore_used_but_not_detected 487 #define YY_MORE_ADJ 0 488 #define YY_RESTORE_YY_MORE_OFFSET 489 char *yytext; 490 #line 1 "pbc/parser.lex" 491 #line 2 "pbc/parser.lex" 492 #include <stdarg.h> 493 #include <stdio.h> 494 #include <stdint.h> // for intptr_t 495 #include <gmp.h> 496 #include "pbc_utils.h" 497 #include "pbc_field.h" 498 499 #include "pbc_tree.h" 500 #define YYSTYPE tree_ptr 501 #include "parser.tab.h" 502 503 extern int option_easy; 504 505 #define YY_NO_INPUT 1 506 507 #line 508 "pbc/lex.yy.c" 508 509 #define INITIAL 0 510 #define COMMENT 1 511 512 #ifndef YY_NO_UNISTD_H 513 /* Special case for "unistd.h", since it is non-ANSI. We include it way 514 * down here because we want the user's section 1 to have been scanned first. 515 * The user has a chance to override it with an option. 516 */ 517 #include <unistd.h> 518 #endif 519 520 #ifndef YY_EXTRA_TYPE 521 #define YY_EXTRA_TYPE void * 522 #endif 523 524 static int yy_init_globals (void ); 525 526 /* Accessor methods to globals. 527 These are made visible to non-reentrant scanners for convenience. */ 528 529 int yylex_destroy (void ); 530 531 int yyget_debug (void ); 532 533 void yyset_debug (int debug_flag ); 534 535 YY_EXTRA_TYPE yyget_extra (void ); 536 537 void yyset_extra (YY_EXTRA_TYPE user_defined ); 538 539 FILE *yyget_in (void ); 540 541 void yyset_in (FILE * in_str ); 542 543 FILE *yyget_out (void ); 544 545 void yyset_out (FILE * out_str ); 546 547 int yyget_leng (void ); 548 549 char *yyget_text (void ); 550 551 int yyget_lineno (void ); 552 553 void yyset_lineno (int line_number ); 554 555 /* Macros after this point can all be overridden by user definitions in 556 * section 1. 557 */ 558 559 #ifndef YY_SKIP_YYWRAP 560 #ifdef __cplusplus 561 extern "C" int yywrap (void ); 562 #else 563 extern int yywrap (void ); 564 #endif 565 #endif 566 567 #ifndef yytext_ptr 568 static void yy_flex_strncpy (char *,yyconst char *,int ); 569 #endif 570 571 #ifdef YY_NEED_STRLEN 572 static int yy_flex_strlen (yyconst char * ); 573 #endif 574 575 #ifndef YY_NO_INPUT 576 577 #ifdef __cplusplus 578 static int yyinput (void ); 579 #else 580 static int input (void ); 581 #endif 582 583 #endif 584 585 /* Amount of stuff to slurp up with each read. */ 586 #ifndef YY_READ_BUF_SIZE 587 #ifdef __ia64__ 588 /* On IA-64, the buffer size is 16k, not 8k */ 589 #define YY_READ_BUF_SIZE 16384 590 #else 591 #define YY_READ_BUF_SIZE 8192 592 #endif /* __ia64__ */ 593 #endif 594 595 /* Copy whatever the last rule matched to the standard output. */ 596 #ifndef ECHO 597 /* This used to be an fputs(), but since the string might contain NUL's, 598 * we now use fwrite(). 599 */ 600 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) 601 #endif 602 603 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 604 * is returned in "result". 605 */ 606 #ifndef YY_INPUT 607 #define YY_INPUT(buf,result,max_size) \ 608 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 609 { \ 610 int c = '*'; \ 611 size_t n; \ 612 for ( n = 0; n < max_size && \ 613 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 614 buf[n] = (char) c; \ 615 if ( c == '\n' ) \ 616 buf[n++] = (char) c; \ 617 if ( c == EOF && ferror( yyin ) ) \ 618 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 619 result = n; \ 620 } \ 621 else \ 622 { \ 623 errno=0; \ 624 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 625 { \ 626 if( errno != EINTR) \ 627 { \ 628 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 629 break; \ 630 } \ 631 errno=0; \ 632 clearerr(yyin); \ 633 } \ 634 }\ 635 \ 636 637 #endif 638 639 /* No semi-colon after return; correct usage is to write "yyterminate();" - 640 * we don't want an extra ';' after the "return" because that will cause 641 * some compilers to complain about unreachable statements. 642 */ 643 #ifndef yyterminate 644 #define yyterminate() return YY_NULL 645 #endif 646 647 /* Number of entries by which start-condition stack grows. */ 648 #ifndef YY_START_STACK_INCR 649 #define YY_START_STACK_INCR 25 650 #endif 651 652 /* Report a fatal error. */ 653 #ifndef YY_FATAL_ERROR 654 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 655 #endif 656 657 /* end tables serialization structures and prototypes */ 658 659 /* Default declaration of generated scanner - a define so the user can 660 * easily add parameters. 661 */ 662 #ifndef YY_DECL 663 #define YY_DECL_IS_OURS 1 664 665 extern int yylex (void); 666 667 #define YY_DECL int yylex (void) 668 #endif /* !YY_DECL */ 669 670 /* Code executed at the beginning of each rule, after yytext and yyleng 671 * have been set up. 672 */ 673 #ifndef YY_USER_ACTION 674 #define YY_USER_ACTION 675 #endif 676 677 /* Code executed at the end of each rule. */ 678 #ifndef YY_BREAK 679 #define YY_BREAK break; 680 #endif 681 682 #define YY_RULE_SETUP \ 683 YY_USER_ACTION 684 685 /** The main scanner function which does all the work. 686 */ 687 YY_DECL 688 { 689 register yy_state_type yy_current_state; 690 register char *yy_cp, *yy_bp; 691 register int yy_act; 692 693 #line 20 "pbc/parser.lex" 694 695 #line 696 "pbc/lex.yy.c" 696 697 if ( !(yy_init) ) 698 { 699 (yy_init) = 1; 700 701 #ifdef YY_USER_INIT 702 YY_USER_INIT; 703 #endif 704 705 if ( ! (yy_start) ) 706 (yy_start) = 1; /* first start state */ 707 708 if ( ! yyin ) 709 yyin = stdin; 710 711 if ( ! yyout ) 712 yyout = stdout; 713 714 if ( ! YY_CURRENT_BUFFER ) { 715 yyensure_buffer_stack (); 716 YY_CURRENT_BUFFER_LVALUE = 717 yy_create_buffer(yyin,YY_BUF_SIZE ); 718 } 719 720 yy_load_buffer_state( ); 721 } 722 723 while ( 1 ) /* loops until end-of-file is reached */ 724 { 725 yy_cp = (yy_c_buf_p); 726 727 /* Support of yytext. */ 728 *yy_cp = (yy_hold_char); 729 730 /* yy_bp points to the position in yy_ch_buf of the start of 731 * the current run. 732 */ 733 yy_bp = yy_cp; 734 735 yy_current_state = (yy_start); 736 yy_match: 737 do 738 { 739 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 740 if ( yy_accept[yy_current_state] ) 741 { 742 (yy_last_accepting_state) = yy_current_state; 743 (yy_last_accepting_cpos) = yy_cp; 744 } 745 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 746 { 747 yy_current_state = (int) yy_def[yy_current_state]; 748 if ( yy_current_state >= 53 ) 749 yy_c = yy_meta[(unsigned int) yy_c]; 750 } 751 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 752 ++yy_cp; 753 } 754 while ( yy_base[yy_current_state] != 59 ); 755 756 yy_find_action: 757 yy_act = yy_accept[yy_current_state]; 758 if ( yy_act == 0 ) 759 { /* have to back up */ 760 yy_cp = (yy_last_accepting_cpos); 761 yy_current_state = (yy_last_accepting_state); 762 yy_act = yy_accept[yy_current_state]; 763 } 764 765 YY_DO_BEFORE_ACTION; 766 767 do_action: /* This label is used only to access EOF actions. */ 768 769 switch ( yy_act ) 770 { /* beginning of action switch */ 771 case 0: /* must back up */ 772 /* undo the effects of YY_DO_BEFORE_ACTION */ 773 *yy_cp = (yy_hold_char); 774 yy_cp = (yy_last_accepting_cpos); 775 yy_current_state = (yy_last_accepting_state); 776 goto yy_find_action; 777 778 case 1: 779 YY_RULE_SETUP 780 #line 21 "pbc/parser.lex" 781 BEGIN(COMMENT); // Open C-style comment. 782 YY_BREAK 783 case 2: 784 YY_RULE_SETUP 785 #line 22 "pbc/parser.lex" 786 BEGIN(0); // Close C-style comment. 787 YY_BREAK 788 case 3: 789 YY_RULE_SETUP 790 #line 23 "pbc/parser.lex" 791 // Within a C-style comment. 792 YY_BREAK 793 case 4: 794 /* rule 4 can match eol */ 795 YY_RULE_SETUP 796 #line 24 "pbc/parser.lex" 797 // Within a C-style comment. 798 YY_BREAK 799 case 5: 800 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ 801 (yy_c_buf_p) = yy_cp -= 1; 802 YY_DO_BEFORE_ACTION; /* set up yytext again */ 803 YY_RULE_SETUP 804 #line 25 "pbc/parser.lex" 805 // Comment. 806 YY_BREAK 807 case 6: 808 YY_RULE_SETUP 809 #line 26 "pbc/parser.lex" 810 // Whitespace. 811 YY_BREAK 812 case 7: 813 YY_RULE_SETUP 814 #line 28 "pbc/parser.lex" 815 return DEFINE; 816 YY_BREAK 817 case 8: 818 YY_RULE_SETUP 819 #line 29 "pbc/parser.lex" 820 yylval = tree_new_z(yytext); return NUM; 821 YY_BREAK 822 case 9: 823 YY_RULE_SETUP 824 #line 30 "pbc/parser.lex" 825 yylval = tree_new_id(yytext); return ID; 826 YY_BREAK 827 case 10: 828 YY_RULE_SETUP 829 #line 31 "pbc/parser.lex" 830 return ASSIGN; 831 YY_BREAK 832 case 11: 833 YY_RULE_SETUP 834 #line 32 "pbc/parser.lex" 835 return EQ; 836 YY_BREAK 837 case 12: 838 YY_RULE_SETUP 839 #line 33 "pbc/parser.lex" 840 return NE; 841 YY_BREAK 842 case 13: 843 YY_RULE_SETUP 844 #line 34 "pbc/parser.lex" 845 return LT; 846 YY_BREAK 847 case 14: 848 YY_RULE_SETUP 849 #line 35 "pbc/parser.lex" 850 return T_GT; 851 YY_BREAK 852 case 15: 853 YY_RULE_SETUP 854 #line 36 "pbc/parser.lex" 855 return LE; 856 YY_BREAK 857 case 16: 858 YY_RULE_SETUP 859 #line 37 "pbc/parser.lex" 860 return GE; 861 YY_BREAK 862 case 17: 863 YY_RULE_SETUP 864 #line 38 "pbc/parser.lex" 865 return PLUS; 866 YY_BREAK 867 case 18: 868 YY_RULE_SETUP 869 #line 39 "pbc/parser.lex" 870 return MINUS; 871 YY_BREAK 872 case 19: 873 YY_RULE_SETUP 874 #line 40 "pbc/parser.lex" 875 return DIVIDE; 876 YY_BREAK 877 case 20: 878 YY_RULE_SETUP 879 #line 41 "pbc/parser.lex" 880 return TIMES; 881 YY_BREAK 882 case 21: 883 YY_RULE_SETUP 884 #line 42 "pbc/parser.lex" 885 return POW; 886 YY_BREAK 887 case 22: 888 YY_RULE_SETUP 889 #line 43 "pbc/parser.lex" 890 return TERMINATOR; 891 YY_BREAK 892 case 23: 893 YY_RULE_SETUP 894 #line 44 "pbc/parser.lex" 895 return COMMA; 896 YY_BREAK 897 case 24: 898 YY_RULE_SETUP 899 #line 45 "pbc/parser.lex" 900 return QUESTION; 901 YY_BREAK 902 case 25: 903 YY_RULE_SETUP 904 #line 46 "pbc/parser.lex" 905 return COLON; 906 YY_BREAK 907 case 26: 908 YY_RULE_SETUP 909 #line 47 "pbc/parser.lex" 910 return LPAR; 911 YY_BREAK 912 case 27: 913 YY_RULE_SETUP 914 #line 48 "pbc/parser.lex" 915 return RPAR; 916 YY_BREAK 917 case 28: 918 YY_RULE_SETUP 919 #line 49 "pbc/parser.lex" 920 return LSQU; 921 YY_BREAK 922 case 29: 923 YY_RULE_SETUP 924 #line 50 "pbc/parser.lex" 925 return RSQU; 926 YY_BREAK 927 case 30: 928 YY_RULE_SETUP 929 #line 51 "pbc/parser.lex" 930 return LBRACE; 931 YY_BREAK 932 case 31: 933 YY_RULE_SETUP 934 #line 52 "pbc/parser.lex" 935 return RBRACE; 936 YY_BREAK 937 case 32: 938 /* rule 32 can match eol */ 939 YY_RULE_SETUP 940 #line 53 "pbc/parser.lex" 941 if (option_easy) return TERMINATOR; 942 YY_BREAK 943 case 33: 944 YY_RULE_SETUP 945 #line 54 "pbc/parser.lex" 946 return option_easy ? ASSIGN : UNKNOWN; 947 YY_BREAK 948 case 34: 949 YY_RULE_SETUP 950 #line 55 "pbc/parser.lex" 951 return UNKNOWN; 952 YY_BREAK 953 case 35: 954 YY_RULE_SETUP 955 #line 56 "pbc/parser.lex" 956 ECHO; 957 YY_BREAK 958 #line 959 "pbc/lex.yy.c" 959 case YY_STATE_EOF(INITIAL): 960 case YY_STATE_EOF(COMMENT): 961 yyterminate(); 962 963 case YY_END_OF_BUFFER: 964 { 965 /* Amount of text matched not including the EOB char. */ 966 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 967 968 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 969 *yy_cp = (yy_hold_char); 970 YY_RESTORE_YY_MORE_OFFSET 971 972 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 973 { 974 /* We're scanning a new file or input source. It's 975 * possible that this happened because the user 976 * just pointed yyin at a new source and called 977 * yylex(). If so, then we have to assure 978 * consistency between YY_CURRENT_BUFFER and our 979 * globals. Here is the right place to do so, because 980 * this is the first action (other than possibly a 981 * back-up) that will match for the new input source. 982 */ 983 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 984 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 985 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 986 } 987 988 /* Note that here we test for yy_c_buf_p "<=" to the position 989 * of the first EOB in the buffer, since yy_c_buf_p will 990 * already have been incremented past the NUL character 991 * (since all states make transitions on EOB to the 992 * end-of-buffer state). Contrast this with the test 993 * in input(). 994 */ 995 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 996 { /* This was really a NUL. */ 997 yy_state_type yy_next_state; 998 999 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 1000 1001 yy_current_state = yy_get_previous_state( ); 1002 1003 /* Okay, we're now positioned to make the NUL 1004 * transition. We couldn't have 1005 * yy_get_previous_state() go ahead and do it 1006 * for us because it doesn't know how to deal 1007 * with the possibility of jamming (and we don't 1008 * want to build jamming into it because then it 1009 * will run more slowly). 1010 */ 1011 1012 yy_next_state = yy_try_NUL_trans( yy_current_state ); 1013 1014 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1015 1016 if ( yy_next_state ) 1017 { 1018 /* Consume the NUL. */ 1019 yy_cp = ++(yy_c_buf_p); 1020 yy_current_state = yy_next_state; 1021 goto yy_match; 1022 } 1023 1024 else 1025 { 1026 yy_cp = (yy_c_buf_p); 1027 goto yy_find_action; 1028 } 1029 } 1030 1031 else switch ( yy_get_next_buffer( ) ) 1032 { 1033 case EOB_ACT_END_OF_FILE: 1034 { 1035 (yy_did_buffer_switch_on_eof) = 0; 1036 1037 if ( yywrap( ) ) 1038 { 1039 /* Note: because we've taken care in 1040 * yy_get_next_buffer() to have set up 1041 * yytext, we can now set up 1042 * yy_c_buf_p so that if some total 1043 * hoser (like flex itself) wants to 1044 * call the scanner after we return the 1045 * YY_NULL, it'll still work - another 1046 * YY_NULL will get returned. 1047 */ 1048 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 1049 1050 yy_act = YY_STATE_EOF(YY_START); 1051 goto do_action; 1052 } 1053 1054 else 1055 { 1056 if ( ! (yy_did_buffer_switch_on_eof) ) 1057 YY_NEW_FILE; 1058 } 1059 break; 1060 } 1061 1062 case EOB_ACT_CONTINUE_SCAN: 1063 (yy_c_buf_p) = 1064 (yytext_ptr) + yy_amount_of_matched_text; 1065 1066 yy_current_state = yy_get_previous_state( ); 1067 1068 yy_cp = (yy_c_buf_p); 1069 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1070 goto yy_match; 1071 1072 case EOB_ACT_LAST_MATCH: 1073 (yy_c_buf_p) = 1074 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 1075 1076 yy_current_state = yy_get_previous_state( ); 1077 1078 yy_cp = (yy_c_buf_p); 1079 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1080 goto yy_find_action; 1081 } 1082 break; 1083 } 1084 1085 default: 1086 YY_FATAL_ERROR( 1087 "fatal flex scanner internal error--no action found" ); 1088 } /* end of action switch */ 1089 } /* end of scanning one token */ 1090 } /* end of yylex */ 1091 1092 /* yy_get_next_buffer - try to read in a new buffer 1093 * 1094 * Returns a code representing an action: 1095 * EOB_ACT_LAST_MATCH - 1096 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1097 * EOB_ACT_END_OF_FILE - end of file 1098 */ 1099 static int yy_get_next_buffer (void) 1100 { 1101 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1102 register char *source = (yytext_ptr); 1103 register int number_to_move, i; 1104 int ret_val; 1105 1106 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 1107 YY_FATAL_ERROR( 1108 "fatal flex scanner internal error--end of buffer missed" ); 1109 1110 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1111 { /* Don't try to fill the buffer, so this is an EOF. */ 1112 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 1113 { 1114 /* We matched a single character, the EOB, so 1115 * treat this as a final EOF. 1116 */ 1117 return EOB_ACT_END_OF_FILE; 1118 } 1119 1120 else 1121 { 1122 /* We matched some text prior to the EOB, first 1123 * process it. 1124 */ 1125 return EOB_ACT_LAST_MATCH; 1126 } 1127 } 1128 1129 /* Try to read more data. */ 1130 1131 /* First move last chars to start of buffer. */ 1132 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; 1133 1134 for ( i = 0; i < number_to_move; ++i ) 1135 *(dest++) = *(source++); 1136 1137 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1138 /* don't do the read, it's not guaranteed to return an EOF, 1139 * just force an EOF 1140 */ 1141 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 1142 1143 else 1144 { 1145 int num_to_read = 1146 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1147 1148 while ( num_to_read <= 0 ) 1149 { /* Not enough room in the buffer - grow it. */ 1150 1151 /* just a shorter name for the current buffer */ 1152 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1153 1154 int yy_c_buf_p_offset = 1155 (int) ((yy_c_buf_p) - b->yy_ch_buf); 1156 1157 if ( b->yy_is_our_buffer ) 1158 { 1159 int new_size = b->yy_buf_size * 2; 1160 1161 if ( new_size <= 0 ) 1162 b->yy_buf_size += b->yy_buf_size / 8; 1163 else 1164 b->yy_buf_size *= 2; 1165 1166 b->yy_ch_buf = (char *) 1167 /* Include room in for 2 EOB chars. */ 1168 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); 1169 } 1170 else 1171 /* Can't grow it, we don't own it. */ 1172 b->yy_ch_buf = 0; 1173 1174 if ( ! b->yy_ch_buf ) 1175 YY_FATAL_ERROR( 1176 "fatal error - scanner input buffer overflow" ); 1177 1178 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 1179 1180 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1181 number_to_move - 1; 1182 1183 } 1184 1185 if ( num_to_read > YY_READ_BUF_SIZE ) 1186 num_to_read = YY_READ_BUF_SIZE; 1187 1188 /* Read in more data. */ 1189 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1190 (yy_n_chars), (size_t) num_to_read ); 1191 1192 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1193 } 1194 1195 if ( (yy_n_chars) == 0 ) 1196 { 1197 if ( number_to_move == YY_MORE_ADJ ) 1198 { 1199 ret_val = EOB_ACT_END_OF_FILE; 1200 yyrestart(yyin ); 1201 } 1202 1203 else 1204 { 1205 ret_val = EOB_ACT_LAST_MATCH; 1206 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1207 YY_BUFFER_EOF_PENDING; 1208 } 1209 } 1210 1211 else 1212 ret_val = EOB_ACT_CONTINUE_SCAN; 1213 1214 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1215 /* Extend the array by 50%, plus the number we really need. */ 1216 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 1217 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); 1218 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1219 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1220 } 1221 1222 (yy_n_chars) += number_to_move; 1223 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1224 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1225 1226 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1227 1228 return ret_val; 1229 } 1230 1231 /* yy_get_previous_state - get the state just before the EOB char was reached */ 1232 1233 static yy_state_type yy_get_previous_state (void) 1234 { 1235 register yy_state_type yy_current_state; 1236 register char *yy_cp; 1237 1238 yy_current_state = (yy_start); 1239 1240 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 1241 { 1242 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1243 if ( yy_accept[yy_current_state] ) 1244 { 1245 (yy_last_accepting_state) = yy_current_state; 1246 (yy_last_accepting_cpos) = yy_cp; 1247 } 1248 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1249 { 1250 yy_current_state = (int) yy_def[yy_current_state]; 1251 if ( yy_current_state >= 53 ) 1252 yy_c = yy_meta[(unsigned int) yy_c]; 1253 } 1254 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1255 } 1256 1257 return yy_current_state; 1258 } 1259 1260 /* yy_try_NUL_trans - try to make a transition on the NUL character 1261 * 1262 * synopsis 1263 * next_state = yy_try_NUL_trans( current_state ); 1264 */ 1265 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 1266 { 1267 register int yy_is_jam; 1268 register char *yy_cp = (yy_c_buf_p); 1269 1270 register YY_CHAR yy_c = 1; 1271 if ( yy_accept[yy_current_state] ) 1272 { 1273 (yy_last_accepting_state) = yy_current_state; 1274 (yy_last_accepting_cpos) = yy_cp; 1275 } 1276 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1277 { 1278 yy_current_state = (int) yy_def[yy_current_state]; 1279 if ( yy_current_state >= 53 ) 1280 yy_c = yy_meta[(unsigned int) yy_c]; 1281 } 1282 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1283 yy_is_jam = (yy_current_state == 52); 1284 1285 return yy_is_jam ? 0 : yy_current_state; 1286 } 1287 1288 #ifndef YY_NO_INPUT 1289 #ifdef __cplusplus 1290 static int yyinput (void) 1291 #else 1292 static int input (void) 1293 #endif 1294 1295 { 1296 int c; 1297 1298 *(yy_c_buf_p) = (yy_hold_char); 1299 1300 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 1301 { 1302 /* yy_c_buf_p now points to the character we want to return. 1303 * If this occurs *before* the EOB characters, then it's a 1304 * valid NUL; if not, then we've hit the end of the buffer. 1305 */ 1306 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1307 /* This was really a NUL. */ 1308 *(yy_c_buf_p) = '\0'; 1309 1310 else 1311 { /* need more input */ 1312 int offset = (yy_c_buf_p) - (yytext_ptr); 1313 ++(yy_c_buf_p); 1314 1315 switch ( yy_get_next_buffer( ) ) 1316 { 1317 case EOB_ACT_LAST_MATCH: 1318 /* This happens because yy_g_n_b() 1319 * sees that we've accumulated a 1320 * token and flags that we need to 1321 * try matching the token before 1322 * proceeding. But for input(), 1323 * there's no matching to consider. 1324 * So convert the EOB_ACT_LAST_MATCH 1325 * to EOB_ACT_END_OF_FILE. 1326 */ 1327 1328 /* Reset buffer status. */ 1329 yyrestart(yyin ); 1330 1331 /*FALLTHROUGH*/ 1332 1333 case EOB_ACT_END_OF_FILE: 1334 { 1335 if ( yywrap( ) ) 1336 return EOF; 1337 1338 if ( ! (yy_did_buffer_switch_on_eof) ) 1339 YY_NEW_FILE; 1340 #ifdef __cplusplus 1341 return yyinput(); 1342 #else 1343 return input(); 1344 #endif 1345 } 1346 1347 case EOB_ACT_CONTINUE_SCAN: 1348 (yy_c_buf_p) = (yytext_ptr) + offset; 1349 break; 1350 } 1351 } 1352 } 1353 1354 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 1355 *(yy_c_buf_p) = '\0'; /* preserve yytext */ 1356 (yy_hold_char) = *++(yy_c_buf_p); 1357 1358 return c; 1359 } 1360 #endif /* ifndef YY_NO_INPUT */ 1361 1362 /** Immediately switch to a different input stream. 1363 * @param input_file A readable stream. 1364 * 1365 * @note This function does not reset the start condition to @c INITIAL . 1366 */ 1367 void yyrestart (FILE * input_file ) 1368 { 1369 1370 if ( ! YY_CURRENT_BUFFER ){ 1371 yyensure_buffer_stack (); 1372 YY_CURRENT_BUFFER_LVALUE = 1373 yy_create_buffer(yyin,YY_BUF_SIZE ); 1374 } 1375 1376 yy_init_buffer(YY_CURRENT_BUFFER,input_file ); 1377 yy_load_buffer_state( ); 1378 } 1379 1380 /** Switch to a different input buffer. 1381 * @param new_buffer The new input buffer. 1382 * 1383 */ 1384 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) 1385 { 1386 1387 /* TODO. We should be able to replace this entire function body 1388 * with 1389 * yypop_buffer_state(); 1390 * yypush_buffer_state(new_buffer); 1391 */ 1392 yyensure_buffer_stack (); 1393 if ( YY_CURRENT_BUFFER == new_buffer ) 1394 return; 1395 1396 if ( YY_CURRENT_BUFFER ) 1397 { 1398 /* Flush out information for old buffer. */ 1399 *(yy_c_buf_p) = (yy_hold_char); 1400 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1401 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1402 } 1403 1404 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1405 yy_load_buffer_state( ); 1406 1407 /* We don't actually know whether we did this switch during 1408 * EOF (yywrap()) processing, but the only time this flag 1409 * is looked at is after yywrap() is called, so it's safe 1410 * to go ahead and always set it. 1411 */ 1412 (yy_did_buffer_switch_on_eof) = 1; 1413 } 1414 1415 static void yy_load_buffer_state (void) 1416 { 1417 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1418 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1419 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1420 (yy_hold_char) = *(yy_c_buf_p); 1421 } 1422 1423 /** Allocate and initialize an input buffer state. 1424 * @param file A readable stream. 1425 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1426 * 1427 * @return the allocated buffer state. 1428 */ 1429 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) 1430 { 1431 YY_BUFFER_STATE b; 1432 1433 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 1434 if ( ! b ) 1435 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1436 1437 b->yy_buf_size = size; 1438 1439 /* yy_ch_buf has to be 2 characters longer than the size given because 1440 * we need to put in 2 end-of-buffer characters. 1441 */ 1442 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); 1443 if ( ! b->yy_ch_buf ) 1444 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1445 1446 b->yy_is_our_buffer = 1; 1447 1448 yy_init_buffer(b,file ); 1449 1450 return b; 1451 } 1452 1453 /** Destroy the buffer. 1454 * @param b a buffer created with yy_create_buffer() 1455 * 1456 */ 1457 void yy_delete_buffer (YY_BUFFER_STATE b ) 1458 { 1459 1460 if ( ! b ) 1461 return; 1462 1463 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1464 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1465 1466 if ( b->yy_is_our_buffer ) 1467 yyfree((void *) b->yy_ch_buf ); 1468 1469 yyfree((void *) b ); 1470 } 1471 1472 #ifndef __cplusplus 1473 extern int isatty (int ); 1474 #endif /* __cplusplus */ 1475 1476 /* Initializes or reinitializes a buffer. 1477 * This function is sometimes called more than once on the same buffer, 1478 * such as during a yyrestart() or at EOF. 1479 */ 1480 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) 1481 1482 { 1483 int oerrno = errno; 1484 1485 yy_flush_buffer(b ); 1486 1487 b->yy_input_file = file; 1488 b->yy_fill_buffer = 1; 1489 1490 /* If b is the current buffer, then yy_init_buffer was _probably_ 1491 * called from yyrestart() or through yy_get_next_buffer. 1492 * In that case, we don't want to reset the lineno or column. 1493 */ 1494 if (b != YY_CURRENT_BUFFER){ 1495 b->yy_bs_lineno = 1; 1496 b->yy_bs_column = 0; 1497 } 1498 1499 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 1500 1501 errno = oerrno; 1502 } 1503 1504 /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1505 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1506 * 1507 */ 1508 void yy_flush_buffer (YY_BUFFER_STATE b ) 1509 { 1510 if ( ! b ) 1511 return; 1512 1513 b->yy_n_chars = 0; 1514 1515 /* We always need two end-of-buffer characters. The first causes 1516 * a transition to the end-of-buffer state. The second causes 1517 * a jam in that state. 1518 */ 1519 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1520 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1521 1522 b->yy_buf_pos = &b->yy_ch_buf[0]; 1523 1524 b->yy_at_bol = 1; 1525 b->yy_buffer_status = YY_BUFFER_NEW; 1526 1527 if ( b == YY_CURRENT_BUFFER ) 1528 yy_load_buffer_state( ); 1529 } 1530 1531 /** Pushes the new state onto the stack. The new state becomes 1532 * the current state. This function will allocate the stack 1533 * if necessary. 1534 * @param new_buffer The new state. 1535 * 1536 */ 1537 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) 1538 { 1539 if (new_buffer == NULL) 1540 return; 1541 1542 yyensure_buffer_stack(); 1543 1544 /* This block is copied from yy_switch_to_buffer. */ 1545 if ( YY_CURRENT_BUFFER ) 1546 { 1547 /* Flush out information for old buffer. */ 1548 *(yy_c_buf_p) = (yy_hold_char); 1549 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1550 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1551 } 1552 1553 /* Only push if top exists. Otherwise, replace top. */ 1554 if (YY_CURRENT_BUFFER) 1555 (yy_buffer_stack_top)++; 1556 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1557 1558 /* copied from yy_switch_to_buffer. */ 1559 yy_load_buffer_state( ); 1560 (yy_did_buffer_switch_on_eof) = 1; 1561 } 1562 1563 /** Removes and deletes the top of the stack, if present. 1564 * The next element becomes the new top. 1565 * 1566 */ 1567 void yypop_buffer_state (void) 1568 { 1569 if (!YY_CURRENT_BUFFER) 1570 return; 1571 1572 yy_delete_buffer(YY_CURRENT_BUFFER ); 1573 YY_CURRENT_BUFFER_LVALUE = NULL; 1574 if ((yy_buffer_stack_top) > 0) 1575 --(yy_buffer_stack_top); 1576 1577 if (YY_CURRENT_BUFFER) { 1578 yy_load_buffer_state( ); 1579 (yy_did_buffer_switch_on_eof) = 1; 1580 } 1581 } 1582 1583 /* Allocates the stack if it does not exist. 1584 * Guarantees space for at least one push. 1585 */ 1586 static void yyensure_buffer_stack (void) 1587 { 1588 int num_to_alloc; 1589 1590 if (!(yy_buffer_stack)) { 1591 1592 /* First allocation is just for 2 elements, since we don't know if this 1593 * scanner will even need a stack. We use 2 instead of 1 to avoid an 1594 * immediate realloc on the next call. 1595 */ 1596 num_to_alloc = 1; 1597 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 1598 (num_to_alloc * sizeof(struct yy_buffer_state*) 1599 ); 1600 if ( ! (yy_buffer_stack) ) 1601 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1602 1603 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1604 1605 (yy_buffer_stack_max) = num_to_alloc; 1606 (yy_buffer_stack_top) = 0; 1607 return; 1608 } 1609 1610 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 1611 1612 /* Increase the buffer to prepare for a possible push. */ 1613 int grow_size = 8 /* arbitrary grow size */; 1614 1615 num_to_alloc = (yy_buffer_stack_max) + grow_size; 1616 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 1617 ((yy_buffer_stack), 1618 num_to_alloc * sizeof(struct yy_buffer_state*) 1619 ); 1620 if ( ! (yy_buffer_stack) ) 1621 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1622 1623 /* zero only the new slots.*/ 1624 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1625 (yy_buffer_stack_max) = num_to_alloc; 1626 } 1627 } 1628 1629 /** Setup the input buffer state to scan directly from a user-specified character buffer. 1630 * @param base the character buffer 1631 * @param size the size in bytes of the character buffer 1632 * 1633 * @return the newly allocated buffer state object. 1634 */ 1635 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 1636 { 1637 YY_BUFFER_STATE b; 1638 1639 if ( size < 2 || 1640 base[size-2] != YY_END_OF_BUFFER_CHAR || 1641 base[size-1] != YY_END_OF_BUFFER_CHAR ) 1642 /* They forgot to leave room for the EOB's. */ 1643 return 0; 1644 1645 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 1646 if ( ! b ) 1647 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 1648 1649 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 1650 b->yy_buf_pos = b->yy_ch_buf = base; 1651 b->yy_is_our_buffer = 0; 1652 b->yy_input_file = 0; 1653 b->yy_n_chars = b->yy_buf_size; 1654 b->yy_is_interactive = 0; 1655 b->yy_at_bol = 1; 1656 b->yy_fill_buffer = 0; 1657 b->yy_buffer_status = YY_BUFFER_NEW; 1658 1659 yy_switch_to_buffer(b ); 1660 1661 return b; 1662 } 1663 1664 /** Setup the input buffer state to scan a string. The next call to yylex() will 1665 * scan from a @e copy of @a str. 1666 * @param yystr a NUL-terminated string to scan 1667 * 1668 * @return the newly allocated buffer state object. 1669 * @note If you want to scan bytes that may contain NUL values, then use 1670 * yy_scan_bytes() instead. 1671 */ 1672 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) 1673 { 1674 1675 return yy_scan_bytes(yystr,strlen(yystr) ); 1676 } 1677 1678 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will 1679 * scan from a @e copy of @a bytes. 1680 * @param yybytes the byte buffer to scan 1681 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 1682 * 1683 * @return the newly allocated buffer state object. 1684 */ 1685 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) 1686 { 1687 YY_BUFFER_STATE b; 1688 char *buf; 1689 yy_size_t n; 1690 int i; 1691 1692 /* Get memory for full buffer, including space for trailing EOB's. */ 1693 n = _yybytes_len + 2; 1694 buf = (char *) yyalloc(n ); 1695 if ( ! buf ) 1696 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 1697 1698 for ( i = 0; i < _yybytes_len; ++i ) 1699 buf[i] = yybytes[i]; 1700 1701 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 1702 1703 b = yy_scan_buffer(buf,n ); 1704 if ( ! b ) 1705 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 1706 1707 /* It's okay to grow etc. this buffer, and we should throw it 1708 * away when we're done. 1709 */ 1710 b->yy_is_our_buffer = 1; 1711 1712 return b; 1713 } 1714 1715 #ifndef YY_EXIT_FAILURE 1716 #define YY_EXIT_FAILURE 2 1717 #endif 1718 1719 static void yy_fatal_error (yyconst char* msg ) 1720 { 1721 (void) fprintf( stderr, "%s\n", msg ); 1722 exit( YY_EXIT_FAILURE ); 1723 } 1724 1725 /* Redefine yyless() so it works in section 3 code. */ 1726 1727 #undef yyless 1728 #define yyless(n) \ 1729 do \ 1730 { \ 1731 /* Undo effects of setting up yytext. */ \ 1732 int yyless_macro_arg = (n); \ 1733 YY_LESS_LINENO(yyless_macro_arg);\ 1734 yytext[yyleng] = (yy_hold_char); \ 1735 (yy_c_buf_p) = yytext + yyless_macro_arg; \ 1736 (yy_hold_char) = *(yy_c_buf_p); \ 1737 *(yy_c_buf_p) = '\0'; \ 1738 yyleng = yyless_macro_arg; \ 1739 } \ 1740 while ( 0 ) 1741 1742 /* Accessor methods (get/set functions) to struct members. */ 1743 1744 /** Get the current line number. 1745 * 1746 */ 1747 int yyget_lineno (void) 1748 { 1749 1750 return yylineno; 1751 } 1752 1753 /** Get the input stream. 1754 * 1755 */ 1756 FILE *yyget_in (void) 1757 { 1758 return yyin; 1759 } 1760 1761 /** Get the output stream. 1762 * 1763 */ 1764 FILE *yyget_out (void) 1765 { 1766 return yyout; 1767 } 1768 1769 /** Get the length of the current token. 1770 * 1771 */ 1772 int yyget_leng (void) 1773 { 1774 return yyleng; 1775 } 1776 1777 /** Get the current token. 1778 * 1779 */ 1780 1781 char *yyget_text (void) 1782 { 1783 return yytext; 1784 } 1785 1786 /** Set the current line number. 1787 * @param line_number 1788 * 1789 */ 1790 void yyset_lineno (int line_number ) 1791 { 1792 1793 yylineno = line_number; 1794 } 1795 1796 /** Set the input stream. This does not discard the current 1797 * input buffer. 1798 * @param in_str A readable stream. 1799 * 1800 * @see yy_switch_to_buffer 1801 */ 1802 void yyset_in (FILE * in_str ) 1803 { 1804 yyin = in_str ; 1805 } 1806 1807 void yyset_out (FILE * out_str ) 1808 { 1809 yyout = out_str ; 1810 } 1811 1812 int yyget_debug (void) 1813 { 1814 return yy_flex_debug; 1815 } 1816 1817 void yyset_debug (int bdebug ) 1818 { 1819 yy_flex_debug = bdebug ; 1820 } 1821 1822 static int yy_init_globals (void) 1823 { 1824 /* Initialization is the same as for the non-reentrant scanner. 1825 * This function is called from yylex_destroy(), so don't allocate here. 1826 */ 1827 1828 (yy_buffer_stack) = 0; 1829 (yy_buffer_stack_top) = 0; 1830 (yy_buffer_stack_max) = 0; 1831 (yy_c_buf_p) = (char *) 0; 1832 (yy_init) = 0; 1833 (yy_start) = 0; 1834 1835 /* Defined in main.c */ 1836 #ifdef YY_STDINIT 1837 yyin = stdin; 1838 yyout = stdout; 1839 #else 1840 yyin = (FILE *) 0; 1841 yyout = (FILE *) 0; 1842 #endif 1843 1844 /* For future reference: Set errno on error, since we are called by 1845 * yylex_init() 1846 */ 1847 return 0; 1848 } 1849 1850 /* yylex_destroy is for both reentrant and non-reentrant scanners. */ 1851 int yylex_destroy (void) 1852 { 1853 1854 /* Pop the buffer stack, destroying each element. */ 1855 while(YY_CURRENT_BUFFER){ 1856 yy_delete_buffer(YY_CURRENT_BUFFER ); 1857 YY_CURRENT_BUFFER_LVALUE = NULL; 1858 yypop_buffer_state(); 1859 } 1860 1861 /* Destroy the stack itself. */ 1862 yyfree((yy_buffer_stack) ); 1863 (yy_buffer_stack) = NULL; 1864 1865 /* Reset the globals. This is important in a non-reentrant scanner so the next time 1866 * yylex() is called, initialization will occur. */ 1867 yy_init_globals( ); 1868 1869 return 0; 1870 } 1871 1872 /* 1873 * Internal utility routines. 1874 */ 1875 1876 #ifndef yytext_ptr 1877 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) 1878 { 1879 register int i; 1880 for ( i = 0; i < n; ++i ) 1881 s1[i] = s2[i]; 1882 } 1883 #endif 1884 1885 #ifdef YY_NEED_STRLEN 1886 static int yy_flex_strlen (yyconst char * s ) 1887 { 1888 register int n; 1889 for ( n = 0; s[n]; ++n ) 1890 ; 1891 1892 return n; 1893 } 1894 #endif 1895 1896 void *yyalloc (yy_size_t size ) 1897 { 1898 return (void *) malloc( size ); 1899 } 1900 1901 void *yyrealloc (void * ptr, yy_size_t size ) 1902 { 1903 /* The cast to (char *) in the following accommodates both 1904 * implementations that use char* generic pointers, and those 1905 * that use void* generic pointers. It works with the latter 1906 * because both ANSI C and C++ allow castless assignment from 1907 * any pointer type to void*, and deal with argument conversions 1908 * as though doing an assignment. 1909 */ 1910 return (void *) realloc( (char *) ptr, size ); 1911 } 1912 1913 void yyfree (void * ptr ) 1914 { 1915 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 1916 } 1917 1918 #define YYTABLES_NAME "yytables" 1919 1920 #line 56 "pbc/parser.lex" 1921 1922 1923 1924