X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/5a35a6cb7199aa58dc0b0cc6386872f5da18e1fe..7093d0f541b397fb279c21c50e21d58985a4fded:/src/bison.simple?ds=sidebyside diff --git a/src/bison.simple b/src/bison.simple index bc656245..cc349bef 100644 --- a/src/bison.simple +++ b/src/bison.simple @@ -1,9 +1,10 @@ -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line -/* This file comes from bison-@bison_version@. */ +/* -*- C -*- */ + +/* A Bison parser, made from %%filename + by GNU bison %%version. */ /* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc. 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 @@ -30,85 +31,303 @@ It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ -#ifndef YYSTACK_USE_ALLOCA -# ifdef alloca -# define YYSTACK_USE_ALLOCA -# else /* alloca not defined */ -# ifdef __GNUC__ -# define YYSTACK_USE_ALLOCA -# define alloca __builtin_alloca -# else /* not GNU C. */ -# if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -# define YYSTACK_USE_ALLOCA -# include -# else /* not sparc */ - /* We think this test detects Watcom and Microsoft C. */ - /* This used to test MSDOS, but that is a bad idea since that - symbol is in the user namespace. */ -# if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -# if 0 - /* No need for malloc.h, which pollutes the namespace; instead, - just don't use alloca. */ -# include +/* Identify Bison output. */ +#define YYBISON 1 + +/* Pure parsers. */ +#define YYPURE %%pure + +/* Using locations. */ +#define YYLSP_NEEDED %%locations-flag + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG %%debug +#endif + +/* Enabling verbose error messages. */ +#undef YYERROR_VERBOSE +#define YYERROR_VERBOSE %%error-verbose + +/* If name_prefix is specify substitute the variables and functions + names. */ +#define yyparse %%prefix##parse +#define yylex %%prefix##lex +#define yyerror %%prefix##error +#define yylval %%prefix##lval +#define yychar %%prefix##char +#define yydebug %%prefix##debug +#define yynerrs %%prefix##nerrs + +#ifndef YYSTYPE +typedef %%stype yystype; +# define YYSTYPE yystype +#endif + +#ifndef YYLTYPE +typedef struct yyltype +{ + int first_line; + int first_column; + int last_line; + int last_column; +} yyltype; +# define YYLTYPE %%ltype +#endif + +/* Copy the user declarations. */ +#line %%input-line "%%filename" +%%prologue + +#line %%line "%%skeleton" + +#include + +#ifndef __cplusplus +# ifndef __STDC__ +# define const +# endif +#endif + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary C library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# define YYSIZE_T size_t +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# define YYSIZE_T size_t +# else +# if defined (__GNUC__) || defined (_AIX) || defined (__hpux) +# define YYSTACK_ALLOC __builtin_alloca +# endif +# ifndef __GNUC__ +# ifdef _AIX + # pragma alloca # endif -# else /* not MSDOS, or __TURBOC__ */ -# if defined(_AIX) - /* I don't know what this was needed for, but it pollutes the - namespace. So I turned it off. rms, 2 May 1997. */ - /* #include */ - #pragma alloca -# define YYSTACK_USE_ALLOCA -# else /* not MSDOS, or __TURBOC__, or _AIX */ -# if 0 - /* haible@ilog.fr says this works for HPUX 9.05 and up, and on - HPUX 10. Eventually we can turn this on. */ -# ifdef __hpux -# define YYSTACK_USE_ALLOCA -# define alloca __builtin_alloca -# endif /* __hpux */ -# endif -# endif /* not _AIX */ -# endif /* not MSDOS, or __TURBOC__ */ -# endif /* not sparc */ -# endif /* not GNU C */ -# endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ - -#ifdef YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -#else -# define YYSTACK_ALLOC malloc +# if defined (__sgi) || defined (__sparc__) || defined (__sparc) || defined (__sun) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSTACK_ALLOC alloca +# define YYSIZE_T size_t +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE(Ptr) free (Ptr) +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# endif + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short yys; + YYSTYPE yyv; +# if YYLSP_NEEDED + YYLTYPE yyl; +# endif +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# if YYLSP_NEEDED +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAX) +# else +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAX) +# endif + +/* Relocate the TYPE STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Type, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + yymemcpy (yyptr, (char *) (Stack), \ + yysize * (YYSIZE_T) sizeof (Type)); \ + (Stack) = (Type *) yyptr; \ + yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \ + yynewbytes -= yynewbytes % sizeof (union yyalloc); \ + yyptr += yynewbytes; \ + } \ + while (0) + +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + +/* Tokens. */ +%%tokendef + +#define YYFINAL %%final +#define YYFLAG %%flag +#define YYNTBASE %%ntbase +#define YYLAST %%last + +#define YYNTOKENS %%ntokens +#define YYNNTS %%nnts +#define YYNRULES %%nrules +#define YYNSTATES %%nstates +#define YYMAXUTOK %%maxtok + +/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ +#define YYTRANSLATE(x) ((unsigned)(x) <= %%maxtok ? yytranslate[x] : %%nsym) + +/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ +static const char yytranslate[] = +{ + %%translate +}; + +#if YYDEBUG +static const short yyprhs[] = +{ + %%prhs +}; + +static const short yyrhs[] = +{ + %%rhs +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const short yyrline[] = +{ + %%rline +}; #endif -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ +static const char *const yytname[] = +{ + %%tname +}; +#endif + +/* YYTOKNUM[YYN] -- Index in YYTNAME corresponding to YYLEX. */ +static const short yytoknum[] = +{ + %%toknum +}; + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const short yyr1[] = +{ + %%r1 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const short yyr2[] = +{ + %%r2 +}; + +/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. */ +static const short yydefact[] = +{ + %%defact +}; + +static const short yydefgoto[] = +{ + %%defgoto +}; + +static const short yypact[] = +{ + %%pact +}; + +static const short yypgoto[] = +{ + %%pgoto +}; + +static const short yytable[] = +{ + %%table +}; + +static const short yycheck[] = +{ + %%check +}; + + +#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) && (defined (__STDC__) || defined (__cplusplus)) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +#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 YYABORT goto yyabortlab #define YYERROR goto 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 goto yyerrlab + #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ + +#define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ - yylval = (Value); \ + yylval = (Value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ - yyerror ("syntax error: cannot back up"); \ + yyerror ("syntax error: cannot back up"); \ YYERROR; \ } \ while (0) @@ -116,12 +335,23 @@ while (0) #define YYTERROR 1 #define YYERRCODE 256 -#ifndef YYPURE -# define YYLEX yylex () +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). + + When YYLLOC_DEFAULT is run, CURRENT is set the location of the + first token. By default, to implement support for ranges, extend + its range to the last symbol. */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; #endif -#ifdef YYPURE -# ifdef YYLSP_NEEDED +/* YYLEX -- calling `yylex' with the right arguments. */ + +#if YYPURE +# if YYLSP_NEEDED # ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) # else @@ -134,28 +364,13 @@ while (0) # define YYLEX yylex (&yylval) # endif # endif /* !YYLSP_NEEDED */ -#endif - -/* If nonreentrant, generate the variables here. */ - -#ifndef YYPURE -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; - -# ifdef YYLSP_NEEDED -/* Location data for the lookahead symbol. */ -YYLTYPE yylloc; -# endif - -/* Number of parse errors so far. */ -int yynerrs; -#endif /* !YYPURE */ +#else /* !YYPURE */ +# define YYLEX yylex () +#endif /* !YYPURE */ /* Enable debugging if requested. */ #if YYDEBUG +# include # define YYDPRINTF(Args) \ do { \ if (yydebug) \ @@ -172,64 +387,109 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -# define YYINITDEPTH 200 +# define YYINITDEPTH %%initdepth #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). */ + 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. */ + #if YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 +# define YYMAXDEPTH %%maxdepth #endif + -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -# define __yy_memcpy(To, From, Count) __builtin_memcpy (To, From, Count) -#else /* not GNU C or C++ */ -# ifndef __cplusplus +#if ! defined (yyoverflow) && ! defined (yymemcpy) +# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +# define yymemcpy __builtin_memcpy +# else /* not GNU C or C++ */ /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; +# if defined (__STDC__) || defined (__cplusplus) +yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount) +# else +yymemcpy (yyto, yyfrom, yycount) + char *yyto; + const char *yyfrom; + YYSIZE_T yycount; +# endif { - register char *f = from; - register char *t = to; - register int i = count; + register const char *yyf = yyfrom; + register char *yyt = yyto; + register YYSIZE_T yyi = yycount; - while (i-- > 0) - *t++ = *f++; + while (yyi-- != 0) + *yyt++ = *yyf++; } +# endif +#endif -# else /* __cplusplus */ +#if YYERROR_VERBOSE -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) +# 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) +# else +yystrlen (yystr) + const char *yystr; +# endif { - register char *t = to; - register char *f = from; - register int i = count; + register const char *yys = yystr; - while (i-- > 0) - *t++ = *f++; + 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 * +# ifndef __cplusplus +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# else +yystpcpy (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 + +#endif /* !YYERROR_VERBOSE */ + -#line + +#line %%line "%%skeleton" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. @@ -259,12 +519,48 @@ int yyparse (void); # endif #endif +/* YY_DECL_VARIABLES -- depending whether we use a pure parser, + variables are global, or local to YYPARSE. */ + +#define YY_DECL_NON_LSP_VARIABLES \ +/* The lookahead symbol. */ \ +int yychar; \ + \ +/* The semantic value of the lookahead symbol. */ \ +YYSTYPE yylval; \ + \ +/* Number of parse errors so far. */ \ +int yynerrs; + +#if YYLSP_NEEDED +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES \ + \ +/* Location data for the lookahead symbol. */ \ +YYLTYPE yylloc; +#else +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES +#endif + +/* If nonreentrant, generate the variables here. */ + +#if !YYPURE +YY_DECL_VARIABLES +#endif /* !YYPURE */ + int yyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { + /* If reentrant, generate the variables here. */ +#if YYPURE + YY_DECL_VARIABLES +#endif /* !YYPURE */ + register int yystate; register int yyn; + int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ @@ -272,13 +568,13 @@ yyparse (YYPARSE_PARAM_ARG) /* Three stacks and their tools: `yyss': related to states, - `yysv': related to semantic values, + `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. */ + /* The state stack. */ short yyssa[YYINITDEPTH]; short *yyss = yyssa; register short *yyssp; @@ -288,41 +584,30 @@ yyparse (YYPARSE_PARAM_ARG) YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; #endif -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else # define YYPOPSTACK (yyvsp--, yyssp--) #endif - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; - -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -# ifdef YYLSP_NEEDED - YYLTYPE yylloc; -# endif -#endif - + YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; -# ifdef YYLSP_NEEDED +#if YYLSP_NEEDED YYLTYPE yyloc; -# endif +#endif /* When reducing, the number of symbols on the RHS of the reduced - rule. */ + rule. */ int yylen; YYDPRINTF ((stderr, "Starting parse\n")); @@ -337,99 +622,91 @@ yyparse (YYPARSE_PARAM_ARG) so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss - 1; + yyssp = yyss; yyvsp = yyvs; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED yylsp = yyls; #endif - + goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ -yynewstate: + 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 = yystate; + yyssp++; + + yysetstate: + *yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { - /* 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 *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif - /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -# ifdef YYLSP_NEEDED - /* 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, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); + { + /* 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 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. */ +# if YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; + /* 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), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + yyls = yyls1; # else - yyoverflow ("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -# endif - - yyss = yyss1; yyvs = yyvs1; -# ifdef YYLSP_NEEDED - yyls = yyls1; + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); # endif + yyss = yyss1; + yyvs = yyvs1; + } #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) - { - yyerror ("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -# ifdef YYLSP_NEEDED - free (yyls); -# endif - } - return 2; - } + goto yyoverflowlab; yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; -# ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -# endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -# ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); + + { + short *yyss1 = yyss; + char *yyptr = (char *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (short, yyss); + YYSTACK_RELOCATE (YYSTYPE, yyvs); +# if YYLSP_NEEDED + YYSTACK_RELOCATE (YYLTYPE, yyls); # endif +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } #endif /* no yyoverflow */ - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; +#if YYLSP_NEEDED + yylsp = yyls + yysize - 1; #endif - YYDPRINTF ((stderr, "Stack size increased to %d\n", yystacksize)); + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); if (yyssp >= yyss + yystacksize - 1) YYABORT; @@ -439,7 +716,6 @@ yynewstate: goto yybackup; - /*-----------. | yybackup. | `-----------*/ @@ -466,12 +742,12 @@ yybackup: yychar = YYLEX; } - /* Convert token to internal form (in yychar1) for indexing tables with */ + /* Convert token to internal form (in yychar1) for indexing tables with. */ - if (yychar <= 0) /* This means end of input. */ + if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ + yychar = YYEOF; /* Don't call YYLEX any more. */ YYDPRINTF ((stderr, "Now at end of input.\n")); } @@ -529,7 +805,7 @@ yybackup: yychar = YYEMPTY; *++yyvsp = yylval; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED *++yylsp = yylloc; #endif @@ -558,26 +834,22 @@ yydefault: yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; - /* Implement default value of the action: - `{dollar}{dollar} = {dollar}1'. */ - if (yylen > 0) - yyval = yyvsp[1-yylen]; -#ifdef YYLSP_NEEDED - /* Implement default location. If the rhs is empty, extend YYLOC to - YYLLOC, which corresponds to the current token, otherwise - implement `@{dollar} = Starts at @1, ends at @YYLEN'. */ - if (yylen > 0) - { - yyloc = yylsp[1-yylen]; - yyloc.last_line = yylsp[0].last_line; - yyloc.last_column = yylsp[0].last_column; - } - else - { - yyloc.last_line = yylsp[0].last_line; - yyloc.last_column = yylsp[0].last_column; - yyloc.text = 0; - } + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to the semantic value of + the lookahead token. This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + +#if YYLSP_NEEDED + /* Similarly for the default location. Let the user run additional + commands if for instance locations are ranges. */ + yyloc = yylsp[1-yylen]; + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); #endif #if YYDEBUG @@ -585,39 +857,42 @@ yyreduce: are defined only if `YYDEBUG' is set. */ if (yydebug) { - int i; + int yyi; fprintf (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); + for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) + fprintf (stderr, "%s ", yytname[yyrhs[yyi]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif -$ /* The action file replaces this line marked with this dollarsign. */ -#line + switch (yyn) + { + %%action + } +#line %%line "%%skeleton" yyvsp -= yylen; yyssp -= yylen; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG if (yydebug) { - short *ssp1 = yyss - 1; + short *yyssp1 = yyss - 1; fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); + while (yyssp1 != yyssp) + fprintf (stderr, " %d", *++yyssp1); fprintf (stderr, "\n"); } #endif *++yyvsp = yyval; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED *++yylsp = yyloc; #endif @@ -645,66 +920,67 @@ yyerrlab: { ++yynerrs; -#ifdef YYERROR_VERBOSE +#if YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof (yytname) / sizeof (char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen (yytname[x]) + 15, count++; - size += strlen ("parse error, unexpected `") + 1; - size += strlen (yytname[YYTRANSLATE (yychar)]); - msg = (char *) malloc (size); - if (msg != 0) + YYSIZE_T yysize = 0; + char *yymsg; + int yyx, yycount; + + yycount = 0; + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + if (yycheck[yyx + yyn] == yyx) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("parse error, unexpected ") + 1; + yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) { - strcpy (msg, "parse error, unexpected `"); - strcat (msg, yytname[YYTRANSLATE (yychar)]); - strcat (msg, "'"); + char *yyp = yystpcpy (yymsg, "parse error, unexpected "); + yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); - if (count < 5) + if (yycount < 5) { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof (yytname) / sizeof (char *)); x++) - if (yycheck[x + yyn] == x) + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx) { - strcat (msg, count == 0 ? ", expecting `" : " or `"); - strcat (msg, yytname[x]); - strcat (msg, "'"); - count++; + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; } } - yyerror (msg); - free (msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("parse error; also virtual memory exhausted"); + } else #endif /* YYERROR_VERBOSE */ - yyerror ("parse error"); + yyerror ("parse error"); } goto yyerrlab1; -/*--------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action | -`--------------------------------------------------*/ +/*----------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action. | +`----------------------------------------------------*/ yyerrlab1: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ - /* return failure if at end of input */ + /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; YYDPRINTF ((stderr, "Discarding token %d (%s).\n", @@ -715,7 +991,7 @@ yyerrlab1: /* Else will try to reuse lookahead token after shifting the error token. */ - yyerrstatus = 3; /* Each real token shifted decrements this */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ goto yyerrhandle; @@ -738,24 +1014,24 @@ yyerrdefault: /*---------------------------------------------------------------. | yyerrpop -- pop the current state because it cannot handle the | -| error token | +| error token. | `---------------------------------------------------------------*/ yyerrpop: if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED yylsp--; #endif #if YYDEBUG if (yydebug) { - short *ssp1 = yyss - 1; + short *yyssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); + while (yyssp1 != yyssp) + fprintf (stderr, " %d", *++yyssp1); fprintf (stderr, "\n"); } #endif @@ -789,7 +1065,7 @@ yyerrhandle: YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; -#ifdef YYLSP_NEEDED +#if YYLSP_NEEDED *++yylsp = yylloc; #endif @@ -801,28 +1077,31 @@ yyerrhandle: | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 0; - + yyresult = 0; + goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); + yyresult = 1; + goto yyreturn; + +/*---------------------------------------------. +| yyoverflowab -- parser overflow comes here. | +`---------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); #endif - } - return 1; + return yyresult; } + +#line %%input-line "%%filename" +%%epilogue