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

📄 lex.yy.c.bw

📁 早期freebsd实现
💻 BW
📖 第 1 页 / 共 2 页
字号:
# include "stdio.h"# define U(x) x# define NLSTATE yyprevious=YYNEWLINE# define BEGIN yybgin = yysvec + 1 +# define INITIAL 0# define YYLERR yysvec# define YYSTATE (yyestate-yysvec-1)# define YYOPTIM 1# define YYLMAX 200# define output(c) putc(c,yyout)# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)# define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}# define yymore() (yymorfg=1)# define ECHO fprintf(yyout, "%s",yytext)# define REJECT { nstr = yyreject(); goto yyfussy;}int yyleng; extern char yytext[];int yymorfg;extern char *yysptr, yysbuf[];int yytchar;FILE *yyin ={stdin}, *yyout ={stdout};extern int yylineno;struct yysvf { 	struct yywork *yystoff;	struct yysvf *yyother;	int *yystops;};struct yysvf *yyestate;extern struct yysvf yysvec[], *yybgin;#ifndef lintstatic char RCSid[] = "$Header: lex.yy.c.bw,v 2.0 85/11/21 07:21:45 jqj Exp $";#endif/* * scanner.l -- scanner for the XNS courier compiler *//* $Log:	lex.yy.c.bw,v $ * Revision 2.0  85/11/21  07:21:45  jqj * 4.3BSD standard release *  * Revision 1.1  85/11/20  12:56:17  jqj * Initial revision *  * Revision 1.3  85/03/11  16:40:08  jqj * Public alpha-test version, released 11 March 1985 *  * Revision 1.2  85/02/21  11:05:51  jqj * alpha test version *  * Revision 1.1  85/02/15  13:55:58  jqj * Initial revision *  */#include "compiler.h"#include "y.tab.h"# define YYNEWLINE 10yylex(){int nstr; extern int yyprevious;while((nstr = yylook()) >= 0)yyfussy: switch(nstr){case 0:if(yywrap()) return(0); break;case 1:		case 2:		case 3:case 4:		/* whitespace */;break;case 5:		{ return (ARRAY); }break;case 6:		{ return (_BEGIN); }break;case 7:		{ return (BOOLEAN); }break;case 8:	{ return (CARDINAL); }break;case 9:		{ return (CHOICE); }break;case 10:		{ return (DEPENDS); }break;case 11:		{ return (END); }break;case 12:		{ return (ERROR); }break;case 13:		{ return (INTEGER); }break;case 14:		{ return (LONG); }break;case 15:		{ return (OF); }break;case 16:	{ return (PROCEDURE); }break;case 17:		{ return (PROGRAM); }break;case 18:		{ return (RECORD); }break;case 19:		{ return (REPORTS); }break;case 20:		{ return (RETURNS); }break;case 21:	{ return (SEQUENCE); }break;case 22:		{ return (STRING); }break;case 23:		{ return (TYPE); }break;case 24:	{ return (UNSPECIFIED); }break;case 25:		{ return (UPON); }break;case 26:		{ return (VERSION); }break;case 27:		{ return (TRUE); }break;case 28:		{ return (FALSE); }break;case 29:		{ return (_CHOOSES); }break;case 30:	{				/*				 * decimal constant.				 */				yylval.stringvalue = copy(yytext);				return (number);			}break;case 31:	{				/*				 * decimal constant.				 */				yytext[yyleng-1] = '\0';				yylval.stringvalue = copy(yytext);				return (number);			}break;case 32:	{				char buf[BUFSIZ];				/*				 * octal constant.				 * change to C representation				 */				yytext[yyleng-1] = '\0';				if (*yytext != '-')					sprintf(buf,"0%s", yytext);				else					sprintf(buf,"-0%s", yytext+1);				yylval.stringvalue = copy(buf);				return (number);			}break;case 33:{				char buf[BUFSIZ];				/*				 * hex constant.				 * change to C representation				 */				yytext[yyleng-1] = '\0';				if (*yytext != '-')					sprintf(buf,"0x%s", yytext);				else					sprintf(buf,"-0x%s", yytext+1);				yylval.stringvalue = copy(buf);				return (number);			}break;case 34:	{				/*				 * string constant				 */								yylval.stringvalue = copy(yytext);				return (string);			}break;case 35:{				register char *p;				/*				 * string constant with embedded ""				 */				for (p=yytext+1; p<yytext+yyleng-1; p++)					if (*p == '"') *p++='\\';				yylval.stringvalue = copy(yytext);				return (string);			}break;case 36:{				yylval.stringvalue = copy(yytext);				return (identifier);			}break;case 37:		{				return ((int) yytext[0]);			}break;case -1:break;default:fprintf(yyout,"bad switch yylook %d",nstr);} return(0); }/* end of yylex */int yyvstop[] ={0,37,0,4,37,0,4,0,37,0,37,0,30,37,0,30,37,0,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,36,37,0,34,35,0,-1,0,30,0,30,0,32,0,31,0,33,0,29,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,15,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,1,0,36,0,36,0,36,0,36,0,36,0,36,0,11,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,35,0,3,0,2,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,14,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,27,36,0,23,36,0,36,0,25,36,0,36,0,5,36,0,6,36,0,36,0,36,0,36,0,36,0,12,36,0,28,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,36,0,

⌨️ 快捷键说明

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