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

📄 lexyy.c

📁 编译原理实验
💻 C
📖 第 1 页 / 共 2 页
字号:
#define FLEX_COMPRESSED
/* A lexical scanner generated by flex */

/* scanner skeleton version:
 * $Header: flex.skel,v 2.0 89/06/20 15:49:46 vern Locked $
 */

#include <stdio.h>

#define FLEX_SCANNER

/* amount of stuff to slurp up with each read */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif

#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of input buffer */
#endif

/* returned upon end-of-file */
#define YY_END_TOK 0

/* copy whatever the last rule matched to the standard output */

#define ECHO fputs( yytext, yyout )

/* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#define YY_INPUT(buf,result,max_size) \
	if ( (result = read( fileno(yyin), buf, max_size )) < 0 ) \
	    YY_FATAL_ERROR( "read() in flex scanner failed" );
#define YY_NULL 0
#define yyterminate() return ( YY_NULL )

/* report a fatal error */
#define YY_FATAL_ERROR(msg) \
	{ \
	fputs( msg, stderr ); \
	putc( '\n', stderr ); \
	exit( 1 ); \
	}

/* default yywrap function - always treat EOF as an EOF */
#define yywrap() 1

/* enter a start condition.  This macro really ought to take a parameter,
 * but we do it the disgusting crufty way forced on us by the ()-less
 * definition of BEGIN
 */
#define BEGIN yy_start = 1 + 2 *

/* action number for EOF rule of a given start state */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)

/* special action meaning "start processing a new file" */
#define YY_NEW_FILE goto new_file

/* default declaration of generated scanner - a define so the user can
 * easily add parameters
 */
#define YY_DECL int yylex( void )

/* code executed at the end of each rule */
#define YY_BREAK break;

#define YY_END_OF_BUFFER_CHAR 0

/* done after the current pattern has been matched and before the
 * corresponding action - sets up yytext
 */
#define YY_DO_BEFORE_ACTION \
	yytext = yy_bp; \
	yy_hold_char = *yy_cp; \
	*yy_cp = '\0'; \
	yy_c_buf_p = yy_cp;

/* returns the length of the matched text */
#define yyleng (yy_cp - yy_bp)

#define EOB_ACT_RESTART_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2

/* return all but the first 'n' matched characters back to the input stream */
#define yyless(n) \
	{ \
	*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
	yy_c_buf_p = yy_cp = yy_bp + n; \
	YY_DO_BEFORE_ACTION; /* set up yytext again */ \
	}

#define unput(c) yyunput( c, yy_bp )

#define YY_USER_ACTION

FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
unsigned char  *yytext;

# line 1 "funcdraw.l"
#define INITIAL 0
// -------------------------- funcdraw.l ------------------------------
# line 5 "funcdraw.l"
# include "semantics.h"
# include "y_tab.h"				// 由XDYACC根据源程序生成
unsigned int LineNo;			// 行号
struct Token tokens;			// 记号
// ----------------- 入口声明 -----------------
#define comment_entry 1
#define c_comment_entry 2
// ----------------- 辅助定义 -----------------
// 姜江解答模式:
// 习题解答模式:c_comments "/*"([^\*]|\*[^/])*"*/"
// 多重入口模式:c_comments "/*"
# line 25 "funcdraw.l"
#define YY_END_OF_BUFFER 41
typedef int yy_state_type;
static const short int yy_accept[125] =
    {   0,
        0,    0,    0,    0,    0,    0,   41,   34,    3,    4,
       29,   30,   25,   24,   27,   23,   26,   32,   28,   33,
       33,   33,   16,   33,   33,   33,   33,   33,   33,   33,
       14,   34,   34,   34,   34,   34,   34,   34,   34,   34,
       35,   36,   38,   39,   38,    3,   31,    1,    0,    0,
       32,   33,    0,   33,   33,   33,   33,   33,    8,   21,
       33,   15,   33,   33,   33,   33,   33,   33,   11,    0,
        0,    0,    9,    8,    0,    0,   11,   10,   37,    0,
        0,    0,   32,   18,   33,   20,    9,   33,   33,    7,
       33,   17,   33,   33,   19,    0,    0,    0,    0,    0,

        2,   13,   10,   33,   33,   22,   12,   12,    0,   13,
        0,    5,   33,    6,    0,    0,    5,    0,    0,    0,
        0,    6,    7,    0
    } ;

