mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 02:03: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);
|
static void handle_skeleton (location const *loc, char const *skel);
|
||||||
|
|
||||||
/* Handle a %yacc directive. */
|
/* 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 *);
|
static void gram_error (location const *, char const *);
|
||||||
|
|
||||||
@@ -912,10 +912,6 @@ tron (yyo);
|
|||||||
{ fputs (((*yyvaluep).PERCENT_PURE_PARSER), yyo); }
|
{ fputs (((*yyvaluep).PERCENT_PURE_PARSER), yyo); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 39: /* "%yacc" */
|
|
||||||
{ fputs (((*yyvaluep).PERCENT_YACC), yyo); }
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 40: /* "{...}" */
|
case 40: /* "{...}" */
|
||||||
{ fputs (((*yyvaluep).BRACED_CODE), yyo); }
|
{ fputs (((*yyvaluep).BRACED_CODE), yyo); }
|
||||||
break;
|
break;
|
||||||
@@ -2119,7 +2115,7 @@ yyreduce:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 29:
|
case 29:
|
||||||
{ handle_yacc (&(yyloc), (yyvsp[0].PERCENT_YACC)); }
|
{ handle_yacc (&(yyloc)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 30:
|
case 30:
|
||||||
@@ -3017,23 +3013,14 @@ handle_skeleton (location const *loc, char const *skel)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_yacc (location const *loc, char const *directive)
|
handle_yacc (location const *loc)
|
||||||
{
|
{
|
||||||
|
const char *directive = "%yacc";
|
||||||
bison_directive (loc, directive);
|
bison_directive (loc, directive);
|
||||||
bool warned = false;
|
|
||||||
|
|
||||||
if (location_empty (yacc_loc))
|
if (location_empty (yacc_loc))
|
||||||
yacc_loc = *loc;
|
yacc_loc = *loc;
|
||||||
else
|
else
|
||||||
{
|
duplicate_directive (directive, yacc_loc, *loc);
|
||||||
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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -207,8 +207,6 @@ union GRAM_STYPE
|
|||||||
uniqstr PERCENT_NAME_PREFIX;
|
uniqstr PERCENT_NAME_PREFIX;
|
||||||
/* "%pure-parser" */
|
/* "%pure-parser" */
|
||||||
uniqstr PERCENT_PURE_PARSER;
|
uniqstr PERCENT_PURE_PARSER;
|
||||||
/* "%yacc" */
|
|
||||||
uniqstr PERCENT_YACC;
|
|
||||||
/* "[identifier]" */
|
/* "[identifier]" */
|
||||||
uniqstr BRACKETED_ID;
|
uniqstr BRACKETED_ID;
|
||||||
/* "identifier" */
|
/* "identifier" */
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
static void handle_skeleton (location const *loc, char const *skel);
|
static void handle_skeleton (location const *loc, char const *skel);
|
||||||
|
|
||||||
/* Handle a %yacc directive. */
|
/* 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 *);
|
static void gram_error (location const *, char const *);
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
%type <uniqstr>
|
%type <uniqstr>
|
||||||
BRACKETED_ID ID ID_COLON
|
BRACKETED_ID ID ID_COLON
|
||||||
PERCENT_ERROR_VERBOSE PERCENT_FILE_PREFIX PERCENT_FLAG PERCENT_NAME_PREFIX
|
PERCENT_ERROR_VERBOSE PERCENT_FILE_PREFIX PERCENT_FLAG PERCENT_NAME_PREFIX
|
||||||
PERCENT_PURE_PARSER PERCENT_YACC
|
PERCENT_PURE_PARSER
|
||||||
TAG tag tag.opt variable
|
TAG tag tag.opt variable
|
||||||
%printer { fputs ($$, yyo); } <uniqstr>
|
%printer { fputs ($$, yyo); } <uniqstr>
|
||||||
%printer { fprintf (yyo, "[%s]", $$); } BRACKETED_ID
|
%printer { fprintf (yyo, "[%s]", $$); } BRACKETED_ID
|
||||||
@@ -352,7 +352,7 @@ prologue_declaration:
|
|||||||
| "%skeleton" STRING { handle_skeleton (&@2, $2); }
|
| "%skeleton" STRING { handle_skeleton (&@2, $2); }
|
||||||
| "%token-table" { token_table_flag = true; }
|
| "%token-table" { token_table_flag = true; }
|
||||||
| "%verbose" { report_flag |= report_states; }
|
| "%verbose" { report_flag |= report_states; }
|
||||||
| "%yacc" { handle_yacc (&@$, $1); }
|
| "%yacc" { handle_yacc (&@$); }
|
||||||
| error ";" { current_class = unknown_sym; yyerrok; }
|
| error ";" { current_class = unknown_sym; yyerrok; }
|
||||||
| /*FIXME: Err? What is this horror doing here? */ ";"
|
| /*FIXME: Err? What is this horror doing here? */ ";"
|
||||||
;
|
;
|
||||||
@@ -1024,23 +1024,14 @@ handle_skeleton (location const *loc, char const *skel)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_yacc (location const *loc, char const *directive)
|
handle_yacc (location const *loc)
|
||||||
{
|
{
|
||||||
|
const char *directive = "%yacc";
|
||||||
bison_directive (loc, directive);
|
bison_directive (loc, directive);
|
||||||
bool warned = false;
|
|
||||||
|
|
||||||
if (location_empty (yacc_loc))
|
if (location_empty (yacc_loc))
|
||||||
yacc_loc = *loc;
|
yacc_loc = *loc;
|
||||||
else
|
else
|
||||||
{
|
duplicate_directive (directive, yacc_loc, *loc);
|
||||||
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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -233,7 +233,6 @@ eqopt ({sp}=)?
|
|||||||
"%expect" return BISON_DIRECTIVE (EXPECT);
|
"%expect" return BISON_DIRECTIVE (EXPECT);
|
||||||
"%expect-rr" return BISON_DIRECTIVE (EXPECT_RR);
|
"%expect-rr" return BISON_DIRECTIVE (EXPECT_RR);
|
||||||
"%file-prefix" RETURN_VALUE (PERCENT_FILE_PREFIX, uniqstr_new (yytext));
|
"%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);
|
"%initial-action" return BISON_DIRECTIVE (INITIAL_ACTION);
|
||||||
"%glr-parser" return BISON_DIRECTIVE (GLR_PARSER);
|
"%glr-parser" return BISON_DIRECTIVE (GLR_PARSER);
|
||||||
"%language" return BISON_DIRECTIVE (LANGUAGE);
|
"%language" return BISON_DIRECTIVE (LANGUAGE);
|
||||||
@@ -262,7 +261,7 @@ eqopt ({sp}=)?
|
|||||||
"%type" return PERCENT_TYPE;
|
"%type" return PERCENT_TYPE;
|
||||||
"%union" return PERCENT_UNION;
|
"%union" return PERCENT_UNION;
|
||||||
"%verbose" return BISON_DIRECTIVE (VERBOSE);
|
"%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
|
/* Deprecated since Bison 2.3b (2008-05-27), but the warning is
|
||||||
issued only since Bison 3.4. */
|
issued only since Bison 3.4. */
|
||||||
@@ -281,7 +280,7 @@ eqopt ({sp}=)?
|
|||||||
"%error"[-_]"verbose" RETURN_VALUE (PERCENT_ERROR_VERBOSE, uniqstr_new (yytext));
|
"%error"[-_]"verbose" RETURN_VALUE (PERCENT_ERROR_VERBOSE, uniqstr_new (yytext));
|
||||||
"%expect"[-_]"rr" DEPRECATED ("%expect-rr");
|
"%expect"[-_]"rr" DEPRECATED ("%expect-rr");
|
||||||
"%file-prefix"{eqopt} RETURN_VALUE (PERCENT_FILE_PREFIX, uniqstr_new (yytext));
|
"%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"[-_]"default"[-_]"prec" DEPRECATED ("%no-default-prec");
|
||||||
"%no"[-_]"lines" DEPRECATED ("%no-lines");
|
"%no"[-_]"lines" DEPRECATED ("%no-lines");
|
||||||
"%output"{eqopt} DEPRECATED ("%output");
|
"%output"{eqopt} DEPRECATED ("%output");
|
||||||
|
|||||||
@@ -2538,14 +2538,12 @@ fix-it:"input.y":{13:1-13:15}:"%file-prefix"
|
|||||||
input.y:14.1-16.5: warning: duplicate directive: '%file-prefix\n =' [-Wother]
|
input.y:14.1-16.5: warning: duplicate directive: '%file-prefix\n =' [-Wother]
|
||||||
input.y:13.1-20: previous declaration
|
input.y:13.1-20: previous declaration
|
||||||
fix-it:"input.y":{14:1-16:6}:""
|
fix-it:"input.y":{14:1-16:6}:""
|
||||||
input.y:17.9-27: warning: deprecated directive: '%fixed-output_files', use '%fixed-output-files' [-Wdeprecated]
|
input.y:17.9-27: warning: deprecated directive: '%fixed-output_files', use '%output "y.tab.c"' [-Wdeprecated]
|
||||||
fix-it:"input.y":{17:2-17:21}:"%fixed-output-files"
|
fix-it:"input.y":{17:2-17:21}:"%output \"y.tab.c\""
|
||||||
input.y:18.9-27: warning: duplicate directive: '%fixed_output-files' [-Wother]
|
input.y:18.9-27: warning: deprecated directive: '%fixed_output-files', use '%output "y.tab.c"' [-Wdeprecated]
|
||||||
input.y:17.9-27: previous declaration
|
fix-it:"input.y":{18:9-18:28}:"%output \"y.tab.c\""
|
||||||
fix-it:"input.y":{18:9-18:28}:""
|
input.y:19.1-19: warning: deprecated directive: '%fixed-output-files', use '%output "y.tab.c"' [-Wdeprecated]
|
||||||
input.y:19.1-19: warning: duplicate directive: '%fixed-output-files' [-Wother]
|
fix-it:"input.y":{19:1-19:20}:"%output \"y.tab.c\""
|
||||||
input.y:17.9-27: previous declaration
|
|
||||||
fix-it:"input.y":{19:1-19:20}:""
|
|
||||||
input.y:20.1-19: warning: deprecated directive: '%name-prefix= "foo"', use '%define api.prefix {foo}' [-Wdeprecated]
|
input.y:20.1-19: warning: deprecated directive: '%name-prefix= "foo"', use '%define api.prefix {foo}' [-Wdeprecated]
|
||||||
fix-it:"input.y":{20:1-20:20}:"%define api.prefix {foo}"
|
fix-it:"input.y":{20:1-20:20}:"%define api.prefix {foo}"
|
||||||
input.y:21.1-16: warning: deprecated directive: '%no-default_prec', use '%no-default-prec' [-Wdeprecated]
|
input.y:21.1-16: warning: deprecated directive: '%no-default_prec', use '%no-default-prec' [-Wdeprecated]
|
||||||
@@ -2596,8 +2594,9 @@ AT_CHECK([sed -e '1,8d' input.y], [],
|
|||||||
%define parse.error verbose
|
%define parse.error verbose
|
||||||
%expect-rr 0
|
%expect-rr 0
|
||||||
%file-prefix "foo"
|
%file-prefix "foo"
|
||||||
%fixed-output-files
|
%output "y.tab.c"
|
||||||
@&t@
|
%output "y.tab.c"
|
||||||
|
%output "y.tab.c"
|
||||||
%define api.prefix {foo}
|
%define api.prefix {foo}
|
||||||
%no-default-prec
|
%no-default-prec
|
||||||
%no-default-prec
|
%no-default-prec
|
||||||
@@ -2674,7 +2673,6 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
%file-prefix "foo"
|
%file-prefix "foo"
|
||||||
%file-prefix
|
%file-prefix
|
||||||
"bar"
|
"bar"
|
||||||
%fixed-output-files
|
|
||||||
%no-default-prec
|
%no-default-prec
|
||||||
%no-lines
|
%no-lines
|
||||||
%output "foo"
|
%output "foo"
|
||||||
|
|||||||
Reference in New Issue
Block a user