lex.yy.c


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