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

📄 lex.yy.c

📁 编译原理课程设计之pp2语法分析程序
💻 C
📖 第 1 页 / 共 5 页
字号:
        1,    1,    3,    3,    1,    1,    1,    3,    3,    3,
        4,    4,    4,    4,    4,    4,    4,    1,    1,    4,
        3,    3,    3,    3,    3,    3,    4,    4,    4,    4,
        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
        4,    1
    } ;

static yyconst flex_int16_t yy_base[184] =
    {   0,
        0,    0,    0,    0,   51,   53,   55,   57,  229,  230,
      230,  230,  224,  211,  220,  230,  217,   53,   56,   60,
      208,  207,  206,    0,  186,  176,  184,  189,   32,   37,
       37,   36,   48,   45,  170,  181,   36,   46,  172,  176,
      161,    0,    0,  230,  230,  200,  207,  230,  204,  230,
      230,  230,    0,   75,   83,    0,  230,  230,  230,    0,
      160,  169,  176,  230,  163,  170,   47,  173,  167,  155,
      156,  154,  158,  154,    0,  151,  155,  149,  150,  154,
       59,   53,  153,  152,  230,    0,  230,    0,   88,   99,
        0,  172,  147,  154,  146,  155,  150,  151,  138,  151,

      149,  145,  144,  133,    0,    0,  136,  129,  136,  128,
      128,  129,  136,    0,  136,  128,  101,  103,  124,  121,
       96,    0,  126,    0,  127,  119,  116,  121,    0,  119,
      125,    0,  115,  116,  124,    0,  107,    0,    0,  120,
      110,    0,  111,  113,    0,    0,    0,  110,  115,  115,
      106,  110,  108,    0,    0,  112,   93,   91,   76,    0,
       76,    0,    0,    0,   69,   76,   72,    0,    0,    0,
       68,    0,   64,   19,    0,  230,  123,  127,  131,  133,
      137,  141,   58
    } ;

static yyconst flex_int16_t yy_def[184] =
    {   0,
      176,    1,    1,    1,  177,  177,  178,  178,  176,  176,
      176,  176,  176,  176,  179,  176,  176,  176,  176,  176,
      176,  176,  176,  180,  180,  180,  180,  176,  180,  180,
      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
      176,  181,  181,  176,  176,  176,  176,  176,  179,  176,
      176,  176,  182,  176,  176,  183,  176,  176,  176,  180,
      180,  180,  180,  176,  180,  180,  180,  180,  180,  180,
      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
      180,  180,  180,  180,  176,  181,  176,  182,  176,  176,
      183,  180,  180,  180,  180,  180,  180,  180,  180,  180,

      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
      180,  180,  180,  180,  180,  180,  176,  176,  180,  180,
      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
      180,  180,  180,  180,  180,    0,  176,  176,  176,  176,
      176,  176,  176
    } ;

static yyconst flex_int16_t yy_nxt[283] =
    {   0,
       10,   11,   12,   13,   14,   15,   16,   17,   16,   16,
       16,   18,   19,   20,   21,   22,   23,   24,   24,   24,
       24,   24,   24,   25,   26,   27,   24,   28,   16,   10,
       24,   29,   30,   31,   32,   33,   24,   24,   34,   24,
       24,   35,   24,   36,   37,   38,   24,   39,   40,   24,
       24,   41,   43,   12,   43,   12,   45,   12,   45,   12,
       91,   52,  175,   46,   53,   46,   54,   67,   55,   55,
       54,   69,   55,   55,   65,   66,   71,   68,   73,   70,
       75,   79,   56,   81,   80,   72,   76,   89,   89,   82,
       74,   97,   98,   54,   90,   55,   55,  111,  174,  113,

       89,   89,  112,  114,  173,   56,  172,   90,  117,   90,
      171,  118,  118,  118,  118,  118,  118,  143,  144,  170,
      169,  168,   90,   42,   42,   42,   42,   44,   44,   44,
       44,   49,  167,   49,   49,   60,   60,   86,  166,   86,
       86,   88,  165,   88,   88,  164,  163,  162,  161,  160,
      159,  158,  157,  156,  155,  154,  153,  152,  151,  138,
      150,  149,  148,  147,  146,  145,  142,  141,  140,  139,
      138,  137,  136,  135,  134,  133,  132,  131,  130,  129,
      128,  127,  126,  125,  124,  123,  122,  121,  120,  119,
      116,  115,  110,  109,  108,  107,  106,  105,  104,  103,

      102,  101,  100,   99,   96,   95,   94,   93,   92,   50,
       47,   87,   85,   84,   83,   78,   77,   64,   63,   62,
       61,   59,   58,   57,   51,   50,   48,   47,  176,    9,
      176,  176,  176,  176,  176,  176,  176,  176,  176,  176,
      176,  176,  176,  176,  176,  176,  176,  176,  176,  176,
      176,  176,  176,  176,  176,  176,  176,  176,  176,  176,
      176,  176,  176,  176,  176,  176,  176,  176,  176,  176,
      176,  176,  176,  176,  176,  176,  176,  176,  176,  176,
      176,  176
    } ;

