⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lexyy.c

📁 GESPI 2.0动态系统模拟工具  
💻 C
📖 第 1 页 / 共 3 页
字号:
void yyrestart YY_PROTO(( FILE *input_file ));
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
void yy_load_buffer_state YY_PROTO(( void ));
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( char *file, int size ));
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, char *file ));

#define yy_new_buffer yy_create_buffer

#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif

void yyreset( void );

YY_DECL
    {
    register yy_state_type yy_current_state;
    register YY_CHAR *yy_cp, *yy_bp;
    register int yy_act;



    if ( yy_init )
	{
	YY_USER_INIT;

	if ( ! yy_start )
	    yy_start = 1;	/* first start state */

	if ( ! yyin )
	    YY_FATAL_ERROR( "yyin is a NULL pointer" );

	if ( ! yyout )
	    yyout = stdout;

	if ( yy_current_buffer )
	    yy_init_buffer( yy_current_buffer, yyin );
	else
	    yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );

	yy_load_buffer_state();

	yy_init = 0;
	}

    while ( 1 )		/* loops until end-of-file is reached */
	{
	yy_cp = yy_c_buf_p;

	/* support of yytext */
	*yy_cp = yy_hold_char;

	/* yy_bp points to the position in yy_ch_buf of the start of the
	 * current run.
	 */
	yy_bp = yy_cp;

	yy_current_state = yy_start;
yy_match:
	do
	    {
	    register YY_CHAR yy_c = yy_ec[*yy_cp];
	    if ( yy_accept[yy_current_state] )
		{
		yy_last_accepting_state = yy_current_state;
		yy_last_accepting_cpos = yy_cp;
		}
	    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
		{
		yy_current_state = yy_def[yy_current_state];
		if ( yy_current_state >= 39 )
		    yy_c = yy_meta[yy_c];
		}
	    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
	    ++yy_cp;
	    }
	while ( yy_current_state != 38 );
	yy_cp = yy_last_accepting_cpos;
	yy_current_state = yy_last_accepting_state;

yy_find_action:
	yy_act = yy_accept[yy_current_state];

	YY_DO_BEFORE_ACTION;
	YY_USER_ACTION;

do_action:	/* this label is used only to access EOF actions */


	switch ( yy_act )
	    {
	    case 0: /* must backtrack */
	    /* undo the effects of YY_DO_BEFORE_ACTION */
	    *yy_cp = yy_hold_char;
	    yy_cp = yy_last_accepting_cpos;
	    yy_current_state = yy_last_accepting_state;
	    goto yy_find_action;

case 1:
{
         faux = (float) atof( yytext );
		 tr.node[tr.nnode].item = 'N';
         for( k=0; k<tr.nnum; k++ )
          if( faux == tr.constant[k] ) break;
		 tr.node[tr.nnode].val = (unsigned char) k;
		 if( k==tr.nnum )
		 {
		  tr.constant[tr.nnum] = faux;
		  ++tr.nnum;
		 }
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
	     }
	YY_BREAK
case 2:
{
         tr.node[tr.nnode].item = 'F';
		 tr.node[tr.nnode].val = 'L';
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 3:
{
         tr.node[tr.nnode].item = 'F';
		 tr.node[tr.nnode].val = 'l';
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 4:
{
         tr.node[tr.nnode].item = 'F';
		 tr.node[tr.nnode].val = 'e';
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 5:
{
         tr.node[tr.nnode].item = 'F';
		 tr.node[tr.nnode].val = 'S';
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 6:
{
         tr.node[tr.nnode].item = 'F';
		 tr.node[tr.nnode].val = 'C';
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
	     ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 7:
{
		 tr.node[tr.nnode].item = 'I';
         for( k=0; k<tr.nid; k++ )
          if( strncmp( &tr.id[k][0], yytext, 8 ) == 0 ) break;
		 tr.node[tr.nnode].val = (unsigned char) k;
		 if( k==tr.nid )
		 {
		  strncpy( &tr.id[tr.nid][0], yytext, 8 );
		  tr.id[tr.nid][8] = '\0';
		  tr.id[tr.nid][9] = '\0';
		  ++tr.nid;
		 }
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
		}
	YY_BREAK
case 8:
{
         tr.node[tr.nnode].item = 'O';
		 tr.node[tr.nnode].val = '+';
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 9:
{
         tr.node[tr.nnode].item = 'O';
		 tr.node[tr.nnode].val = '-';
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 10:
{
         tr.node[tr.nnode].item = 'O';
		 tr.node[tr.nnode].val = '*';
		 ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 11:
{
         tr.node[tr.nnode].item = 'O';
		 tr.node[tr.nnode].val = '/';
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 12:
{
         tr.node[tr.nnode].item = 'O';
		 tr.node[tr.nnode].val = '^';
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 13:
{
         tr.node[tr.nnode].item = 'O';
		 tr.node[tr.nnode].val = '(';
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 14:
{
         tr.node[tr.nnode].item = 'O';
		 tr.node[tr.nnode].val = ')';
		 if( tr.nnode==253 )
		 {
		  if( !errfl )
           sprintf( errstr, "ERROR - expression too long." );
          errfl++;
          yyterminate();
         }
		 ++tr.nnode;
		 return 1;
	    }
	YY_BREAK
case 15:
/* eat up whitespace	*/
	YY_BREAK
case 16:
{
         if( !errfl )
          sprintf( errstr, "ERROR - character not allowed: %s", yytext );
         errfl++;
         yyterminate();
        }
	YY_BREAK
case 17:
YY_FATAL_ERROR( "flex scanner jammed" );
	YY_BREAK
case YY_STATE_EOF(INITIAL):
    yyterminate();

	    case YY_END_OF_BUFFER:
		{
		/* amount of text matched not including the EOB char */
		int yy_amount_of_matched_text = yy_cp - yytext - 1;

		/* undo the effects of YY_DO_BEFORE_ACTION */
		*yy_cp = yy_hold_char;

		/* note that here we test for yy_c_buf_p "<=" to the position
		 * of the first EOB in the buffer, since yy_c_buf_p will
		 * already have been incremented past the NUL character
		 * (since all states make transitions on EOB to the end-
		 * of-buffer state).  Contrast this with the test in yyinput().
		 */
		if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
		    /* this was really a NUL */
		    {
		    yy_state_type yy_next_state;

		    yy_c_buf_p = yytext + yy_amount_of_matched_text;

		    yy_current_state = yy_get_previous_state();

		    /* okay, we're now positioned to make the
		     * NUL transition.  We couldn't have
		     * yy_get_previous_state() go ahead and do it
		     * for us because it doesn't know how to deal
		     * with the possibility of jamming (and we
		     * don't want to build jamming into it because
		     * then it will run more slowly)
		     */

		    yy_next_state = yy_try_NUL_trans( yy_current_state );

		    yy_bp = yytext + YY_MORE_ADJ;

		    if ( yy_next_state )
			{
			/* consume the NUL */
			yy_cp = ++yy_c_buf_p;
			yy_current_state = yy_next_state;
			goto yy_match;
			}

		    else
			{
			    yy_cp = yy_last_accepting_cpos;
			    yy_current_state = yy_last_accepting_state;
			goto yy_find_action;
			}
		    }

		else switch ( yy_get_next_buffer() )
		    {
		    case EOB_ACT_END_OF_FILE:
			{
			yy_did_buffer_switch_on_eof = 0;

			if ( yywrap() )
			    {
			    /* note: because we've taken care in
			     * yy_get_next_buffer() to have set up yytext,
			     * we can now set up yy_c_buf_p so that if some
			     * total hoser (like flex itself) wants
			     * to call the scanner after we return the
			     * YY_NULL, it'll still work - another YY_NULL
			     * will get returned.
			     */
			    yy_c_buf_p = yytext + YY_MORE_ADJ;

			    yy_act = YY_STATE_EOF((yy_start - 1) / 2);
			    goto do_action;
			    }

			else
			    {
			    if ( ! yy_did_buffer_switch_on_eof )
				YY_NEW_FILE;
			    }
			}
			break;

		    case EOB_ACT_CONTINUE_SCAN:
			yy_c_buf_p = yytext + yy_amount_of_matched_text;

			yy_current_state = yy_get_previous_state();

			yy_cp = yy_c_buf_p;
			yy_bp = yytext + YY_MORE_ADJ;
			goto yy_match;

		    case EOB_ACT_LAST_MATCH:
			yy_c_buf_p =
			    &yy_current_buffer->yy_ch_buf[yy_n_chars];

			yy_current_state = yy_get_previous_state();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -