dma: allow empty sender in queue files
[dragonfly.git] / usr.bin / lex / flex.skl
blob9881a8b5c5ae6a79f8242e83c0daf176f4e5ae72
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 $
5  * $FreeBSD: src/usr.bin/lex/flex.skl,v 1.4 1999/10/27 07:56:44 obrien Exp $
6  * $DragonFly: src/usr.bin/lex/flex.skl,v 1.9 2008/10/16 01:52:32 swildner Exp $
7  */
9 #define FLEX_SCANNER
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
14 #include <stdio.h>
18 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
19 #ifdef c_plusplus
20 #ifndef __cplusplus
21 #define __cplusplus
22 #endif
23 #endif
26 #ifdef __cplusplus
28 #include <stdlib.h>
30 #include <iosfwd>
31 using namespace std;
33 #include <unistd.h>
35 /* Use prototypes in function declarations. */
36 #define YY_USE_PROTOS
38 /* The "const" storage-class-modifier is valid. */
39 #define YY_USE_CONST
41 #else   /* ! __cplusplus */
43 #include <unistd.h>
45 #if __STDC__
47 #define YY_USE_PROTOS
48 #define YY_USE_CONST
50 #endif  /* __STDC__ */
51 #endif  /* ! __cplusplus */
53 #ifdef YY_USE_CONST
54 #define yyconst const
55 #else
56 #define yyconst
57 #endif
60 #ifdef YY_USE_PROTOS
61 #define YY_PROTO(proto) proto
62 #else
63 #define YY_PROTO(proto) ()
64 #endif
66 /* Returned upon end-of-file. */
67 #define YY_NULL 0
69 /* Promotes a possibly negative, possibly signed char to an unsigned
70  * integer for use as an array index.  If the signed char is negative,
71  * we want to instead treat it as an 8-bit unsigned char, hence the
72  * double cast.
73  */
74 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
76 /* Enter a start condition.  This macro really ought to take a parameter,
77  * but we do it the disgusting crufty way forced on us by the ()-less
78  * definition of BEGIN.
79  */
80 #define BEGIN yy_start = 1 + 2 *
82 /* Translate the current start state into a value that can be later handed
83  * to BEGIN to return to the state.  The YYSTATE alias is for lex
84  * compatibility.
85  */
86 #define YY_START ((yy_start - 1) / 2)
87 #define YYSTATE YY_START
89 /* Action number for EOF rule of a given start state. */
90 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
92 /* Special action meaning "start processing a new file". */
93 #define YY_NEW_FILE yyrestart( yyin )
95 #define YY_END_OF_BUFFER_CHAR 0
97 /* Size of default input buffer. */
98 #define YY_BUF_SIZE 16384
100 typedef struct yy_buffer_state *YY_BUFFER_STATE;
102 extern int yyleng;
104 extern FILE *yyin, *yyout;
107 #define EOB_ACT_CONTINUE_SCAN 0
108 #define EOB_ACT_END_OF_FILE 1
109 #define EOB_ACT_LAST_MATCH 2
111 /* The funky do-while in the following #define is used to turn the definition
112  * int a single C statement (which needs a semi-colon terminator).  This
113  * avoids problems with code like:
115  *      if ( condition_holds )
116  *              yyless( 5 );
117  *      else
118  *              do_something_else();
120  * Prior to using the do-while the compiler would get upset at the
121  * "else" because it interpreted the "if" statement as being all
122  * done when it reached the ';' after the yyless() call.
123  */
125 /* Return all but the first 'n' matched characters back to the input stream. */
127 #define yyless(n) \
128         do \
129                 { \
130                 /* Undo effects of setting up yytext. */ \
131                 *yy_cp = yy_hold_char; \
132                 YY_RESTORE_YY_MORE_OFFSET \
133                 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
134                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
135                 } \
136         while ( 0 )
138 #define unput(c) yyunput( c, yytext_ptr )
140 /* The following is because we cannot portably get our hands on size_t
141  * (without autoconf's help, which isn't available because we want
142  * flex-generated scanners to compile on their own).
143  */
144 typedef unsigned int yy_size_t;
147 struct yy_buffer_state
148         {
150         FILE *yy_input_file;
152         istream* yy_input_file;
155         char *yy_ch_buf;                /* input buffer */
156         char *yy_buf_pos;               /* current position in input buffer */
158         /* Size of input buffer in bytes, not including room for EOB
159          * characters.
160          */
161         yy_size_t yy_buf_size;
163         /* Number of characters read into yy_ch_buf, not including EOB
164          * characters.
165          */
166         int yy_n_chars;
168         /* Whether we "own" the buffer - i.e., we know we created it,
169          * and can realloc() it to grow it, and should free() it to
170          * delete it.
171          */
172         int yy_is_our_buffer;
174         /* Whether this is an "interactive" input source; if so, and
175          * if we're using stdio for input, then we want to use getc()
176          * instead of fread(), to make sure we stop fetching input after
177          * each newline.
178          */
179         int yy_is_interactive;
181         /* Whether we're considered to be at the beginning of a line.
182          * If so, '^' rules will be active on the next match, otherwise
183          * not.
184          */
185         int yy_at_bol;
187         /* Whether to try to fill the input buffer when we reach the
188          * end of it.
189          */
190         int yy_fill_buffer;
192         int yy_buffer_status;
193 #define YY_BUFFER_NEW 0
194 #define YY_BUFFER_NORMAL 1
195         /* When an EOF's been seen but there's still some text to process
196          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
197          * shouldn't try reading from the input source any more.  We might
198          * still have a bunch of tokens to match, though, because of
199          * possible backing-up.
200          *
201          * When we actually see the EOF, we change the status to "new"
202          * (via yyrestart()), so that the user can continue scanning by
203          * just pointing yyin at a new input file.
204          */
205 #define YY_BUFFER_EOF_PENDING 2
206         };
208 %- Standard (non-C++) definition
209 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
214  * "scanner state".
215  */
216 #define YY_CURRENT_BUFFER yy_current_buffer
219 %- Standard (non-C++) definition
220 /* yy_hold_char holds the character lost when yytext is formed. */
221 static char yy_hold_char;
223 static int yy_n_chars;          /* number of characters read into yy_ch_buf */
226 int yyleng;
228 /* Points to current character in buffer. */
229 static char *yy_c_buf_p = NULL;
230 static int yy_init = 1;         /* whether we need to initialize */
231 static int yy_start = 0;        /* start state number */
233 /* Flag which is used to allow yywrap()'s to do buffer switches
234  * instead of setting up a fresh yyin.  A bit of a hack ...
235  */
236 static int yy_did_buffer_switch_on_eof;
238 void yyrestart YY_PROTO(( FILE *input_file ));
240 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
241 void yy_load_buffer_state YY_PROTO(( void ));
242 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
243 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
244 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
245 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
246 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
248 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
249 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
250 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
253 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
254 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ))
255 #ifdef __GNUC__
256         __attribute__((__unused__))
257 #endif
259 static void yy_flex_free YY_PROTO(( void * ));
261 #define yy_new_buffer yy_create_buffer
263 #define yy_set_interactive(is_interactive) \
264         { \
265         if ( ! yy_current_buffer ) \
266                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
267         yy_current_buffer->yy_is_interactive = is_interactive; \
268         }
270 #define yy_set_bol(at_bol) \
271         { \
272         if ( ! yy_current_buffer ) \
273                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
274         yy_current_buffer->yy_at_bol = at_bol; \
275         }
277 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
279 %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
281 %- Standard (non-C++) definition
282 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
283 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
284 static int yy_get_next_buffer YY_PROTO(( void ));
285 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
288 /* Done after the current pattern has been matched and before the
289  * corresponding action - sets up yytext.
290  */
291 #define YY_DO_BEFORE_ACTION \
292         yytext_ptr = yy_bp; \
293 %% code to fiddle yytext and yyleng for yymore() goes here
294         yy_hold_char = *yy_cp; \
295         *yy_cp = '\0'; \
296 %% code to copy yytext_ptr to yytext[] goes here, if %array
297         yy_c_buf_p = yy_cp;
299 %% data tables for the DFA and the user's section 1 definitions go here
301 /* Macros after this point can all be overridden by user definitions in
302  * section 1.
303  */
305 #ifndef YY_SKIP_YYWRAP
306 #ifdef __cplusplus
307 extern "C" int yywrap YY_PROTO(( void ));
308 #else
309 extern int yywrap YY_PROTO(( void ));
310 #endif
311 #endif
314 #ifndef YY_NO_UNPUT
315 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
316 #endif
319 #ifndef yytext_ptr
320 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
321 #endif
323 #ifdef YY_NEED_STRLEN
324 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
325 #endif
327 #ifndef YY_NO_INPUT
328 %- Standard (non-C++) definition
329 #ifdef __cplusplus
330 static int yyinput YY_PROTO(( void ));
331 #else
332 static int input YY_PROTO(( void ));
333 #endif
335 #endif
337 #if YY_STACK_USED
338 static int yy_start_stack_ptr = 0;
339 static int yy_start_stack_depth = 0;
340 static int *yy_start_stack = 0;
341 #ifndef YY_NO_PUSH_STATE
342 static void yy_push_state YY_PROTO(( int new_state ));
343 #endif
344 #ifndef YY_NO_POP_STATE
345 static void yy_pop_state YY_PROTO(( void ));
346 #endif
347 #ifndef YY_NO_TOP_STATE
348 static int yy_top_state YY_PROTO(( void ));
349 #endif
351 #else
352 #define YY_NO_PUSH_STATE 1
353 #define YY_NO_POP_STATE 1
354 #define YY_NO_TOP_STATE 1
355 #endif
357 #ifdef YY_MALLOC_DECL
358 YY_MALLOC_DECL
359 #else
360 #if __STDC__
361 #ifndef __cplusplus
362 #include <stdlib.h>
363 #endif
364 #else
365 /* Just try to get by without declaring the routines.  This will fail
366  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
367  * or sizeof(void*) != sizeof(int).
368  */
369 #endif
370 #endif
372 /* Amount of stuff to slurp up with each read. */
373 #ifndef YY_READ_BUF_SIZE
374 #define YY_READ_BUF_SIZE 8192
375 #endif
377 /* Copy whatever the last rule matched to the standard output. */
379 #ifndef ECHO
380 %- Standard (non-C++) definition
381 /* This used to be an fputs(), but since the string might contain NUL's,
382  * we now use fwrite().
383  */
384 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
385 %+ C++ definition
386 #define ECHO LexerOutput( yytext, yyleng )
388 #endif
390 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
391  * is returned in "result".
392  */
393 #ifndef YY_INPUT
394 #define YY_INPUT(buf,result,max_size) \
395 %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
396 %+ C++ definition
397         if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
398                 YY_FATAL_ERROR( "input in flex scanner failed" );
400 #endif
402 /* No semi-colon after return; correct usage is to write "yyterminate();" -
403  * we don't want an extra ';' after the "return" because that will cause
404  * some compilers to complain about unreachable statements.
405  */
406 #ifndef yyterminate
407 #define yyterminate() return YY_NULL
408 #endif
410 /* Number of entries by which start-condition stack grows. */
411 #ifndef YY_START_STACK_INCR
412 #define YY_START_STACK_INCR 25
413 #endif
415 /* Report a fatal error. */
416 #ifndef YY_FATAL_ERROR
418 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
420 #define YY_FATAL_ERROR(msg) LexerError( msg )
422 #endif
424 /* Default declaration of generated scanner - a define so the user can
425  * easily add parameters.
426  */
427 #ifndef YY_DECL
428 %- Standard (non-C++) definition
429 #define YY_DECL int yylex YY_PROTO(( void ))
430 %+ C++ definition
431 #define YY_DECL int yyFlexLexer::yylex()
433 #endif
435 /* Code executed at the beginning of each rule, after yytext and yyleng
436  * have been set up.
437  */
438 #ifndef YY_USER_ACTION
439 #define YY_USER_ACTION
440 #endif
442 /* Code executed at the end of each rule. */
443 #ifndef YY_BREAK
444 #define YY_BREAK break;
445 #endif
447 %% YY_RULE_SETUP definition goes here
449 YY_DECL
450         {
451         yy_state_type yy_current_state;
452         char *yy_cp, *yy_bp;
453         int yy_act;
455 %% user's declarations go here
457         if ( yy_init )
458                 {
459                 yy_init = 0;
461 #ifdef YY_USER_INIT
462                 YY_USER_INIT;
463 #endif
465                 if ( ! yy_start )
466                         yy_start = 1;   /* first start state */
468                 if ( ! yyin )
470                         yyin = stdin;
472                         yyin = &cin;
475                 if ( ! yyout )
477                         yyout = stdout;
479                         yyout = &cout;
482                 if ( ! yy_current_buffer )
483                         yy_current_buffer =
484                                 yy_create_buffer( yyin, YY_BUF_SIZE );
486                 yy_load_buffer_state();
487                 }
489         while ( 1 )             /* loops until end-of-file is reached */
490                 {
491 %% yymore()-related code goes here
492                 yy_cp = yy_c_buf_p;
494                 /* Support of yytext. */
495                 *yy_cp = yy_hold_char;
497                 /* yy_bp points to the position in yy_ch_buf of the start of
498                  * the current run.
499                  */
500                 yy_bp = yy_cp;
502 %% code to set up and find next match goes here
504 yy_find_action:
505 %% code to find the action number goes here
507                 YY_DO_BEFORE_ACTION;
509 %% code for yylineno update goes here
511 do_action:      /* This label is used only to access EOF actions. */
513 %% debug code goes here
515                 switch ( yy_act )
516         { /* beginning of action switch */
517 %% actions go here
519         case YY_END_OF_BUFFER:
520                 {
521                 /* Amount of text matched not including the EOB char. */
522                 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
524                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
525                 *yy_cp = yy_hold_char;
526                 YY_RESTORE_YY_MORE_OFFSET
528                 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
529                         {
530                         /* We're scanning a new file or input source.  It's
531                          * possible that this happened because the user
532                          * just pointed yyin at a new source and called
533                          * yylex().  If so, then we have to assure
534                          * consistency between yy_current_buffer and our
535                          * globals.  Here is the right place to do so, because
536                          * this is the first action (other than possibly a
537                          * back-up) that will match for the new input source.
538                          */
539                         yy_n_chars = yy_current_buffer->yy_n_chars;
540                         yy_current_buffer->yy_input_file = yyin;
541                         yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
542                         }
544                 /* Note that here we test for yy_c_buf_p "<=" to the position
545                  * of the first EOB in the buffer, since yy_c_buf_p will
546                  * already have been incremented past the NUL character
547                  * (since all states make transitions on EOB to the
548                  * end-of-buffer state).  Contrast this with the test
549                  * in input().
550                  */
551                 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
552                         { /* This was really a NUL. */
553                         yy_state_type yy_next_state;
555                         yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
557                         yy_current_state = yy_get_previous_state();
559                         /* Okay, we're now positioned to make the NUL
560                          * transition.  We couldn't have
561                          * yy_get_previous_state() go ahead and do it
562                          * for us because it doesn't know how to deal
563                          * with the possibility of jamming (and we don't
564                          * want to build jamming into it because then it
565                          * will run more slowly).
566                          */
568                         yy_next_state = yy_try_NUL_trans( yy_current_state );
570                         yy_bp = yytext_ptr + YY_MORE_ADJ;
572                         if ( yy_next_state )
573                                 {
574                                 /* Consume the NUL. */
575                                 yy_cp = ++yy_c_buf_p;
576                                 yy_current_state = yy_next_state;
577                                 goto yy_match;
578                                 }
580                         else
581                                 {
582 %% code to do back-up for compressed tables and set up yy_cp goes here
583                                 goto yy_find_action;
584                                 }
585                         }
587                 else switch ( yy_get_next_buffer() )
588                         {
589                         case EOB_ACT_END_OF_FILE:
590                                 {
591                                 yy_did_buffer_switch_on_eof = 0;
593                                 if ( yywrap() )
594                                         {
595                                         /* Note: because we've taken care in
596                                          * yy_get_next_buffer() to have set up
597                                          * yytext, we can now set up
598                                          * yy_c_buf_p so that if some total
599                                          * hoser (like flex itself) wants to
600                                          * call the scanner after we return the
601                                          * YY_NULL, it'll still work - another
602                                          * YY_NULL will get returned.
603                                          */
604                                         yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
606                                         yy_act = YY_STATE_EOF(YY_START);
607                                         goto do_action;
608                                         }
610                                 else
611                                         {
612                                         if ( ! yy_did_buffer_switch_on_eof )
613                                                 YY_NEW_FILE;
614                                         }
615                                 break;
616                                 }
618                         case EOB_ACT_CONTINUE_SCAN:
619                                 yy_c_buf_p =
620                                         yytext_ptr + yy_amount_of_matched_text;
622                                 yy_current_state = yy_get_previous_state();
624                                 yy_cp = yy_c_buf_p;
625                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
626                                 goto yy_match;
628                         case EOB_ACT_LAST_MATCH:
629                                 yy_c_buf_p =
630                                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
632                                 yy_current_state = yy_get_previous_state();
634                                 yy_cp = yy_c_buf_p;
635                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
636                                 goto yy_find_action;
637                         }
638                 break;
639                 }
641         default:
642                 YY_FATAL_ERROR(
643                         "fatal flex scanner internal error--no action found" );
644         } /* end of action switch */
645                 } /* end of scanning one token */
646         } /* end of yylex */
649 yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
650         {
651         yyin = arg_yyin;
652         yyout = arg_yyout;
653         yy_c_buf_p = 0;
654         yy_init = 1;
655         yy_start = 0;
656         yy_flex_debug = 0;
657         yylineno = 1;   // this will only get updated if %option yylineno
659         yy_did_buffer_switch_on_eof = 0;
661         yy_looking_for_trail_begin = 0;
662         yy_more_flag = 0;
663         yy_more_len = 0;
664         yy_more_offset = yy_prev_more_offset = 0;
666         yy_start_stack_ptr = yy_start_stack_depth = 0;
667         yy_start_stack = 0;
669         yy_current_buffer = 0;
671 #ifdef YY_USES_REJECT
672         yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
673 #else
674         yy_state_buf = 0;
675 #endif
676         }
678 yyFlexLexer::~yyFlexLexer()
679         {
680         delete yy_state_buf;
681         yy_delete_buffer( yy_current_buffer );
682         }
684 void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
685         {
686         if ( new_in )
687                 {
688                 yy_delete_buffer( yy_current_buffer );
689                 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
690                 }
692         if ( new_out )
693                 yyout = new_out;
694         }
696 #ifdef YY_INTERACTIVE
697 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
698 #else
699 int yyFlexLexer::LexerInput( char* buf, int max_size )
700 #endif
701         {
702         if ( yyin->eof() || yyin->fail() )
703                 return 0;
705 #ifdef YY_INTERACTIVE
706         yyin->get( buf[0] );
708         if ( yyin->eof() )
709                 return 0;
711         if ( yyin->bad() )
712                 return -1;
714         return 1;
716 #else
717         (void) yyin->read( buf, max_size );
719         if ( yyin->bad() )
720                 return -1;
721         else
722                 return yyin->gcount();
723 #endif
724         }
726 void yyFlexLexer::LexerOutput( const char* buf, int size )
727         {
728         (void) yyout->write( buf, size );
729         }
732 /* yy_get_next_buffer - try to read in a new buffer
734  * Returns a code representing an action:
735  *      EOB_ACT_LAST_MATCH -
736  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
737  *      EOB_ACT_END_OF_FILE - end of file
738  */
741 #ifdef YY_USE_PROTOS
742 static int yy_get_next_buffer( void )
743 #else
744 static int yy_get_next_buffer()
745 #endif
747 int yyFlexLexer::yy_get_next_buffer()
749         {
750         char *dest = yy_current_buffer->yy_ch_buf;
751         char *source = yytext_ptr;
752         int number_to_move, i;
753         int ret_val;
755         if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
756                 YY_FATAL_ERROR(
757                 "fatal flex scanner internal error--end of buffer missed" );
759         if ( yy_current_buffer->yy_fill_buffer == 0 )
760                 { /* Don't try to fill the buffer, so this is an EOF. */
761                 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
762                         {
763                         /* We matched a single character, the EOB, so
764                          * treat this as a final EOF.
765                          */
766                         return EOB_ACT_END_OF_FILE;
767                         }
769                 else
770                         {
771                         /* We matched some text prior to the EOB, first
772                          * process it.
773                          */
774                         return EOB_ACT_LAST_MATCH;
775                         }
776                 }
778         /* Try to read more data. */
780         /* First move last chars to start of buffer. */
781         number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
783         for ( i = 0; i < number_to_move; ++i )
784                 *(dest++) = *(source++);
786         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
787                 /* don't do the read, it's not guaranteed to return an EOF,
788                  * just force an EOF
789                  */
790                 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
792         else
793                 {
794                 int num_to_read =
795                         yy_current_buffer->yy_buf_size - number_to_move - 1;
797                 while ( num_to_read <= 0 )
798                         { /* Not enough room in the buffer - grow it. */
799 #ifdef YY_USES_REJECT
800                         YY_FATAL_ERROR(
801 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
802 #else
804                         /* just a shorter name for the current buffer */
805                         YY_BUFFER_STATE b = yy_current_buffer;
807                         int yy_c_buf_p_offset =
808                                 (int) (yy_c_buf_p - b->yy_ch_buf);
810                         if ( b->yy_is_our_buffer )
811                                 {
812                                 int new_size = b->yy_buf_size * 2;
814                                 if ( new_size <= 0 )
815                                         b->yy_buf_size += b->yy_buf_size / 8;
816                                 else
817                                         b->yy_buf_size *= 2;
819                                 b->yy_ch_buf = (char *)
820                                         /* Include room in for 2 EOB chars. */
821                                         yy_flex_realloc( (void *) b->yy_ch_buf,
822                                                          b->yy_buf_size + 2 );
823                                 }
824                         else
825                                 /* Can't grow it, we don't own it. */
826                                 b->yy_ch_buf = 0;
828                         if ( ! b->yy_ch_buf )
829                                 YY_FATAL_ERROR(
830                                 "fatal error - scanner input buffer overflow" );
832                         yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
834                         num_to_read = yy_current_buffer->yy_buf_size -
835                                                 number_to_move - 1;
836 #endif
837                         }
839                 if ( num_to_read > YY_READ_BUF_SIZE )
840                         num_to_read = YY_READ_BUF_SIZE;
842                 /* Read in more data. */
843                 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
844                         yy_n_chars, num_to_read );
846                 yy_current_buffer->yy_n_chars = yy_n_chars;
847                 }
849         if ( yy_n_chars == 0 )
850                 {
851                 if ( number_to_move == YY_MORE_ADJ )
852                         {
853                         ret_val = EOB_ACT_END_OF_FILE;
854                         yyrestart( yyin );
855                         }
857                 else
858                         {
859                         ret_val = EOB_ACT_LAST_MATCH;
860                         yy_current_buffer->yy_buffer_status =
861                                 YY_BUFFER_EOF_PENDING;
862                         }
863                 }
865         else
866                 ret_val = EOB_ACT_CONTINUE_SCAN;
868         yy_n_chars += number_to_move;
869         yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
870         yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
872         yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
874         return ret_val;
875         }
878 /* yy_get_previous_state - get the state just before the EOB char was reached */
881 #ifdef YY_USE_PROTOS
882 static yy_state_type yy_get_previous_state( void )
883 #else
884 static yy_state_type yy_get_previous_state()
885 #endif
887 yy_state_type yyFlexLexer::yy_get_previous_state()
889         {
890         yy_state_type yy_current_state;
891         char *yy_cp;
893 %% code to get the start state into yy_current_state goes here
895         for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
896                 {
897 %% code to find the next state goes here
898                 }
900         return yy_current_state;
901         }
904 /* yy_try_NUL_trans - try to make a transition on the NUL character
906  * synopsis
907  *      next_state = yy_try_NUL_trans( current_state );
908  */
911 #ifdef YY_USE_PROTOS
912 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
913 #else
914 static yy_state_type yy_try_NUL_trans( yy_current_state )
915 yy_state_type yy_current_state;
916 #endif
918 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
920         {
921         int yy_is_jam;
922 %% code to find the next state, and perhaps do backing up, goes here
924         return yy_is_jam ? 0 : yy_current_state;
925         }
929 #ifndef YY_NO_UNPUT
930 #ifdef YY_USE_PROTOS
931 static void yyunput( int c, char *yy_bp )
932 #else
933 static void yyunput( c, yy_bp )
934 int c;
935 char *yy_bp;
936 #endif
938 void yyFlexLexer::yyunput( int c, char* yy_bp )
940         {
941         char *yy_cp = yy_c_buf_p;
943         /* undo effects of setting up yytext */
944         *yy_cp = yy_hold_char;
946         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
947                 { /* need to shift things up to make room */
948                 /* +2 for EOB chars. */
949                 int number_to_move = yy_n_chars + 2;
950                 char *dest = &yy_current_buffer->yy_ch_buf[
951                                         yy_current_buffer->yy_buf_size + 2];
952                 char *source = &yy_current_buffer->yy_ch_buf[number_to_move];
954                 while ( source > yy_current_buffer->yy_ch_buf )
955                         *--dest = *--source;
957                 yy_cp += (int) (dest - source);
958                 yy_bp += (int) (dest - source);
959                 yy_current_buffer->yy_n_chars =
960                         yy_n_chars = yy_current_buffer->yy_buf_size;
962                 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
963                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
964                 }
966         *--yy_cp = (char) c;
968 %% update yylineno here
970         yytext_ptr = yy_bp;
971         yy_hold_char = *yy_cp;
972         yy_c_buf_p = yy_cp;
973         }
975 #endif  /* ifndef YY_NO_UNPUT */
980 #ifndef YY_NO_INPUT
981 #ifdef __cplusplus
982 static int yyinput()
983 #else
984 #ifdef YY_USE_PROTOS
985 static int input( void )
986 #else
987 static int input()
988 #endif
989 #endif
991 int yyFlexLexer::yyinput()
993         {
994         int c;
996         *yy_c_buf_p = yy_hold_char;
998         if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
999                 {
1000                 /* yy_c_buf_p now points to the character we want to return.
1001                  * If this occurs *before* the EOB characters, then it's a
1002                  * valid NUL; if not, then we've hit the end of the buffer.
1003                  */
1004                 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1005                         /* This was really a NUL. */
1006                         *yy_c_buf_p = '\0';
1008                 else
1009                         { /* need more input */
1010                         int offset = yy_c_buf_p - yytext_ptr;
1011                         ++yy_c_buf_p;
1013                         switch ( yy_get_next_buffer() )
1014                                 {
1015                                 case EOB_ACT_LAST_MATCH:
1016                                         /* This happens because yy_g_n_b()
1017                                          * sees that we've accumulated a
1018                                          * token and flags that we need to
1019                                          * try matching the token before
1020                                          * proceeding.  But for input(),
1021                                          * there's no matching to consider.
1022                                          * So convert the EOB_ACT_LAST_MATCH
1023                                          * to EOB_ACT_END_OF_FILE.
1024                                          */
1026                                         /* Reset buffer status. */
1027                                         yyrestart( yyin );
1029                                         /* fall through */
1031                                 case EOB_ACT_END_OF_FILE:
1032                                         {
1033                                         if ( yywrap() )
1034                                                 return EOF;
1036                                         if ( ! yy_did_buffer_switch_on_eof )
1037                                                 YY_NEW_FILE;
1038 #ifdef __cplusplus
1039                                         return yyinput();
1040 #else
1041                                         return input();
1042 #endif
1043                                         }
1045                                 case EOB_ACT_CONTINUE_SCAN:
1046                                         yy_c_buf_p = yytext_ptr + offset;
1047                                         break;
1048                                 }
1049                         }
1050                 }
1052         c = *(unsigned char *) yy_c_buf_p;      /* cast for 8-bit char's */
1053         *yy_c_buf_p = '\0';     /* preserve yytext */
1054         yy_hold_char = *++yy_c_buf_p;
1056 %% update BOL and yylineno
1058         return c;
1059         }
1061 #endif  /* ifndef YY_NO_INPUT */
1066 #ifdef YY_USE_PROTOS
1067 void yyrestart( FILE *input_file )
1068 #else
1069 void yyrestart( input_file )
1070 FILE *input_file;
1071 #endif
1073 void yyFlexLexer::yyrestart( istream* input_file )
1075         {
1076         if ( ! yy_current_buffer )
1077                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1079         yy_init_buffer( yy_current_buffer, input_file );
1080         yy_load_buffer_state();
1081         }
1085 #ifdef YY_USE_PROTOS
1086 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1087 #else
1088 void yy_switch_to_buffer( new_buffer )
1089 YY_BUFFER_STATE new_buffer;
1090 #endif
1092 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1094         {
1095         if ( yy_current_buffer == new_buffer )
1096                 return;
1098         if ( yy_current_buffer )
1099                 {
1100                 /* Flush out information for old buffer. */
1101                 *yy_c_buf_p = yy_hold_char;
1102                 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1103                 yy_current_buffer->yy_n_chars = yy_n_chars;
1104                 }
1106         yy_current_buffer = new_buffer;
1107         yy_load_buffer_state();
1109         /* We don't actually know whether we did this switch during
1110          * EOF (yywrap()) processing, but the only time this flag
1111          * is looked at is after yywrap() is called, so it's safe
1112          * to go ahead and always set it.
1113          */
1114         yy_did_buffer_switch_on_eof = 1;
1115         }
1119 #ifdef YY_USE_PROTOS
1120 void yy_load_buffer_state( void )
1121 #else
1122 void yy_load_buffer_state()
1123 #endif
1125 void yyFlexLexer::yy_load_buffer_state()
1127         {
1128         yy_n_chars = yy_current_buffer->yy_n_chars;
1129         yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1130         yyin = yy_current_buffer->yy_input_file;
1131         yy_hold_char = *yy_c_buf_p;
1132         }
1136 #ifdef YY_USE_PROTOS
1137 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1138 #else
1139 YY_BUFFER_STATE yy_create_buffer( file, size )
1140 FILE *file;
1141 int size;
1142 #endif
1144 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
1146         {
1147         YY_BUFFER_STATE b;
1149         b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1150         if ( ! b )
1151                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1153         b->yy_buf_size = size;
1155         /* yy_ch_buf has to be 2 characters longer than the size given because
1156          * we need to put in 2 end-of-buffer characters.
1157          */
1158         b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1159         if ( ! b->yy_ch_buf )
1160                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1162         b->yy_is_our_buffer = 1;
1164         yy_init_buffer( b, file );
1166         return b;
1167         }
1171 #ifdef YY_USE_PROTOS
1172 void yy_delete_buffer( YY_BUFFER_STATE b )
1173 #else
1174 void yy_delete_buffer( b )
1175 YY_BUFFER_STATE b;
1176 #endif
1178 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1180         {
1181         if ( ! b )
1182                 return;
1184         if ( b == yy_current_buffer )
1185                 yy_current_buffer = (YY_BUFFER_STATE) 0;
1187         if ( b->yy_is_our_buffer )
1188                 yy_flex_free( (void *) b->yy_ch_buf );
1190         yy_flex_free( (void *) b );
1191         }
1195 #ifdef YY_USE_PROTOS
1196 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1197 #else
1198 void yy_init_buffer( b, file )
1199 YY_BUFFER_STATE b;
1200 FILE *file;
1201 #endif
1204 extern "C" int isatty YY_PROTO(( int ));
1205 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
1208         {
1209         yy_flush_buffer( b );
1211         b->yy_input_file = file;
1212         b->yy_fill_buffer = 1;
1215 #if YY_ALWAYS_INTERACTIVE
1216         b->yy_is_interactive = 1;
1217 #else
1218 #if YY_NEVER_INTERACTIVE
1219         b->yy_is_interactive = 0;
1220 #else
1221         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1222 #endif
1223 #endif
1225         b->yy_is_interactive = 0;
1227         }
1231 #ifdef YY_USE_PROTOS
1232 void yy_flush_buffer( YY_BUFFER_STATE b )
1233 #else
1234 void yy_flush_buffer( b )
1235 YY_BUFFER_STATE b;
1236 #endif
1239 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1241         {
1242         if ( ! b )
1243                 return;
1245         b->yy_n_chars = 0;
1247         /* We always need two end-of-buffer characters.  The first causes
1248          * a transition to the end-of-buffer state.  The second causes
1249          * a jam in that state.
1250          */
1251         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1252         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1254         b->yy_buf_pos = &b->yy_ch_buf[0];
1256         b->yy_at_bol = 1;
1257         b->yy_buffer_status = YY_BUFFER_NEW;
1259         if ( b == yy_current_buffer )
1260                 yy_load_buffer_state();
1261         }
1265 #ifndef YY_NO_SCAN_BUFFER
1267 #ifdef YY_USE_PROTOS
1268 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1269 #else
1270 YY_BUFFER_STATE yy_scan_buffer( base, size )
1271 char *base;
1272 yy_size_t size;
1273 #endif
1274         {
1275         YY_BUFFER_STATE b;
1277         if ( size < 2 ||
1278              base[size-2] != YY_END_OF_BUFFER_CHAR ||
1279              base[size-1] != YY_END_OF_BUFFER_CHAR )
1280                 /* They forgot to leave room for the EOB's. */
1281                 return 0;
1283         b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1284         if ( ! b )
1285                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1287         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
1288         b->yy_buf_pos = b->yy_ch_buf = base;
1289         b->yy_is_our_buffer = 0;
1290         b->yy_input_file = 0;
1291         b->yy_n_chars = b->yy_buf_size;
1292         b->yy_is_interactive = 0;
1293         b->yy_at_bol = 1;
1294         b->yy_fill_buffer = 0;
1295         b->yy_buffer_status = YY_BUFFER_NEW;
1297         yy_switch_to_buffer( b );
1299         return b;
1300         }
1302 #endif
1305 #ifndef YY_NO_SCAN_STRING
1307 #ifdef YY_USE_PROTOS
1308 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1309 #else
1310 YY_BUFFER_STATE yy_scan_string( yy_str )
1311 yyconst char *yy_str;
1312 #endif
1313         {
1314         int len;
1315         for ( len = 0; yy_str[len]; ++len )
1316                 ;
1318         return yy_scan_bytes( yy_str, len );
1319         }
1321 #endif
1324 #ifndef YY_NO_SCAN_BYTES
1326 #ifdef YY_USE_PROTOS
1327 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1328 #else
1329 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1330 yyconst char *bytes;
1331 int len;
1332 #endif
1333         {
1334         YY_BUFFER_STATE b;
1335         char *buf;
1336         yy_size_t n;
1337         int i;
1339         /* Get memory for full buffer, including space for trailing EOB's. */
1340         n = len + 2;
1341         buf = (char *) yy_flex_alloc( n );
1342         if ( ! buf )
1343                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1345         for ( i = 0; i < len; ++i )
1346                 buf[i] = bytes[i];
1348         buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1350         b = yy_scan_buffer( buf, n );
1351         if ( ! b )
1352                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1354         /* It's okay to grow etc. this buffer, and we should throw it
1355          * away when we're done.
1356          */
1357         b->yy_is_our_buffer = 1;
1359         return b;
1360         }
1362 #endif
1365 #ifndef YY_NO_PUSH_STATE
1367 #ifdef YY_USE_PROTOS
1368 static void yy_push_state( int new_state )
1369 #else
1370 static void yy_push_state( new_state )
1371 int new_state;
1372 #endif
1374 void yyFlexLexer::yy_push_state( int new_state )
1376         {
1377         if ( yy_start_stack_ptr >= yy_start_stack_depth )
1378                 {
1379                 yy_size_t new_size;
1381                 yy_start_stack_depth += YY_START_STACK_INCR;
1382                 new_size = yy_start_stack_depth * sizeof( int );
1384                 if ( ! yy_start_stack )
1385                         yy_start_stack = (int *) yy_flex_alloc( new_size );
1387                 else
1388                         yy_start_stack = (int *) yy_flex_realloc(
1389                                         (void *) yy_start_stack, new_size );
1391                 if ( ! yy_start_stack )
1392                         YY_FATAL_ERROR(
1393                         "out of memory expanding start-condition stack" );
1394                 }
1396         yy_start_stack[yy_start_stack_ptr++] = YY_START;
1398         BEGIN(new_state);
1399         }
1400 #endif
1403 #ifndef YY_NO_POP_STATE
1405 #ifdef YY_USE_PROTOS
1406 static void yy_pop_state( void )
1407 #else
1408 static void yy_pop_state()
1409 #endif
1411 void yyFlexLexer::yy_pop_state()
1413         {
1414         if ( --yy_start_stack_ptr < 0 )
1415                 YY_FATAL_ERROR( "start-condition stack underflow" );
1417         BEGIN(yy_start_stack[yy_start_stack_ptr]);
1418         }
1419 #endif
1422 #ifndef YY_NO_TOP_STATE
1424 #ifdef YY_USE_PROTOS
1425 static int yy_top_state( void )
1426 #else
1427 static int yy_top_state()
1428 #endif
1430 int yyFlexLexer::yy_top_state()
1432         {
1433         return yy_start_stack[yy_start_stack_ptr - 1];
1434         }
1435 #endif
1437 #ifndef YY_EXIT_FAILURE
1438 #define YY_EXIT_FAILURE 2
1439 #endif
1442 #ifdef YY_USE_PROTOS
1443 static void yy_fatal_error( yyconst char msg[] )
1444 #else
1445 static void yy_fatal_error( msg )
1446 char msg[];
1447 #endif
1448         {
1449         (void) fprintf( stderr, "%s\n", msg );
1450         exit( YY_EXIT_FAILURE );
1451         }
1455 void yyFlexLexer::LexerError( yyconst char msg[] )
1456         {
1457         cerr << msg << '\n';
1458         exit( YY_EXIT_FAILURE );
1459         }
1463 /* Redefine yyless() so it works in section 3 code. */
1465 #undef yyless
1466 #define yyless(n) \
1467         do \
1468                 { \
1469                 /* Undo effects of setting up yytext. */ \
1470                 yytext[yyleng] = yy_hold_char; \
1471                 yy_c_buf_p = yytext + n; \
1472                 yy_hold_char = *yy_c_buf_p; \
1473                 *yy_c_buf_p = '\0'; \
1474                 yyleng = n; \
1475                 } \
1476         while ( 0 )
1479 /* Internal utility routines. */
1481 #ifndef yytext_ptr
1482 #ifdef YY_USE_PROTOS
1483 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1484 #else
1485 static void yy_flex_strncpy( s1, s2, n )
1486 char *s1;
1487 yyconst char *s2;
1488 int n;
1489 #endif
1490         {
1491         int i;
1492         for ( i = 0; i < n; ++i )
1493                 s1[i] = s2[i];
1494         }
1495 #endif
1497 #ifdef YY_NEED_STRLEN
1498 #ifdef YY_USE_PROTOS
1499 static int yy_flex_strlen( yyconst char *s )
1500 #else
1501 static int yy_flex_strlen( s )
1502 yyconst char *s;
1503 #endif
1504         {
1505         int n;
1506         for ( n = 0; s[n]; ++n )
1507                 ;
1509         return n;
1510         }
1511 #endif
1514 #ifdef YY_USE_PROTOS
1515 static void *yy_flex_alloc( yy_size_t size )
1516 #else
1517 static void *yy_flex_alloc( size )
1518 yy_size_t size;
1519 #endif
1520         {
1521         return (void *) malloc( size );
1522         }
1524 #ifdef YY_USE_PROTOS
1525 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1526 #else
1527 static void *yy_flex_realloc( ptr, size )
1528 void *ptr;
1529 yy_size_t size;
1530 #endif
1531         {
1532         /* The cast to (char *) in the following accommodates both
1533          * implementations that use char* generic pointers, and those
1534          * that use void* generic pointers.  It works with the latter
1535          * because both ANSI C and C++ allow castless assignment from
1536          * any pointer type to void*, and deal with argument conversions
1537          * as though doing an assignment.
1538          */
1539         return (void *) realloc( (char *) ptr, size );
1540         }
1542 #ifdef YY_USE_PROTOS
1543 static void yy_flex_free( void *ptr )
1544 #else
1545 static void yy_flex_free( ptr )
1546 void *ptr;
1547 #endif
1548         {
1549         free( ptr );
1550         }
1552 #if YY_MAIN
1553 int main()
1554         {
1555         yylex();
1556         return 0;
1557         }
1558 #endif