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

📄 framelex.cpp

📁 不需要做任何修改的lex-yacc的demo
💻 CPP
字号:
/****************************************************************************
* framelex.cpp
* C++ source file generated from framelex.l.
* 
* Date: 05/20/07
* Time: 22:59:12
* 
* ALex Version: 2.07
****************************************************************************/

#include <yyclex.h>

// namespaces
#ifdef YYSTDCPPLIB
using namespace std;
#endif
#ifdef YYNAMESPACE
using namespace yl;
#endif

#line 1 ".\\framelex.l"

#include "main.h"// 在其中保存了记录头文件所需要的所有数据结构
#include "frameparser.h"// 由Yacc自动生成的所有标记声明,实际上都是C宏
extern "C"
{int yywrap(void);
//int yylex(void);
}

#line 31 "framelex.cpp"
// repeated because of possible precompiled header
#include <yyclex.h>

// namespaces
#ifdef YYSTDCPPLIB
using namespace std;
#endif
#ifdef YYNAMESPACE
using namespace yl;
#endif

#include ".\framelex.h"

/////////////////////////////////////////////////////////////////////////////
// constructor

YYLEXERNAME::YYLEXERNAME()
{
	yytables();
}

/////////////////////////////////////////////////////////////////////////////
// destructor

YYLEXERNAME::~YYLEXERNAME()
{
}

#ifndef YYTEXT_SIZE
#define YYTEXT_SIZE 100
#endif
#ifndef YYUNPUT_SIZE
#define YYUNPUT_SIZE YYTEXT_SIZE
#endif
#ifndef YYTEXT_MAX
#define YYTEXT_MAX 0
#endif
#ifndef YYUNPUT_MAX
#define YYUNPUT_MAX YYTEXT_MAX
#endif

/****************************************************************************
* N O T E
* 
* If the compiler generates a YYLEXERNAME error then you have not declared
* the name of the lexical analyser. The easiest way to do this is to use a
* name declaration. This is placed in the declarations section of your Lex
* source file and is introduced with the %name keyword. For instance, the
* following name declaration declares the lexer mylexer:
* 
* %name mylexer
* 
* For more information see help.
****************************************************************************/

// backwards compatability with lex
#ifdef input
int YYLEXERNAME::yyinput()
{
	return input();
}
#else
#define input yyinput
#endif

#ifdef output
void YYLEXERNAME::yyoutput(int ch)
{
	output(ch);
}
#else
#define output yyoutput
#endif

#ifdef unput
void YYLEXERNAME::yyunput(int ch)
{
	unput(ch);
}
#else
#define unput yyunput
#endif

#ifndef YYNBORLANDWARN
#ifdef __BORLANDC__
#pragma warn -rch		// <warning: unreachable code> off
#endif
#endif

int YYLEXERNAME::yyaction(int action)
{
#line 14 ".\\framelex.l"

	// extract yylval for use later on in actions
	YYSTYPE YYFAR& yylval = *(YYSTYPE YYFAR*)yyparserptr->yylvalptr;

#line 128 "framelex.cpp"
	yyreturnflg = yytrue;
	switch (action) {
	case 1:
		{
#line 20 ".\\framelex.l"
                                
			BEGIN _INCLUDE_;// 进入_INCLUDE_状态                                
			yylval.clear();// 需要将所有的Include值初始化                                
			return INCLUDE;// 返回INCLUDE标记                        
		
#line 139 "framelex.cpp"
		}
		break;
	case 2:
		{
#line 27 ".\\framelex.l"
                                
			BEGIN _INCLUDE_FILE_;// 进入_INCLUDE_FILE_状态                                
			return *yytext; // 返回引号或者尖括号                        
		
#line 149 "framelex.cpp"
		}
		break;
	case 3:
		{
#line 32 ".\\framelex.l"
                                
			yylval.headerfile=yylval.headerfile+yytext;// 记录头文件字符串                                
			return HEADERFILE;// 返回头文件标记                        
		
#line 159 "framelex.cpp"
		}
		break;
	case 4:
		{
#line 37 ".\\framelex.l"
                                
			BEGIN INITIAL;// 恢复到初始状态,默认状态                                
			return *yytext;// 返回引号或者尖括号                        
		
#line 169 "framelex.cpp"
		}
		break;
	case 5:
		{
#line 41 ".\\framelex.l"
;
#line 176 "framelex.cpp"
		}
		break;
	default:
		yyassert(0);
		break;
	}
	yyreturnflg = yyfalse;
	return 0;
}

#ifndef YYNBORLANDWARN
#ifdef __BORLANDC__
#pragma warn .rch		// <warning: unreachable code> to the old state
#endif
#endif

void YYLEXERNAME::yytables()
{
	yystext_size = YYTEXT_SIZE;
	yysunput_size = YYUNPUT_SIZE;
	yytext_max = YYTEXT_MAX;
	yyunput_max = YYUNPUT_MAX;

	static const yymatch_t YYNEARFAR YYBASED_CODE match[] = {
		0
	};
	yymatch = match;

	yytransitionmax = 98;
	static const yytransition_t YYNEARFAR YYBASED_CODE transition[] = {
		{ 0, 0 },
		{ 8, 8 },
		{ 16, 3 },
		{ 18, 5 },
		{ 0, 17 },
		{ 13, 12 },
		{ 14, 13 },
		{ 7, 1 },
		{ 7, 1 },
		{ 15, 14 },
		{ 10, 9 },
		{ 11, 10 },
		{ 12, 11 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 8, 8 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 16, 3 },
		{ 0, 0 },
		{ 7, 1 },
		{ 18, 5 },
		{ 0, 17 },
		{ 8, 1 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 16, 3 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 0, 0 },
		{ 9, 8 }
	};
	yytransition = transition;

	static const yystate_t YYNEARFAR YYBASED_CODE state[] = {
		{ 0, 0, 0 },
		{ 0, -2, 0 },
		{ 1, 0, 0 },
		{ 0, -32, 0 },
		{ 3, 0, 0 },
		{ -17, -31, 0 },
		{ 5, 0, 0 },
		{ 0, 0, 5 },
		{ 0, -8, 0 },
		{ 0, -100, 0 },
		{ 0, -88, 0 },
		{ 0, -96, 0 },
		{ 0, -112, 0 },
		{ 0, -94, 0 },
		{ 0, -92, 0 },
		{ 0, 0, 1 },
		{ 0, 0, 2 },
		{ -17, -30, 3 },
		{ 0, 0, 4 }
	};
	yystate = state;

	static const yybackup_t YYNEARFAR YYBASED_CODE backup[] = {
		0,
		0,
		0,
		0,
		0,
		0
	};
	yybackup = backup;
}
#line 43 ".\\framelex.l"

int yywrap(void)
{        
return 1;// 只处理一个输入文件
}

⌨️ 快捷键说明

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