static yyconst flex_int16_t yy_chk[283] =
    {   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,    5,    5,    6,    6,    7,    7,    8,    8,
      183,   18,  174,    7,   18,    8,   19,   30,   19,   19,
       20,   31,   20,   20,   29,   29,   32,   30,   33,   31,
       34,   37,   19,   38,   37,   32,   34,   54,   54,   38,
       33,   67,   67,   55,   54,   55,   55,   81,  173,   82,

       89,   89,   81,   82,  171,   19,  167,   89,   90,   54,
      166,   90,   90,  117,  117,  118,  118,  121,  121,  165,
      161,  159,   89,  177,  177,  177,  177,  178,  178,  178,
      178,  179,  158,  179,  179,  180,  180,  181,  157,  181,
      181,  182,  156,  182,  182,  153,  152,  151,  150,  149,
      148,  144,  143,  141,  140,  137,  135,  134,  133,  131,
      130,  128,  127,  126,  125,  123,  120,  119,  116,  115,
      113,  112,  111,  110,  109,  108,  107,  104,  103,  102,
      101,  100,   99,   98,   97,   96,   95,   94,   93,   92,
       84,   83,   80,   79,   78,   77,   76,   74,   73,   72,

       71,   70,   69,   68,   66,   65,   63,   62,   61,   49,
       47,   46,   41,   40,   39,   36,   35,   28,   27,   26,
       25,   23,   22,   21,   17,   15,   14,   13,    9,  176,
      176,  176,  176,  176,  176,  176,  176,  176,  176,  176,
      176,  176,  176,  176,  176,  176,  176,  176,  176,  176,
      176,  176,  176,  176,  176,  176,  176,  176,  176,  176,
      176,  176,  176,  176,  176,  176,  176,  176,  176,  176,
      176,  176,  176,  176,  176,  176,  176,  176,  176,  176,
      176,  176
    } ;

static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;

extern int yy_flex_debug;
int yy_flex_debug = 1;

static yyconst flex_int16_t yy_rule_linenum[51] =
    {   0,
       60,   65,   69,   70,   74,   75,   78,   79,   83,   84,
       85,   86,   87,   88,   89,   90,   91,   92,   93,   94,
       95,   96,   97,   98,   99,  100,  101,  102,  103,  104,
      105,  106,  107,  108,  111,  112,  113,  114,  115,  116,
      117,  119,  122,  124,  126,  128,  130,  132,  136,  144
    } ;

/* 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
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "scanner.l"
/*
 * File:  scanner.l
 * ----------------
 * Lex inupt file to generate the scanner for the compiler.
 */
#line 8 "scanner.l"

#include <string.h>
#include "scanner.h"
#include "utility.h" // for PrintDebug()
#include "errors.h"
#include "parser.h" // for token codes, yylval
#include "list.h"

#define TAB_SIZE 8

/* Global variables
 * ----------------
 * (For shame!) But we need a few to keep track of things that are
 * preserved between calls to yylex or used outside the scanner.
 */
static int curLineNum, curColNum;
List<char*> savedLines; //used to copy the source code.

static void DoBeforeEachAction();
#define YY_USER_ACTION DoBeforeEachAction();

/* States
 * ------
 * A little wrinkle on states is the COPY exclusive state which
 * I added to first match each line and copy it ot the list of lines
 * read before re-processing it. This allows us to print the entire
 * line later to provide context on errors.
 */


/* Definitions
 * -----------
 * To make our rules more readable, we establish some definitions here.
 */
#line 685 "lex.yy.c"

#define INITIAL 0
#define N 1
#define COPY 2
#define COMM 3

#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
 * down here because we want the user's section 1 to have been scanned first.
 * The user has a chance to override it with an option.
 */
/* %if-c-only */
#include <unistd.h>
/* %endif */
/* %if-c++-only */
/* %endif */
#endif

#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif

/* %if-c-only Reentrant structure and macros (non-C++). */
/* %if-reentrant */
/* %if-reentrant */
/* %endif */
/* %if-bison-bridge */
/* %endif */
/* %endif End reentrant structures and macros. */

/* Macros after this point can all be overridden by user definitions in
 * section 1.
 */

#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap (void );
#else
extern int yywrap (void );
#endif
#endif

