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