mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 05:43:03 +00:00
%fixed-output-files: detach from %yacc
The name fixed-output-files is pretty clear: generate y.tab.c, as Yacc
does. So let's detach this from %yacc which does more: it requires
POSIX Yacc behavior.
This directive is obsolete since December 29th 2001
8c9a50bee1. It does not show in the
doc. I don't want to spend more time on improving its diagnostics, it
could be removed just as well as far as I'm concerned.
* src/scan-gram.l, src/parse-gram.y (%fixed-output-files): Detach from
%yacc.
This commit is contained in:
@@ -177,7 +177,7 @@
|
||||
static void handle_skeleton (location const *loc, char const *skel);
|
||||
|
||||
/* Handle a %yacc directive. */
|
||||
static void handle_yacc (location const *loc, char const *directive);
|
||||
static void handle_yacc (location const *loc);
|
||||
|
||||
static void gram_error (location const *, char const *);
|
||||
|
||||
@@ -912,10 +912,6 @@ tron (yyo);
|
||||
{ fputs (((*yyvaluep).PERCENT_PURE_PARSER), yyo); }
|
||||
break;
|
||||
|
||||
case 39: /* "%yacc" */
|
||||
{ fputs (((*yyvaluep).PERCENT_YACC), yyo); }
|
||||
break;
|
||||
|
||||
case 40: /* "{...}" */
|
||||
{ fputs (((*yyvaluep).BRACED_CODE), yyo); }
|
||||
break;
|
||||
@@ -2119,7 +2115,7 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 29:
|
||||
{ handle_yacc (&(yyloc), (yyvsp[0].PERCENT_YACC)); }
|
||||
{ handle_yacc (&(yyloc)); }
|
||||
break;
|
||||
|
||||
case 30:
|
||||
@@ -3017,23 +3013,14 @@ handle_skeleton (location const *loc, char const *skel)
|
||||
|
||||
|
||||
static void
|
||||
handle_yacc (location const *loc, char const *directive)
|
||||
handle_yacc (location const *loc)
|
||||
{
|
||||
const char *directive = "%yacc";
|
||||
bison_directive (loc, directive);
|
||||
bool warned = false;
|
||||
|
||||
if (location_empty (yacc_loc))
|
||||
yacc_loc = *loc;
|
||||
else
|
||||
{
|
||||
duplicate_directive (directive, yacc_loc, *loc);
|
||||
warned = true;
|
||||
}
|
||||
|
||||
if (!warned
|
||||
&& STRNEQ (directive, "%fixed-output-files")
|
||||
&& STRNEQ (directive, "%yacc"))
|
||||
deprecated_directive (loc, directive, "%fixed-output-files");
|
||||
duplicate_directive (directive, yacc_loc, *loc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -207,8 +207,6 @@ union GRAM_STYPE
|
||||
uniqstr PERCENT_NAME_PREFIX;
|
||||
/* "%pure-parser" */
|
||||
uniqstr PERCENT_PURE_PARSER;
|
||||
/* "%yacc" */
|
||||
uniqstr PERCENT_YACC;
|
||||
/* "[identifier]" */
|
||||
uniqstr BRACKETED_ID;
|
||||
/* "identifier" */
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
static void handle_skeleton (location const *loc, char const *skel);
|
||||
|
||||
/* Handle a %yacc directive. */
|
||||
static void handle_yacc (location const *loc, char const *directive);
|
||||
static void handle_yacc (location const *loc);
|
||||
|
||||
static void gram_error (location const *, char const *);
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
%type <uniqstr>
|
||||
BRACKETED_ID ID ID_COLON
|
||||
PERCENT_ERROR_VERBOSE PERCENT_FILE_PREFIX PERCENT_FLAG PERCENT_NAME_PREFIX
|
||||
PERCENT_PURE_PARSER PERCENT_YACC
|
||||
PERCENT_PURE_PARSER
|
||||
TAG tag tag.opt variable
|
||||
%printer { fputs ($$, yyo); } <uniqstr>
|
||||
%printer { fprintf (yyo, "[%s]", $$); } BRACKETED_ID
|
||||
@@ -352,7 +352,7 @@ prologue_declaration:
|
||||
| "%skeleton" STRING { handle_skeleton (&@2, $2); }
|
||||
| "%token-table" { token_table_flag = true; }
|
||||
| "%verbose" { report_flag |= report_states; }
|
||||
| "%yacc" { handle_yacc (&@$, $1); }
|
||||
| "%yacc" { handle_yacc (&@$); }
|
||||
| error ";" { current_class = unknown_sym; yyerrok; }
|
||||
| /*FIXME: Err? What is this horror doing here? */ ";"
|
||||
;
|
||||
@@ -1024,23 +1024,14 @@ handle_skeleton (location const *loc, char const *skel)
|
||||
|
||||
|
||||
static void
|
||||
handle_yacc (location const *loc, char const *directive)
|
||||
handle_yacc (location const *loc)
|
||||
{
|
||||
const char *directive = "%yacc";
|
||||
bison_directive (loc, directive);
|
||||
bool warned = false;
|
||||
|
||||
if (location_empty (yacc_loc))
|
||||
yacc_loc = *loc;
|
||||
else
|
||||
{
|
||||
duplicate_directive (directive, yacc_loc, *loc);
|
||||
warned = true;
|
||||
}
|
||||
|
||||
if (!warned
|
||||
&& STRNEQ (directive, "%fixed-output-files")
|
||||
&& STRNEQ (directive, "%yacc"))
|
||||
deprecated_directive (loc, directive, "%fixed-output-files");
|
||||
duplicate_directive (directive, yacc_loc, *loc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -233,7 +233,6 @@ eqopt ({sp}=)?
|
||||
"%expect" return BISON_DIRECTIVE (EXPECT);
|
||||
"%expect-rr" return BISON_DIRECTIVE (EXPECT_RR);
|
||||
"%file-prefix" RETURN_VALUE (PERCENT_FILE_PREFIX, uniqstr_new (yytext));
|
||||
"%fixed-output-files" RETURN_VALUE (PERCENT_YACC, uniqstr_new (yytext));
|
||||
"%initial-action" return BISON_DIRECTIVE (INITIAL_ACTION);
|
||||
"%glr-parser" return BISON_DIRECTIVE (GLR_PARSER);
|
||||
"%language" return BISON_DIRECTIVE (LANGUAGE);
|
||||
@@ -262,7 +261,7 @@ eqopt ({sp}=)?
|
||||
"%type" return PERCENT_TYPE;
|
||||
"%union" return PERCENT_UNION;
|
||||
"%verbose" return BISON_DIRECTIVE (VERBOSE);
|
||||
"%yacc" RETURN_VALUE (PERCENT_YACC, uniqstr_new (yytext));
|
||||
"%yacc" return PERCENT_YACC;
|
||||
|
||||
/* Deprecated since Bison 2.3b (2008-05-27), but the warning is
|
||||
issued only since Bison 3.4. */
|
||||
@@ -281,7 +280,7 @@ eqopt ({sp}=)?
|
||||
"%error"[-_]"verbose" RETURN_VALUE (PERCENT_ERROR_VERBOSE, uniqstr_new (yytext));
|
||||
"%expect"[-_]"rr" DEPRECATED ("%expect-rr");
|
||||
"%file-prefix"{eqopt} RETURN_VALUE (PERCENT_FILE_PREFIX, uniqstr_new (yytext));
|
||||
"%fixed"[-_]"output"[-_]"files" RETURN_VALUE (PERCENT_YACC, uniqstr_new (yytext));
|
||||
"%fixed"[-_]"output"[-_]"files" DEPRECATED ("%output \"y.tab.c\"");
|
||||
"%no"[-_]"default"[-_]"prec" DEPRECATED ("%no-default-prec");
|
||||
"%no"[-_]"lines" DEPRECATED ("%no-lines");
|
||||
"%output"{eqopt} DEPRECATED ("%output");
|
||||
|
||||
Reference in New Issue
Block a user