static const unsigned char   yy_ec[256] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    2,    1,    1,    1,    1,    1,    1,    1,    4,
        5,    6,    7,    8,    9,   10,   11,   12,   12,   12,
       12,   12,   12,   12,   12,   12,   12,    1,   13,    1,
        1,    1,    1,    1,   15,   16,   17,   18,   19,   20,
       21,   16,   22,   16,   16,   23,   24,   25,   26,   27,
       28,   29,   30,   31,   16,   16,   32,   33,   16,   16,
        1,    1,    1,    1,   14,    1,   15,   16,   17,   18,

       19,   20,   21,   16,   22,   16,   16,   23,   24,   25,
       26,   27,   28,   29,   30,   31,   16,   16,   32,   33,
       16,   16,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,   34,    1,    1,    1,    1,    1,   35,
        1,    1,   36,    1,    1,    1,   37,   38,   39,    1,
       40,   41,    1,    1,    1,   42,   43,    1,   44,    1,
        1,   45,   46,    1,    1,    1,    1,   47,   48,   49,

        1,   50,    1,    1,    1,    1,    1,   51,    1,    1,
        1,   52,    1,   53,   54,    1,    1,    1,    1,    1,
       55,    1,    1,    1,   56,    1,   57,    1,    1,   58,
        1,    1,    1,    1,    1,    1,    1,   59,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,   60,    1,    1
    } ;

static const char yy_meta[61] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    2,    1,    2,    2,    2,    2,    2,    2,    2,
        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
        2,    2,    2,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1
    } ;

static const short int yy_base[130] =
    {   0,
        0,    0,  209,  208,   58,   59,  210,  213,  207,  213,
      213,  213,  202,  213,  213,  198,   57,   57,  213,  192,
       52,   56,   57,   58,   59,   61,   62,   60,   66,   79,
       80,  161,  148,  145,  143,  153,  140,  163,  152,  145,
      213,  213,  213,  213,  185,  193,  213,  213,   77,  182,
       67,  179,  178,   67,   84,   86,   88,   89,  177,  176,
       90,  175,   91,   94,  100,   97,  102,  104,  174,  148,
      132,  132,  213,  213,  130,  143,  213,  213,  213,  113,
      117,  121,  170,  167,  106,  166,  165,  116,  120,  164,
      119,  163,  117,  122,  162,  141,  119,  126,  137,  114,

      213,  156,  155,  121,  125,  154,  153,  213,  129,  213,
      121,  213,  131,  141,  105,  105,  138,  106,  109,   87,
       97,  213,  213,  213,  156,  158,  135,  160,  162
    } ;

static const short int yy_def[130] =
    {   0,
      124,    1,  125,  125,  126,  126,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  127,
      127,  127,  127,  127,  127,  127,  127,  127,  127,  127,
      127,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  128,  124,
      124,  127,  127,  127,  127,  127,  127,  127,  127,  127,
      127,  127,  127,  127,  127,  127,  127,  127,  127,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  128,
      129,  128,  124,  127,  127,  127,  127,  127,  127,  127,
      127,  127,  127,  127,  127,  124,  124,  124,  124,  124,

      124,  127,  127,  127,  127,  127,  127,  124,  124,  124,
      124,  124,  127,  127,  124,  124,  127,  124,  124,  124,
      124,  124,  124,    0,  124,  124,  124,  124,  124
    } ;

static const short int yy_nxt[274] =
    {   0,
        8,    9,   10,   11,   12,   13,   14,   15,   16,    8,
       17,   18,   19,    8,   20,   20,   21,   22,   23,   24,
       20,   25,   26,   20,   20,   27,   28,   20,   29,   30,
       31,   20,   20,    8,    8,    8,    8,   32,    8,    8,
        8,   33,   34,    8,    8,   35,    8,    8,    8,   36,
       37,   38,   39,   40,    8,    8,    8,    8,    8,    8,
       44,   44,   49,   45,   45,   53,   50,   48,   51,   53,
       53,   53,   53,   53,   53,   53,   50,   54,   51,   53,
       53,   62,   81,   57,   55,   60,   58,   82,   59,   56,
       61,   63,   53,   53,   68,   64,   84,   53,   85,   53,

       65,   53,   53,   53,   53,   69,   66,   53,   91,   67,
       53,   89,   86,   53,   88,   53,   87,   53,   81,   53,
       94,   90,   81,   82,   92,   93,   81,  101,   95,   53,
       53,   82,   53,   53,   53,   53,   52,  102,   53,  103,
      104,  105,  113,  114,   53,  123,  122,  106,  107,  121,
      120,   53,  119,  118,   53,  117,   41,   41,   43,   43,
       80,   80,   82,   82,  116,  115,   53,   53,   53,   53,
      112,  111,  110,  109,  108,   53,   53,   53,   53,   53,
       53,   83,  100,   99,   98,   97,   96,   53,   53,   53,
       53,  124,   53,   83,   46,   79,   78,   77,   76,   75,

       74,   73,   72,   71,   70,   53,   48,   47,   46,  124,
       42,   42,    7,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124
    } ;

