1 #line 2 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor_flex.cpp"
2 /* A lexical scanner generated by flex */
3 
4 /* Scanner skeleton version:
5  * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
6  */
7 
8 #define FLEX_SCANNER
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 5
11 
12 #include <stdio.h>
13 #include <errno.h>
14 
15 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
16 #ifdef c_plusplus
17 #ifndef __cplusplus
18 #define __cplusplus
19 #endif
20 #endif
21 
22 
23 #ifdef __cplusplus
24 
25 #include <stdlib.h>
26 #ifndef _WIN32
27 #include <unistd.h>
28 #endif
29 
30 /* Use prototypes in function declarations. */
31 #define YY_USE_PROTOS
32 
33 /* The "const" storage-class-modifier is valid. */
34 #define YY_USE_CONST
35 
36 #else  /* ! __cplusplus */
37 
38 #if __STDC__
39 
40 #define YY_USE_PROTOS
41 #define YY_USE_CONST
42 
43 #endif  /* __STDC__ */
44 #endif  /* ! __cplusplus */
45 
46 #ifdef __TURBOC__
47  #pragma warn -rch
48  #pragma warn -use
49 #include <io.h>
50 #include <stdlib.h>
51 #define YY_USE_CONST
52 #define YY_USE_PROTOS
53 #endif
54 
55 #ifdef YY_USE_CONST
56 #define yyconst const
57 #else
58 #define yyconst
59 #endif
60 
61 
62 #ifdef YY_USE_PROTOS
63 #define YY_PROTO(proto) proto
64 #else
65 #define YY_PROTO(proto) ()
66 #endif
67 
68 
69 /* Returned upon end-of-file. */
70 #define YY_NULL 0
71 
72 /* Promotes a possibly negative, possibly signed char to an unsigned
73  * integer for use as an array index.  If the signed char is negative,
74  * we want to instead treat it as an 8-bit unsigned char, hence the
75  * double cast.
76  */
77 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
78 
79 /* Enter a start condition.  This macro really ought to take a parameter,
80  * but we do it the disgusting crufty way forced on us by the ()-less
81  * definition of BEGIN.
82  */
83 #define BEGIN yy_start = 1 + 2 *
84 
85 /* Translate the current start state into a value that can be later handed
86  * to BEGIN to return to the state.  The YYSTATE alias is for lex
87  * compatibility.
88  */
89 #define YY_START ((yy_start - 1) / 2)
90 #define YYSTATE YY_START
91 
92 /* Action number for EOF rule of a given start state. */
93 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
94 
95 /* Special action meaning "start processing a new file". */
96 #define YY_NEW_FILE yyrestart( yyin )
97 
98 #define YY_END_OF_BUFFER_CHAR 0
99 
100 /* Size of default input buffer. */
101 #define YY_BUF_SIZE 16384
102 
103 typedef struct yy_buffer_state *YY_BUFFER_STATE;
104 
105 extern int yyleng;
106 extern FILE *yyin, *yyout;
107 
108 #define EOB_ACT_CONTINUE_SCAN 0
109 #define EOB_ACT_END_OF_FILE 1
110 #define EOB_ACT_LAST_MATCH 2
111 
112 /* The funky do-while in the following #define is used to turn the definition
113  * int a single C statement (which needs a semi-colon terminator).  This
114  * avoids problems with code like:
115  *
116  *   if ( condition_holds )
117  *    yyless( 5 );
118  *  else
119  *    do_something_else();
120  *
121  * Prior to using the do-while the compiler would get upset at the
122  * "else" because it interpreted the "if" statement as being all
123  * done when it reached the ';' after the yyless() call.
124  */
125 
126 /* Return all but the first 'n' matched characters back to the input stream. */
127 
128 #define yyless(n) \
129     do \
130         { \
131         /* Undo effects of setting up yytext. */ \
132         *yy_cp = yy_hold_char; \
133         YY_RESTORE_YY_MORE_OFFSET \
134         yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
135         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
136         } \
137     while ( 0 )
138 
139 #define unput(c) yyunput( c, yytext_ptr )
140 
141 /* The following is because we cannot portably get our hands on size_t
142  * (without autoconf's help, which isn't available because we want
143  * flex-generated scanners to compile on their own).
144  */
145 typedef unsigned int yy_size_t;
146 
147 
148 struct yy_buffer_state
149     {
150     FILE *yy_input_file;
151 
152     char *yy_ch_buf;    /* input buffer */
153     char *yy_buf_pos;    /* current position in input buffer */
154 
155     /* Size of input buffer in bytes, not including room for EOB
156      * characters.
157      */
158     yy_size_t yy_buf_size;
159 
160     /* Number of characters read into yy_ch_buf, not including EOB
161      * characters.
162      */
163     int yy_n_chars;
164 
165     /* Whether we "own" the buffer - i.e., we know we created it,
166      * and can realloc() it to grow it, and should free() it to
167      * delete it.
168      */
169     int yy_is_our_buffer;
170 
171     /* Whether this is an "interactive" input source; if so, and
172      * if we're using stdio for input, then we want to use getc()
173      * instead of fread(), to make sure we stop fetching input after
174      * each newline.
175      */
176     int yy_is_interactive;
177 
178     /* Whether we're considered to be at the beginning of a line.
179      * If so, '^' rules will be active on the next match, otherwise
180      * not.
181      */
182     int yy_at_bol;
183 
184     /* Whether to try to fill the input buffer when we reach the
185      * end of it.
186      */
187     int yy_fill_buffer;
188 
189     int yy_buffer_status;
190 #define YY_BUFFER_NEW 0
191 #define YY_BUFFER_NORMAL 1
192     /* When an EOF's been seen but there's still some text to process
193      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
194      * shouldn't try reading from the input source any more.  We might
195      * still have a bunch of tokens to match, though, because of
196      * possible backing-up.
197      *
198      * When we actually see the EOF, we change the status to "new"
199      * (via yyrestart()), so that the user can continue scanning by
200      * just pointing yyin at a new input file.
201      */
202 #define YY_BUFFER_EOF_PENDING 2
203     };
204 
205 static YY_BUFFER_STATE yy_current_buffer = 0;
206 
207 /* We provide macros for accessing buffer states in case in the
208  * future we want to put the buffer states in a more general
209  * "scanner state".
210  */
211 #define YY_CURRENT_BUFFER yy_current_buffer
212 
213 
214 /* yy_hold_char holds the character lost when yytext is formed. */
215 static char yy_hold_char;
216 
217 static int yy_n_chars;    /* number of characters read into yy_ch_buf */
218 
219 
220 int yyleng;
221 
222 /* Points to current character in buffer. */
223 static char *yy_c_buf_p = (char *) 0;
224 static int yy_init = 1;    /* whether we need to initialize */
225 static int yy_start = 0;  /* start state number */
226 
227 /* Flag which is used to allow yywrap()'s to do buffer switches
228  * instead of setting up a fresh yyin.  A bit of a hack ...
229  */
230 static int yy_did_buffer_switch_on_eof;
231 
232 void yyrestart YY_PROTO(( FILE *input_file ));
233 
234 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
235 void yy_load_buffer_state YY_PROTO(( void ));
236 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
237 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
238 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
239 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
240 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
241 
242 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
243 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
244 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
245 
246 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
247 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
248 static void yy_flex_free YY_PROTO(( void * ));
249 
250 #define yy_new_buffer yy_create_buffer
251 
252 #define yy_set_interactive(is_interactive) \
253     { \
254     if ( ! yy_current_buffer ) \
255         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
256     yy_current_buffer->yy_is_interactive = is_interactive; \
257     }
258 
259 #define yy_set_bol(at_bol) \
260     { \
261     if ( ! yy_current_buffer ) \
262         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
263     yy_current_buffer->yy_at_bol = at_bol; \
264     }
265 
266 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
267 
268 typedef unsigned char YY_CHAR;
269 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
270 typedef int yy_state_type;
271 extern char *yytext;
272 #define yytext_ptr yytext
273 
274 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
275 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
276 static int yy_get_next_buffer YY_PROTO(( void ));
277 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
278 
279 /* Done after the current pattern has been matched and before the
280  * corresponding action - sets up yytext.
281  */
282 #define YY_DO_BEFORE_ACTION \
283     yytext_ptr = yy_bp; \
284     yyleng = (int) (yy_cp - yy_bp); \
285     yy_hold_char = *yy_cp; \
286     *yy_cp = '\0'; \
287     yy_c_buf_p = yy_cp;
288 
289 #define YY_NUM_RULES 4
290 #define YY_END_OF_BUFFER 5
291 static yyconst short int yy_accept[9] =
292     {   0,
293         0,    0,    5,    1,    3,    2,    1,    0
294     } ;
295 
296 static yyconst int yy_ec[256] =
297     {   0,
298         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
299         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
300         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
301         1,    2,    1,    1,    1,    1,    1,    1,    1,    1,
302         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
303         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
304         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
305         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
306         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
307         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
308 
309         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
310         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
311         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
312         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
313         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
314         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
315         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
316         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
317         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
318         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
319 
320         1,    1,    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
326     } ;
327 
328 static yyconst int yy_meta[4] =
329     {   0,
330         1,    2,    2
331     } ;
332 
333 static yyconst short int yy_base[10] =
334     {   0,
335         0,    0,    5,    0,    6,    6,    0,    6,    3
336     } ;
337 
338 static yyconst short int yy_def[10] =
339     {   0,
340         8,    1,    8,    9,    8,    8,    9,    0,    8
341     } ;
342 
343 static yyconst short int yy_nxt[10] =
344     {   0,
345         4,    5,    6,    7,    8,    3,    8,    8,    8
346     } ;
347 
348 static yyconst short int yy_chk[10] =
349     {   0,
350         1,    1,    1,    9,    3,    8,    8,    8,    8
351     } ;
352 
353 static yy_state_type yy_last_accepting_state;
354 static char *yy_last_accepting_cpos;
355 
356 /* The intent behind this definition is that it'll catch
357  * any uses of REJECT which flex missed.
358  */
359 #define REJECT reject_used_but_not_detected
360 #define yymore() yymore_used_but_not_detected
361 #define YY_MORE_ADJ 0
362 #define YY_RESTORE_YY_MORE_OFFSET
363 char *yytext;
364 #line 1 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor.flex"
365 #define INITIAL 0
366 #line 2 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor.flex"
367 //  Copyright (c) 2001-2010 Hartmut Kaiser
368 //
369 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
370 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
371 
372 #include <boost/timer.hpp>
373 #if defined(_WIN32)
374     #include <io.h>
375 #endif
376     #define ID_WORD 1000
377     #define ID_EOL  1001
378     #define ID_CHAR 1002
379 #line 380 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor_flex.cpp"
380 
381 /* Macros after this point can all be overridden by user definitions in
382  * section 1.
383  */
384 
385 #ifndef YY_SKIP_YYWRAP
386 #ifdef __cplusplus
387 extern "C" int yywrap YY_PROTO(( void ));
388 #else
389 extern int yywrap YY_PROTO(( void ));
390 #endif
391 #endif
392 
393 #ifndef YY_NO_UNPUT
394 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
395 #endif
396 
397 #ifndef yytext_ptr
398 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
399 #endif
400 
401 #ifdef YY_NEED_STRLEN
402 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
403 #endif
404 
405 #ifndef YY_NO_INPUT
406 #ifdef __cplusplus
407 static int yyinput YY_PROTO(( void ));
408 #else
409 static int input YY_PROTO(( void ));
410 #endif
411 #endif
412 
413 #if YY_STACK_USED
414 static int yy_start_stack_ptr = 0;
415 static int yy_start_stack_depth = 0;
416 static int *yy_start_stack = 0;
417 #ifndef YY_NO_PUSH_STATE
418 static void yy_push_state YY_PROTO(( int new_state ));
419 #endif
420 #ifndef YY_NO_POP_STATE
421 static void yy_pop_state YY_PROTO(( void ));
422 #endif
423 #ifndef YY_NO_TOP_STATE
424 static int yy_top_state YY_PROTO(( void ));
425 #endif
426 
427 #else
428 #define YY_NO_PUSH_STATE 1
429 #define YY_NO_POP_STATE 1
430 #define YY_NO_TOP_STATE 1
431 #endif
432 
433 #ifdef YY_MALLOC_DECL
434 YY_MALLOC_DECL
435 #else
436 #if __STDC__
437 #ifndef __cplusplus
438 #include <stdlib.h>
439 #endif
440 #else
441 /* Just try to get by without declaring the routines.  This will fail
442  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
443  * or sizeof(void*) != sizeof(int).
444  */
445 #endif
446 #endif
447 
448 /* Amount of stuff to slurp up with each read. */
449 #ifndef YY_READ_BUF_SIZE
450 #define YY_READ_BUF_SIZE 8192
451 #endif
452 
453 /* Copy whatever the last rule matched to the standard output. */
454 
455 #ifndef ECHO
456 /* This used to be an fputs(), but since the string might contain NUL's,
457  * we now use fwrite().
458  */
459 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
460 #endif
461 
462 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
463  * is returned in "result".
464  */
465 #ifndef YY_INPUT
466 #define YY_INPUT(buf,result,max_size) \
467     if ( yy_current_buffer->yy_is_interactive ) \
468         { \
469         int c = '*', n; \
470         for ( n = 0; n < max_size && \
471                  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
472             buf[n] = (char) c; \
473         if ( c == '\n' ) \
474             buf[n++] = (char) c; \
475         if ( c == EOF && ferror( yyin ) ) \
476             YY_FATAL_ERROR( "input in flex scanner failed" ); \
477         result = n; \
478         } \
479     else \
480         { \
481         errno=0; \
482         while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
483             { \
484             if( errno != EINTR) \
485                 { \
486                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
487                 break; \
488                 } \
489             errno=0; \
490             clearerr(yyin); \
491             } \
492         }
493 #endif
494 
495 /* No semi-colon after return; correct usage is to write "yyterminate();" -
496  * we don't want an extra ';' after the "return" because that will cause
497  * some compilers to complain about unreachable statements.
498  */
499 #ifndef yyterminate
500 #define yyterminate() return YY_NULL
501 #endif
502 
503 /* Number of entries by which start-condition stack grows. */
504 #ifndef YY_START_STACK_INCR
505 #define YY_START_STACK_INCR 25
506 #endif
507 
508 /* Report a fatal error. */
509 #ifndef YY_FATAL_ERROR
510 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
511 #endif
512 
513 /* Default declaration of generated scanner - a define so the user can
514  * easily add parameters.
515  */
516 #ifndef YY_DECL
517 #define YY_DECL int yylex YY_PROTO(( void ))
518 #endif
519 
520 /* Code executed at the beginning of each rule, after yytext and yyleng
521  * have been set up.
522  */
523 #ifndef YY_USER_ACTION
524 #define YY_USER_ACTION
525 #endif
526 
527 /* Code executed at the end of each rule. */
528 #ifndef YY_BREAK
529 #define YY_BREAK break;
530 #endif
531 
532 #define YY_RULE_SETUP \
533     YY_USER_ACTION
534 
535 YY_DECL
536     {
537     register yy_state_type yy_current_state;
538     register char *yy_cp, *yy_bp;
539     register int yy_act;
540 
541 #line 16 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor.flex"
542 
543 #line 544 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor_flex.cpp"
544 
545     if ( yy_init )
546         {
547         yy_init = 0;
548 
549 #ifdef YY_USER_INIT
550         YY_USER_INIT;
551 #endif
552 
553         if ( ! yy_start )
554             yy_start = 1;  /* first start state */
555 
556         if ( ! yyin )
557             yyin = stdin;
558 
559         if ( ! yyout )
560             yyout = stdout;
561 
562         if ( ! yy_current_buffer )
563             yy_current_buffer =
564                 yy_create_buffer( yyin, YY_BUF_SIZE );
565 
566         yy_load_buffer_state();
567         }
568 
569     while ( 1 )    /* loops until end-of-file is reached */
570         {
571         yy_cp = yy_c_buf_p;
572 
573         /* Support of yytext. */
574         *yy_cp = yy_hold_char;
575 
576         /* yy_bp points to the position in yy_ch_buf of the start of
577          * the current run.
578          */
579         yy_bp = yy_cp;
580 
581         yy_current_state = yy_start;
582 yy_match:
583         do
584             {
585             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
586             if ( yy_accept[yy_current_state] )
587                 {
588                 yy_last_accepting_state = yy_current_state;
589                 yy_last_accepting_cpos = yy_cp;
590                 }
591             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
592                 {
593                 yy_current_state = (int) yy_def[yy_current_state];
594                 if ( yy_current_state >= 9 )
595                     yy_c = yy_meta[(unsigned int) yy_c];
596                 }
597             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
598             ++yy_cp;
599             }
600         while ( yy_base[yy_current_state] != 6 );
601 
602 yy_find_action:
603         yy_act = yy_accept[yy_current_state];
604         if ( yy_act == 0 )
605             { /* have to back up */
606             yy_cp = yy_last_accepting_cpos;
607             yy_current_state = yy_last_accepting_state;
608             yy_act = yy_accept[yy_current_state];
609             }
610 
611         YY_DO_BEFORE_ACTION;
612 
613 
614 do_action:  /* This label is used only to access EOF actions. */
615 
616 
617         switch ( yy_act )
618     { /* beginning of action switch */
619             case 0: /* must back up */
620             /* undo the effects of YY_DO_BEFORE_ACTION */
621             *yy_cp = yy_hold_char;
622             yy_cp = yy_last_accepting_cpos;
623             yy_current_state = yy_last_accepting_state;
624             goto yy_find_action;
625 
626 case 1:
627 YY_RULE_SETUP
628 #line 17 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor.flex"
629 { return ID_WORD; }
630     YY_BREAK
631 case 2:
632 YY_RULE_SETUP
633 #line 18 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor.flex"
634 { return ID_EOL; }
635     YY_BREAK
636 case 3:
637 YY_RULE_SETUP
638 #line 19 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor.flex"
639 { return ID_CHAR; }
640     YY_BREAK
641 case 4:
642 YY_RULE_SETUP
643 #line 20 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor.flex"
644 ECHO;
645     YY_BREAK
646 #line 647 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor_flex.cpp"
647 case YY_STATE_EOF(INITIAL):
648     yyterminate();
649 
650     case YY_END_OF_BUFFER:
651         {
652         /* Amount of text matched not including the EOB char. */
653         int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
654 
655         /* Undo the effects of YY_DO_BEFORE_ACTION. */
656         *yy_cp = yy_hold_char;
657         YY_RESTORE_YY_MORE_OFFSET
658 
659         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
660             {
661             /* We're scanning a new file or input source.  It's
662              * possible that this happened because the user
663              * just pointed yyin at a new source and called
664              * yylex().  If so, then we have to assure
665              * consistency between yy_current_buffer and our
666              * globals.  Here is the right place to do so, because
667              * this is the first action (other than possibly a
668              * back-up) that will match for the new input source.
669              */
670             yy_n_chars = yy_current_buffer->yy_n_chars;
671             yy_current_buffer->yy_input_file = yyin;
672             yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
673             }
674 
675         /* Note that here we test for yy_c_buf_p "<=" to the position
676          * of the first EOB in the buffer, since yy_c_buf_p will
677          * already have been incremented past the NUL character
678          * (since all states make transitions on EOB to the
679          * end-of-buffer state).  Contrast this with the test
680          * in input().
681          */
682         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
683             { /* This was really a NUL. */
684             yy_state_type yy_next_state;
685 
686             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
687 
688             yy_current_state = yy_get_previous_state();
689 
690             /* Okay, we're now positioned to make the NUL
691              * transition.  We couldn't have
692              * yy_get_previous_state() go ahead and do it
693              * for us because it doesn't know how to deal
694              * with the possibility of jamming (and we don't
695              * want to build jamming into it because then it
696              * will run more slowly).
697              */
698 
699             yy_next_state = yy_try_NUL_trans( yy_current_state );
700 
701             yy_bp = yytext_ptr + YY_MORE_ADJ;
702 
703             if ( yy_next_state )
704                 {
705                 /* Consume the NUL. */
706                 yy_cp = ++yy_c_buf_p;
707                 yy_current_state = yy_next_state;
708                 goto yy_match;
709                 }
710 
711             else
712                 {
713                 yy_cp = yy_c_buf_p;
714                 goto yy_find_action;
715                 }
716             }
717 
718         else switch ( yy_get_next_buffer() )
719             {
720             case EOB_ACT_END_OF_FILE:
721                 {
722                 yy_did_buffer_switch_on_eof = 0;
723 
724                 if ( yywrap() )
725                     {
726                     /* Note: because we've taken care in
727                      * yy_get_next_buffer() to have set up
728                      * yytext, we can now set up
729                      * yy_c_buf_p so that if some total
730                      * hoser (like flex itself) wants to
731                      * call the scanner after we return the
732                      * YY_NULL, it'll still work - another
733                      * YY_NULL will get returned.
734                      */
735                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
736 
737                     yy_act = YY_STATE_EOF(YY_START);
738                     goto do_action;
739                     }
740 
741                 else
742                     {
743                     if ( ! yy_did_buffer_switch_on_eof )
744                         YY_NEW_FILE;
745                     }
746                 break;
747                 }
748 
749             case EOB_ACT_CONTINUE_SCAN:
750                 yy_c_buf_p =
751                     yytext_ptr + yy_amount_of_matched_text;
752 
753                 yy_current_state = yy_get_previous_state();
754 
755                 yy_cp = yy_c_buf_p;
756                 yy_bp = yytext_ptr + YY_MORE_ADJ;
757                 goto yy_match;
758 
759             case EOB_ACT_LAST_MATCH:
760                 yy_c_buf_p =
761                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
762 
763                 yy_current_state = yy_get_previous_state();
764 
765                 yy_cp = yy_c_buf_p;
766                 yy_bp = yytext_ptr + YY_MORE_ADJ;
767                 goto yy_find_action;
768             }
769         break;
770         }
771 
772     default:
773         YY_FATAL_ERROR(
774             "fatal flex scanner internal error--no action found" );
775     } /* end of action switch */
776         } /* end of scanning one token */
777     } /* end of yylex */
778 
779 
780 /* yy_get_next_buffer - try to read in a new buffer
781  *
782  * Returns a code representing an action:
783  *  EOB_ACT_LAST_MATCH -
784  *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
785  *  EOB_ACT_END_OF_FILE - end of file
786  */
787 
788 static int yy_get_next_buffer()
789     {
790     register char *dest = yy_current_buffer->yy_ch_buf;
791     register char *source = yytext_ptr;
792     register int number_to_move, i;
793     int ret_val;
794 
795     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
796         YY_FATAL_ERROR(
797         "fatal flex scanner internal error--end of buffer missed" );
798 
799     if ( yy_current_buffer->yy_fill_buffer == 0 )
800         { /* Don't try to fill the buffer, so this is an EOF. */
801         if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
802             {
803             /* We matched a single character, the EOB, so
804              * treat this as a final EOF.
805              */
806             return EOB_ACT_END_OF_FILE;
807             }
808 
809         else
810             {
811             /* We matched some text prior to the EOB, first
812              * process it.
813              */
814             return EOB_ACT_LAST_MATCH;
815             }
816         }
817 
818     /* Try to read more data. */
819 
820     /* First move last chars to start of buffer. */
821     number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
822 
823     for ( i = 0; i < number_to_move; ++i )
824         *(dest++) = *(source++);
825 
826     if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
827         /* don't do the read, it's not guaranteed to return an EOF,
828          * just force an EOF
829          */
830         yy_current_buffer->yy_n_chars = yy_n_chars = 0;
831 
832     else
833         {
834         int num_to_read =
835             yy_current_buffer->yy_buf_size - number_to_move - 1;
836 
837         while ( num_to_read <= 0 )
838             { /* Not enough room in the buffer - grow it. */
839 #ifdef YY_USES_REJECT
840             YY_FATAL_ERROR(
841 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
842 #else
843 
844             /* just a shorter name for the current buffer */
845             YY_BUFFER_STATE b = yy_current_buffer;
846 
847             int yy_c_buf_p_offset =
848                 (int) (yy_c_buf_p - b->yy_ch_buf);
849 
850             if ( b->yy_is_our_buffer )
851                 {
852                 int new_size = b->yy_buf_size * 2;
853 
854                 if ( new_size <= 0 )
855                     b->yy_buf_size += b->yy_buf_size / 8;
856                 else
857                     b->yy_buf_size *= 2;
858 
859                 b->yy_ch_buf = (char *)
860                     /* Include room in for 2 EOB chars. */
861                     yy_flex_realloc( (void *) b->yy_ch_buf,
862                              b->yy_buf_size + 2 );
863                 }
864             else
865                 /* Can't grow it, we don't own it. */
866                 b->yy_ch_buf = 0;
867 
868             if ( ! b->yy_ch_buf )
869                 YY_FATAL_ERROR(
870                 "fatal error - scanner input buffer overflow" );
871 
872             yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
873 
874             num_to_read = yy_current_buffer->yy_buf_size -
875                         number_to_move - 1;
876 #endif
877             }
878 
879         if ( num_to_read > YY_READ_BUF_SIZE )
880             num_to_read = YY_READ_BUF_SIZE;
881 
882         /* Read in more data. */
883         YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
884             yy_n_chars, num_to_read );
885 
886         yy_current_buffer->yy_n_chars = yy_n_chars;
887         }
888 
889     if ( yy_n_chars == 0 )
890         {
891         if ( number_to_move == YY_MORE_ADJ )
892             {
893             ret_val = EOB_ACT_END_OF_FILE;
894             yyrestart( yyin );
895             }
896 
897         else
898             {
899             ret_val = EOB_ACT_LAST_MATCH;
900             yy_current_buffer->yy_buffer_status =
901                 YY_BUFFER_EOF_PENDING;
902             }
903         }
904 
905     else
906         ret_val = EOB_ACT_CONTINUE_SCAN;
907 
908     yy_n_chars += number_to_move;
909     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
910     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
911 
912     yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
913 
914     return ret_val;
915     }
916 
917 
918 /* yy_get_previous_state - get the state just before the EOB char was reached */
919 
yy_get_previous_state()920 static yy_state_type yy_get_previous_state()
921     {
922     register yy_state_type yy_current_state;
923     register char *yy_cp;
924 
925     yy_current_state = yy_start;
926 
927     for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
928         {
929         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
930         if ( yy_accept[yy_current_state] )
931             {
932             yy_last_accepting_state = yy_current_state;
933             yy_last_accepting_cpos = yy_cp;
934             }
935         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
936             {
937             yy_current_state = (int) yy_def[yy_current_state];
938             if ( yy_current_state >= 9 )
939                 yy_c = yy_meta[(unsigned int) yy_c];
940             }
941         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
942         }
943 
944     return yy_current_state;
945     }
946 
947 
948 /* yy_try_NUL_trans - try to make a transition on the NUL character
949  *
950  * synopsis
951  *  next_state = yy_try_NUL_trans( current_state );
952  */
953 
954 #ifdef YY_USE_PROTOS
yy_try_NUL_trans(yy_state_type yy_current_state)955 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
956 #else
957 static yy_state_type yy_try_NUL_trans( yy_current_state )
958 yy_state_type yy_current_state;
959 #endif
960     {
961     register int yy_is_jam;
962     register char *yy_cp = yy_c_buf_p;
963 
964     register YY_CHAR yy_c = 1;
965     if ( yy_accept[yy_current_state] )
966         {
967         yy_last_accepting_state = yy_current_state;
968         yy_last_accepting_cpos = yy_cp;
969         }
970     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
971         {
972         yy_current_state = (int) yy_def[yy_current_state];
973         if ( yy_current_state >= 9 )
974             yy_c = yy_meta[(unsigned int) yy_c];
975         }
976     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
977     yy_is_jam = (yy_current_state == 8);
978 
979     return yy_is_jam ? 0 : yy_current_state;
980     }
981 
982 
983 #ifndef YY_NO_UNPUT
984 #ifdef YY_USE_PROTOS
yyunput(int c,register char * yy_bp)985 static void yyunput( int c, register char *yy_bp )
986 #else
987 static void yyunput( c, yy_bp )
988 int c;
989 register char *yy_bp;
990 #endif
991     {
992     register char *yy_cp = yy_c_buf_p;
993 
994     /* undo effects of setting up yytext */
995     *yy_cp = yy_hold_char;
996 
997     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
998         { /* need to shift things up to make room */
999         /* +2 for EOB chars. */
1000         register int number_to_move = yy_n_chars + 2;
1001         register char *dest = &yy_current_buffer->yy_ch_buf[
1002                     yy_current_buffer->yy_buf_size + 2];
1003         register char *source =
1004                 &yy_current_buffer->yy_ch_buf[number_to_move];
1005 
1006         while ( source > yy_current_buffer->yy_ch_buf )
1007             *--dest = *--source;
1008 
1009         yy_cp += (int) (dest - source);
1010         yy_bp += (int) (dest - source);
1011         yy_current_buffer->yy_n_chars =
1012             yy_n_chars = yy_current_buffer->yy_buf_size;
1013 
1014         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1015             YY_FATAL_ERROR( "flex scanner push-back overflow" );
1016         }
1017 
1018     *--yy_cp = (char) c;
1019 
1020 
1021     yytext_ptr = yy_bp;
1022     yy_hold_char = *yy_cp;
1023     yy_c_buf_p = yy_cp;
1024     }
1025 #endif  /* ifndef YY_NO_UNPUT */
1026 
1027 
1028 #ifdef __cplusplus
yyinput()1029 static int yyinput()
1030 #else
1031 static int input()
1032 #endif
1033     {
1034     int c;
1035 
1036     *yy_c_buf_p = yy_hold_char;
1037 
1038     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1039         {
1040         /* yy_c_buf_p now points to the character we want to return.
1041          * If this occurs *before* the EOB characters, then it's a
1042          * valid NUL; if not, then we've hit the end of the buffer.
1043          */
1044         if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1045             /* This was really a NUL. */
1046             *yy_c_buf_p = '\0';
1047 
1048         else
1049             { /* need more input */
1050             int offset = yy_c_buf_p - yytext_ptr;
1051             ++yy_c_buf_p;
1052 
1053             switch ( yy_get_next_buffer() )
1054                 {
1055                 case EOB_ACT_LAST_MATCH:
1056                     /* This happens because yy_g_n_b()
1057                      * sees that we've accumulated a
1058                      * token and flags that we need to
1059                      * try matching the token before
1060                      * proceeding.  But for input(),
1061                      * there's no matching to consider.
1062                      * So convert the EOB_ACT_LAST_MATCH
1063                      * to EOB_ACT_END_OF_FILE.
1064                      */
1065 
1066                     /* Reset buffer status. */
1067                     yyrestart( yyin );
1068 
1069                     /* fall through */
1070 
1071                 case EOB_ACT_END_OF_FILE:
1072                     {
1073                     if ( yywrap() )
1074                         return EOF;
1075 
1076                     if ( ! yy_did_buffer_switch_on_eof )
1077                         YY_NEW_FILE;
1078 #ifdef __cplusplus
1079                     return yyinput();
1080 #else
1081                     return input();
1082 #endif
1083                     }
1084 
1085                 case EOB_ACT_CONTINUE_SCAN:
1086                     yy_c_buf_p = yytext_ptr + offset;
1087                     break;
1088                 }
1089             }
1090         }
1091 
1092     c = *(unsigned char *) yy_c_buf_p;  /* cast for 8-bit char's */
1093     *yy_c_buf_p = '\0';  /* preserve yytext */
1094     yy_hold_char = *++yy_c_buf_p;
1095 
1096 
1097     return c;
1098     }
1099 
1100 
1101 #ifdef YY_USE_PROTOS
yyrestart(FILE * input_file)1102 void yyrestart( FILE *input_file )
1103 #else
1104 void yyrestart( input_file )
1105 FILE *input_file;
1106 #endif
1107     {
1108     if ( ! yy_current_buffer )
1109         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1110 
1111     yy_init_buffer( yy_current_buffer, input_file );
1112     yy_load_buffer_state();
1113     }
1114 
1115 
1116 #ifdef YY_USE_PROTOS
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)1117 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1118 #else
1119 void yy_switch_to_buffer( new_buffer )
1120 YY_BUFFER_STATE new_buffer;
1121 #endif
1122     {
1123     if ( yy_current_buffer == new_buffer )
1124         return;
1125 
1126     if ( yy_current_buffer )
1127         {
1128         /* Flush out information for old buffer. */
1129         *yy_c_buf_p = yy_hold_char;
1130         yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1131         yy_current_buffer->yy_n_chars = yy_n_chars;
1132         }
1133 
1134     yy_current_buffer = new_buffer;
1135     yy_load_buffer_state();
1136 
1137     /* We don't actually know whether we did this switch during
1138      * EOF (yywrap()) processing, but the only time this flag
1139      * is looked at is after yywrap() is called, so it's safe
1140      * to go ahead and always set it.
1141      */
1142     yy_did_buffer_switch_on_eof = 1;
1143     }
1144 
1145 
1146 #ifdef YY_USE_PROTOS
yy_load_buffer_state(void)1147 void yy_load_buffer_state( void )
1148 #else
1149 void yy_load_buffer_state()
1150 #endif
1151     {
1152     yy_n_chars = yy_current_buffer->yy_n_chars;
1153     yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1154     yyin = yy_current_buffer->yy_input_file;
1155     yy_hold_char = *yy_c_buf_p;
1156     }
1157 
1158 
1159 #ifdef YY_USE_PROTOS
yy_create_buffer(FILE * file,int size)1160 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1161 #else
1162 YY_BUFFER_STATE yy_create_buffer( file, size )
1163 FILE *file;
1164 int size;
1165 #endif
1166     {
1167     YY_BUFFER_STATE b;
1168 
1169     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1170     if ( ! b )
1171         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1172 
1173     b->yy_buf_size = size;
1174 
1175     /* yy_ch_buf has to be 2 characters longer than the size given because
1176      * we need to put in 2 end-of-buffer characters.
1177      */
1178     b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1179     if ( ! b->yy_ch_buf )
1180         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1181 
1182     b->yy_is_our_buffer = 1;
1183 
1184     yy_init_buffer( b, file );
1185 
1186     return b;
1187     }
1188 
1189 
1190 #ifdef YY_USE_PROTOS
yy_delete_buffer(YY_BUFFER_STATE b)1191 void yy_delete_buffer( YY_BUFFER_STATE b )
1192 #else
1193 void yy_delete_buffer( b )
1194 YY_BUFFER_STATE b;
1195 #endif
1196     {
1197     if ( ! b )
1198         return;
1199 
1200     if ( b == yy_current_buffer )
1201         yy_current_buffer = (YY_BUFFER_STATE) 0;
1202 
1203     if ( b->yy_is_our_buffer )
1204         yy_flex_free( (void *) b->yy_ch_buf );
1205 
1206     yy_flex_free( (void *) b );
1207     }
1208 
1209 
1210 #ifndef _WIN32
1211 #include <unistd.h>
1212 #else
1213 #ifndef YY_ALWAYS_INTERACTIVE
1214 #ifndef YY_NEVER_INTERACTIVE
1215 extern int isatty YY_PROTO(( int ));
1216 #endif
1217 #endif
1218 #endif
1219 
1220 #ifdef YY_USE_PROTOS
yy_init_buffer(YY_BUFFER_STATE b,FILE * file)1221 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1222 #else
1223 void yy_init_buffer( b, file )
1224 YY_BUFFER_STATE b;
1225 FILE *file;
1226 #endif
1227 
1228 
1229     {
1230     yy_flush_buffer( b );
1231 
1232     b->yy_input_file = file;
1233     b->yy_fill_buffer = 1;
1234 
1235 #if YY_ALWAYS_INTERACTIVE
1236     b->yy_is_interactive = 1;
1237 #else
1238 #if YY_NEVER_INTERACTIVE
1239     b->yy_is_interactive = 0;
1240 #else
1241     b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1242 #endif
1243 #endif
1244     }
1245 
1246 
1247 #ifdef YY_USE_PROTOS
yy_flush_buffer(YY_BUFFER_STATE b)1248 void yy_flush_buffer( YY_BUFFER_STATE b )
1249 #else
1250 void yy_flush_buffer( b )
1251 YY_BUFFER_STATE b;
1252 #endif
1253 
1254     {
1255     if ( ! b )
1256         return;
1257 
1258     b->yy_n_chars = 0;
1259 
1260     /* We always need two end-of-buffer characters.  The first causes
1261      * a transition to the end-of-buffer state.  The second causes
1262      * a jam in that state.
1263      */
1264     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1265     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1266 
1267     b->yy_buf_pos = &b->yy_ch_buf[0];
1268 
1269     b->yy_at_bol = 1;
1270     b->yy_buffer_status = YY_BUFFER_NEW;
1271 
1272     if ( b == yy_current_buffer )
1273         yy_load_buffer_state();
1274     }
1275 
1276 
1277 #ifndef YY_NO_SCAN_BUFFER
1278 #ifdef YY_USE_PROTOS
yy_scan_buffer(char * base,yy_size_t size)1279 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1280 #else
1281 YY_BUFFER_STATE yy_scan_buffer( base, size )
1282 char *base;
1283 yy_size_t size;
1284 #endif
1285     {
1286     YY_BUFFER_STATE b;
1287 
1288     if ( size < 2 ||
1289          base[size-2] != YY_END_OF_BUFFER_CHAR ||
1290          base[size-1] != YY_END_OF_BUFFER_CHAR )
1291         /* They forgot to leave room for the EOB's. */
1292         return 0;
1293 
1294     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1295     if ( ! b )
1296         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1297 
1298     b->yy_buf_size = size - 2;  /* "- 2" to take care of EOB's */
1299     b->yy_buf_pos = b->yy_ch_buf = base;
1300     b->yy_is_our_buffer = 0;
1301     b->yy_input_file = 0;
1302     b->yy_n_chars = b->yy_buf_size;
1303     b->yy_is_interactive = 0;
1304     b->yy_at_bol = 1;
1305     b->yy_fill_buffer = 0;
1306     b->yy_buffer_status = YY_BUFFER_NEW;
1307 
1308     yy_switch_to_buffer( b );
1309 
1310     return b;
1311     }
1312 #endif
1313 
1314 
1315 #ifndef YY_NO_SCAN_STRING
1316 #ifdef YY_USE_PROTOS
yy_scan_string(yyconst char * yy_str)1317 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1318 #else
1319 YY_BUFFER_STATE yy_scan_string( yy_str )
1320 yyconst char *yy_str;
1321 #endif
1322     {
1323     int len;
1324     for ( len = 0; yy_str[len]; ++len )
1325         ;
1326 
1327     return yy_scan_bytes( yy_str, len );
1328     }
1329 #endif
1330 
1331 
1332 #ifndef YY_NO_SCAN_BYTES
1333 #ifdef YY_USE_PROTOS
yy_scan_bytes(yyconst char * bytes,int len)1334 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1335 #else
1336 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1337 yyconst char *bytes;
1338 int len;
1339 #endif
1340     {
1341     YY_BUFFER_STATE b;
1342     char *buf;
1343     yy_size_t n;
1344     int i;
1345 
1346     /* Get memory for full buffer, including space for trailing EOB's. */
1347     n = len + 2;
1348     buf = (char *) yy_flex_alloc( n );
1349     if ( ! buf )
1350         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1351 
1352     for ( i = 0; i < len; ++i )
1353         buf[i] = bytes[i];
1354 
1355     buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1356 
1357     b = yy_scan_buffer( buf, n );
1358     if ( ! b )
1359         YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1360 
1361     /* It's okay to grow etc. this buffer, and we should throw it
1362      * away when we're done.
1363      */
1364     b->yy_is_our_buffer = 1;
1365 
1366     return b;
1367     }
1368 #endif
1369 
1370 
1371 #ifndef YY_NO_PUSH_STATE
1372 #ifdef YY_USE_PROTOS
yy_push_state(int new_state)1373 static void yy_push_state( int new_state )
1374 #else
1375 static void yy_push_state( new_state )
1376 int new_state;
1377 #endif
1378     {
1379     if ( yy_start_stack_ptr >= yy_start_stack_depth )
1380         {
1381         yy_size_t new_size;
1382 
1383         yy_start_stack_depth += YY_START_STACK_INCR;
1384         new_size = yy_start_stack_depth * sizeof( int );
1385 
1386         if ( ! yy_start_stack )
1387             yy_start_stack = (int *) yy_flex_alloc( new_size );
1388 
1389         else
1390             yy_start_stack = (int *) yy_flex_realloc(
1391                     (void *) yy_start_stack, new_size );
1392 
1393         if ( ! yy_start_stack )
1394             YY_FATAL_ERROR(
1395             "out of memory expanding start-condition stack" );
1396         }
1397 
1398     yy_start_stack[yy_start_stack_ptr++] = YY_START;
1399 
1400     BEGIN(new_state);
1401     }
1402 #endif
1403 
1404 
1405 #ifndef YY_NO_POP_STATE
yy_pop_state()1406 static void yy_pop_state()
1407     {
1408     if ( --yy_start_stack_ptr < 0 )
1409         YY_FATAL_ERROR( "start-condition stack underflow" );
1410 
1411     BEGIN(yy_start_stack[yy_start_stack_ptr]);
1412     }
1413 #endif
1414 
1415 
1416 #ifndef YY_NO_TOP_STATE
yy_top_state()1417 static int yy_top_state()
1418     {
1419     return yy_start_stack[yy_start_stack_ptr - 1];
1420     }
1421 #endif
1422 
1423 #ifndef YY_EXIT_FAILURE
1424 #define YY_EXIT_FAILURE 2
1425 #endif
1426 
1427 #ifdef YY_USE_PROTOS
yy_fatal_error(yyconst char msg[])1428 static void yy_fatal_error( yyconst char msg[] )
1429 #else
1430 static void yy_fatal_error( msg )
1431 char msg[];
1432 #endif
1433     {
1434     (void) fprintf( stderr, "%s\n", msg );
1435     exit( YY_EXIT_FAILURE );
1436     }
1437 
1438 
1439 
1440 /* Redefine yyless() so it works in section 3 code. */
1441 
1442 #undef yyless
1443 #define yyless(n) \
1444     do \
1445         { \
1446         /* Undo effects of setting up yytext. */ \
1447         yytext[yyleng] = yy_hold_char; \
1448         yy_c_buf_p = yytext + n; \
1449         yy_hold_char = *yy_c_buf_p; \
1450         *yy_c_buf_p = '\0'; \
1451         yyleng = n; \
1452         } \
1453     while ( 0 )
1454 
1455 
1456 /* Internal utility routines. */
1457 
1458 #ifndef yytext_ptr
1459 #ifdef YY_USE_PROTOS
yy_flex_strncpy(char * s1,yyconst char * s2,int n)1460 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1461 #else
1462 static void yy_flex_strncpy( s1, s2, n )
1463 char *s1;
1464 yyconst char *s2;
1465 int n;
1466 #endif
1467     {
1468     register int i;
1469     for ( i = 0; i < n; ++i )
1470         s1[i] = s2[i];
1471     }
1472 #endif
1473 
1474 #ifdef YY_NEED_STRLEN
1475 #ifdef YY_USE_PROTOS
yy_flex_strlen(yyconst char * s)1476 static int yy_flex_strlen( yyconst char *s )
1477 #else
1478 static int yy_flex_strlen( s )
1479 yyconst char *s;
1480 #endif
1481     {
1482     register int n;
1483     for ( n = 0; s[n]; ++n )
1484         ;
1485 
1486     return n;
1487     }
1488 #endif
1489 
1490 
1491 #ifdef YY_USE_PROTOS
yy_flex_alloc(yy_size_t size)1492 static void *yy_flex_alloc( yy_size_t size )
1493 #else
1494 static void *yy_flex_alloc( size )
1495 yy_size_t size;
1496 #endif
1497     {
1498     return (void *) malloc( size );
1499     }
1500 
1501 #ifdef YY_USE_PROTOS
yy_flex_realloc(void * ptr,yy_size_t size)1502 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1503 #else
1504 static void *yy_flex_realloc( ptr, size )
1505 void *ptr;
1506 yy_size_t size;
1507 #endif
1508     {
1509     /* The cast to (char *) in the following accommodates both
1510      * implementations that use char* generic pointers, and those
1511      * that use void* generic pointers.  It works with the latter
1512      * because both ANSI C and C++ allow castless assignment from
1513      * any pointer type to void*, and deal with argument conversions
1514      * as though doing an assignment.
1515      */
1516     return (void *) realloc( (char *) ptr, size );
1517     }
1518 
1519 #ifdef YY_USE_PROTOS
yy_flex_free(void * ptr)1520 static void yy_flex_free( void *ptr )
1521 #else
1522 static void yy_flex_free( ptr )
1523 void *ptr;
1524 #endif
1525     {
1526     free( ptr );
1527     }
1528 
1529 #if YY_MAIN
main()1530 int main()
1531     {
1532     yylex();
1533     return 0;
1534     }
1535 #endif
1536 #line 20 "c:\\CVS\\boost\\libs\\spirit\\example\\lex\\word_count_functor.flex"
1537 
1538 
count(int tok,int * c,int * w,int * l)1539 bool count(int tok, int* c, int* w, int* l)
1540 {
1541     switch (tok) {
1542     case ID_WORD: ++*w; *c += yyleng; break;
1543     case ID_EOL:  ++*l; ++*c; break;
1544     case ID_CHAR: ++*c; break;
1545     default:
1546         return false;
1547     }
1548     return true;
1549 }
1550 
main(int argc,char * argv[])1551 int main(int argc, char* argv[])
1552 {
1553     int tok = EOF;
1554     int c = 0, w = 0, l = 0;
1555     yyin = fopen(1 == argc ? "word_count.input" : argv[1], "r");
1556     if (NULL == yyin) {
1557         fprintf(stderr, "Couldn't open input file!\n");
1558         exit(-1);
1559     }
1560 
1561     boost::timer tim;
1562     do {
1563         tok = yylex();
1564         if (!count(tok, &c, &w, &l))
1565             break;
1566     } while (EOF != tok);
1567     printf("lines: %d, words: %d, characters: %d\n", l, w, c);
1568     fclose(yyin);
1569     return 0;
1570 }
1571 
yywrap()1572 extern "C" int yywrap()
1573 {
1574     return 1;
1575 }
1576 
1577