diagnostics: %pure-parser is obsolete

Reported by Uxio Prego.
http://lists.gnu.org/archive/html/bug-bison/2018-12/msg00029.html

* src/scan-gram.l, src/parse-gram.y (PERCENT_PURE_PARSER)
(handle_pure_parser): New.
Issue a deprecation/update notice for %pure-parser.
* doc/bison.texi (Java Bison Interface): Don't mention %pure-parser.
* tests/actions.at, tests/input.at: Adjust.
This commit is contained in:
Akim Demaille
2019-05-19 08:15:08 +02:00
parent cae8132690
commit de5207244b
6 changed files with 30 additions and 10 deletions

View File

@@ -94,6 +94,9 @@
static void handle_name_prefix (location const *loc,
char const *directive, char const *value);
/* Handle a %pure-parser directive. */
static void handle_pure_parser (location const *loc, char const *directive);
/* Handle a %require directive. */
static void handle_require (location const *loc, char const *version);
@@ -181,6 +184,7 @@
PERCENT_NONDETERMINISTIC_PARSER
"%nondeterministic-parser"
PERCENT_OUTPUT "%output"
PERCENT_PURE_PARSER "%pure-parser"
PERCENT_REQUIRE "%require"
PERCENT_SKELETON "%skeleton"
PERCENT_START "%start"
@@ -219,7 +223,7 @@
%type <uniqstr>
BRACKETED_ID ID ID_COLON
PERCENT_ERROR_VERBOSE PERCENT_FILE_PREFIX PERCENT_FLAG PERCENT_NAME_PREFIX
PERCENT_YACC
PERCENT_PURE_PARSER PERCENT_YACC
TAG tag tag.opt variable
%printer { fputs ($$, yyo); } <uniqstr>
%printer { fprintf (yyo, "[%s]", $$); } BRACKETED_ID
@@ -343,6 +347,7 @@ prologue_declaration:
| "%nondeterministic-parser" { nondeterministic_parser = true; }
| "%output" STRING { spec_outfile = $2; }
| "%param" { current_param = $1; } params { current_param = param_none; }
| "%pure-parser" { handle_pure_parser (&@$, $1); }
| "%require" STRING { handle_require (&@2, $2); }
| "%skeleton" STRING { handle_skeleton (&@2, $2); }
| "%token-table" { token_table_flag = true; }
@@ -910,6 +915,7 @@ handle_file_prefix (location const *loc,
deprecated_directive (dir_loc, directive, "%file-prefix");
}
static void
handle_name_prefix (location const *loc,
char const *directive, char const *value)
@@ -944,6 +950,16 @@ handle_name_prefix (location const *loc,
}
static void
handle_pure_parser (location const *loc, char const *directive)
{
bison_directive (loc, directive);
deprecated_directive (loc, directive, "%define api.pure");
muscle_percent_define_insert ("api.pure", *loc, muscle_keyword, "",
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
}
static void
handle_require (location const *loc, char const *version)
{
@@ -1006,6 +1022,7 @@ handle_skeleton (location const *loc, char const *skel)
skeleton_arg (skeleton_user, grammar_prio, *loc);
}
static void
handle_yacc (location const *loc, char const *directive)
{
@@ -1026,6 +1043,7 @@ handle_yacc (location const *loc, char const *directive)
deprecated_directive (loc, directive, "%fixed-output-files");
}
static void
gram_error (location const *loc, char const *msg)
{

View File

@@ -252,7 +252,6 @@ eqopt ({sp}=)?
"%prec" return PERCENT_PREC;
"%precedence" return BISON_DIRECTIVE (PRECEDENCE);
"%printer" return BISON_DIRECTIVE (PRINTER);
"%pure-parser" RETURN_PERCENT_FLAG ("api.pure");
"%require" return BISON_DIRECTIVE (REQUIRE);
"%right" return PERCENT_RIGHT;
"%skeleton" return BISON_DIRECTIVE (SKELETON);
@@ -265,6 +264,10 @@ eqopt ({sp}=)?
"%verbose" return BISON_DIRECTIVE (VERBOSE);
"%yacc" RETURN_VALUE (PERCENT_YACC, uniqstr_new (yytext));
/* Deprecated since Bison 2.3b (2008-05-27), but the warning is
issued only since Bison 3.4. */
"%pure"[-_]"parser" RETURN_VALUE (PERCENT_PURE_PARSER, uniqstr_new (yytext));
/* Deprecated since Bison 3.0 (2013-07-25), but the warning is
issued only since Bison 3.3. */
"%error-verbose" RETURN_VALUE (PERCENT_ERROR_VERBOSE, uniqstr_new (yytext));
@@ -282,7 +285,6 @@ eqopt ({sp}=)?
"%no"[-_]"default"[-_]"prec" DEPRECATED ("%no-default-prec");
"%no"[-_]"lines" DEPRECATED ("%no-lines");
"%output"{eqopt} DEPRECATED ("%output");
"%pure"[-_]"parser" DEPRECATED ("%pure-parser");
"%token"[-_]"table" DEPRECATED ("%token-table");
"%"{id} {