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