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