static const short int yy_chk[274] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        5,    6,   17,    5,    6,   21,   18,   17,   18,   22,
       23,   24,   25,   28,   26,   27,   51,   21,   51,   29,
       54,   28,   49,   24,   22,   26,   24,   49,   25,   23,
       27,   29,   30,   31,   31,   30,   54,   55,   55,   56,

       30,   57,   58,   61,   63,   31,   30,   64,   64,   30,
       66,   61,   56,   65,   58,   67,   57,   68,   80,   85,
       67,   63,   81,   80,   65,   66,   82,   81,   68,   88,
       93,   82,   91,   89,  104,   94,  127,   85,  105,   88,
       89,   91,  104,  105,  113,  121,  120,   93,   94,  119,
      118,  117,  116,  115,  114,  113,  125,  125,  126,  126,
      128,  128,  129,  129,  111,  109,  107,  106,  103,  102,
      100,   99,   98,   97,   96,   95,   92,   90,   87,   86,
       84,   83,   76,   75,   72,   71,   70,   69,   62,   60,
       59,   53,   52,   50,   46,   45,   40,   39,   38,   37,

       36,   35,   34,   33,   32,   20,   16,   13,    9,    7,
        4,    3,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124
    } ;

/* the intent behind this definition is that it'll catch
 * any uses of REJECT which flex missed
 */
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected

/* these variables are all declared out here so that section 3 code can
 * manipulate them
 */
static unsigned char  *yy_c_buf_p;	/* points to current character in buffer */
static int yy_init = 1;		/* whether we need to initialize */
static int yy_start = 0;	/* start state number */

/* true when we've seen an EOF for the current input file */
static int yy_eof_has_been_seen;

static int yy_n_chars;		/* number of characters read into yy_ch_buf */

/* yy_ch_buf has to be 2 characters longer than YY_BUF_SIZE because we need
 * to put in 2 end-of-buffer characters (this is explained where it is
 * done) at the end of yy_ch_buf
 */
static unsigned char  yy_ch_buf[YY_BUF_SIZE + 2];

/* yy_hold_char holds the character lost when yytext is formed */
static unsigned char  yy_hold_char;

static yy_state_type yy_last_accepting_state;
static unsigned char  *yy_last_accepting_cpos;

static yy_state_type yy_get_previous_state( void );
static int yy_get_next_buffer( void );
static void yyunput( int c, unsigned char  *buf_ptr );
static int input( void );
static void yyrestart( FILE *input_file );

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



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

	if ( ! yyin )
	    yyin = stdin;

	if ( ! yyout )
	    yyout = stdout;

new_file:
	/* this is where we enter upon encountering an end-of-file and
	 * yywrap() indicating that we should continue processing
	 */

	/* we put in the '\n' and start reading from [1] so that an
	 * initial match-at-newline will be true.
	 */

	yy_ch_buf[0] = '\n';
	yy_n_chars = 1;

	/* we always need two end-of-buffer characters.  The first causes
	 * a transition to the end-of-buffer state.  The second causes
	 * a jam in that state.
	 */
	yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
	yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;

	yy_eof_has_been_seen = 0;

	yytext = yy_c_buf_p = &yy_ch_buf[1];
	yy_hold_char = *yy_c_buf_p;
	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;
	do
	    {
	    register unsigned 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 >= 125 )
		    yy_c = yy_meta[yy_c];
		}
	    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
	    ++yy_cp;
	    }
	while ( yy_current_state != 124 );
	yy_cp = yy_last_accepting_cpos;
	yy_current_state = yy_last_accepting_state;

	/* bogus while loop to let YY_BACK_TRACK, EOB_ACT_LAST_MATCH,
	 * and EOF actions branch here without introducing an optimizer-
	 * daunting goto
	 */
	while ( 1 )
	    {
	    yy_act = yy_accept[yy_current_state];

	    YY_DO_BEFORE_ACTION;
	    YY_USER_ACTION;

#ifdef FLEX_DEBUG
	    fprintf( stderr, "--accepting rule #%d (\"%s\")\n",
		     yy_act, yytext );
#endif

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;
		continue; /* go to "YY_DO_BEFORE_ACTION" */

// ----------------- 翻译规则 -----------------
case 1:
# line 27 "funcdraw.l"
BEGIN comment_entry ;		// Ada或C++注释
	YY_BREAK
// 多重入口模式:{c_comments}		BEGIN c_comment_entry ;		// C注释
// 单个入口模式:
case 2:
# line 30 "funcdraw.l"
;							// C注释
	YY_BREAK

⌨️ 快捷键说明

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