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 * $FreeBSD$ 487 */ 488 #include "parser.h" 489 #include <assert.h> 490 #include <stdlib.h> 491 #include <errno.h> 492 #include <stdint.h> 493 #include <limits.h> 494 495 extern void m4_warnx(const char *, ...); 496 extern int mimic_gnu; 497 extern int32_t yylval; 498 499 int32_t number(void); 500 int32_t parse_radix(void); 501 extern int yylex(void); 502 503 #define YY_DECL int yylex(void) 504 #line 504 "tokenizer.c" 505 #line 505 "tokenizer.c" 506 507 #define INITIAL 0 508 509 #ifndef YY_NO_UNISTD_H 510 /* Special case for "unistd.h", since it is non-ANSI. We include it way 511 * down here because we want the user's section 1 to have been scanned first. 512 * The user has a chance to override it with an option. 513 */ 514 #include <unistd.h> 515 #endif 516 517 #ifndef YY_EXTRA_TYPE 518 #define YY_EXTRA_TYPE void * 519 #endif 520 521 static int yy_init_globals ( void ); 522 523 /* Accessor methods to globals. 524 These are made visible to non-reentrant scanners for convenience. */ 525 526 int yylex_destroy ( void ); 527 528 int yyget_debug ( void ); 529 530 void yyset_debug ( int debug_flag ); 531 532 YY_EXTRA_TYPE yyget_extra ( void ); 533 534 void yyset_extra ( YY_EXTRA_TYPE user_defined ); 535 536 FILE *yyget_in ( void ); 537 538 void yyset_in ( FILE * _in_str ); 539 540 FILE *yyget_out ( void ); 541 542 void yyset_out ( FILE * _out_str ); 543 544 int yyget_leng ( void ); 545 546 char *yyget_text ( void ); 547 548 int yyget_lineno ( void ); 549 550 void yyset_lineno ( int _line_number ); 551 552 /* Macros after this point can all be overridden by user definitions in 553 * section 1. 554 */ 555 556 #ifndef YY_SKIP_YYWRAP 557 #ifdef __cplusplus 558 extern "C" int yywrap ( void ); 559 #else 560 extern int yywrap ( void ); 561 #endif 562 #endif 563 564 #ifndef YY_NO_UNPUT 565 566 #endif 567 568 #ifndef yytext_ptr 569 static void yy_flex_strncpy ( char *, const char *, int ); 570 #endif 571 572 #ifdef YY_NEED_STRLEN 573 static int yy_flex_strlen ( const char * ); 574 #endif 575 576 #ifndef YY_NO_INPUT 577 #ifdef __cplusplus 578 static int yyinput ( void ); 579 #else 580 static int input ( void ); 581 #endif 582 583 #endif 584 585 /* Amount of stuff to slurp up with each read. */ 586 #ifndef YY_READ_BUF_SIZE 587 #ifdef __ia64__ 588 /* On IA-64, the buffer size is 16k, not 8k */ 589 #define YY_READ_BUF_SIZE 16384 590 #else 591 #define YY_READ_BUF_SIZE 8192 592 #endif /* __ia64__ */ 593 #endif 594 595 /* Copy whatever the last rule matched to the standard output. */ 596 #ifndef ECHO 597 /* This used to be an fputs(), but since the string might contain NUL's, 598 * we now use fwrite(). 599 */ 600 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) 601 #endif 602 603 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 604 * is returned in "result". 605 */ 606 #ifndef YY_INPUT 607 #define YY_INPUT(buf,result,max_size) \ 608 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 609 { \ 610 int c = '*'; \ 611 int n; \ 612 for ( n = 0; n < max_size && \ 613 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 614 buf[n] = (char) c; \ 615 if ( c == '\n' ) \ 616 buf[n++] = (char) c; \ 617 if ( c == EOF && ferror( yyin ) ) \ 618 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 619 result = n; \ 620 } \ 621 else \ 622 { \ 623 errno=0; \ 624 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ 625 { \ 626 if( errno != EINTR) \ 627 { \ 628 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 629 break; \ 630 } \ 631 errno=0; \ 632 clearerr(yyin); \ 633 } \ 634 }\ 635 \ 636 637 #endif 638 639 /* No semi-colon after return; correct usage is to write "yyterminate();" - 640 * we don't want an extra ';' after the "return" because that will cause 641 * some compilers to complain about unreachable statements. 642 */ 643 #ifndef yyterminate 644 #define yyterminate() return YY_NULL 645 #endif 646 647 /* Number of entries by which start-condition stack grows. */ 648 #ifndef YY_START_STACK_INCR 649 #define YY_START_STACK_INCR 25 650 #endif 651 652 /* Report a fatal error. */ 653 #ifndef YY_FATAL_ERROR 654 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 655 #endif 656 657 /* end tables serialization structures and prototypes */ 658 659 /* Default declaration of generated scanner - a define so the user can 660 * easily add parameters. 661 */ 662 #ifndef YY_DECL 663 #define YY_DECL_IS_OURS 1 664 665 extern int yylex (void); 666 667 #define YY_DECL int yylex (void) 668 #endif /* !YY_DECL */ 669 670 /* Code executed at the beginning of each rule, after yytext and yyleng 671 * have been set up. 672 */ 673 #ifndef YY_USER_ACTION 674 #define YY_USER_ACTION 675 #endif 676 677 /* Code executed at the end of each rule. */ 678 #ifndef YY_BREAK 679 #define YY_BREAK /*LINTED*/break; 680 #endif 681 682 #define YY_RULE_SETUP \ 683 YY_USER_ACTION 684 685 /** The main scanner function which does all the work. 686 */ 687 YY_DECL 688 { 689 yy_state_type yy_current_state; 690 char *yy_cp, *yy_bp; 691 int yy_act; 692 693 if ( !(yy_init) ) 694 { 695 (yy_init) = 1; 696 697 #ifdef YY_USER_INIT 698 YY_USER_INIT; 699 #endif 700 701 if ( ! (yy_start) ) 702 (yy_start) = 1; /* first start state */ 703 704 if ( ! yyin ) 705 yyin = stdin; 706 707 if ( ! yyout ) 708 yyout = stdout; 709 710 if ( ! YY_CURRENT_BUFFER ) { 711 yyensure_buffer_stack (); 712 YY_CURRENT_BUFFER_LVALUE = 713 yy_create_buffer( yyin, YY_BUF_SIZE ); 714 } 715 716 yy_load_buffer_state( ); 717 } 718 719 { 720 #line 48 "tokenizer.l" 721 722 #line 722 "tokenizer.c" 723 724 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ 725 { 726 yy_cp = (yy_c_buf_p); 727 728 /* Support of yytext. */ 729 *yy_cp = (yy_hold_char); 730 731 /* yy_bp points to the position in yy_ch_buf of the start of 732 * the current run. 733 */ 734 yy_bp = yy_cp; 735 736 yy_current_state = (yy_start); 737 yy_match: 738 do 739 { 740 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; 741 if ( yy_accept[yy_current_state] ) 742 { 743 (yy_last_accepting_state) = yy_current_state; 744 (yy_last_accepting_cpos) = yy_cp; 745 } 746 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 747 { 748 yy_current_state = (int) yy_def[yy_current_state]; 749 if ( yy_current_state >= 35 ) 750 yy_c = yy_meta[yy_c]; 751 } 752 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; 753 ++yy_cp; 754 } 755 while ( yy_base[yy_current_state] != 49 ); 756 757 yy_find_action: 758 yy_act = yy_accept[yy_current_state]; 759 if ( yy_act == 0 ) 760 { /* have to back up */ 761 yy_cp = (yy_last_accepting_cpos); 762 yy_current_state = (yy_last_accepting_state); 763 yy_act = yy_accept[yy_current_state]; 764 } 765 766 YY_DO_BEFORE_ACTION; 767 768 do_action: /* This label is used only to access EOF actions. */ 769 770 switch ( yy_act ) 771 { /* beginning of action switch */ 772 case 0: /* must back up */ 773 /* undo the effects of YY_DO_BEFORE_ACTION */ 774 *yy_cp = (yy_hold_char); 775 yy_cp = (yy_last_accepting_cpos); 776 yy_current_state = (yy_last_accepting_state); 777 goto yy_find_action; 778 779 case 1: 780 /* rule 1 can match eol */ 781 YY_RULE_SETUP 782 #line 49 "tokenizer.l" 783 {/* just skip it */} 784 YY_BREAK 785 case 2: 786 YY_RULE_SETUP 787 #line 50 "tokenizer.l" 788 { yylval = number(); return(NUMBER); } 789 YY_BREAK 790 case 3: 791 YY_RULE_SETUP 792 #line 51 "tokenizer.l" 793 { if (mimic_gnu) { 794 yylval = parse_radix(); return(NUMBER); 795 } else { 796 return(ERROR); 797 } 798 } 799 YY_BREAK 800 case 4: 801 YY_RULE_SETUP 802 #line 57 "tokenizer.l" 803 { return(LE); } 804 YY_BREAK 805 case 5: 806 YY_RULE_SETUP 807 #line 58 "tokenizer.l" 808 { return(GE); } 809 YY_BREAK 810 case 6: 811 YY_RULE_SETUP 812 #line 59 "tokenizer.l" 813 { return(LSHIFT); } 814 YY_BREAK 815 case 7: 816 YY_RULE_SETUP 817 #line 60 "tokenizer.l" 818 { return(RSHIFT); } 819 YY_BREAK 820 case 8: 821 YY_RULE_SETUP 822 #line 61 "tokenizer.l" 823 { return(EQ); } 824 YY_BREAK 825 case 9: 826 YY_RULE_SETUP 827 #line 62 "tokenizer.l" 828 { return(NE); } 829 YY_BREAK 830 case 10: 831 YY_RULE_SETUP 832 #line 63 "tokenizer.l" 833 { return(LAND); } 834 YY_BREAK 835 case 11: 836 YY_RULE_SETUP 837 #line 64 "tokenizer.l" 838 { return(LOR); } 839 YY_BREAK 840 case 12: 841 YY_RULE_SETUP 842 #line 65 "tokenizer.l" 843 { if (mimic_gnu) { return (EXPONENT); } } 844 YY_BREAK 845 case 13: 846 YY_RULE_SETUP 847 #line 66 "tokenizer.l" 848 { return yytext[0]; } 849 YY_BREAK 850 case 14: 851 YY_RULE_SETUP 852 #line 67 "tokenizer.l" 853 ECHO; 854 YY_BREAK 855 #line 855 "tokenizer.c" 856 case YY_STATE_EOF(INITIAL): 857 yyterminate(); 858 859 case YY_END_OF_BUFFER: 860 { 861 /* Amount of text matched not including the EOB char. */ 862 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 863 864 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 865 *yy_cp = (yy_hold_char); 866 YY_RESTORE_YY_MORE_OFFSET 867 868 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 869 { 870 /* We're scanning a new file or input source. It's 871 * possible that this happened because the user 872 * just pointed yyin at a new source and called 873 * yylex(). If so, then we have to assure 874 * consistency between YY_CURRENT_BUFFER and our 875 * globals. Here is the right place to do so, because 876 * this is the first action (other than possibly a 877 * back-up) that will match for the new input source. 878 */ 879 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 880 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 881 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 882 } 883 884 /* Note that here we test for yy_c_buf_p "<=" to the position 885 * of the first EOB in the buffer, since yy_c_buf_p will 886 * already have been incremented past the NUL character 887 * (since all states make transitions on EOB to the 888 * end-of-buffer state). Contrast this with the test 889 * in input(). 890 */ 891 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 892 { /* This was really a NUL. */ 893 yy_state_type yy_next_state; 894 895 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 896 897 yy_current_state = yy_get_previous_state( ); 898 899 /* Okay, we're now positioned to make the NUL 900 * transition. We couldn't have 901 * yy_get_previous_state() go ahead and do it 902 * for us because it doesn't know how to deal 903 * with the possibility of jamming (and we don't 904 * want to build jamming into it because then it 905 * will run more slowly). 906 */ 907 908 yy_next_state = yy_try_NUL_trans( yy_current_state ); 909 910 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 911 912 if ( yy_next_state ) 913 { 914 /* Consume the NUL. */ 915 yy_cp = ++(yy_c_buf_p); 916 yy_current_state = yy_next_state; 917 goto yy_match; 918 } 919 920 else 921 { 922 yy_cp = (yy_c_buf_p); 923 goto yy_find_action; 924 } 925 } 926 927 else switch ( yy_get_next_buffer( ) ) 928 { 929 case EOB_ACT_END_OF_FILE: 930 { 931 (yy_did_buffer_switch_on_eof) = 0; 932 933 if ( yywrap( ) ) 934 { 935 /* Note: because we've taken care in 936 * yy_get_next_buffer() to have set up 937 * yytext, we can now set up 938 * yy_c_buf_p so that if some total 939 * hoser (like flex itself) wants to 940 * call the scanner after we return the 941 * YY_NULL, it'll still work - another 942 * YY_NULL will get returned. 943 */ 944 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 945 946 yy_act = YY_STATE_EOF(YY_START); 947 goto do_action; 948 } 949 950 else 951 { 952 if ( ! (yy_did_buffer_switch_on_eof) ) 953 YY_NEW_FILE; 954 } 955 break; 956 } 957 958 case EOB_ACT_CONTINUE_SCAN: 959 (yy_c_buf_p) = 960 (yytext_ptr) + yy_amount_of_matched_text; 961 962 yy_current_state = yy_get_previous_state( ); 963 964 yy_cp = (yy_c_buf_p); 965 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 966 goto yy_match; 967 968 case EOB_ACT_LAST_MATCH: 969 (yy_c_buf_p) = 970 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 971 972 yy_current_state = yy_get_previous_state( ); 973 974 yy_cp = (yy_c_buf_p); 975 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 976 goto yy_find_action; 977 } 978 break; 979 } 980 981 default: 982 YY_FATAL_ERROR( 983 "fatal flex scanner internal error--no action found" ); 984 } /* end of action switch */ 985 } /* end of scanning one token */ 986 } /* end of user's declarations */ 987 } /* end of yylex */ 988 989 /* yy_get_next_buffer - try to read in a new buffer 990 * 991 * Returns a code representing an action: 992 * EOB_ACT_LAST_MATCH - 993 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 994 * EOB_ACT_END_OF_FILE - end of file 995 */ 996 static int yy_get_next_buffer (void) 997 { 998 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 999 char *source = (yytext_ptr); 1000 int number_to_move, i; 1001 int ret_val; 1002 1003 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 1004 YY_FATAL_ERROR( 1005 "fatal flex scanner internal error--end of buffer missed" ); 1006 1007 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1008 { /* Don't try to fill the buffer, so this is an EOF. */ 1009 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 1010 { 1011 /* We matched a single character, the EOB, so 1012 * treat this as a final EOF. 1013 */ 1014 return EOB_ACT_END_OF_FILE; 1015 } 1016 1017 else 1018 { 1019 /* We matched some text prior to the EOB, first 1020 * process it. 1021 */ 1022 return EOB_ACT_LAST_MATCH; 1023 } 1024 } 1025 1026 /* Try to read more data. */ 1027 1028 /* First move last chars to start of buffer. */ 1029 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); 1030 1031 for ( i = 0; i < number_to_move; ++i ) 1032 *(dest++) = *(source++); 1033 1034 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1035 /* don't do the read, it's not guaranteed to return an EOF, 1036 * just force an EOF 1037 */ 1038 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 1039 1040 else 1041 { 1042 int num_to_read = 1043 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1044 1045 while ( num_to_read <= 0 ) 1046 { /* Not enough room in the buffer - grow it. */ 1047 1048 /* just a shorter name for the current buffer */ 1049 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; 1050 1051 int yy_c_buf_p_offset = 1052 (int) ((yy_c_buf_p) - b->yy_ch_buf); 1053 1054 if ( b->yy_is_our_buffer ) 1055 { 1056 int new_size = b->yy_buf_size * 2; 1057 1058 if ( new_size <= 0 ) 1059 b->yy_buf_size += b->yy_buf_size / 8; 1060 else 1061 b->yy_buf_size *= 2; 1062 1063 b->yy_ch_buf = (char *) 1064 /* Include room in for 2 EOB chars. */ 1065 yyrealloc( (void *) b->yy_ch_buf, 1066 (yy_size_t) (b->yy_buf_size + 2) ); 1067 } 1068 else 1069 /* Can't grow it, we don't own it. */ 1070 b->yy_ch_buf = NULL; 1071 1072 if ( ! b->yy_ch_buf ) 1073 YY_FATAL_ERROR( 1074 "fatal error - scanner input buffer overflow" ); 1075 1076 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 1077 1078 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1079 number_to_move - 1; 1080 1081 } 1082 1083 if ( num_to_read > YY_READ_BUF_SIZE ) 1084 num_to_read = YY_READ_BUF_SIZE; 1085 1086 /* Read in more data. */ 1087 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1088 (yy_n_chars), num_to_read ); 1089 1090 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1091 } 1092 1093 if ( (yy_n_chars) == 0 ) 1094 { 1095 if ( number_to_move == YY_MORE_ADJ ) 1096 { 1097 ret_val = EOB_ACT_END_OF_FILE; 1098 yyrestart( yyin ); 1099 } 1100 1101 else 1102 { 1103 ret_val = EOB_ACT_LAST_MATCH; 1104 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1105 YY_BUFFER_EOF_PENDING; 1106 } 1107 } 1108 1109 else 1110 ret_val = EOB_ACT_CONTINUE_SCAN; 1111 1112 if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1113 /* Extend the array by 50%, plus the number we really need. */ 1114 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 1115 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( 1116 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); 1117 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1118 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1119 /* "- 2" to take care of EOB's */ 1120 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); 1121 } 1122 1123 (yy_n_chars) += number_to_move; 1124 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1125 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1126 1127 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1128 1129 return ret_val; 1130 } 1131 1132 /* yy_get_previous_state - get the state just before the EOB char was reached */ 1133 1134 static yy_state_type yy_get_previous_state (void) 1135 { 1136 yy_state_type yy_current_state; 1137 char *yy_cp; 1138 1139 yy_current_state = (yy_start); 1140 1141 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 1142 { 1143 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1144 if ( yy_accept[yy_current_state] ) 1145 { 1146 (yy_last_accepting_state) = yy_current_state; 1147 (yy_last_accepting_cpos) = yy_cp; 1148 } 1149 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1150 { 1151 yy_current_state = (int) yy_def[yy_current_state]; 1152 if ( yy_current_state >= 35 ) 1153 yy_c = yy_meta[yy_c]; 1154 } 1155 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; 1156 } 1157 1158 return yy_current_state; 1159 } 1160 1161 /* yy_try_NUL_trans - try to make a transition on the NUL character 1162 * 1163 * synopsis 1164 * next_state = yy_try_NUL_trans( current_state ); 1165 */ 1166 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 1167 { 1168 int yy_is_jam; 1169 char *yy_cp = (yy_c_buf_p); 1170 1171 YY_CHAR yy_c = 1; 1172 if ( yy_accept[yy_current_state] ) 1173 { 1174 (yy_last_accepting_state) = yy_current_state; 1175 (yy_last_accepting_cpos) = yy_cp; 1176 } 1177 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1178 { 1179 yy_current_state = (int) yy_def[yy_current_state]; 1180 if ( yy_current_state >= 35 ) 1181 yy_c = yy_meta[yy_c]; 1182 } 1183 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; 1184 yy_is_jam = (yy_current_state == 34); 1185 1186 return yy_is_jam ? 0 : yy_current_state; 1187 } 1188 1189 #ifndef YY_NO_UNPUT 1190 1191 #endif 1192 1193 #ifndef YY_NO_INPUT 1194 #ifdef __cplusplus 1195 static int yyinput (void) 1196 #else 1197 static int input (void) 1198 #endif 1199 1200 { 1201 int c; 1202 1203 *(yy_c_buf_p) = (yy_hold_char); 1204 1205 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 1206 { 1207 /* yy_c_buf_p now points to the character we want to return. 1208 * If this occurs *before* the EOB characters, then it's a 1209 * valid NUL; if not, then we've hit the end of the buffer. 1210 */ 1211 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1212 /* This was really a NUL. */ 1213 *(yy_c_buf_p) = '\0'; 1214 1215 else 1216 { /* need more input */ 1217 int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); 1218 ++(yy_c_buf_p); 1219 1220 switch ( yy_get_next_buffer( ) ) 1221 { 1222 case EOB_ACT_LAST_MATCH: 1223 /* This happens because yy_g_n_b() 1224 * sees that we've accumulated a 1225 * token and flags that we need to 1226 * try matching the token before 1227 * proceeding. But for input(), 1228 * there's no matching to consider. 1229 * So convert the EOB_ACT_LAST_MATCH 1230 * to EOB_ACT_END_OF_FILE. 1231 */ 1232 1233 /* Reset buffer status. */ 1234 yyrestart( yyin ); 1235 1236 /*FALLTHROUGH*/ 1237 1238 case EOB_ACT_END_OF_FILE: 1239 { 1240 if ( yywrap( ) ) 1241 return 0; 1242 1243 if ( ! (yy_did_buffer_switch_on_eof) ) 1244 YY_NEW_FILE; 1245 #ifdef __cplusplus 1246 return yyinput(); 1247 #else 1248 return input(); 1249 #endif 1250 } 1251 1252 case EOB_ACT_CONTINUE_SCAN: 1253 (yy_c_buf_p) = (yytext_ptr) + offset; 1254 break; 1255 } 1256 } 1257 } 1258 1259 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 1260 *(yy_c_buf_p) = '\0'; /* preserve yytext */ 1261 (yy_hold_char) = *++(yy_c_buf_p); 1262 1263 return c; 1264 } 1265 #endif /* ifndef YY_NO_INPUT */ 1266 1267 /** Immediately switch to a different input stream. 1268 * @param input_file A readable stream. 1269 * 1270 * @note This function does not reset the start condition to @c INITIAL . 1271 */ 1272 void yyrestart (FILE * input_file ) 1273 { 1274 1275 if ( ! YY_CURRENT_BUFFER ){ 1276 yyensure_buffer_stack (); 1277 YY_CURRENT_BUFFER_LVALUE = 1278 yy_create_buffer( yyin, YY_BUF_SIZE ); 1279 } 1280 1281 yy_init_buffer( YY_CURRENT_BUFFER, input_file ); 1282 yy_load_buffer_state( ); 1283 } 1284 1285 /** Switch to a different input buffer. 1286 * @param new_buffer The new input buffer. 1287 * 1288 */ 1289 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) 1290 { 1291 1292 /* TODO. We should be able to replace this entire function body 1293 * with 1294 * yypop_buffer_state(); 1295 * yypush_buffer_state(new_buffer); 1296 */ 1297 yyensure_buffer_stack (); 1298 if ( YY_CURRENT_BUFFER == new_buffer ) 1299 return; 1300 1301 if ( YY_CURRENT_BUFFER ) 1302 { 1303 /* Flush out information for old buffer. */ 1304 *(yy_c_buf_p) = (yy_hold_char); 1305 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1306 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1307 } 1308 1309 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1310 yy_load_buffer_state( ); 1311 1312 /* We don't actually know whether we did this switch during 1313 * EOF (yywrap()) processing, but the only time this flag 1314 * is looked at is after yywrap() is called, so it's safe 1315 * to go ahead and always set it. 1316 */ 1317 (yy_did_buffer_switch_on_eof) = 1; 1318 } 1319 1320 static void yy_load_buffer_state (void) 1321 { 1322 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1323 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1324 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1325 (yy_hold_char) = *(yy_c_buf_p); 1326 } 1327 1328 /** Allocate and initialize an input buffer state. 1329 * @param file A readable stream. 1330 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1331 * 1332 * @return the allocated buffer state. 1333 */ 1334 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) 1335 { 1336 YY_BUFFER_STATE b; 1337 1338 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); 1339 if ( ! b ) 1340 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1341 1342 b->yy_buf_size = size; 1343 1344 /* yy_ch_buf has to be 2 characters longer than the size given because 1345 * we need to put in 2 end-of-buffer characters. 1346 */ 1347 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); 1348 if ( ! b->yy_ch_buf ) 1349 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1350 1351 b->yy_is_our_buffer = 1; 1352 1353 yy_init_buffer( b, file ); 1354 1355 return b; 1356 } 1357 1358 /** Destroy the buffer. 1359 * @param b a buffer created with yy_create_buffer() 1360 * 1361 */ 1362 void yy_delete_buffer (YY_BUFFER_STATE b ) 1363 { 1364 1365 if ( ! b ) 1366 return; 1367 1368 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1369 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1370 1371 if ( b->yy_is_our_buffer ) 1372 yyfree( (void *) b->yy_ch_buf ); 1373 1374 yyfree( (void *) b ); 1375 } 1376 1377 /* Initializes or reinitializes a buffer. 1378 * This function is sometimes called more than once on the same buffer, 1379 * such as during a yyrestart() or at EOF. 1380 */ 1381 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) 1382 1383 { 1384 int oerrno = errno; 1385 1386 yy_flush_buffer( b ); 1387 1388 b->yy_input_file = file; 1389 b->yy_fill_buffer = 1; 1390 1391 /* If b is the current buffer, then yy_init_buffer was _probably_ 1392 * called from yyrestart() or through yy_get_next_buffer. 1393 * In that case, we don't want to reset the lineno or column. 1394 */ 1395 if (b != YY_CURRENT_BUFFER){ 1396 b->yy_bs_lineno = 1; 1397 b->yy_bs_column = 0; 1398 } 1399 1400 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 1401 1402 errno = oerrno; 1403 } 1404 1405 /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1406 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1407 * 1408 */ 1409 void yy_flush_buffer (YY_BUFFER_STATE b ) 1410 { 1411 if ( ! b ) 1412 return; 1413 1414 b->yy_n_chars = 0; 1415 1416 /* We always need two end-of-buffer characters. The first causes 1417 * a transition to the end-of-buffer state. The second causes 1418 * a jam in that state. 1419 */ 1420 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1421 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1422 1423 b->yy_buf_pos = &b->yy_ch_buf[0]; 1424 1425 b->yy_at_bol = 1; 1426 b->yy_buffer_status = YY_BUFFER_NEW; 1427 1428 if ( b == YY_CURRENT_BUFFER ) 1429 yy_load_buffer_state( ); 1430 } 1431 1432 /** Pushes the new state onto the stack. The new state becomes 1433 * the current state. This function will allocate the stack 1434 * if necessary. 1435 * @param new_buffer The new state. 1436 * 1437 */ 1438 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) 1439 { 1440 if (new_buffer == NULL) 1441 return; 1442 1443 yyensure_buffer_stack(); 1444 1445 /* This block is copied from yy_switch_to_buffer. */ 1446 if ( YY_CURRENT_BUFFER ) 1447 { 1448 /* Flush out information for old buffer. */ 1449 *(yy_c_buf_p) = (yy_hold_char); 1450 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1451 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1452 } 1453 1454 /* Only push if top exists. Otherwise, replace top. */ 1455 if (YY_CURRENT_BUFFER) 1456 (yy_buffer_stack_top)++; 1457 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1458 1459 /* copied from yy_switch_to_buffer. */ 1460 yy_load_buffer_state( ); 1461 (yy_did_buffer_switch_on_eof) = 1; 1462 } 1463 1464 /** Removes and deletes the top of the stack, if present. 1465 * The next element becomes the new top. 1466 * 1467 */ 1468 void yypop_buffer_state (void) 1469 { 1470 if (!YY_CURRENT_BUFFER) 1471 return; 1472 1473 yy_delete_buffer(YY_CURRENT_BUFFER ); 1474 YY_CURRENT_BUFFER_LVALUE = NULL; 1475 if ((yy_buffer_stack_top) > 0) 1476 --(yy_buffer_stack_top); 1477 1478 if (YY_CURRENT_BUFFER) { 1479 yy_load_buffer_state( ); 1480 (yy_did_buffer_switch_on_eof) = 1; 1481 } 1482 } 1483 1484 /* Allocates the stack if it does not exist. 1485 * Guarantees space for at least one push. 1486 */ 1487 static void yyensure_buffer_stack (void) 1488 { 1489 yy_size_t num_to_alloc; 1490 1491 if (!(yy_buffer_stack)) { 1492 1493 /* First allocation is just for 2 elements, since we don't know if this 1494 * scanner will even need a stack. We use 2 instead of 1 to avoid an 1495 * immediate realloc on the next call. 1496 */ 1497 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ 1498 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 1499 (num_to_alloc * sizeof(struct yy_buffer_state*) 1500 ); 1501 if ( ! (yy_buffer_stack) ) 1502 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1503 1504 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1505 1506 (yy_buffer_stack_max) = num_to_alloc; 1507 (yy_buffer_stack_top) = 0; 1508 return; 1509 } 1510 1511 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 1512 1513 /* Increase the buffer to prepare for a possible push. */ 1514 yy_size_t grow_size = 8 /* arbitrary grow size */; 1515 1516 num_to_alloc = (yy_buffer_stack_max) + grow_size; 1517 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 1518 ((yy_buffer_stack), 1519 num_to_alloc * sizeof(struct yy_buffer_state*) 1520 ); 1521 if ( ! (yy_buffer_stack) ) 1522 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1523 1524 /* zero only the new slots.*/ 1525 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1526 (yy_buffer_stack_max) = num_to_alloc; 1527 } 1528 } 1529 1530 /** Setup the input buffer state to scan directly from a user-specified character buffer. 1531 * @param base the character buffer 1532 * @param size the size in bytes of the character buffer 1533 * 1534 * @return the newly allocated buffer state object. 1535 */ 1536 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 1537 { 1538 YY_BUFFER_STATE b; 1539 1540 if ( size < 2 || 1541 base[size-2] != YY_END_OF_BUFFER_CHAR || 1542 base[size-1] != YY_END_OF_BUFFER_CHAR ) 1543 /* They forgot to leave room for the EOB's. */ 1544 return NULL; 1545 1546 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); 1547 if ( ! b ) 1548 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 1549 1550 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ 1551 b->yy_buf_pos = b->yy_ch_buf = base; 1552 b->yy_is_our_buffer = 0; 1553 b->yy_input_file = NULL; 1554 b->yy_n_chars = b->yy_buf_size; 1555 b->yy_is_interactive = 0; 1556 b->yy_at_bol = 1; 1557 b->yy_fill_buffer = 0; 1558 b->yy_buffer_status = YY_BUFFER_NEW; 1559 1560 yy_switch_to_buffer( b ); 1561 1562 return b; 1563 } 1564 1565 /** Setup the input buffer state to scan a string. The next call to yylex() will 1566 * scan from a @e copy of @a str. 1567 * @param yystr a NUL-terminated string to scan 1568 * 1569 * @return the newly allocated buffer state object. 1570 * @note If you want to scan bytes that may contain NUL values, then use 1571 * yy_scan_bytes() instead. 1572 */ 1573 YY_BUFFER_STATE yy_scan_string (const char * yystr ) 1574 { 1575 1576 return yy_scan_bytes( yystr, (int) strlen(yystr) ); 1577 } 1578 1579 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will 1580 * scan from a @e copy of @a bytes. 1581 * @param yybytes the byte buffer to scan 1582 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 1583 * 1584 * @return the newly allocated buffer state object. 1585 */ 1586 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) 1587 { 1588 YY_BUFFER_STATE b; 1589 char *buf; 1590 yy_size_t n; 1591 int i; 1592 1593 /* Get memory for full buffer, including space for trailing EOB's. */ 1594 n = (yy_size_t) (_yybytes_len + 2); 1595 buf = (char *) yyalloc( n ); 1596 if ( ! buf ) 1597 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 1598 1599 for ( i = 0; i < _yybytes_len; ++i ) 1600 buf[i] = yybytes[i]; 1601 1602 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 1603 1604 b = yy_scan_buffer( buf, n ); 1605 if ( ! b ) 1606 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 1607 1608 /* It's okay to grow etc. this buffer, and we should throw it 1609 * away when we're done. 1610 */ 1611 b->yy_is_our_buffer = 1; 1612 1613 return b; 1614 } 1615 1616 #ifndef YY_EXIT_FAILURE 1617 #define YY_EXIT_FAILURE 2 1618 #endif 1619 1620 static void yynoreturn yy_fatal_error (const char* msg ) 1621 { 1622 fprintf( stderr, "%s\n", msg ); 1623 exit( YY_EXIT_FAILURE ); 1624 } 1625 1626 /* Redefine yyless() so it works in section 3 code. */ 1627 1628 #undef yyless 1629 #define yyless(n) \ 1630 do \ 1631 { \ 1632 /* Undo effects of setting up yytext. */ \ 1633 int yyless_macro_arg = (n); \ 1634 YY_LESS_LINENO(yyless_macro_arg);\ 1635 yytext[yyleng] = (yy_hold_char); \ 1636 (yy_c_buf_p) = yytext + yyless_macro_arg; \ 1637 (yy_hold_char) = *(yy_c_buf_p); \ 1638 *(yy_c_buf_p) = '\0'; \ 1639 yyleng = yyless_macro_arg; \ 1640 } \ 1641 while ( 0 ) 1642 1643 /* Accessor methods (get/set functions) to struct members. */ 1644 1645 /** Get the current line number. 1646 * 1647 */ 1648 int yyget_lineno (void) 1649 { 1650 1651 return yylineno; 1652 } 1653 1654 /** Get the input stream. 1655 * 1656 */ 1657 FILE *yyget_in (void) 1658 { 1659 return yyin; 1660 } 1661 1662 /** Get the output stream. 1663 * 1664 */ 1665 FILE *yyget_out (void) 1666 { 1667 return yyout; 1668 } 1669 1670 /** Get the length of the current token. 1671 * 1672 */ 1673 int yyget_leng (void) 1674 { 1675 return yyleng; 1676 } 1677 1678 /** Get the current token. 1679 * 1680 */ 1681 1682 char *yyget_text (void) 1683 { 1684 return yytext; 1685 } 1686 1687 /** Set the current line number. 1688 * @param _line_number line number 1689 * 1690 */ 1691 void yyset_lineno (int _line_number ) 1692 { 1693 1694 yylineno = _line_number; 1695 } 1696 1697 /** Set the input stream. This does not discard the current 1698 * input buffer. 1699 * @param _in_str A readable stream. 1700 * 1701 * @see yy_switch_to_buffer 1702 */ 1703 void yyset_in (FILE * _in_str ) 1704 { 1705 yyin = _in_str ; 1706 } 1707 1708 void yyset_out (FILE * _out_str ) 1709 { 1710 yyout = _out_str ; 1711 } 1712 1713 int yyget_debug (void) 1714 { 1715 return yy_flex_debug; 1716 } 1717 1718 void yyset_debug (int _bdebug ) 1719 { 1720 yy_flex_debug = _bdebug ; 1721 } 1722 1723 static int yy_init_globals (void) 1724 { 1725 /* Initialization is the same as for the non-reentrant scanner. 1726 * This function is called from yylex_destroy(), so don't allocate here. 1727 */ 1728 1729 (yy_buffer_stack) = NULL; 1730 (yy_buffer_stack_top) = 0; 1731 (yy_buffer_stack_max) = 0; 1732 (yy_c_buf_p) = NULL; 1733 (yy_init) = 0; 1734 (yy_start) = 0; 1735 1736 /* Defined in main.c */ 1737 #ifdef YY_STDINIT 1738 yyin = stdin; 1739 yyout = stdout; 1740 #else 1741 yyin = NULL; 1742 yyout = NULL; 1743 #endif 1744 1745 /* For future reference: Set errno on error, since we are called by 1746 * yylex_init() 1747 */ 1748 return 0; 1749 } 1750 1751 /* yylex_destroy is for both reentrant and non-reentrant scanners. */ 1752 int yylex_destroy (void) 1753 { 1754 1755 /* Pop the buffer stack, destroying each element. */ 1756 while(YY_CURRENT_BUFFER){ 1757 yy_delete_buffer( YY_CURRENT_BUFFER ); 1758 YY_CURRENT_BUFFER_LVALUE = NULL; 1759 yypop_buffer_state(); 1760 } 1761 1762 /* Destroy the stack itself. */ 1763 yyfree((yy_buffer_stack) ); 1764 (yy_buffer_stack) = NULL; 1765 1766 /* Reset the globals. This is important in a non-reentrant scanner so the next time 1767 * yylex() is called, initialization will occur. */ 1768 yy_init_globals( ); 1769 1770 return 0; 1771 } 1772 1773 /* 1774 * Internal utility routines. 1775 */ 1776 1777 #ifndef yytext_ptr 1778 static void yy_flex_strncpy (char* s1, const char * s2, int n ) 1779 { 1780 1781 int i; 1782 for ( i = 0; i < n; ++i ) 1783 s1[i] = s2[i]; 1784 } 1785 #endif 1786 1787 #ifdef YY_NEED_STRLEN 1788 static int yy_flex_strlen (const char * s ) 1789 { 1790 int n; 1791 for ( n = 0; s[n]; ++n ) 1792 ; 1793 1794 return n; 1795 } 1796 #endif 1797 1798 void *yyalloc (yy_size_t size ) 1799 { 1800 return malloc(size); 1801 } 1802 1803 void *yyrealloc (void * ptr, yy_size_t size ) 1804 { 1805 1806 /* The cast to (char *) in the following accommodates both 1807 * implementations that use char* generic pointers, and those 1808 * that use void* generic pointers. It works with the latter 1809 * because both ANSI C and C++ allow castless assignment from 1810 * any pointer type to void*, and deal with argument conversions 1811 * as though doing an assignment. 1812 */ 1813 return realloc(ptr, size); 1814 } 1815 1816 void yyfree (void * ptr ) 1817 { 1818 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 1819 } 1820 1821 #define YYTABLES_NAME "yytables" 1822 1823 #line 67 "tokenizer.l" 1824 1825 1826 int32_t 1827 number(void) 1828 { 1829 long l; 1830 1831 errno = 0; 1832 l = strtol(yytext, NULL, 0); 1833 if (((l == LONG_MAX || l == LONG_MIN) && errno == ERANGE) || 1834 l > INT32_MAX || l < INT32_MIN) { 1835 m4_warnx("numeric overflow in expr: %s", yytext); 1836 } 1837 return l; 1838 } 1839 1840 int32_t 1841 parse_radix(void) 1842 { 1843 long base; 1844 char *next; 1845 long l; 1846 int d; 1847 1848 l = 0; 1849 base = strtol(yytext+2, &next, 0); 1850 if (base > 36 || next == NULL) { 1851 m4_warnx("error in number %s", yytext); 1852 } else { 1853 next++; 1854 while (*next != 0) { 1855 if (*next >= '0' && *next <= '9') 1856 d = *next - '0'; 1857 else if (*next >= 'a' && *next <= 'z') 1858 d = *next - 'a' + 10; 1859 else { 1860 assert(*next >= 'A' && *next <= 'Z'); 1861 d = *next - 'A' + 10; 1862 } 1863 if (d >= base) { 1864 m4_warnx("error in number %s", yytext); 1865 return 0; 1866 } 1867 l = base * l + d; 1868 next++; 1869 } 1870 } 1871 return l; 1872 } 1873 1874 1875