source: liacs/coco/assignment1/gen/lex.yy.c@ 151

Last change on this file since 151 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

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