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

📄 lex.yy.c

📁 编译原理课程设计之pp2语法分析程序
💻 C
📖 第 1 页 / 共 5 页
字号:
/* %% [11.0] code for yylineno update goes here */

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

/* %% [12.0] debug code goes here */
		if ( yy_flex_debug )
			{
			if ( yy_act == 0 )
				fprintf( stderr, "--scanner backing up\n" );
			else if ( yy_act < 51 )
				fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
				         (long)yy_rule_linenum[yy_act], yytext );
			else if ( yy_act == 51 )
				fprintf( stderr, "--accepting default rule (\"%s\")\n",
				         yytext );
			else if ( yy_act == 52 )
				fprintf( stderr, "--(end of buffer or a NUL)\n" );
			else
				fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
			}

		switch ( yy_act )
	{ /* beginning of action switch */
/* %% [13.0] actions go here */
			case 0: /* must back up */
			/* 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:
YY_RULE_SETUP
#line 60 "scanner.l"
{ 
                         savedLines.Append(strdup(yytext));
                         curColNum = 1; yy_pop_state(); yyless(0); }
	YY_BREAK
case YY_STATE_EOF(COPY):
#line 63 "scanner.l"
{ yy_pop_state(); }
	YY_BREAK
case 2:
/* rule 2 can match eol */
YY_RULE_SETUP
#line 65 "scanner.l"
{ curLineNum++; curColNum = 1;
			 if (YYSTATE == COPY) savedLines.Append("");
                         else yy_push_state(COPY);
		       }
	YY_BREAK
case 3:
YY_RULE_SETUP
#line 69 "scanner.l"
{ /* ignore all spaces */  }
	YY_BREAK
case 4:
YY_RULE_SETUP
#line 70 "scanner.l"
{ curColNum-=yyleng;
			 curColNum += (curColNum%TAB_SIZE==0) ? 1 : TAB_SIZE - curColNum%TAB_SIZE + 1; }
	YY_BREAK
/* -------------------- Comments ----------------------------- */
case 5:
YY_RULE_SETUP
#line 74 "scanner.l"
{ BEGIN(COMM); }
	YY_BREAK
case 6:
YY_RULE_SETUP
#line 75 "scanner.l"
{ BEGIN(0); }
	YY_BREAK
case YY_STATE_EOF(COMM):
#line 76 "scanner.l"
{ ReportError::UntermComment();
                         return 0; }
	YY_BREAK
case 7:
YY_RULE_SETUP
#line 78 "scanner.l"
{ /* ignore everything else that doesn't match */ }
	YY_BREAK
case 8:
YY_RULE_SETUP
#line 79 "scanner.l"
{ /* skip to end of line for // comment */ }
	YY_BREAK
/* --------------------- Keywords ------------------------------- */
case 9:
YY_RULE_SETUP
#line 83 "scanner.l"
{ return T_Void;        }
	YY_BREAK
case 10:
YY_RULE_SETUP
#line 84 "scanner.l"
{ return T_Int;         }
	YY_BREAK
case 11:
YY_RULE_SETUP
#line 85 "scanner.l"
{ return T_Double;      }
	YY_BREAK
case 12:
YY_RULE_SETUP
#line 86 "scanner.l"
{ return T_Bool;        }
	YY_BREAK
case 13:
YY_RULE_SETUP
#line 87 "scanner.l"
{ return T_String;      }
	YY_BREAK
case 14:
YY_RULE_SETUP
#line 88 "scanner.l"
{ return T_Null;        }
	YY_BREAK
case 15:
YY_RULE_SETUP
#line 89 "scanner.l"
{ return T_Class;       }
	YY_BREAK
case 16:
YY_RULE_SETUP
#line 90 "scanner.l"
{ return T_Extends;     }
	YY_BREAK
case 17:
YY_RULE_SETUP
#line 91 "scanner.l"
{ return T_This;        }
	YY_BREAK
case 18:
YY_RULE_SETUP
#line 92 "scanner.l"
{ return T_While;       }
	YY_BREAK
case 19:
YY_RULE_SETUP
#line 93 "scanner.l"
{ return T_For;         }
	YY_BREAK
case 20:
YY_RULE_SETUP
#line 94 "scanner.l"
{ return T_If;          }
	YY_BREAK
case 21:
YY_RULE_SETUP
#line 95 "scanner.l"
{ return T_Else;        }
	YY_BREAK
case 22:
YY_RULE_SETUP
#line 96 "scanner.l"
{ return T_Return;      }
	YY_BREAK
case 23:
YY_RULE_SETUP
#line 97 "scanner.l"
{ return T_Break;       }
	YY_BREAK
case 24:
YY_RULE_SETUP
#line 98 "scanner.l"
{ return T_New;         }
	YY_BREAK
case 25:
YY_RULE_SETUP
#line 99 "scanner.l"
{ return T_NewArray;    }
	YY_BREAK
case 26:
YY_RULE_SETUP
#line 100 "scanner.l"
{ return T_Print;       }
	YY_BREAK
case 27:
YY_RULE_SETUP
#line 101 "scanner.l"
{ return T_ReadInteger; }
	YY_BREAK
case 28:
YY_RULE_SETUP
#line 102 "scanner.l"
{ return T_ReadLine;    }
	YY_BREAK
case 29:
YY_RULE_SETUP
#line 103 "scanner.l"
{ return T_Try; 		}
	YY_BREAK
case 30:
YY_RULE_SETUP
#line 104 "scanner.l"
{ return T_Catch;		}
	YY_BREAK
case 31:
YY_RULE_SETUP
#line 105 "scanner.l"
{ return T_Throw;		}
	YY_BREAK
case 32:
YY_RULE_SETUP
#line 106 "scanner.l"
{ return T_Switch;              }
	YY_BREAK
case 33:
YY_RULE_SETUP
#line 107 "scanner.l"
{ return T_Case;                }
	YY_BREAK
case 34:
YY_RULE_SETUP
#line 108 "scanner.l"
{ return T_Default;             }
	YY_BREAK
/* -------------------- Operators ----------------------------- */
case 35:
YY_RULE_SETUP
#line 111 "scanner.l"
{ return T_LessEqual;   }
	YY_BREAK
case 36:
YY_RULE_SETUP
#line 112 "scanner.l"
{ return T_GreaterEqual;}
	YY_BREAK
case 37:
YY_RULE_SETUP
#line 113 "scanner.l"
{ return T_Equal;       }
	YY_BREAK
case 38:
YY_RULE_SETUP
#line 114 "scanner.l"
{ return T_NotEqual;    }
	YY_BREAK
case 39:
YY_RULE_SETUP
#line 115 "scanner.l"
{ return T_And;         }
	YY_BREAK
case 40:
YY_RULE_SETUP
#line 116 "scanner.l"
{ return T_Or;          }
	YY_BREAK
case 41:
YY_RULE_SETUP
#line 117 "scanner.l"
{ return yytext[0];     }
	YY_BREAK
case 42:
YY_RULE_SETUP
#line 119 "scanner.l"
{ return T_Dims;        }
	YY_BREAK
/* -------------------- Constants ------------------------------ */
case 43:
YY_RULE_SETUP
#line 122 "scanner.l"
{ yylval.boolConstant = (yytext[0] == 't');
                         return T_BoolConstant; }
	YY_BREAK
case 44:
YY_RULE_SETUP
#line 124 "scanner.l"
{ yylval.integerConstant = strtol(yytext, NULL, 10);
                         return T_IntConstant; }
	YY_BREAK
case 45:
YY_RULE_SETUP
#line 126 "scanner.l"
{ yylval.integerConstant = strtol(yytext, NULL, 16);
                         return T_IntConstant; }
	YY_BREAK
case 46:
YY_RULE_SETUP
#line 128 "scanner.l"
{ yylval.doubleConstant = atof(yytext);
                         return T_DoubleConstant; }
	YY_BREAK
case 47:
YY_RULE_SETUP
#line 130 "scanner.l"
{ yylval.stringConstant = strdup(yytext); 
                         return T_StringConstant; }
	YY_BREAK
case 48:
YY_RULE_SETUP
#line 132 "scanner.l"
{ ReportError::UntermString(&yylloc, yytext); }
	YY_BREAK
/* -------------------- Identifiers --------------------------- */
case 49:
YY_RULE_SETUP
#line 136 "scanner.l"
{ if (strlen(yytext) > MaxIdentLen)
                         ReportError::LongIdentifier(&yylloc, yytext);
                       strncpy(yylval.identifier, yytext, MaxIdentLen);
                       yylval.identifier[MaxIdentLen] = '\0';
                       return T_Identifier; }
	YY_BREAK
/* -------------------- Default rule (error) -------------------- */
case 50:
YY_RULE_SETUP
#line 144 "scanner.l"
{ ReportError::UnrecogChar(&yylloc, yytext[0]); }
	YY_BREAK
case 51:
YY_RULE_SETUP
#line 147 "scanner.l"
ECHO;
	YY_BREAK
#line 1307 "lex.yy.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(N):
	yyterminate();

	case YY_END_OF_BUFFER:
		{
		/* Amount of text matched not including the EOB char. */
		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;

		/* Undo the effects of YY_DO_BEFORE_ACTION. */
		*yy_cp = (yy_hold_char);
		YY_RESTORE_YY_MORE_OFFSET

		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
			{
			/* We're scanning a new file or input source.  It's
			 * possible that this happened because the user
			 * just pointed yyin at a new source and called
			 * yylex().  If so, then we have to assure
			 * consistency between YY_CURRENT_BUFFER and our
			 * globals.  Here is the right place to do so, because
			 * this is the first action (other than possibly a
			 * back-up) that will match for the new input source.
			 */
			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
			}

		/* 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 input().
		 */
		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
			{ /* This was really a NUL. */
			yy_state_type yy_next_state;

			(yy_c_buf_p) = (yytext_ptr) + 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_ptr) + 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
				{
/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
				yy_cp = (yy_c_buf_p);
				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_ptr) + YY_MORE_ADJ;

					yy_act = YY_STATE_EOF(YY_START);
					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_ptr) + yy_amount_of_matched_text;

				yy_current_state = yy_get_previous_state(  );

				yy_cp = (yy_c_buf_p);
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
				goto yy_match;

			case EOB_ACT_LAST_MATCH:
				(yy_c_buf_p) =
				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];

				yy_current_state = yy_get_previous_state(  );

				yy_cp = (yy_c_buf_p);
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
				goto yy_find_action;
			}
		break;
		}

	default:
		YY_FATAL_ERROR(
			"fatal flex scanner internal error--no action found" );
	} /* end of action switch */
		} /* end of scanning one token */
} /* end of yylex */
/* %ok-for-header */

/* %if-c++-only */
/* %not-for-header */

/* %ok-for-header */

/* %endif */

/* yy_get_next_buffer - try to read in a new buffer
 *
 * Returns a code representing an action:
 *	EOB_ACT_LAST_MATCH -
 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 *	EOB_ACT_END_OF_FILE - end of file
 */
/* %if-c-only */
static int yy_get_next_buffer (void)
/* %endif */
/* %if-c++-only */
/* %endif */
{
    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
	register char *source = (yytext_ptr);
	register int number_to_move, i;
	int ret_val;

	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
		YY_FATAL_ERROR(
		"fatal flex scanner internal error--end of buffer missed" );

	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
		{ /* Don't try to fill the buffer, so this is an EOF. */
		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
			{
			/* We matched a single character, the EOB, so
			 * treat this as a final EOF.
			 */
			return EOB_ACT_END_OF_FILE;
			}

		else
			{

⌨️ 快捷键说明

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