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