1 /* A lexical scanner generated by flex*/
3 /* Scanner skeleton version:
4 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
15 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
27 /* Use prototypes in function declarations. */
30 /* The "const" storage-class-modifier is valid. */
33 #else /* ! __cplusplus */
41 #endif /* ! __cplusplus */
60 #define YY_PROTO(proto) proto
62 #define YY_PROTO(proto) ()
65 /* Returned upon end-of-file. */
68 /* Promotes a possibly negative, possibly signed char to an unsigned
69 * integer for use as an array index. If the signed char is negative,
70 * we want to instead treat it as an 8-bit unsigned char, hence the
73 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
75 /* Enter a start condition. This macro really ought to take a parameter,
76 * but we do it the disgusting crufty way forced on us by the ()-less
77 * definition of BEGIN.
79 #define BEGIN yy_start = 1 + 2 *
81 /* Translate the current start state into a value that can be later handed
82 * to BEGIN to return to the state. The YYSTATE alias is for lex
85 #define YY_START ((yy_start - 1) / 2)
86 #define YYSTATE YY_START
88 /* Action number for EOF rule of a given start state. */
89 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
91 /* Special action meaning "start processing a new file". */
92 #define YY_NEW_FILE yyrestart( yyin )
94 #define YY_END_OF_BUFFER_CHAR 0
96 /* Size of default input buffer. */
97 #define YY_BUF_SIZE 16384
99 typedef struct yy_buffer_state *YY_BUFFER_STATE;
102 extern FILE *yyin, *yyout;
104 #define EOB_ACT_CONTINUE_SCAN 0
105 #define EOB_ACT_END_OF_FILE 1
106 #define EOB_ACT_LAST_MATCH 2
108 /* The funky do-while in the following #define is used to turn the definition
109 * int a single C statement (which needs a semi-colon terminator). This
110 * avoids problems with code like:
112 * if ( condition_holds )
115 * do_something_else();
117 * Prior to using the do-while the compiler would get upset at the
118 * "else" because it interpreted the "if" statement as being all
119 * done when it reached the ';' after the yyless() call.
122 /* Return all but the first 'n' matched characters back to the input stream. */
127 /* Undo effects of setting up yytext. */ \
128 *yy_cp = yy_hold_char; \
129 YY_RESTORE_YY_MORE_OFFSET \
130 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
131 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
135 #define unput(c) yyunput( c, yytext_ptr )
137 /* Some routines like yy_flex_realloc() are emitted as static but are
138 not called by all lexers. This generates warnings in some compilers,
139 notably GCC. Arrange to suppress these. */
141 #define YY_MAY_BE_UNUSED __attribute__((unused))
143 #define YY_MAY_BE_UNUSED
146 /* The following is because we cannot portably get our hands on size_t
147 * (without autoconf's help, which isn't available because we want
148 * flex-generated scanners to compile on their own).
150 typedef unsigned int yy_size_t;
153 struct yy_buffer_state
157 char *yy_ch_buf; /* input buffer */
158 char *yy_buf_pos; /* current position in input buffer */
160 /* Size of input buffer in bytes, not including room for EOB
163 yy_size_t yy_buf_size;
165 /* Number of characters read into yy_ch_buf, not including EOB
170 /* Whether we "own" the buffer - i.e., we know we created it,
171 * and can realloc() it to grow it, and should free() it to
174 int yy_is_our_buffer;
176 /* Whether this is an "interactive" input source; if so, and
177 * if we're using stdio for input, then we want to use getc()
178 * instead of fread(), to make sure we stop fetching input after
181 int yy_is_interactive;
183 /* Whether we're considered to be at the beginning of a line.
184 * If so, '^' rules will be active on the next match, otherwise
189 /* Whether to try to fill the input buffer when we reach the
194 int yy_buffer_status;
195 #define YY_BUFFER_NEW 0
196 #define YY_BUFFER_NORMAL 1
197 /* When an EOF's been seen but there's still some text to process
198 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
199 * shouldn't try reading from the input source any more. We might
200 * still have a bunch of tokens to match, though, because of
201 * possible backing-up.
203 * When we actually see the EOF, we change the status to "new"
204 * (via yyrestart()), so that the user can continue scanning by
205 * just pointing yyin at a new input file.
207 #define YY_BUFFER_EOF_PENDING 2
210 static YY_BUFFER_STATE yy_current_buffer = 0;
212 /* We provide macros for accessing buffer states in case in the
213 * future we want to put the buffer states in a more general
216 #define YY_CURRENT_BUFFER yy_current_buffer
219 /* yy_hold_char holds the character lost when yytext is formed. */
220 static char yy_hold_char;
222 static int yy_n_chars; /* number of characters read into yy_ch_buf */
227 /* Points to current character in buffer. */
228 static char *yy_c_buf_p = (char *) 0;
229 static int yy_init = 1; /* whether we need to initialize */
230 static int yy_start = 0; /* start state number */
232 /* Flag which is used to allow yywrap()'s to do buffer switches
233 * instead of setting up a fresh yyin. A bit of a hack ...
235 static int yy_did_buffer_switch_on_eof;
237 void yyrestart YY_PROTO(( FILE *input_file ));
239 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
240 void yy_load_buffer_state YY_PROTO(( void ));
241 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
242 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
243 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
244 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
245 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
247 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
248 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
249 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
251 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
252 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED;
253 static void yy_flex_free YY_PROTO(( void * ));
255 #define yy_new_buffer yy_create_buffer
257 #define yy_set_interactive(is_interactive) \
259 if ( ! yy_current_buffer ) \
260 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
261 yy_current_buffer->yy_is_interactive = is_interactive; \
264 #define yy_set_bol(at_bol) \
266 if ( ! yy_current_buffer ) \
267 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
268 yy_current_buffer->yy_at_bol = at_bol; \
271 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
273 typedef unsigned char YY_CHAR;
274 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
275 typedef int yy_state_type;
277 #define yytext_ptr yytext
279 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
280 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
281 static int yy_get_next_buffer YY_PROTO(( void ));
282 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
284 /* Done after the current pattern has been matched and before the
285 * corresponding action - sets up yytext.
287 #define YY_DO_BEFORE_ACTION \
288 yytext_ptr = yy_bp; \
289 yyleng = (int) (yy_cp - yy_bp); \
290 yy_hold_char = *yy_cp; \
294 #define YY_NUM_RULES 16
295 #define YY_END_OF_BUFFER 17
296 static yyconst short int yy_accept[46] =
298 0, 0, 17, 15, 11, 12, 13, 10, 9, 14,
299 14, 14, 14, 10, 9, 14, 3, 14, 14, 1,
300 7, 14, 14, 8, 14, 14, 14, 14, 14, 14,
301 14, 6, 14, 14, 5, 14, 14, 14, 14, 14,
305 static yyconst int yy_ec[256] =
307 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
308 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
309 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
310 1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
311 1, 1, 1, 1, 1, 1, 1, 6, 6, 6,
312 6, 6, 6, 6, 6, 6, 6, 1, 1, 1,
313 1, 1, 1, 1, 7, 7, 7, 7, 7, 7,
314 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
315 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
316 1, 1, 1, 1, 8, 1, 9, 10, 11, 12,
318 13, 14, 7, 7, 15, 7, 7, 16, 7, 17,
319 18, 19, 7, 20, 7, 21, 7, 7, 7, 22,
320 7, 7, 1, 1, 1, 1, 1, 1, 1, 1,
321 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
322 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
323 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
324 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
325 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
326 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
327 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
329 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
330 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
331 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
332 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
333 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
337 static yyconst int yy_meta[23] =
339 1, 1, 2, 1, 1, 3, 3, 3, 3, 3,
340 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
344 static yyconst short int yy_base[48] =
346 0, 0, 56, 57, 57, 57, 57, 0, 49, 0,
347 12, 13, 34, 0, 47, 0, 0, 40, 31, 0,
348 0, 38, 36, 0, 30, 34, 32, 25, 22, 28,
349 34, 0, 19, 13, 0, 22, 30, 26, 26, 18,
350 12, 0, 14, 0, 57, 34, 23
353 static yyconst short int yy_def[48] =
355 45, 1, 45, 45, 45, 45, 45, 46, 47, 47,
356 47, 47, 47, 46, 47, 47, 47, 47, 47, 47,
357 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
358 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
359 47, 47, 47, 47, 0, 45, 45
362 static yyconst short int yy_nxt[80] =
364 4, 5, 6, 7, 8, 9, 10, 10, 10, 10,
365 10, 10, 11, 10, 12, 10, 10, 10, 13, 10,
366 10, 10, 17, 36, 21, 16, 44, 43, 18, 22,
367 42, 19, 20, 37, 14, 41, 14, 40, 39, 38,
368 35, 34, 33, 32, 31, 30, 29, 28, 27, 26,
369 25, 24, 15, 23, 15, 45, 3, 45, 45, 45,
370 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
371 45, 45, 45, 45, 45, 45, 45, 45, 45
374 static yyconst short int yy_chk[80] =
376 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
377 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
378 1, 1, 11, 34, 12, 47, 43, 41, 11, 12,
379 40, 11, 11, 34, 46, 39, 46, 38, 37, 36,
380 33, 31, 30, 29, 28, 27, 26, 25, 23, 22,
381 19, 18, 15, 13, 9, 3, 45, 45, 45, 45,
382 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
383 45, 45, 45, 45, 45, 45, 45, 45, 45
386 static yy_state_type yy_last_accepting_state;
387 static char *yy_last_accepting_cpos;
389 /* The intent behind this definition is that it'll catch
390 * any uses of REJECT which flex missed.
392 #define REJECT reject_used_but_not_detected
393 #define yymore() yymore_used_but_not_detected
394 #define YY_MORE_ADJ 0
395 #define YY_RESTORE_YY_MORE_OFFSET
401 * Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
402 * (Royal Institute of Technology, Stockholm, Sweden).
403 * All rights reserved.
405 * Redistribution and use in source and binary forms, with or without
406 * modification, are permitted provided that the following conditions
409 * 1. Redistributions of source code must retain the above copyright
410 * notice, this list of conditions and the following disclaimer.
412 * 2. Redistributions in binary form must reproduce the above copyright
413 * notice, this list of conditions and the following disclaimer in the
414 * documentation and/or other materials provided with the distribution.
416 * 3. Neither the name of the Institute nor the names of its contributors
417 * may be used to endorse or promote products derived from this software
418 * without specific prior written permission.
420 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
421 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
422 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
423 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
424 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
425 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
426 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
427 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
428 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
429 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
434 * This is to handle the definition of this symbol in some AIX
435 * headers, which will conflict with the definition that lex will
436 * generate for it. It's only a problem for AIX lex.
441 #include "compile_et.h"
445 RCSID("$Id: lex.l,v 1.8 2005/05/16 08:52:54 lha Exp $");
447 static unsigned lineno = 1;
448 static int getstring(void);
456 /* Macros after this point can all be overridden by user definitions in
460 #ifndef YY_SKIP_YYWRAP
462 extern "C" int yywrap YY_PROTO(( void ));
464 extern int yywrap YY_PROTO(( void ));
469 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
473 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
476 #ifdef YY_NEED_STRLEN
477 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
482 static int yyinput YY_PROTO(( void ));
484 static int input YY_PROTO(( void ));
489 static int yy_start_stack_ptr = 0;
490 static int yy_start_stack_depth = 0;
491 static int *yy_start_stack = 0;
492 #ifndef YY_NO_PUSH_STATE
493 static void yy_push_state YY_PROTO(( int new_state ));
495 #ifndef YY_NO_POP_STATE
496 static void yy_pop_state YY_PROTO(( void ));
498 #ifndef YY_NO_TOP_STATE
499 static int yy_top_state YY_PROTO(( void ));
503 #define YY_NO_PUSH_STATE 1
504 #define YY_NO_POP_STATE 1
505 #define YY_NO_TOP_STATE 1
508 #ifdef YY_MALLOC_DECL
516 /* Just try to get by without declaring the routines. This will fail
517 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
518 * or sizeof(void*) != sizeof(int).
523 /* Amount of stuff to slurp up with each read. */
524 #ifndef YY_READ_BUF_SIZE
525 #define YY_READ_BUF_SIZE 8192
528 /* Copy whatever the last rule matched to the standard output. */
531 /* This used to be an fputs(), but since the string might contain NUL's,
532 * we now use fwrite().
534 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
537 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
538 * is returned in "result".
541 #define YY_INPUT(buf,result,max_size) \
542 if ( yy_current_buffer->yy_is_interactive ) \
545 for ( n = 0; n < max_size && \
546 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
549 buf[n++] = (char) c; \
550 if ( c == EOF && ferror( yyin ) ) \
551 YY_FATAL_ERROR( "input in flex scanner failed" ); \
554 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
555 && ferror( yyin ) ) \
556 YY_FATAL_ERROR( "input in flex scanner failed" );
559 /* No semi-colon after return; correct usage is to write "yyterminate();" -
560 * we don't want an extra ';' after the "return" because that will cause
561 * some compilers to complain about unreachable statements.
564 #define yyterminate() return YY_NULL
567 /* Number of entries by which start-condition stack grows. */
568 #ifndef YY_START_STACK_INCR
569 #define YY_START_STACK_INCR 25
572 /* Report a fatal error. */
573 #ifndef YY_FATAL_ERROR
574 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
577 /* Default declaration of generated scanner - a define so the user can
578 * easily add parameters.
581 #define YY_DECL int yylex YY_PROTO(( void ))
584 /* Code executed at the beginning of each rule, after yytext and yyleng
587 #ifndef YY_USER_ACTION
588 #define YY_USER_ACTION
591 /* Code executed at the end of each rule. */
593 #define YY_BREAK break;
596 #define YY_RULE_SETUP \
601 register yy_state_type yy_current_state;
602 register char *yy_cp = NULL, *yy_bp = NULL;
618 yy_start = 1; /* first start state */
626 if ( ! yy_current_buffer )
628 yy_create_buffer( yyin, YY_BUF_SIZE );
630 yy_load_buffer_state();
633 while ( 1 ) /* loops until end-of-file is reached */
637 /* Support of yytext. */
638 *yy_cp = yy_hold_char;
640 /* yy_bp points to the position in yy_ch_buf of the start of
645 yy_current_state = yy_start;
649 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
650 if ( yy_accept[yy_current_state] )
652 yy_last_accepting_state = yy_current_state;
653 yy_last_accepting_cpos = yy_cp;
655 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
657 yy_current_state = (int) yy_def[yy_current_state];
658 if ( yy_current_state >= 46 )
659 yy_c = yy_meta[(unsigned int) yy_c];
661 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
664 while ( yy_base[yy_current_state] != 57 );
667 yy_act = yy_accept[yy_current_state];
669 { /* have to back up */
670 yy_cp = yy_last_accepting_cpos;
671 yy_current_state = yy_last_accepting_state;
672 yy_act = yy_accept[yy_current_state];
678 do_action: /* This label is used only to access EOF actions. */
682 { /* beginning of action switch */
683 case 0: /* must back up */
684 /* undo the effects of YY_DO_BEFORE_ACTION */
685 *yy_cp = yy_hold_char;
686 yy_cp = yy_last_accepting_cpos;
687 yy_current_state = yy_last_accepting_state;
733 { yylval.number = atoi(yytext); return NUMBER; }
753 { return getstring(); }
758 { yylval.string = strdup(yytext); return STRING; }
771 case YY_STATE_EOF(INITIAL):
774 case YY_END_OF_BUFFER:
776 /* Amount of text matched not including the EOB char. */
777 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
779 /* Undo the effects of YY_DO_BEFORE_ACTION. */
780 *yy_cp = yy_hold_char;
781 YY_RESTORE_YY_MORE_OFFSET
783 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
785 /* We're scanning a new file or input source. It's
786 * possible that this happened because the user
787 * just pointed yyin at a new source and called
788 * yylex(). If so, then we have to assure
789 * consistency between yy_current_buffer and our
790 * globals. Here is the right place to do so, because
791 * this is the first action (other than possibly a
792 * back-up) that will match for the new input source.
794 yy_n_chars = yy_current_buffer->yy_n_chars;
795 yy_current_buffer->yy_input_file = yyin;
796 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
799 /* Note that here we test for yy_c_buf_p "<=" to the position
800 * of the first EOB in the buffer, since yy_c_buf_p will
801 * already have been incremented past the NUL character
802 * (since all states make transitions on EOB to the
803 * end-of-buffer state). Contrast this with the test
806 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
807 { /* This was really a NUL. */
808 yy_state_type yy_next_state;
810 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
812 yy_current_state = yy_get_previous_state();
814 /* Okay, we're now positioned to make the NUL
815 * transition. We couldn't have
816 * yy_get_previous_state() go ahead and do it
817 * for us because it doesn't know how to deal
818 * with the possibility of jamming (and we don't
819 * want to build jamming into it because then it
820 * will run more slowly).
823 yy_next_state = yy_try_NUL_trans( yy_current_state );
825 yy_bp = yytext_ptr + YY_MORE_ADJ;
829 /* Consume the NUL. */
830 yy_cp = ++yy_c_buf_p;
831 yy_current_state = yy_next_state;
842 else switch ( yy_get_next_buffer() )
844 case EOB_ACT_END_OF_FILE:
846 yy_did_buffer_switch_on_eof = 0;
850 /* Note: because we've taken care in
851 * yy_get_next_buffer() to have set up
852 * yytext, we can now set up
853 * yy_c_buf_p so that if some total
854 * hoser (like flex itself) wants to
855 * call the scanner after we return the
856 * YY_NULL, it'll still work - another
857 * YY_NULL will get returned.
859 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
861 yy_act = YY_STATE_EOF(YY_START);
867 if ( ! yy_did_buffer_switch_on_eof )
873 case EOB_ACT_CONTINUE_SCAN:
875 yytext_ptr + yy_amount_of_matched_text;
877 yy_current_state = yy_get_previous_state();
880 yy_bp = yytext_ptr + YY_MORE_ADJ;
883 case EOB_ACT_LAST_MATCH:
885 &yy_current_buffer->yy_ch_buf[yy_n_chars];
887 yy_current_state = yy_get_previous_state();
890 yy_bp = yytext_ptr + YY_MORE_ADJ;
898 "fatal flex scanner internal error--no action found" );
899 } /* end of action switch */
900 } /* end of scanning one token */
904 /* yy_get_next_buffer - try to read in a new buffer
906 * Returns a code representing an action:
907 * EOB_ACT_LAST_MATCH -
908 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
909 * EOB_ACT_END_OF_FILE - end of file
912 static int yy_get_next_buffer()
914 register char *dest = yy_current_buffer->yy_ch_buf;
915 register char *source = yytext_ptr;
916 register int number_to_move, i;
919 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
921 "fatal flex scanner internal error--end of buffer missed" );
923 if ( yy_current_buffer->yy_fill_buffer == 0 )
924 { /* Don't try to fill the buffer, so this is an EOF. */
925 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
927 /* We matched a single character, the EOB, so
928 * treat this as a final EOF.
930 return EOB_ACT_END_OF_FILE;
935 /* We matched some text prior to the EOB, first
938 return EOB_ACT_LAST_MATCH;
942 /* Try to read more data. */
944 /* First move last chars to start of buffer. */
945 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
947 for ( i = 0; i < number_to_move; ++i )
948 *(dest++) = *(source++);
950 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
951 /* don't do the read, it's not guaranteed to return an EOF,
954 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
959 yy_current_buffer->yy_buf_size - number_to_move - 1;
961 while ( num_to_read <= 0 )
962 { /* Not enough room in the buffer - grow it. */
963 #ifdef YY_USES_REJECT
965 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
968 /* just a shorter name for the current buffer */
969 YY_BUFFER_STATE b = yy_current_buffer;
971 int yy_c_buf_p_offset =
972 (int) (yy_c_buf_p - b->yy_ch_buf);
974 if ( b->yy_is_our_buffer )
976 int new_size = b->yy_buf_size * 2;
979 b->yy_buf_size += b->yy_buf_size / 8;
983 b->yy_ch_buf = (char *)
984 /* Include room in for 2 EOB chars. */
985 yy_flex_realloc( (void *) b->yy_ch_buf,
986 b->yy_buf_size + 2 );
989 /* Can't grow it, we don't own it. */
992 if ( ! b->yy_ch_buf )
994 "fatal error - scanner input buffer overflow" );
996 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
998 num_to_read = yy_current_buffer->yy_buf_size -
1003 if ( num_to_read > YY_READ_BUF_SIZE )
1004 num_to_read = YY_READ_BUF_SIZE;
1006 /* Read in more data. */
1007 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1008 yy_n_chars, num_to_read );
1010 yy_current_buffer->yy_n_chars = yy_n_chars;
1013 if ( yy_n_chars == 0 )
1015 if ( number_to_move == YY_MORE_ADJ )
1017 ret_val = EOB_ACT_END_OF_FILE;
1023 ret_val = EOB_ACT_LAST_MATCH;
1024 yy_current_buffer->yy_buffer_status =
1025 YY_BUFFER_EOF_PENDING;
1030 ret_val = EOB_ACT_CONTINUE_SCAN;
1032 yy_n_chars += number_to_move;
1033 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1034 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1036 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1042 /* yy_get_previous_state - get the state just before the EOB char was reached */
1044 static yy_state_type yy_get_previous_state()
1046 register yy_state_type yy_current_state;
1047 register char *yy_cp;
1049 yy_current_state = yy_start;
1051 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1053 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1054 if ( yy_accept[yy_current_state] )
1056 yy_last_accepting_state = yy_current_state;
1057 yy_last_accepting_cpos = yy_cp;
1059 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1061 yy_current_state = (int) yy_def[yy_current_state];
1062 if ( yy_current_state >= 46 )
1063 yy_c = yy_meta[(unsigned int) yy_c];
1065 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1068 return yy_current_state;
1072 /* yy_try_NUL_trans - try to make a transition on the NUL character
1075 * next_state = yy_try_NUL_trans( current_state );
1078 #ifdef YY_USE_PROTOS
1079 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1081 static yy_state_type yy_try_NUL_trans( yy_current_state )
1082 yy_state_type yy_current_state;
1085 register int yy_is_jam;
1086 register char *yy_cp = yy_c_buf_p;
1088 register YY_CHAR yy_c = 1;
1089 if ( yy_accept[yy_current_state] )
1091 yy_last_accepting_state = yy_current_state;
1092 yy_last_accepting_cpos = yy_cp;
1094 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1096 yy_current_state = (int) yy_def[yy_current_state];
1097 if ( yy_current_state >= 46 )
1098 yy_c = yy_meta[(unsigned int) yy_c];
1100 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1101 yy_is_jam = (yy_current_state == 45);
1103 return yy_is_jam ? 0 : yy_current_state;
1108 #ifdef YY_USE_PROTOS
1109 static void yyunput( int c, register char *yy_bp )
1111 static void yyunput( c, yy_bp )
1113 register char *yy_bp;
1116 register char *yy_cp = yy_c_buf_p;
1118 /* undo effects of setting up yytext */
1119 *yy_cp = yy_hold_char;
1121 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1122 { /* need to shift things up to make room */
1123 /* +2 for EOB chars. */
1124 register int number_to_move = yy_n_chars + 2;
1125 register char *dest = &yy_current_buffer->yy_ch_buf[
1126 yy_current_buffer->yy_buf_size + 2];
1127 register char *source =
1128 &yy_current_buffer->yy_ch_buf[number_to_move];
1130 while ( source > yy_current_buffer->yy_ch_buf )
1131 *--dest = *--source;
1133 yy_cp += (int) (dest - source);
1134 yy_bp += (int) (dest - source);
1135 yy_current_buffer->yy_n_chars =
1136 yy_n_chars = yy_current_buffer->yy_buf_size;
1138 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1139 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1142 *--yy_cp = (char) c;
1146 yy_hold_char = *yy_cp;
1149 #endif /* ifndef YY_NO_UNPUT */
1154 static int yyinput()
1161 *yy_c_buf_p = yy_hold_char;
1163 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1165 /* yy_c_buf_p now points to the character we want to return.
1166 * If this occurs *before* the EOB characters, then it's a
1167 * valid NUL; if not, then we've hit the end of the buffer.
1169 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1170 /* This was really a NUL. */
1174 { /* need more input */
1175 int offset = yy_c_buf_p - yytext_ptr;
1178 switch ( yy_get_next_buffer() )
1180 case EOB_ACT_LAST_MATCH:
1181 /* This happens because yy_g_n_b()
1182 * sees that we've accumulated a
1183 * token and flags that we need to
1184 * try matching the token before
1185 * proceeding. But for input(),
1186 * there's no matching to consider.
1187 * So convert the EOB_ACT_LAST_MATCH
1188 * to EOB_ACT_END_OF_FILE.
1191 /* Reset buffer status. */
1196 case EOB_ACT_END_OF_FILE:
1201 if ( ! yy_did_buffer_switch_on_eof )
1210 case EOB_ACT_CONTINUE_SCAN:
1211 yy_c_buf_p = yytext_ptr + offset;
1217 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1218 *yy_c_buf_p = '\0'; /* preserve yytext */
1219 yy_hold_char = *++yy_c_buf_p;
1224 #endif /* YY_NO_INPUT */
1226 #ifdef YY_USE_PROTOS
1227 void yyrestart( FILE *input_file )
1229 void yyrestart( input_file )
1233 if ( ! yy_current_buffer )
1234 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1236 yy_init_buffer( yy_current_buffer, input_file );
1237 yy_load_buffer_state();
1241 #ifdef YY_USE_PROTOS
1242 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1244 void yy_switch_to_buffer( new_buffer )
1245 YY_BUFFER_STATE new_buffer;
1248 if ( yy_current_buffer == new_buffer )
1251 if ( yy_current_buffer )
1253 /* Flush out information for old buffer. */
1254 *yy_c_buf_p = yy_hold_char;
1255 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1256 yy_current_buffer->yy_n_chars = yy_n_chars;
1259 yy_current_buffer = new_buffer;
1260 yy_load_buffer_state();
1262 /* We don't actually know whether we did this switch during
1263 * EOF (yywrap()) processing, but the only time this flag
1264 * is looked at is after yywrap() is called, so it's safe
1265 * to go ahead and always set it.
1267 yy_did_buffer_switch_on_eof = 1;
1271 #ifdef YY_USE_PROTOS
1272 void yy_load_buffer_state( void )
1274 void yy_load_buffer_state()
1277 yy_n_chars = yy_current_buffer->yy_n_chars;
1278 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1279 yyin = yy_current_buffer->yy_input_file;
1280 yy_hold_char = *yy_c_buf_p;
1284 #ifdef YY_USE_PROTOS
1285 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1287 YY_BUFFER_STATE yy_create_buffer( file, size )
1294 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1296 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1298 b->yy_buf_size = size;
1300 /* yy_ch_buf has to be 2 characters longer than the size given because
1301 * we need to put in 2 end-of-buffer characters.
1303 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1304 if ( ! b->yy_ch_buf )
1305 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1307 b->yy_is_our_buffer = 1;
1309 yy_init_buffer( b, file );
1315 #ifdef YY_USE_PROTOS
1316 void yy_delete_buffer( YY_BUFFER_STATE b )
1318 void yy_delete_buffer( b )
1325 if ( b == yy_current_buffer )
1326 yy_current_buffer = (YY_BUFFER_STATE) 0;
1328 if ( b->yy_is_our_buffer )
1329 yy_flex_free( (void *) b->yy_ch_buf );
1331 yy_flex_free( (void *) b );
1336 #ifdef YY_USE_PROTOS
1337 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1339 void yy_init_buffer( b, file )
1346 yy_flush_buffer( b );
1348 b->yy_input_file = file;
1349 b->yy_fill_buffer = 1;
1351 #if YY_ALWAYS_INTERACTIVE
1352 b->yy_is_interactive = 1;
1354 #if YY_NEVER_INTERACTIVE
1355 b->yy_is_interactive = 0;
1357 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1363 #ifdef YY_USE_PROTOS
1364 void yy_flush_buffer( YY_BUFFER_STATE b )
1366 void yy_flush_buffer( b )
1376 /* We always need two end-of-buffer characters. The first causes
1377 * a transition to the end-of-buffer state. The second causes
1378 * a jam in that state.
1380 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1381 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1383 b->yy_buf_pos = &b->yy_ch_buf[0];
1386 b->yy_buffer_status = YY_BUFFER_NEW;
1388 if ( b == yy_current_buffer )
1389 yy_load_buffer_state();
1393 #ifndef YY_NO_SCAN_BUFFER
1394 #ifdef YY_USE_PROTOS
1395 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1397 YY_BUFFER_STATE yy_scan_buffer( base, size )
1405 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1406 base[size-1] != YY_END_OF_BUFFER_CHAR )
1407 /* They forgot to leave room for the EOB's. */
1410 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1412 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1414 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1415 b->yy_buf_pos = b->yy_ch_buf = base;
1416 b->yy_is_our_buffer = 0;
1417 b->yy_input_file = 0;
1418 b->yy_n_chars = b->yy_buf_size;
1419 b->yy_is_interactive = 0;
1421 b->yy_fill_buffer = 0;
1422 b->yy_buffer_status = YY_BUFFER_NEW;
1424 yy_switch_to_buffer( b );
1431 #ifndef YY_NO_SCAN_STRING
1432 #ifdef YY_USE_PROTOS
1433 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1435 YY_BUFFER_STATE yy_scan_string( yy_str )
1436 yyconst char *yy_str;
1440 for ( len = 0; yy_str[len]; ++len )
1443 return yy_scan_bytes( yy_str, len );
1448 #ifndef YY_NO_SCAN_BYTES
1449 #ifdef YY_USE_PROTOS
1450 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1452 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1453 yyconst char *bytes;
1462 /* Get memory for full buffer, including space for trailing EOB's. */
1464 buf = (char *) yy_flex_alloc( n );
1466 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1468 for ( i = 0; i < len; ++i )
1471 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1473 b = yy_scan_buffer( buf, n );
1475 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1477 /* It's okay to grow etc. this buffer, and we should throw it
1478 * away when we're done.
1480 b->yy_is_our_buffer = 1;
1487 #ifndef YY_NO_PUSH_STATE
1488 #ifdef YY_USE_PROTOS
1489 static void yy_push_state( int new_state )
1491 static void yy_push_state( new_state )
1495 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1499 yy_start_stack_depth += YY_START_STACK_INCR;
1500 new_size = yy_start_stack_depth * sizeof( int );
1502 if ( ! yy_start_stack )
1503 yy_start_stack = (int *) yy_flex_alloc( new_size );
1506 yy_start_stack = (int *) yy_flex_realloc(
1507 (void *) yy_start_stack, new_size );
1509 if ( ! yy_start_stack )
1511 "out of memory expanding start-condition stack" );
1514 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1521 #ifndef YY_NO_POP_STATE
1522 static void yy_pop_state()
1524 if ( --yy_start_stack_ptr < 0 )
1525 YY_FATAL_ERROR( "start-condition stack underflow" );
1527 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1532 #ifndef YY_NO_TOP_STATE
1533 static int yy_top_state()
1535 return yy_start_stack[yy_start_stack_ptr - 1];
1539 #ifndef YY_EXIT_FAILURE
1540 #define YY_EXIT_FAILURE 2
1543 #ifdef YY_USE_PROTOS
1544 static void yy_fatal_error( yyconst char msg[] )
1546 static void yy_fatal_error( msg )
1550 (void) fprintf( stderr, "%s\n", msg );
1551 exit( YY_EXIT_FAILURE );
1556 /* Redefine yyless() so it works in section 3 code. */
1562 /* Undo effects of setting up yytext. */ \
1563 yytext[yyleng] = yy_hold_char; \
1564 yy_c_buf_p = yytext + n; \
1565 yy_hold_char = *yy_c_buf_p; \
1566 *yy_c_buf_p = '\0'; \
1572 /* Internal utility routines. */
1575 #ifdef YY_USE_PROTOS
1576 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1578 static void yy_flex_strncpy( s1, s2, n )
1585 for ( i = 0; i < n; ++i )
1590 #ifdef YY_NEED_STRLEN
1591 #ifdef YY_USE_PROTOS
1592 static int yy_flex_strlen( yyconst char *s )
1594 static int yy_flex_strlen( s )
1599 for ( n = 0; s[n]; ++n )
1607 #ifdef YY_USE_PROTOS
1608 static void *yy_flex_alloc( yy_size_t size )
1610 static void *yy_flex_alloc( size )
1614 return (void *) malloc( size );
1617 #ifdef YY_USE_PROTOS
1618 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1620 static void *yy_flex_realloc( ptr, size )
1625 /* The cast to (char *) in the following accommodates both
1626 * implementations that use char* generic pointers, and those
1627 * that use void* generic pointers. It works with the latter
1628 * because both ANSI C and C++ allow castless assignment from
1629 * any pointer type to void*, and deal with argument conversions
1630 * as though doing an assignment.
1632 return (void *) realloc( (char *) ptr, size );
1635 #ifdef YY_USE_PROTOS
1636 static void yy_flex_free( void *ptr )
1638 static void yy_flex_free( ptr )
1655 #ifndef yywrap /* XXX */
1670 while(i < sizeof(x) - 1 && (c = input()) != EOF){
1677 error_message("unterminated string");
1690 yylval.string = strdup(x);
1691 if (yylval.string == NULL)
1697 error_message (const char *format, ...)
1701 va_start (args, format);
1702 fprintf (stderr, "%s:%d:", filename, lineno);
1703 vfprintf (stderr, format, args);