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

📄 yacc.c

📁 bison 2.0 主要可以用来做语法分析用的
💻 C
📖 第 1 页 / 共 3 页
字号:
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing   symbol of state STATE-NUM.  */static const ]b4_int_type_for([b4_stos])[ yystos[] ={  ]b4_stos[};#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)# define YYSIZE_T __SIZE_TYPE__#endif#if ! defined (YYSIZE_T) && defined (size_t)# define YYSIZE_T size_t#endif#if ! defined (YYSIZE_T)# if defined (__STDC__) || defined (__cplusplus)#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */#  define YYSIZE_T size_t# endif#endif#if ! defined (YYSIZE_T)# define YYSIZE_T unsigned int#endif#define yyerrok		(yyerrstatus = 0)#define yyclearin	(yychar = YYEMPTY)#define YYEMPTY		(-2)#define YYEOF		0#define YYACCEPT	goto yyacceptlab#define YYABORT		goto yyabortlab#define YYERROR		goto yyerrorlab/* 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		goto yyerrlab#define YYRECOVERING()  (!!yyerrstatus)#define YYBACKUP(Token, Value)					\do								\  if (yychar == YYEMPTY && yylen == 1)				\    {								\      yychar = (Token);						\      yylval = (Value);						\      yytoken = YYTRANSLATE (yychar);				\      YYPOPSTACK;						\      goto yybackup;						\    }								\  else								\    { 								\      yyerror (]b4_yyerror_args["syntax error: cannot back up");\      YYERROR;							\    }								\while (0)#define YYTERROR	1#define YYERRCODE	256/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].   If N is 0, then set CURRENT to the empty location which ends   the previous symbol: RHS[0] (always defined).  */#define YYRHSLOC(Rhs, K) ((Rhs)[K])#ifndef YYLLOC_DEFAULT# define YYLLOC_DEFAULT(Current, Rhs, N)				\    do									\      if (N)								\	{								\	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\	}								\      else								\	{								\	  (Current).first_line   = (Current).last_line   =		\	    YYRHSLOC (Rhs, 0).last_line;				\	  (Current).first_column = (Current).last_column =		\	    YYRHSLOC (Rhs, 0).last_column;				\	}								\    while (0)#endif/* YY_LOCATION_PRINT -- Print the location on the stream.   This macro was not mandated originally: define only if we know   we won't break user code: when these are the locations we know.  */#ifndef YY_LOCATION_PRINT# if YYLTYPE_IS_TRIVIAL#  define YY_LOCATION_PRINT(File, Loc)			\     fprintf (File, "%d.%d-%d.%d",			\              (Loc).first_line, (Loc).first_column,	\              (Loc).last_line,  (Loc).last_column)# else#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)# endif#endif/* YYLEX -- calling `yylex' with the right arguments.  */#ifdef YYLEX_PARAM# define YYLEX yylex (]b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])[YYLEX_PARAM)#else# define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[#endif/* Enable debugging if requested.  */#if YYDEBUG# ifndef YYFPRINTF#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */#  define YYFPRINTF fprintf# endif# define YYDPRINTF(Args)			\do {						\  if (yydebug)					\    YYFPRINTF Args;				\} while (0)# define YY_SYMBOL_PRINT(Title, Type, Value, Location)		\do {								\  if (yydebug)							\    {								\      YYFPRINTF (stderr, "%s ", Title);				\      yysymprint (stderr, 					\                  Type, Value]b4_location_if([, Location])[);	\      YYFPRINTF (stderr, "\n");					\    }								\} while (0)/*------------------------------------------------------------------.| yy_stack_print -- Print the state stack from its BOTTOM up to its || TOP (included).                                                   |`------------------------------------------------------------------*/]b4_c_function_def([yy_stack_print], [static void],                   [[short int *bottom], [bottom]],                   [[short int *top],    [top]])[{  YYFPRINTF (stderr, "Stack now");  for (/* Nothing. */; bottom <= top; ++bottom)    YYFPRINTF (stderr, " %d", *bottom);  YYFPRINTF (stderr, "\n");}# define YY_STACK_PRINT(Bottom, Top)				\do {								\  if (yydebug)							\    yy_stack_print ((Bottom), (Top));				\} while (0)/*------------------------------------------------.| Report that the YYRULE is going to be reduced.  |`------------------------------------------------*/]b4_c_function_def([yy_reduce_print], [static void],                   [[int yyrule], [yyrule]])[{  int yyi;  unsigned int yylno = yyrline[yyrule];  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",             yyrule - 1, yylno);  /* Print the symbols being reduced, and their result.  */  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);}# define YY_REDUCE_PRINT(Rule)		\do {					\  if (yydebug)				\    yy_reduce_print (Rule);		\} while (0)/* Nonzero means print parse trace.  It is left uninitialized so that   multiple parsers can coexist.  */int yydebug;#else /* !YYDEBUG */# define YYDPRINTF(Args)# define YY_SYMBOL_PRINT(Title, Type, Value, Location)# define YY_STACK_PRINT(Bottom, Top)# define YY_REDUCE_PRINT(Rule)#endif /* !YYDEBUG *//* YYINITDEPTH -- initial size of the parser's stacks.  */#ifndef	YYINITDEPTH# define YYINITDEPTH ]b4_stack_depth_init[#endif/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only   if the built-in stack extension method is used).   Do not make this value too large; the results are undefined if   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)   evaluated with infinite-precision integer arithmetic.  */#ifndef YYMAXDEPTH# define YYMAXDEPTH ]b4_stack_depth_max[#endif#if YYERROR_VERBOSE# ifndef yystrlen#  if defined (__GLIBC__) && defined (_STRING_H)#   define yystrlen strlen#  else/* Return the length of YYSTR.  */static YYSIZE_T#   if defined (__STDC__) || defined (__cplusplus)yystrlen (const char *yystr)#   elseyystrlen (yystr)     const char *yystr;#   endif{  register const char *yys = yystr;  while (*yys++ != '\0')    continue;  return yys - yystr - 1;}#  endif# endif# ifndef yystpcpy#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)#   define yystpcpy stpcpy#  else/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in   YYDEST.  */static char *#   if defined (__STDC__) || defined (__cplusplus)yystpcpy (char *yydest, const char *yysrc)#   elseyystpcpy (yydest, yysrc)     char *yydest;     const char *yysrc;#   endif{  register char *yyd = yydest;  register const char *yys = yysrc;  while ((*yyd++ = *yys++) != '\0')    continue;  return yyd - 1;}#  endif# endif#endif /* !YYERROR_VERBOSE */#if YYDEBUG]b4_yysymprint_generate([b4_c_function_def])[#endif /* ! YYDEBUG */]b4_yydestruct_generate([b4_c_function_def])/* Prevent warnings from -Wmissing-prototypes.  */#ifdef YYPARSE_PARAM# if defined (__STDC__) || defined (__cplusplus)int yyparse (void *YYPARSE_PARAM);# elseint yyparse ();# endif#else /* ! YYPARSE_PARAM */b4_c_function_decl([yyparse], [int], b4_parse_param)#endif /* ! YYPARSE_PARAM */m4_divert_push([KILL])# ======================== M4 code.# b4_declare_parser_variables# ---------------------------# Declare the variables that are global, or local to YYPARSE if# pure-parser.m4_define([b4_declare_parser_variables],[/* The look-ahead symbol.  */int yychar;/* The semantic value of the look-ahead symbol.  */YYSTYPE yylval;/* Number of syntax errors so far.  */int yynerrs;b4_location_if([/* Location data for the look-ahead symbol.  */YYLTYPE yylloc;])])m4_divert_pop([KILL])dnl# ====================== End of M4 code.b4_pure_if([],           [b4_declare_parser_variables])/*----------.| yyparse.  |`----------*/#ifdef YYPARSE_PARAM# if defined (__STDC__) || defined (__cplusplus)int yyparse (void *YYPARSE_PARAM)# elseint yyparse (YYPARSE_PARAM)  void *YYPARSE_PARAM;# endif#else /* ! YYPARSE_PARAM */b4_c_function_def([yyparse], [int], b4_parse_param)#endif{[  ]b4_pure_if([b4_declare_parser_variables])[  register int yystate;  register int yyn;  int yyresult;  /* Number of tokens to shift before error messages enabled.  */  int yyerrstatus;  /* Look-ahead token as an internal (translated) token number.  */  int yytoken = 0;  /* Three stacks and their tools:     `yyss': related to states,     `yyvs': related to semantic values,     `yyls': related to locations.     Refer to the stacks thru separate pointers, to allow yyoverflow     to reallocate them elsewhere.  */  /* The state stack.  */  short int yyssa[YYINITDEPTH];  short int *yyss = yyssa;  register short int *yyssp;  /* The semantic value stack.  */  YYSTYPE yyvsa[YYINITDEPTH];  YYSTYPE *yyvs = yyvsa;  register YYSTYPE *yyvsp;]b4_location_if([[  /* The location stack.  */  YYLTYPE yylsa[YYINITDEPTH];  YYLTYPE *yyls = yylsa;  YYLTYPE *yylsp;  /* The locations where the error started and ended. */  YYLTYPE yyerror_range[2];]])[#define YYPOPSTACK   (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)  YYSIZE_T yystacksize = YYINITDEPTH;  /* The variables used to return semantic value and location from the     action routines.  */  YYSTYPE yyval;]b4_location_if([  YYLTYPE yyloc;])[  /* When reducing, the number of symbols on the RHS of the reduced     rule.  */  int yylen;  YYDPRINTF ((stderr, "Starting parse\n"));  yystate = 0;  yyerrstatus = 0;  yynerrs = 0;  yychar = YYEMPTY;		/* Cause a token to be read.  */  /* Initialize stack pointers.     Waste one element of value and location stack     so that they stay on the same level as the state stack.     The wasted elements are never initialized.  */  yyssp = yyss;  yyvsp = yyvs;]b4_location_if([[  yylsp = yyls;#if YYLTYPE_IS_TRIVIAL  /* Initialize the default location before parsing starts.  */  yylloc.first_line   = yylloc.last_line   = 1;  yylloc.first_column = yylloc.last_column = 0;#endif]])m4_ifdef([b4_initial_action], [m4_pushdef([b4_at_dollar],     [yylloc])dnlm4_pushdef([b4_dollar_dollar], [yylval])dnl  /* User initialization code. */  b4_initial_actionm4_popdef([b4_dollar_dollar])dnlm4_popdef([b4_at_dollar])dnl/* Line __line__ of yacc.c.  */b4_syncline([@oline@], [@ofile@])])dnl[  yyvsp[0] = yylval;]b4_location_if([[    yylsp[0] = yylloc;]])[  goto yysetstate;/*------------------------------------------------------------.| yynewstate -- Push a new state, which is found in yystate.  |`------------------------------------------------------------*/ yynewstate:  /* In all cases, when you get here, the value and location stacks     have just been pushed. so pushing a state here evens the stacks.     */  yyssp++; yysetstate:  *yyssp = yystate;  if (yyss + yystacksize - 1 <= yyssp)    {      /* Get the current used size of the three stacks, in elements.  */      YYSIZE_T yysize = yyssp - yyss + 1;#ifdef yyoverflow      {	/* Give user a chance to reallocate the stack. Use copies of	   these so that the &'s don't force the real ones into	   memory.  */	YYSTYPE *yyvs1 = yyvs;	short int *yyss1 = yyss;]b4_location_if([	YYLTYPE *yyls1 = yyls;])[	/* Each stack pointer address is followed by the size of the	   data in use in that stack, in bytes.  This used to be a	   conditional around just the two extra args, but that might	   be undefined if yyoverflow is a macro.  */	yyoverflow ("parser stack overflow",		    &yyss1, yysize * sizeof (*yyssp),

⌨️ 快捷键说明

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