mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
muscle: factor the handling of obsolete of obsolete directives.
Suggested by Joel E. Denny. * src/muscle_tab.h, src/muscle_tab.c (muscle_percent_define_ensure): New, extracted from... * src/parse-gram.y (prologue_declaration: pure-parser): here. Remove it. (prologue_declaration: "%<flag>"): Use muscle_percent_define_ensure. (%error-verbose, %pure-parser): No longer tokens. * src/scan-gram.l (pure-parser): Return as a %<flag>.
This commit is contained in:
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
||||
2009-04-06 Akim Demaille <demaille@gostai.com>
|
||||
|
||||
muscle: factor the handling of obsolete of obsolete directives.
|
||||
Suggested by Joel E. Denny.
|
||||
|
||||
* src/muscle_tab.h, src/muscle_tab.c (muscle_percent_define_ensure):
|
||||
New, extracted from...
|
||||
* src/parse-gram.y (prologue_declaration: pure-parser): here.
|
||||
Remove it.
|
||||
(prologue_declaration: "%<flag>"): Use
|
||||
muscle_percent_define_ensure.
|
||||
(%error-verbose, %pure-parser): No longer tokens.
|
||||
* src/scan-gram.l (pure-parser): Return as a %<flag>.
|
||||
|
||||
2009-04-06 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||
|
||||
Fix options documentation.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Muscle table manager for Bison.
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
|
||||
Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -429,6 +429,28 @@ muscle_percent_define_insert (char const *variable, location variable_loc,
|
||||
variable_loc);
|
||||
}
|
||||
|
||||
/* This is used for backward compatibility, e.g., "%define api.pure"
|
||||
supersedes "%pure-parser". */
|
||||
void
|
||||
muscle_percent_define_ensure (char const *variable, location loc,
|
||||
bool value)
|
||||
{
|
||||
char const *val = value ? "" : "false";
|
||||
char const *name;
|
||||
MUSCLE_USER_NAME_CONVERT (name, "percent_define(", variable, ")");
|
||||
|
||||
/* %pure-parser is deprecated in favor of `%define api.pure', so use
|
||||
`%define api.pure' in a backward-compatible manner here. First,
|
||||
don't complain if %pure-parser is specified multiple times. */
|
||||
if (!muscle_find_const (name))
|
||||
muscle_percent_define_insert (variable, loc, val);
|
||||
/* In all cases, use api.pure now so that the backend doesn't complain if
|
||||
the skeleton ignores api.pure, but do warn now if there's a previous
|
||||
conflicting definition from an actual %define. */
|
||||
if (muscle_percent_define_flag_if (variable) != value)
|
||||
muscle_percent_define_insert (variable, loc, val);
|
||||
}
|
||||
|
||||
char *
|
||||
muscle_percent_define_get (char const *variable)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/* Muscle table manager for Bison,
|
||||
Copyright (C) 2001, 2002, 2003, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2006, 2007, 2008, 2009
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -131,6 +133,13 @@ void muscle_user_name_list_grow (char const *key, char const *user_name,
|
||||
void muscle_percent_define_insert (char const *variable, location variable_loc,
|
||||
char const *value);
|
||||
|
||||
/* Make sure that VARIABLE is set to the boolean VALUE. Warn on mismatches
|
||||
only, but accept repeated declaration. Used for backward compatibility
|
||||
between old directives such as %pure-parser, and the recommended use of
|
||||
variables (%define api.pure). */
|
||||
void muscle_percent_define_ensure (char const *variable, location variable_loc,
|
||||
bool value);
|
||||
|
||||
/* Mimic b4_percent_define_get in ../data/bison.m4 exactly. That is, if the
|
||||
%define variable VARIABLE is defined, return its value. Otherwise, return
|
||||
the empty string. Also, record Bison's usage of VARIABLE by defining
|
||||
|
||||
@@ -131,7 +131,6 @@ static int current_prec = 0;
|
||||
PERCENT_DEFAULT_PREC "%default-prec"
|
||||
PERCENT_DEFINE "%define"
|
||||
PERCENT_DEFINES "%defines"
|
||||
PERCENT_ERROR_VERBOSE "%error-verbose"
|
||||
PERCENT_EXPECT "%expect"
|
||||
PERCENT_EXPECT_RR "%expect-rr"
|
||||
PERCENT_FLAG "%<flag>"
|
||||
@@ -148,7 +147,6 @@ static int current_prec = 0;
|
||||
"%nondeterministic-parser"
|
||||
PERCENT_OUTPUT "%output"
|
||||
PERCENT_PARSE_PARAM "%parse-param"
|
||||
PERCENT_PURE_PARSER "%pure-parser"
|
||||
PERCENT_REQUIRE "%require"
|
||||
PERCENT_SKELETON "%skeleton"
|
||||
PERCENT_START "%start"
|
||||
@@ -228,7 +226,7 @@ prologue_declaration:
|
||||
}
|
||||
| "%<flag>"
|
||||
{
|
||||
muscle_percent_define_insert ($1, @1, "");
|
||||
muscle_percent_define_ensure ($1, @1, true);
|
||||
}
|
||||
| "%define" variable content.opt
|
||||
{
|
||||
@@ -268,19 +266,6 @@ prologue_declaration:
|
||||
| "%output" STRING { spec_outfile = $2; }
|
||||
| "%output" "=" STRING { spec_outfile = $3; } /* deprecated */
|
||||
| "%parse-param" "{...}" { add_param ("parse_param", $2, @2); }
|
||||
| "%pure-parser"
|
||||
{
|
||||
/* %pure-parser is deprecated in favor of `%define api.pure', so use
|
||||
`%define api.pure' in a backward-compatible manner here. First, don't
|
||||
complain if %pure-parser is specified multiple times. */
|
||||
if (!muscle_find_const ("percent_define(api.pure)"))
|
||||
muscle_percent_define_insert ("api.pure", @1, "");
|
||||
/* In all cases, use api.pure now so that the backend doesn't complain if
|
||||
the skeleton ignores api.pure, but do warn now if there's a previous
|
||||
conflicting definition from an actual %define. */
|
||||
if (!muscle_percent_define_flag_if ("api.pure"))
|
||||
muscle_percent_define_insert ("api.pure", @1, "");
|
||||
}
|
||||
| "%require" STRING { version_check (&@2, $2); }
|
||||
| "%skeleton" STRING
|
||||
{
|
||||
|
||||
@@ -204,7 +204,7 @@ splice (\\[ \f\t\v]*\n)*
|
||||
"%prec" return PERCENT_PREC;
|
||||
"%precedence" return PERCENT_PRECEDENCE;
|
||||
"%printer" return PERCENT_PRINTER;
|
||||
"%pure"[-_]"parser" return PERCENT_PURE_PARSER;
|
||||
"%pure"[-_]"parser" RETURN_PERCENT_FLAG("api.pure");
|
||||
"%require" return PERCENT_REQUIRE;
|
||||
"%right" return PERCENT_RIGHT;
|
||||
"%skeleton" return PERCENT_SKELETON;
|
||||
|
||||
Reference in New Issue
Block a user