* data/c.m4 (b4_yysymprint_generate): Pass *yyvaluep to YYPRINT,

not yyvalue.
This commit is contained in:
Akim Demaille
2002-11-12 09:44:41 +00:00
parent 3df374151b
commit 886b69d197
4 changed files with 59 additions and 65 deletions

View File

@@ -1,3 +1,8 @@
2002-11-12 Akim Demaille <akim@epita.fr>
* data/c.m4 (b4_yysymprint_generate): Pass *yyvaluep to YYPRINT,
not yyvalue.
2002-11-12 Akim Demaille <akim@epita.fr> 2002-11-12 Akim Demaille <akim@epita.fr>
* tests/actions.at (AT_CHECK_PRINTER_AND_DESTRUCTOR): New. * tests/actions.at (AT_CHECK_PRINTER_AND_DESTRUCTOR): New.

View File

@@ -395,7 +395,7 @@ b4_location_if([ (void) yylocationp;
{ {
YYFPRINTF (yyout, "token %s (", yytname[[yytype]]); YYFPRINTF (yyout, "token %s (", yytname[[yytype]]);
# ifdef YYPRINT # ifdef YYPRINT
YYPRINT (yyout, yytoknum[[yytype]], yyvalue); YYPRINT (yyout, yytoknum[[yytype]], *yyvaluep);
# endif # endif
} }
else else

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made from parse-gram.y, by GNU bison 1.75b. */ /* A Bison parser, made by GNU Bison 1.75b. */
/* Skeleton parser for Yacc-like parsing with Bison, /* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
@@ -238,8 +238,8 @@ typedef union {
assoc_t assoc; assoc_t assoc;
struniq_t struniq; struniq_t struniq;
} yystype; } yystype;
/* Line 237 of /usr/local/share/bison/yacc.c. */ /* Line 195 of /usr/local/share/bison/yacc.c. */
#line 243 "parse-gram.c" #line 242 "parse-gram.c"
# define YYSTYPE yystype # define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
#endif #endif
@@ -259,8 +259,8 @@ typedef struct yyltype
/* Copy the second part of user declarations. */ /* Copy the second part of user declarations. */
/* Line 257 of /usr/local/share/bison/yacc.c. */ /* Line 215 of /usr/local/share/bison/yacc.c. */
#line 264 "parse-gram.c" #line 263 "parse-gram.c"
#if ! defined (yyoverflow) || YYERROR_VERBOSE #if ! defined (yyoverflow) || YYERROR_VERBOSE
@@ -375,8 +375,9 @@ union yyalloc
#define YYUNDEFTOK 2 #define YYUNDEFTOK 2
#define YYMAXUTOK 301 #define YYMAXUTOK 301
#define YYTRANSLATE(X) \ #define YYTRANSLATE(YYX) \
((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK) ((YYX <= 0) ? YYEOF : \
(unsigned)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const unsigned char yytranslate[] = static const unsigned char yytranslate[] =
@@ -661,7 +662,7 @@ static const unsigned char yystos[] =
#endif #endif
#define yyerrok (yyerrstatus = 0) #define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY) #define yyclearin (yytoken = YYEMPTY)
#define YYEMPTY -2 #define YYEMPTY -2
#define YYEOF 0 #define YYEOF 0
@@ -679,11 +680,11 @@ static const unsigned char yystos[] =
#define YYBACKUP(Token, Value) \ #define YYBACKUP(Token, Value) \
do \ do \
if (yychar == YYEMPTY && yylen == 1) \ if (yytoken == YYEMPTY && yylen == 1) \
{ \ { \
yychar = (Token); \ yychar = (Token); \
yylval = (Value); \ yylval = (Value); \
yychar1 = YYTRANSLATE (yychar); \ yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK; \ YYPOPSTACK; \
goto yybackup; \ goto yybackup; \
} \ } \
@@ -826,25 +827,25 @@ yystpcpy (yydest, yysrc)
#if defined (__STDC__) || defined (__cplusplus) #if defined (__STDC__) || defined (__cplusplus)
static void static void
yysymprint (FILE *yyout, int yytype, YYSTYPE yyvalue, YYLTYPE yylocation) yysymprint (FILE *yyout, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
#else #else
static void static void
yysymprint (yyout, yytype, yyvalue, yylocation) yysymprint (yyout, yytype, yyvaluep, yylocationp)
FILE *yyout; FILE *yyout;
int yytype; int yytype;
YYSTYPE yyvalue; YYSTYPE *yyvaluep;
YYLTYPE yylocation; YYLTYPE *yylocationp;
#endif #endif
{ {
/* Pacify ``unused variable'' warnings. */ /* Pacify ``unused variable'' warnings. */
(void) yyvalue; (void) yyvaluep;
(void) yylocation; (void) yylocationp;
if (yytype < YYNTOKENS) if (yytype < YYNTOKENS)
{ {
YYFPRINTF (yyout, "token %s (", yytname[yytype]); YYFPRINTF (yyout, "token %s (", yytname[yytype]);
# ifdef YYPRINT # ifdef YYPRINT
YYPRINT (yyout, yytoknum[yytype], yyvalue); YYPRINT (yyout, yytoknum[yytype], *yyvaluep);
# endif # endif
} }
else else
@@ -857,35 +858,34 @@ yysymprint (yyout, yytype, yyvalue, yylocation)
} }
YYFPRINTF (yyout, ")"); YYFPRINTF (yyout, ")");
} }
#endif /* YYDEBUG. */ #endif /* YYDEBUG. */
/*-----------------------------------------------. /*-----------------------------------------------.
| Release the memory associated to this symbol. | | Release the memory associated to this symbol. |
`-----------------------------------------------*/ `-----------------------------------------------*/
#if defined (__STDC__) || defined (__cplusplus) #if defined (__STDC__) || defined (__cplusplus)
static void static void
yydestruct (int yytype, YYSTYPE yyvalue, YYLTYPE yylocation) yydestruct (int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
#else #else
static void static void
yydestruct (yytype, yyvalue, yylocation) yydestruct (yytype, yyvaluep, yylocationp)
int yytype; int yytype;
YYSTYPE yyvalue; YYSTYPE *yyvaluep;
YYLTYPE yylocation; YYLTYPE *yylocationp;
#endif #endif
{ {
/* Pacify ``unused variable'' warnings. */ /* Pacify ``unused variable'' warnings. */
(void) yyvalue; (void) yyvaluep;
(void) yylocation; (void) yylocationp;
switch (yytype) switch (yytype)
{ {
default: default:
break; break;
} }
} }
/* Prevent warnings from -Wmissing-prototypes. */ /* Prevent warnings from -Wmissing-prototypes. */
@@ -948,7 +948,7 @@ YYLTYPE yylloc;
/* Number of tokens to shift before error messages enabled. */ /* Number of tokens to shift before error messages enabled. */
int yyerrstatus; int yyerrstatus;
/* Lookahead token as an internal (translated) token number. */ /* Lookahead token as an internal (translated) token number. */
int yychar1 = 0; int yytoken = 0;
/* Three stacks and their tools: /* Three stacks and their tools:
`yyss': related to states, `yyss': related to states,
@@ -991,7 +991,7 @@ YYLTYPE yylloc;
yystate = 0; yystate = 0;
yyerrstatus = 0; yyerrstatus = 0;
yynerrs = 0; yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */ yychar = yytoken = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers. /* Initialize stack pointers.
Waste one element of value and location stack Waste one element of value and location stack
@@ -1101,39 +1101,31 @@ yybackup:
/* Not known => get a lookahead token if don't already have one. */ /* Not known => get a lookahead token if don't already have one. */
/* yychar is either YYEMPTY or YYEOF /* YYTOKEN is either YYEMPTY or YYEOF or a valid token. */
or a valid token in external form. */ if (yytoken == YYEMPTY)
if (yychar == YYEMPTY)
{ {
YYDPRINTF ((stderr, "Reading a token: ")); YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX; yychar = YYLEX;
yytoken = YYTRANSLATE (yychar);
} }
/* Convert token to internal form (in yychar1) for indexing tables with. */ if (yytoken == YYEOF)
if (yychar <= 0) /* This means end of input. */
{ {
yychar1 = 0;
yychar = YYEOF; /* Don't call YYLEX any more. */
YYDPRINTF ((stderr, "Now at end of input.\n")); YYDPRINTF ((stderr, "Now at end of input.\n"));
} }
else else
{ {
yychar1 = YYTRANSLATE (yychar);
/* We have to keep this `#if YYDEBUG', since we use variables /* We have to keep this `#if YYDEBUG', since we use variables
which are defined only if `YYDEBUG' is set. */ which are defined only if `YYDEBUG' is set. */
YYDPRINTF ((stderr, "Next token is ")); YYDPRINTF ((stderr, "Next token is "));
YYDSYMPRINT ((stderr, yychar1, yylval, yyloc)); YYDSYMPRINT ((stderr, yytoken, &yylval, &yyloc));
YYDPRINTF ((stderr, "\n")); YYDPRINTF ((stderr, "\n"));
} }
/* If the proper action on seeing token YYCHAR1 is to reduce or to /* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */ detect an error, take that action. */
yyn += yychar1; yyn += yytoken;
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1) if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
goto yydefault; goto yydefault;
yyn = yytable[yyn]; yyn = yytable[yyn];
if (yyn <= 0) if (yyn <= 0)
@@ -1149,11 +1141,11 @@ yybackup:
/* Shift the lookahead token. */ /* Shift the lookahead token. */
YYDPRINTF ((stderr, "Shifting token %d (%s), ", YYDPRINTF ((stderr, "Shifting token %d (%s), ",
yychar, yytname[yychar1])); yytoken, yytname[yytoken]));
/* Discard the token being shifted unless it is eof. */ /* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF) if (yytoken != YYEOF)
yychar = YYEMPTY; yytoken = YYEMPTY;
*++yyvsp = yylval; *++yyvsp = yylval;
*++yylsp = yylloc; *++yylsp = yylloc;
@@ -1611,8 +1603,8 @@ yyreduce:
} }
/* Line 1056 of /usr/local/share/bison/yacc.c. */ /* Line 950 of /usr/local/share/bison/yacc.c. */
#line 1616 "parse-gram.c" #line 1607 "parse-gram.c"
yyvsp -= yylen; yyvsp -= yylen;
yyssp -= yylen; yyssp -= yylen;
@@ -1717,7 +1709,7 @@ yyerrlab1:
error, discard it. */ error, discard it. */
/* Return failure if at end of input. */ /* Return failure if at end of input. */
if (yychar == YYEOF) if (yytoken == YYEOF)
{ {
/* Pop the error token. */ /* Pop the error token. */
YYPOPSTACK; YYPOPSTACK;
@@ -1727,18 +1719,18 @@ yyerrlab1:
YYDPRINTF ((stderr, "Error: popping ")); YYDPRINTF ((stderr, "Error: popping "));
YYDSYMPRINT ((stderr, YYDSYMPRINT ((stderr,
yystos[*yyssp], yystos[*yyssp],
*yyvsp, *yylsp)); yyvsp, yylsp));
YYDPRINTF ((stderr, "\n")); YYDPRINTF ((stderr, "\n"));
yydestruct (yystos[*yyssp], *yyvsp, *yylsp); yydestruct (yystos[*yyssp], yyvsp, yylsp);
YYPOPSTACK; YYPOPSTACK;
} }
YYABORT; YYABORT;
} }
YYDPRINTF ((stderr, "Discarding token %d (%s).\n", YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
yychar, yytname[yychar1])); yytoken, yytname[yytoken]));
yydestruct (yychar1, yylval, yylloc); yydestruct (yytoken, &yylval, &yylloc);
yychar = YYEMPTY; yytoken = YYEMPTY;
} }
/* Else will try to reuse lookahead token after shifting the error /* Else will try to reuse lookahead token after shifting the error
@@ -1766,10 +1758,10 @@ yyerrlab1:
YYDPRINTF ((stderr, "Error: popping ")); YYDPRINTF ((stderr, "Error: popping "));
YYDSYMPRINT ((stderr, YYDSYMPRINT ((stderr,
yystos[*yyssp], *yyvsp, *yylsp)); yystos[*yyssp], yyvsp, yylsp));
YYDPRINTF ((stderr, "\n")); YYDPRINTF ((stderr, "\n"));
yydestruct (yystos[yystate], *yyvsp, *yylsp); yydestruct (yystos[yystate], yyvsp, yylsp);
yyvsp--; yyvsp--;
yystate = *--yyssp; yystate = *--yyssp;
yylsp--; yylsp--;

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made from parse-gram.y, by GNU bison 1.75b. */ /* A Bison parser, made by GNU Bison 1.75b. */
/* Skeleton parser for Yacc-like parsing with Bison, /* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
@@ -23,9 +23,6 @@
This special exception was added by the Free Software Foundation This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */ in version 1.24 of Bison. */
#ifndef BISON_PARSE_GRAM_H
# define BISON_PARSE_GRAM_H
/* Tokens. */ /* Tokens. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
# define YYTOKENTYPE # define YYTOKENTYPE
@@ -138,9 +135,10 @@ typedef union {
assoc_t assoc; assoc_t assoc;
struniq_t struniq; struniq_t struniq;
} yystype; } yystype;
/* Line 1321 of /usr/local/share/bison/yacc.c. */ /* Line 1212 of /usr/local/share/bison/yacc.c. */
#line 143 "y.tab.h" #line 139 "y.tab.h"
# define YYSTYPE yystype # define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1
#endif #endif
@@ -158,5 +156,4 @@ typedef struct yyltype
#endif /* not BISON_PARSE_GRAM_H */