/* %not-for-header */

    static void yyunput (int c,char *buf_ptr  );
    
/* %ok-for-header */

/* %endif */

#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif

#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * );
#endif

#ifndef YY_NO_INPUT
/* %if-c-only Standard (non-C++) definition */
/* %not-for-header */

#ifdef __cplusplus
static int yyinput (void );
#else
static int input (void );
#endif
/* %ok-for-header */

/* %endif */
#endif

/* %if-c-only */

        static int yy_start_stack_ptr = 0;
        static int yy_start_stack_depth = 0;
        static int *yy_start_stack = 0;
    
    static void yy_push_state (int new_state );
    
    static void yy_pop_state (void );
    
    static int yy_top_state (void );
    
/* %endif */

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

/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* %if-c-only Standard (non-C++) definition */
/* This used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite().
 */
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
/* %endif */
/* %if-c++-only C++ definition */
/* %endif */
#endif

/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
		{ \
		int c = '*'; \
		size_t n; \
		for ( n = 0; n < max_size && \
			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
			buf[n] = (char) c; \
		if ( c == '\n' ) \
			buf[n++] = (char) c; \
		if ( c == EOF && ferror( yyin ) ) \
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
		result = n; \
		} \
	else \
		{ \
		errno=0; \
		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
			{ \
			if( errno != EINTR) \
				{ \
				YY_FATAL_ERROR( "input in flex scanner failed" ); \
				break; \
				} \
			errno=0; \
			clearerr(yyin); \
			} \
		}\
\
/* %if-c++-only C++ definition \ */\
/* %endif */

#endif

/* No semi-colon after return; correct usage is to write "yyterminate();" -
 * we don't want an extra ';' after the "return" because that will cause
 * some compilers to complain about unreachable statements.
 */
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif

/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif

/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
/* %if-c-only */
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
/* %endif */
/* %if-c++-only */
/* %endif */
#endif

/* %if-tables-serialization structures and prototypes */
/* %not-for-header */

/* %ok-for-header */

/* %not-for-header */

/* %tables-yydmap generated elements */
/* %endif */
/* end tables serialization structures and prototypes */

/* %ok-for-header */

/* Default declaration of generated scanner - a define so the user can
 * easily add parameters.
 */
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1
/* %if-c-only Standard (non-C++) definition */

extern int yylex (void);

#define YY_DECL int yylex (void)
/* %endif */
/* %if-c++-only C++ definition */
/* %endif */
#endif /* !YY_DECL */

/* Code executed at the beginning of each rule, after yytext and yyleng
 * have been set up.
 */
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif

/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif

/* %% [6.0] YY_RULE_SETUP definition goes here */
#define YY_RULE_SETUP \
	YY_USER_ACTION

/* %not-for-header */

/** The main scanner function which does all the work.
 */
YY_DECL
{
	register yy_state_type yy_current_state;
	register char *yy_cp, *yy_bp;
	register int yy_act;
    
/* %% [7.0] user's declarations go here */
#line 59 "scanner.l"

#line 907 "lex.yy.c"

	if ( (yy_init) )
		{
		(yy_init) = 0;

#ifdef YY_USER_INIT
		YY_USER_INIT;
#endif

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

		if ( ! yyin )
/* %if-c-only */
			yyin = stdin;
/* %endif */
/* %if-c++-only */
/* %endif */

		if ( ! yyout )
/* %if-c-only */
			yyout = stdout;
/* %endif */
/* %if-c++-only */
/* %endif */

		if ( ! YY_CURRENT_BUFFER ) {
			yyensure_buffer_stack ();
			YY_CURRENT_BUFFER_LVALUE =
				yy_create_buffer(yyin,YY_BUF_SIZE );
		}

		yy_load_buffer_state( );
		}

	while ( 1 )		/* loops until end-of-file is reached */
		{
/* %% [8.0] yymore()-related code goes here */
		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;

/* %% [9.0] code to set up and find next match goes here */
		yy_current_state = (yy_start);
yy_match:
		do
			{
			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*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 = (int) yy_def[yy_current_state];
				if ( yy_current_state >= 177 )
					yy_c = yy_meta[(unsigned int) yy_c];
				}
			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
			++yy_cp;
			}
		while ( yy_base[yy_current_state] != 230 );

yy_find_action:
/* %% [10.0] code to find the action number goes here */
		yy_act = yy_accept[yy_current_state];
		if ( yy_act == 0 )
			{ /* have to back up */
			yy_cp = (yy_last_accepting_cpos);
			yy_current_state = (yy_last_accepting_state);
			yy_act = yy_accept[yy_current_state];
			}

		YY_DO_BEFORE_ACTION;

⌨️ 快捷键说明

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