parser: deprecate %nterm

It has several weaknesses.
Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00000.html

* src/scan-gram.l: here.
This commit is contained in:
Akim Demaille
2018-11-11 19:16:56 +01:00
parent 8d454b843c
commit 7928c3e6fb
5 changed files with 30 additions and 32 deletions

View File

@@ -240,7 +240,6 @@ eqopt ([[:space:]]*=)?
"%no-lines" return PERCENT_NO_LINES;
"%nonassoc" return PERCENT_NONASSOC;
"%nondeterministic-parser" return PERCENT_NONDETERMINISTIC_PARSER;
"%nterm" return PERCENT_NTERM;
"%output" return PERCENT_OUTPUT;
"%param" RETURN_PERCENT_PARAM(both);
"%parse-param" RETURN_PERCENT_PARAM(parse);
@@ -260,7 +259,7 @@ eqopt ([[:space:]]*=)?
"%verbose" return PERCENT_VERBOSE;
"%yacc" return PERCENT_YACC;
/* deprecated */
/* Deprecated since Bison 2.7.90, 2012. */
"%default"[-_]"prec" DEPRECATED("%default-prec");
"%error"[-_]"verbose" DEPRECATED("%define parse.error verbose");
"%expect"[-_]"rr" DEPRECATED("%expect-rr");
@@ -273,6 +272,12 @@ eqopt ([[:space:]]*=)?
"%pure"[-_]"parser" DEPRECATED("%pure-parser");
"%token"[-_]"table" DEPRECATED("%token-table");
"%nterm" {
/* Deprecated since Bison 3.3, but was a rather stealth feature. */
deprecated_directive (loc, yytext, "%type");
return PERCENT_NTERM;
}
"%"{id} {
complain (loc, complaint, _("invalid directive: %s"), quote (yytext));
}