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