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