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