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