📄 bison.cc
字号:
/* -*-C-*- Note some compilers choke on comments on `#line' lines. *//* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *//* HEADER SECTION */#if defined( _MSDOS ) || defined(MSDOS) || defined(__MSDOS__) #define __MSDOS_AND_ALIKE#endif#if defined(_WINDOWS) && defined(_MSC_VER)#define __HAVE_NO_ALLOCA#define __MSDOS_AND_ALIKE#endif#ifndef alloca#if defined( __GNUC__)#define alloca __builtin_alloca#elif (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)#include <alloca.h>#elif defined (__MSDOS_AND_ALIKE)#include <malloc.h>#ifndef __TURBOC__/* MS C runtime lib */#define alloca _alloca#endif#elif defined(_AIX)#include <malloc.h>#pragma alloca#elif defined(__hpux)#ifdef __cplusplusextern "C" {void *alloca (unsigned int);};#else /* not __cplusplus */void *alloca ();#endif /* not __cplusplus */#endif /* not _AIX not MSDOS, or __TURBOC__ or _AIX, not sparc. */#endif /* alloca not defined. */#ifdef c_plusplus#ifndef __cplusplus#define __cplusplus#endif#endif#ifdef __cplusplus#ifndef YY_USE_CLASS#define YY_USE_CLASS#endif#else#ifndef __STDC__#define const#endif#endif#include <stdio.h>#define YYBISON 1 $/* %{ and %header{ and %union, during decl */#define YY_@_BISON 1#ifndef YY_@_COMPATIBILITY#ifndef YY_USE_CLASS#define YY_@_COMPATIBILITY 1#else#define YY_@_COMPATIBILITY 0#endif#endif#if YY_@_COMPATIBILITY != 0/* backward compatibility */#ifdef YYLTYPE#ifndef YY_@_LTYPE#define YY_@_LTYPE YYLTYPE#endif#endif#ifdef YYSTYPE#ifndef YY_@_STYPE #define YY_@_STYPE YYSTYPE#endif#endif#ifdef YYDEBUG#ifndef YY_@_DEBUG#define YY_@_DEBUG YYDEBUG#endif#endif#ifdef YY_@_STYPE#ifndef yystype#define yystype YY_@_STYPE#endif#endif/* use goto to be compatible */#ifndef YY_@_USE_GOTO#define YY_@_USE_GOTO 1#endif#endif/* use no goto to be clean in C++ */#ifndef YY_@_USE_GOTO#define YY_@_USE_GOTO 0#endif#ifndef YY_@_PURE$/* YY_@_PURE */#endif/* section apres lecture def, avant lecture grammaire S2 */$/* prefix */#ifndef YY_@_DEBUG$/* YY_@_DEBUG */#endif#ifndef YY_@_LSP_NEEDED$ /* YY_@_LSP_NEEDED*/#endif/* DEFAULT LTYPE*/#ifdef YY_@_LSP_NEEDED#ifndef YY_@_LTYPEtypedef struct yyltype { int timestamp; int first_line; int first_column; int last_line; int last_column; char *text; } yyltype;#define YY_@_LTYPE yyltype#endif#endif/* DEFAULT STYPE*/ /* We used to use `unsigned long' as YY_@_STYPE on MSDOS, but it seems better to be consistent. Most programs should declare their own type anyway. */#ifndef YY_@_STYPE#define YY_@_STYPE int#endif/* DEFAULT MISCELANEOUS */#ifndef YY_@_PARSE#define YY_@_PARSE yyparse#endif#ifndef YY_@_LEX#define YY_@_LEX yylex#endif#ifndef YY_@_LVAL#define YY_@_LVAL yylval#endif#ifndef YY_@_LLOC#define YY_@_LLOC yylloc#endif#ifndef YY_@_CHAR#define YY_@_CHAR yychar#endif#ifndef YY_@_NERRS#define YY_@_NERRS yynerrs#endif#ifndef YY_@_DEBUG_FLAG#define YY_@_DEBUG_FLAG yydebug#endif#ifndef YY_@_ERROR#define YY_@_ERROR yyerror#endif#ifndef YY_@_PARSE_PARAM#ifndef __STDC__#ifndef __cplusplus#ifndef YY_USE_CLASS#define YY_@_PARSE_PARAM#ifndef YY_@_PARSE_PARAM_DEF#define YY_@_PARSE_PARAM_DEF#endif#endif#endif#endif#ifndef YY_@_PARSE_PARAM#define YY_@_PARSE_PARAM void#endif#endif#if YY_@_COMPATIBILITY != 0/* backward compatibility */#ifdef YY_@_LTYPE#ifndef YYLTYPE#define YYLTYPE YY_@_LTYPE#else/* WARNING obsolete !!! user defined YYLTYPE not reported into generated header */#endif#endif#ifndef YYSTYPE#define YYSTYPE YY_@_STYPE#else/* WARNING obsolete !!! user defined YYSTYPE not reported into generated header */#endif#ifdef YY_@_PURE#ifndef YYPURE#define YYPURE YY_@_PURE#endif#endif#ifdef YY_@_DEBUG#ifndef YYDEBUG#define YYDEBUG YY_@_DEBUG #endif#endif#ifndef YY_@_ERROR_VERBOSE#ifdef YYERROR_VERBOSE#define YY_@_ERROR_VERBOSE YYERROR_VERBOSE#endif#endif#ifndef YY_@_LSP_NEEDED#ifdef YYLSP_NEEDED#define YY_@_LSP_NEEDED YYLSP_NEEDED#endif#endif#endif#ifndef YY_USE_CLASS/* TOKEN C */$ /* #defines tokens */#else/* CLASS */#ifndef YY_@_CLASS#define YY_@_CLASS @#endif#ifndef YY_@_INHERIT#define YY_@_INHERIT#endif#ifndef YY_@_MEMBERS#define YY_@_MEMBERS #endif#ifndef YY_@_LEX_BODY#define YY_@_LEX_BODY #endif#ifndef YY_@_ERROR_BODY#define YY_@_ERROR_BODY #endif#ifndef YY_@_CONSTRUCTOR_PARAM#define YY_@_CONSTRUCTOR_PARAM#endif#ifndef YY_@_CONSTRUCTOR_CODE#define YY_@_CONSTRUCTOR_CODE#endif#ifndef YY_@_CONSTRUCTOR_INIT#define YY_@_CONSTRUCTOR_INIT#endif/* choose between enum and const */#ifndef YY_@_USE_CONST_TOKEN#define YY_@_USE_CONST_TOKEN 0/* yes enum is more compatible with flex, *//* so by default we use it */ #endif#if YY_@_USE_CONST_TOKEN != 0#ifndef YY_@_ENUM_TOKEN#define YY_@_ENUM_TOKEN yy_@_enum_token#endif#endifclass YY_@_CLASS YY_@_INHERIT{public: #if YY_@_USE_CONST_TOKEN != 0/* static const int token ... */$ /* decl const */#elseenum YY_@_ENUM_TOKEN { YY_@_NULL_TOKEN=0$ /* enum token */ }; /* end of enum declaration */#endifpublic: int YY_@_PARSE (YY_@_PARSE_PARAM); virtual void YY_@_ERROR(char *msg) YY_@_ERROR_BODY;#ifdef YY_@_PURE#ifdef YY_@_LSP_NEEDED virtual int YY_@_LEX (YY_@_STYPE *YY_@_LVAL,YY_@_LTYPE *YY_@_LLOC) YY_@_LEX_BODY;#else virtual int YY_@_LEX (YY_@_STYPE *YY_@_LVAL) YY_@_LEX_BODY;#endif#else virtual int YY_@_LEX() YY_@_LEX_BODY; YY_@_STYPE YY_@_LVAL;#ifdef YY_@_LSP_NEEDED YY_@_LTYPE YY_@_LLOC;#endif int YY_@_NERRS; int YY_@_CHAR;#endif#if YY_@_DEBUG != 0 int YY_@_DEBUG_FLAG; /* nonzero means print parse trace */#endifpublic: YY_@_CLASS(YY_@_CONSTRUCTOR_PARAM);public: YY_@_MEMBERS };/* other declare folow */#if YY_@_USE_CONST_TOKEN != 0$ /* const YY_@_CLASS::token */#endif/*apres const */YY_@_CLASS::YY_@_CLASS(YY_@_CONSTRUCTOR_PARAM) YY_@_CONSTRUCTOR_INIT{#if YY_@_DEBUG != 0YY_@_DEBUG_FLAG=0;#endifYY_@_CONSTRUCTOR_CODE;};#endif$ /* fattrs + tables *//* parser code folow *//* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. *//* Note: dollar marks section change the next is replaced by the list of actions, each action as one case of the switch. */ #if YY_@_USE_GOTO != 0/* SUPRESSION OF GOTO : on some C++ compiler (sun c++) the goto is strictly forbidden if any constructor/destructor is used in the whole function (very stupid isn't it ?) so goto are to be replaced with a 'while/switch/case construct' here are the macro to keep some apparent compatibility*/#define YYGOTO(lb) {yy_gotostate=lb;continue;}#define YYBEGINGOTO enum yy_labels yy_gotostate=yygotostart; \ for(;;) switch(yy_gotostate) { case yygotostart: {#define YYLABEL(lb) } case lb: {#define YYENDGOTO } } #define YYBEGINDECLARELABEL enum yy_labels {yygotostart#define YYDECLARELABEL(lb) ,lb#define YYENDDECLARELABEL };#else/* macro to keep goto */#define YYGOTO(lb) goto lb#define YYBEGINGOTO #define YYLABEL(lb) lb:#define YYENDGOTO#define YYBEGINDECLARELABEL #define YYDECLARELABEL(lb)#define YYENDDECLARELABEL #endif/* LABEL DECLARATION */YYBEGINDECLARELABEL YYDECLARELABEL(yynewstate) YYDECLARELABEL(yybackup)/* YYDECLARELABEL(yyresume) */ YYDECLARELABEL(yydefault) YYDECLARELABEL(yyreduce) YYDECLARELABEL(yyerrlab) /* here on detecting error */ YYDECLARELABEL(yyerrlab1) /* here on error raised explicitly by an action */ YYDECLARELABEL(yyerrdefault) /* current state does not do anything special for the error token. */ YYDECLARELABEL(yyerrpop) /* pop the current state because it cannot handle the error token */ YYDECLARELABEL(yyerrhandle) YYENDDECLARELABEL/* ALLOCA SIMULATION *//* __HAVE_NO_ALLOCA */#ifdef __HAVE_NO_ALLOCAint __alloca_free_ptr(char *ptr,char *ref){if(ptr!=ref) free(ptr); return 0;}#define __ALLOCA_alloca(size) malloc(size)#define __ALLOCA_free(ptr,ref) __alloca_free_ptr((char *)ptr,(char *)ref)#ifdef YY_@_LSP_NEEDED#define __ALLOCA_return(num) \ return( __ALLOCA_free(yyss,yyssa)+\ __ALLOCA_free(yyvs,yyvsa)+\ __ALLOCA_free(yyls,yylsa)+\ (num))#else#define __ALLOCA_return(num) \ return( __ALLOCA_free(yyss,yyssa)+\ __ALLOCA_free(yyvs,yyvsa)+\ (num))#endif#else#define __ALLOCA_return(num) return(num)#define __ALLOCA_alloca(size) alloca(size)#define __ALLOCA_free(ptr,ref) #endif/* ENDALLOCA SIMULATION */#define yyerrok (yyerrstatus = 0)#define yyclearin (YY_@_CHAR = YYEMPTY)#define YYEMPTY -2#define YYEOF 0#define YYACCEPT __ALLOCA_return(0)#define YYABORT __ALLOCA_return(1)#define YYERROR YYGOTO(yyerrlab1)/* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */#define YYFAIL YYGOTO(yyerrlab)#define YYRECOVERING() (!!yyerrstatus)#define YYBACKUP(token, value) \do \ if (YY_@_CHAR == YYEMPTY && yylen == 1) \ { YY_@_CHAR = (token), YY_@_LVAL = (value); \ yychar1 = YYTRANSLATE (YY_@_CHAR); \ YYPOPSTACK; \ YYGOTO(yybackup); \ } \ else \ { YY_@_ERROR ("syntax error: cannot back up"); YYERROR; } \while (0)#define YYTERROR 1#define YYERRCODE 256#ifndef YY_@_PURE/* UNPURE */#define YYLEX YY_@_LEX()#ifndef YY_USE_CLASS/* If nonreentrant, and not class , generate the variables here */int YY_@_CHAR; /* the lookahead symbol */YY_@_STYPE YY_@_LVAL; /* the semantic value of the */ /* lookahead symbol */int YY_@_NERRS; /* number of parse errors so far */#ifdef YY_@_LSP_NEEDEDYY_@_LTYPE YY_@_LLOC; /* location data for the lookahead */ /* symbol */#endif#endif#else/* PURE */#ifdef YY_@_LSP_NEEDED#define YYLEX YY_@_LEX(&YY_@_LVAL, &YY_@_LLOC)#else#define YYLEX YY_@_LEX(&YY_@_LVAL)#endif#endif#ifndef YY_USE_CLASS#if YY_@_DEBUG != 0int YY_@_DEBUG_FLAG; /* nonzero means print parse trace *//* Since this is uninitialized, it does not stop multiple parsers from coexisting. */#endif#endif/* YYINITDEPTH indicates the initial size of the parser's stacks */#ifndef YYINITDEPTH#define YYINITDEPTH 200#endif/* YYMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */#if YYMAXDEPTH == 0#undef YYMAXDEPTH#endif#ifndef YYMAXDEPTH#define YYMAXDEPTH 10000#endif#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */#define __yy_bcopy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)#else /* not GNU C or C++ *//* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */#ifdef __cplusplusstatic void __yy_bcopy (char *from, char *to, int count)#else#ifdef __STDC__static void __yy_bcopy (char *from, char *to, int count)#elsestatic void __yy_bcopy (from, to, count) char *from; char *to; int count;#endif#endif{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -