source: mainline/uspace/app/ash/lex.yy.c@ 8ccd2ea

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 8ccd2ea was c28a023, checked in by Josef Cejka <malyzelenyhnus@…>, 17 years ago

Initial commit of ash shell.
It cannot be compiled yet.

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