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

📄 push.skel

📁 yacc源码
💻 SKEL
字号:
%% banner/***    "@(#)push.skel, based on byacc 1.8 (Berkeley) 01/20/91";*/#define YYBTYACC 1%% header#define yyclearin (yychar=(-1))#define yyerrok (yyerrflag=0)/*  #ifdef YYSTACKSIZE    #ifndef YYMAXDEPTH    #define YYMAXDEPTH YYSTACKSIZE    #endif    #else    #ifdef YYMAXDEPTH    #define YYSTACKSIZE YYMAXDEPTH    #else    #define YYSTACKSIZE 500    #define YYMAXDEPTH 500    #endif    #endif */int yydebug;static struct yyparsestate {	struct yyparsestate *save;	int state;	int errflag;	short *ssp;	YYSTYPE *vsp;	YYSTYPE val;	short *ss;	YYSTYPE *vs;	int lexeme;	unsigned short stacksize;	short ctry;	} *yypstate=0, *yypath=0;#define yyerrflag (yypstate->errflag)#define yyssp (yypstate->ssp)#define yyvsp (yypstate->vsp)#define yyval (yypstate->val)#define yyss (yypstate->ss)#define yyvs (yypstate->vs)#define yystacksize (yypstate->stacksize)static YYSTYPE *yylvals=0, *yylvp=0, *yylve=0, *yylvlim=0;static short *yylexemes=0, *yylexp=0;#define YYLEX (yylvp<yylve ? yylval=*yylvp++, *yylexp++ :		\    yytrial ? (yylvp==yylvlim ? yyexpand() : 0), *yylexp = yylex(),	\	      *yylvp++ = yylval, yylve++, *yylexp++			\	    : yylex())extern int yylex(), yyparse();#define yytrial (yypstate->save)#ifndef __cplusplus#define YYSCOPY(t, f, s)	memcpy(t, f, (s)*sizeof(YYSTYPE))#define YYMORESTACK do { int p = yyssp - yyss;				\    yystacksize += 16;							\    yyss = (short *)realloc(yyss, yystacksize * sizeof(short));		\    yyvs = (YYSTYPE *)realloc(yyvs, yystacksize * sizeof(YYSTYPE));	\    yyssp = yyss + p;							\    yyvsp = yyvs + p;							\    } while (0)#else  /* C++ */#define	YYSCOPY(to, from, size)	do { int _i;				\	for (_i = (size)-1; _i >= 0; _i--)				\	    (to)[_i] = (from)[_i];					\				    } while(0)#define YYMORESTACK do { int p = yyssp - yyss;				\    short *tss = yyss; YYSTYPE *tvs = yyvs;				\    yyss = new short[yystacksize + 16];					\    yyvs = new YYSTYPE[yystacksize + 16];				\    memcpy(yyss, tss, yystacksize * sizeof(short));			\    YYSCOPY(yyvs, tvs, yystacksize);					\    yystacksize += 16;							\    delete[] tss;							\    delete[] tvs;							\    yyssp = yyss + p;							\    yyvsp = yyvs + p;							\    } while (0)#endif /* C++ */%% body#ifndef YYNEWSTATE#ifdef __oldcstatic struct yyparsestate *YYNEWSTATE(size)int size;#elsestatic struct yyparsestate *YYNEWSTATE(int size)#endif /* __oldc */{struct yyparsestate *p;#ifndef __cplusplus    p = (struct yyparsestate *)malloc(sizeof(struct yyparsestate));    p->stacksize = size+4;    p->ss = (short *)malloc((size+4)*sizeof(short));    p->vs = (YYSTYPE *)malloc((size+4)*sizeof(YYSTYPE));#else /* C++ */    p = new yyparsestate;    p->stacksize = size+4;    p->ss = new short[size + 4];    p->vs = new YYSTYPE[size + 4];#endif /* C++ */    return p;}#endif /* YYNEWSTATE */#ifndef YYFREESTATE#ifndef __cplusplus#define YYFREESTATE(p) (free((p)->ss), free((p)->vs), free(p))#else /* C++ */#define YYFREESTATE(p) (delete[] (p)->ss, delete[] (p)->vs, delete (p))#endif /* C++ */#endif /* YYFREESTATE */static int yyexpand(){int p = yylvp-yylvals;int s = yylvlim-yylvals;    s += 16;#ifndef __cplusplus    yylvals = (YYSTYPE *)realloc(yylvals, s*sizeof(YYSTYPE));    yylexemes = (short *)realloc(yylexemes, s*sizeof(short));#else /* C++ */      { short *tl = yylexemes; YYSTYPE *tv = yylvals;	yylvals = new YYSTYPE[s];	yylexemes = new short[s];	memcpy(yylexemes, tl, (s-16)*sizeof(short));	YYSCOPY(yylvals, tv, s-16);	delete[] tl;	delete[] tv; }#endif /* C++ */    yylvp = yylve = yylvals + p;    yylvlim = yylvals + s;    yylexp = yylexemes + p;    return 0;}#define YYABORT goto yyabort#define YYACCEPT goto yyaccept#define YYERROR goto yyerrlab#define YYVALID do { if (yytrial) goto yyvalid; } while(0)#ifdef __cplusplusextern "C" char *getenv(const char *);#elseextern char *getenv();#endifint yyparse(int yychar, YYSTYPE yylval){    int yym, yyn, yystate, yynewerrflag;#if YYDEBUG    char *yys;#endif    if (yychar < 0) yychar = 0;    if (!yypstate) {	/* initialize the parser state */	yypstate = YYNEWSTATE(12);	yypath = 0;	yytrial = 0;	yyerrflag = 0;	yylvp = yylve = yylvals;	yylexp = yylexemes;	yyssp = yyss;	yyvsp = yyvs;	*yyssp = yypstate->state = 0; }    yystate = yypstate->state;#if YYDEBUG    if (yydebug) {	yys = 0;	if (yychar <= YYMAXTOKEN) yys = yyname[yychar];	if (!yys) yys = "illegal-symbol";	printf("yydebug: state %d, input %d (%s)", yystate,		yychar, yys);#ifdef YYDBPR	printf("<");	YYDBPR(yylval);	printf(">");#endif	printf("\n"); }#endif    if (yystate == YYFINAL && yychar == 0)	goto yyaccept;    if (yytrial) {	if (yylvp == yylvlim) yyexpand();	*yylvp++ = yylval;	yylve++;	*yylexp++ = yychar; }yyloop:    if ((yyn = yydefred[yystate])) goto yyreduce;    if (yychar < 0) {	if (yylvp < yylve) {	    yylval = *yylvp++;	    yychar = *yylexp++; }	else {	    yypstate->state = yystate;	    return 0; }#if YYDEBUG	if (yydebug) {	    yys = 0;	    if (yychar <= YYMAXTOKEN) yys = yyname[yychar];	    if (!yys) yys = "illegal-symbol";	    printf("yydebug: state %d, reading %d (%s)", yystate,		    yychar, yys);#ifdef YYDBPR	    printf("<");	    YYDBPR(yylval);	    printf(">");#endif	    printf("\n"); }#endif	}    if ((yyn = yycindex[yystate]) &&	(yyn += yychar) >= 0 &&	yyn <= YYTABLESIZE &&	yycheck[yyn] == yychar) {	    int ctry;	    struct yyparsestate *save;#if YYDEBUG	if (yydebug)	    printf("yydebug: state %d, conflict%s\n", yystate,		   yypath ? ", following successful trial parse" :		       yytrial ? "" : ", starting trial parse");#endif	if (yypath) {	    save = yypath;	    yypath = save->save;	    ctry = save->ctry;	    if (save->state != yystate) goto yyabort;	    YYFREESTATE(save); }	else {	    save = YYNEWSTATE(yyssp - yyss);	    save->save = yypstate->save;	    save->state = yystate;	    save->errflag = yypstate->errflag;	    save->ssp = save->ss + (yyssp - yyss);	    save->vsp = save->vs + (yyvsp - yyvs);	    memcpy(save->ss, yyss, (yyssp - yyss + 1)*sizeof(short));	    YYSCOPY(save->vs, yyvs, yyssp - yyss + 1);	    ctry = yytable[yyn];	    if (yyctable[ctry] == -1) {#if YYDEBUG		if (yydebug && yychar >= 0)		    printf("yydebug: backtracking 1 token\n");#endif		ctry++; }	    save->ctry = ctry;	    if (!yytrial) {		if (!yylexemes) {#ifndef __cplusplus		    yylexemes = (short *)malloc(16*sizeof(short));		    yylvals = (YYSTYPE *)malloc(16*sizeof(YYSTYPE));#else  /* C++ */		    yylexemes = new short[16];		    yylvals = new YYSTYPE[16];#endif /* C++ */		    yylvlim = yylvals + 16; }		if (yylvp == yylve) {		    yylvp = yylve = yylvals;		    yylexp = yylexemes;		    if (yychar >= 0) {			*yylve++ = yylval;			*yylexp = yychar;			yychar = -1; } } }	    if (yychar >= 0) {		yylvp--, yylexp--;		yychar = -1; }	    save->lexeme = yylvp - yylvals;	    yypstate->save = save; }	if (yytable[yyn] == ctry) {#if YYDEBUG	    if (yydebug)		printf("yydebug: state %d, shifting to state %d\n",			yystate, yyctable[ctry]);#endif	    if (yychar < 0)		yylvp++, yylexp++;	    yychar = -1;	    if (yyerrflag > 0) --yyerrflag;	    yystate = yyctable[ctry];	    goto yyshift; }	else {	    yyn = yyctable[ctry];	    goto yyreduce; } }    if ((yyn = yysindex[yystate]) &&	(yyn += yychar) >= 0 &&	yyn <= YYTABLESIZE &&	yycheck[yyn] == yychar) {#if YYDEBUG	if (yydebug)	    printf("yydebug: state %d, shifting to state %d\n",		    yystate, yytable[yyn]);#endif	yychar = (-1);	if (yyerrflag > 0)  --yyerrflag;	yystate = yytable[yyn];yyshift:	if (yyssp >= yyss + yystacksize - 1)	    YYMORESTACK;	*++yyssp = yystate;	*++yyvsp = yylval;	goto yyloop; }    if ((yyn = yyrindex[yystate]) &&	(yyn += yychar) >= 0 &&	yyn <= YYTABLESIZE &&	yycheck[yyn] == yychar) {	yyn = yytable[yyn];	goto yyreduce; }    if (yyerrflag) goto yyinrecovery;    yynewerrflag = 1;    goto yyerrhandler;yyerrlab:    yynewerrflag = 0;yyerrhandler:    while (yytrial) { int ctry; struct yyparsestate *save;#if YYDEBUG	if (yydebug)	    printf("yydebug: error in state %d, %s state %d, %d tokens\n",		   yystate, "backtracking to", yypstate->save->state,		   (int)(yylvp - yylvals - yypstate->save->lexeme));#endif	save = yypstate->save;	yylvp = yylvals + save->lexeme;	yylexp = yylexemes + save->lexeme;	yychar = -1;	yyssp = yyss + (save->ssp - save->ss);	yyvsp = yyvs + (save->vsp - save->vs);	memcpy(yyss, save->ss, (yyssp - yyss + 1) * sizeof(short));	YYSCOPY(yyvs, save->vs, yyvsp - yyvs + 1);	ctry = ++save->ctry;	yystate = save->state;	if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;	yypstate->save = save->save;	YYFREESTATE(save);#if YYDEBUG	if (yydebug && !yytrial)	    printf("yydebug: trial parse failed, entering error mode\n");#endif	yynewerrflag = 1; }    if (yynewerrflag)	yyerror("syntax error");yyinrecovery:    if (yyerrflag < 3) {	yyerrflag = 3;	for (;;) {	    if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&		    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) {#if YYDEBUG		if (yydebug)		    printf("yydebug: state %d, error recovery %s state %d\n",			   *yyssp, "shifting to", yytable[yyn]);#endif		yystate = yytable[yyn];		goto yyshift; }	    else {#if YYDEBUG		if (yydebug)		    printf("yydebug: error recovery discarding state %d\n",			    *yyssp);#endif		if (yyssp <= yyss) goto yyabort;		--yyssp;		--yyvsp; } } }    else {	if (yychar == 0) goto yyabort;#if YYDEBUG	if (yydebug) {	    yys = 0;	    if (yychar <= YYMAXTOKEN) yys = yyname[yychar];	    if (!yys) yys = "illegal-symbol";	    printf("yydebug: state %d, error recovery discards token %d (%s)\n",		    yystate, yychar, yys); }#endif	yychar = (-1);	goto yyloop; }yyreduce:    yym = yylen[yyn];#if YYDEBUG    if (yydebug) {	printf("yydebug: state %d, reducing by rule %d (%s)",		yystate, yyn, yyrule[yyn]);#ifdef YYDBPR	if (yym) {	    int i;	    printf("<");	    for (i=yym; i>0; i--) {		if (i!=yym) printf(", ");		YYDBPR(yyvsp[1-i]); }	    printf(">"); }#endif	printf("\n"); }#endif    if (yyssp + 1 - yym >= yyss + yystacksize)	YYMORESTACK;    yyval = yyvsp[1-yym];    switch (yyn) {%% trailer    }#if YYDEBUG && defined(YYDBPR)    if (yydebug) {	printf("yydebug: after reduction, result is ");	YYDBPR(yyval);	printf("\n"); }#endif    yyssp -= yym;    yystate = *yyssp;    yyvsp -= yym;    yym = yylhs[yyn];    if (yystate == 0 && yym == 0) {#if YYDEBUG	if (yydebug)	    printf("yydebug: after reduction, %s from state 0 to state %d\n",		   "shifting", YYFINAL);#endif	yystate = YYFINAL;	*++yyssp = YYFINAL;	*++yyvsp = yyval;	if (yychar == 0) goto yyaccept;	goto yyloop; }    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&	    yyn <= YYTABLESIZE && yycheck[yyn] == yystate)	yystate = yytable[yyn];    else	yystate = yydgoto[yym];#if YYDEBUG    if (yydebug)	printf("yydebug: after reduction, %s from state %d to state %d\n",	       "shifting", *yyssp, yystate);#endif    if (yyssp >= yyss + yystacksize - 1)	YYMORESTACK;    *++yyssp = yystate;    *++yyvsp = yyval;    goto yyloop;yyvalid:    if (yypath)	goto yyabort;    while (yypstate->save) {	struct yyparsestate *save = yypstate->save;	yypstate->save = save->save;	save->save = yypath;	yypath = save; }#if YYDEBUG    if (yydebug)	printf("yydebug: trial successful, %s state %d, %d tokens\n",	       "backtracking to", yypath->state,	       (int)(yylvp - yylvals - yypath->lexeme));#endif    yychar = -1;    yyssp = yyss + (yypath->ssp - yypath->ss);    yyvsp = yyvs + (yypath->vsp - yypath->vs);    memcpy(yyss, yypath->ss, (yyssp - yyss + 1) * sizeof(short));    YYSCOPY(yyvs, yypath->vs, yyvsp - yyvs + 1);    yylvp = yylvals + yypath->lexeme;    yylexp = yylexemes + yypath->lexeme;    yystate = yypath->state;    goto yyloop;yyabort:    while (yypstate) {	struct yyparsestate *save = yypstate;	yypstate = save->save;	YYFREESTATE(save); }    while (yypath) {	struct yyparsestate *save = yypath;	yypath = save->save;	YYFREESTATE(save); }    return -1;yyaccept:    if (yytrial) goto yyvalid;    while (yypstate) {	struct yyparsestate *save = yypstate;	yypstate = save->save;	YYFREESTATE(save); }    while (yypath) {	struct yyparsestate *save = yypath;	yypath = save->save;	YYFREESTATE(save); }    return 1;}

⌨️ 快捷键说明

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