Convert underscores to dashes in some %define variable names.

For now, just api.push-pull and lr.keep-unreachable-states.
Maintain old names for backward compatibility.
* NEWS (2.5): Document.
* data/c.m4 (b4_identification): Update comment.
* data/yacc.c: Update access.
* doc/bison.texinfo: Update.
* etc/bench.pl.in (bench_grammar): Update use.
* src/files.c (tr): Move to...
* src/getargs.c, src/getargs.h (tr): ... here because I can't
think of a better place to expose it.  My logic is that, for all
uses of tr so far, command-line arguments can be involved, and
getargs.h is already included.
* src/main.c (main): Update access.
* src/muscle_tab.c (muscle_percent_define_insert): Convert old
variable names to new variable names before assigning value.
* src/reader.c (reader): Update setting default.
* tests/calc.at: Update uses.
* tests/conflicts.at (Unreachable States After Conflict
Resolution): Update use.
* tests/input.at (%define enum variables): Update use.
(%define backward compatibility): New test group.
* tests/push.at: Update uses.
* tests/reduce.at: Update uses.
* tests/torture.at: Update uses.
This commit is contained in:
Joel E. Denny
2009-04-30 01:04:33 -04:00
parent 1c4aa81df1
commit 812775a039
20 changed files with 164 additions and 65 deletions

View File

@@ -1,3 +1,31 @@
2009-04-30 Joel E. Denny <jdenny@ces.clemson.edu>
Convert underscores to dashes in some %define variable names.
For now, just api.push-pull and lr.keep-unreachable-states.
Maintain old names for backward compatibility.
* NEWS (2.5): Document.
* data/c.m4 (b4_identification): Update comment.
* data/yacc.c: Update access.
* doc/bison.texinfo: Update.
* etc/bench.pl.in (bench_grammar): Update use.
* src/files.c (tr): Move to...
* src/getargs.c, src/getargs.h (tr): ... here because I can't
think of a better place to expose it. My logic is that, for all
uses of tr so far, command-line arguments can be involved, and
getargs.h is already included.
* src/main.c (main): Update access.
* src/muscle_tab.c (muscle_percent_define_insert): Convert old
variable names to new variable names before assigning value.
* src/reader.c (reader): Update setting default.
* tests/calc.at: Update uses.
* tests/conflicts.at (Unreachable States After Conflict
Resolution): Update use.
* tests/input.at (%define enum variables): Update use.
(%define backward compatibility): New test group.
* tests/push.at: Update uses.
* tests/reduce.at: Update uses.
* tests/torture.at: Update uses.
2009-04-30 Joel E. Denny <jdenny@ces.clemson.edu> 2009-04-30 Joel E. Denny <jdenny@ces.clemson.edu>
Set all front-end %define defaults in one place. Set all front-end %define defaults in one place.

15
NEWS
View File

@@ -47,6 +47,21 @@ Bison News
for any NAME and VALUE. Omitting `=VALUE' on the command line is for any NAME and VALUE. Omitting `=VALUE' on the command line is
equivalent to omitting `"VALUE"' in the declaration. equivalent to omitting `"VALUE"' in the declaration.
** %define variables renamed.
The following %define variables
api.push_pull
lr.keep_unreachable_states
have been renamed to
api.push-pull
lr.keep-unreachable-states
The old names are now deprecated but will be maintained indefinitely
for backward compatibility.
** Temporary hack for adding a semicolon to the user action. ** Temporary hack for adding a semicolon to the user action.
Previously, Bison appended a semicolon to every user action for Previously, Bison appended a semicolon to every user action for

View File

@@ -1,7 +1,7 @@
-*- Autoconf -*- -*- Autoconf -*-
# C M4 Macros for Bison. # C M4 Macros for Bison.
# Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008 Free Software # Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
# Foundation, Inc. # Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@@ -31,7 +31,7 @@ m4_define([b4_comment], [/* m4_bpatsubst([$1], [
# ----------------- # -----------------
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or # Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
# b4_pull_flag if they use the values of the %define variables api.pure or # b4_pull_flag if they use the values of the %define variables api.pure or
# api.push_pull. # api.push-pull.
m4_define([b4_identification], m4_define([b4_identification],
[[/* Identify Bison output. */ [[/* Identify Bison output. */
#define YYBISON 1 #define YYBISON 1

View File

@@ -18,13 +18,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Check the value of %define api.push_pull. # Check the value of %define api.push-pull.
b4_percent_define_default([[api.push_pull]], [[pull]]) b4_percent_define_default([[api.push-pull]], [[pull]])
b4_percent_define_check_values([[[[api.push_pull]], b4_percent_define_check_values([[[[api.push-pull]],
[[pull]], [[push]], [[both]]]]) [[pull]], [[push]], [[both]]]])
b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]]) b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]]) b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
m4_case(b4_percent_define_get([[api.push_pull]]), m4_case(b4_percent_define_get([[api.push-pull]]),
[pull], [m4_define([b4_push_flag], [[0]])], [pull], [m4_define([b4_push_flag], [[0]])],
[push], [m4_define([b4_pull_flag], [[0]])]) [push], [m4_define([b4_pull_flag], [[0]])])

View File

@@ -4561,7 +4561,7 @@ valid grammar.
@subsection A Push Parser @subsection A Push Parser
@cindex push parser @cindex push parser
@cindex push parser @cindex push parser
@findex %define api.push_pull @findex %define api.push-pull
(The current push parsing interface is experimental and may evolve. (The current push parsing interface is experimental and may evolve.
More user feedback will help to stabilize it.) More user feedback will help to stabilize it.)
@@ -4577,10 +4577,10 @@ within a certain time period.
Normally, Bison generates a pull parser. Normally, Bison generates a pull parser.
The following Bison declaration says that you want the parser to be a push The following Bison declaration says that you want the parser to be a push
parser (@pxref{Decl Summary,,%define api.push_pull}): parser (@pxref{Decl Summary,,%define api.push-pull}):
@example @example
%define api.push_pull "push" %define api.push-pull "push"
@end example @end example
In almost all cases, you want to ensure that your push parser is also In almost all cases, you want to ensure that your push parser is also
@@ -4591,7 +4591,7 @@ what you are doing, your declarations should look like this:
@example @example
%define api.pure %define api.pure
%define api.push_pull "push" %define api.push-pull "push"
@end example @end example
There is a major notable functional difference between the pure push parser There is a major notable functional difference between the pure push parser
@@ -4640,14 +4640,14 @@ for use by the next invocation of the @code{yypush_parse} function.
Bison also supports both the push parser interface along with the pull parser Bison also supports both the push parser interface along with the pull parser
interface in the same generated parser. In order to get this functionality, interface in the same generated parser. In order to get this functionality,
you should replace the @code{%define api.push_pull "push"} declaration with the you should replace the @code{%define api.push-pull "push"} declaration with the
@code{%define api.push_pull "both"} declaration. Doing this will create all of @code{%define api.push-pull "both"} declaration. Doing this will create all of
the symbols mentioned earlier along with the two extra symbols, @code{yyparse} the symbols mentioned earlier along with the two extra symbols, @code{yyparse}
and @code{yypull_parse}. @code{yyparse} can be used exactly as it normally and @code{yypull_parse}. @code{yyparse} can be used exactly as it normally
would be used. However, the user should note that it is implemented in the would be used. However, the user should note that it is implemented in the
generated parser by calling @code{yypull_parse}. generated parser by calling @code{yypull_parse}.
This makes the @code{yyparse} function that is generated with the This makes the @code{yyparse} function that is generated with the
@code{%define api.push_pull "both"} declaration slower than the normal @code{%define api.push-pull "both"} declaration slower than the normal
@code{yyparse} function. If the user @code{yyparse} function. If the user
calls the @code{yypull_parse} function it will parse the rest of the input calls the @code{yypull_parse} function it will parse the rest of the input
stream. It is possible to @code{yypush_parse} tokens to select a subgrammar stream. It is possible to @code{yypush_parse} tokens to select a subgrammar
@@ -4664,8 +4664,8 @@ yypstate_delete (ps);
@end example @end example
Adding the @code{%define api.pure} declaration does exactly the same thing to Adding the @code{%define api.pure} declaration does exactly the same thing to
the generated parser with @code{%define api.push_pull "both"} as it did for the generated parser with @code{%define api.push-pull "both"} as it did for
@code{%define api.push_pull "push"}. @code{%define api.push-pull "push"}.
@node Decl Summary @node Decl Summary
@subsection Bison Declaration Summary @subsection Bison Declaration Summary
@@ -4887,8 +4887,8 @@ Some of the accepted @var{variable}s are:
@item Default Value: @code{"false"} @item Default Value: @code{"false"}
@end itemize @end itemize
@item api.push_pull @item api.push-pull
@findex %define api.push_pull @findex %define api.push-pull
@itemize @bullet @itemize @bullet
@item Language(s): C (deterministic parsers only) @item Language(s): C (deterministic parsers only)
@@ -4968,8 +4968,8 @@ without performing any extra reductions.
@end itemize @end itemize
@end itemize @end itemize
@item lr.keep_unreachable_states @item lr.keep-unreachable-states
@findex %define lr.keep_unreachable_states @findex %define lr.keep-unreachable-states
@itemize @bullet @itemize @bullet
@item Language(s): all @item Language(s): all
@@ -5467,8 +5467,8 @@ exp: @dots{} @{ @dots{}; *randomness += 1; @dots{} @}
More user feedback will help to stabilize it.) More user feedback will help to stabilize it.)
You call the function @code{yypush_parse} to parse a single token. This You call the function @code{yypush_parse} to parse a single token. This
function is available if either the @code{%define api.push_pull "push"} or function is available if either the @code{%define api.push-pull "push"} or
@code{%define api.push_pull "both"} declaration is used. @code{%define api.push-pull "both"} declaration is used.
@xref{Push Decl, ,A Push Parser}. @xref{Push Decl, ,A Push Parser}.
@deftypefun int yypush_parse (yypstate *yyps) @deftypefun int yypush_parse (yypstate *yyps)
@@ -5485,7 +5485,7 @@ is required to finish parsing the grammar.
More user feedback will help to stabilize it.) More user feedback will help to stabilize it.)
You call the function @code{yypull_parse} to parse the rest of the input You call the function @code{yypull_parse} to parse the rest of the input
stream. This function is available if the @code{%define api.push_pull "both"} stream. This function is available if the @code{%define api.push-pull "both"}
declaration is used. declaration is used.
@xref{Push Decl, ,A Push Parser}. @xref{Push Decl, ,A Push Parser}.
@@ -5501,8 +5501,8 @@ The value returned by @code{yypull_parse} is the same as for @code{yyparse}.
More user feedback will help to stabilize it.) More user feedback will help to stabilize it.)
You call the function @code{yypstate_new} to create a new parser instance. You call the function @code{yypstate_new} to create a new parser instance.
This function is available if either the @code{%define api.push_pull "push"} or This function is available if either the @code{%define api.push-pull "push"} or
@code{%define api.push_pull "both"} declaration is used. @code{%define api.push-pull "both"} declaration is used.
@xref{Push Decl, ,A Push Parser}. @xref{Push Decl, ,A Push Parser}.
@deftypefun yypstate *yypstate_new (void) @deftypefun yypstate *yypstate_new (void)
@@ -5520,8 +5520,8 @@ allocated.
More user feedback will help to stabilize it.) More user feedback will help to stabilize it.)
You call the function @code{yypstate_delete} to delete a parser instance. You call the function @code{yypstate_delete} to delete a parser instance.
function is available if either the @code{%define api.push_pull "push"} or function is available if either the @code{%define api.push-pull "push"} or
@code{%define api.push_pull "both"} declaration is used. @code{%define api.push-pull "both"} declaration is used.
@xref{Push Decl, ,A Push Parser}. @xref{Push Decl, ,A Push Parser}.
@deftypefun void yypstate_delete (yypstate *yyps) @deftypefun void yypstate_delete (yypstate *yyps)
@@ -8929,7 +8929,7 @@ and @code{%define api.pure} directives does not do anything when used in
Java. Java.
Push parsers are currently unsupported in Java and @code{%define Push parsers are currently unsupported in Java and @code{%define
api.push_pull} have no effect. api.push-pull} have no effect.
@acronym{GLR} parsers are currently unsupported in Java. Do not use the @acronym{GLR} parsers are currently unsupported in Java. Do not use the
@code{glr-parser} directive. @code{glr-parser} directive.

View File

@@ -1,6 +1,6 @@
#! /usr/bin/perl -w #! /usr/bin/perl -w
# Copyright (C) 2006, 2008 Free Software Foundation, Inc. # Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
# #
# This file is part of Bison, the GNU Compiler Compiler. # This file is part of Bison, the GNU Compiler Compiler.
# #
@@ -343,8 +343,8 @@ sub bench_grammar ($)
( (
"pull-impure" => '', "pull-impure" => '',
"pull-pure" => '%define api.pure', "pull-pure" => '%define api.pure',
"push-impure" => '%define api.push_pull "both"', "push-impure" => '%define api.push-pull "both"',
"push-pure" => '%define api.push_pull "both" %define api.pure', "push-pure" => '%define api.push-pull "both" %define api.pure',
); );
my %bench; my %bench;

View File

@@ -1,7 +1,7 @@
/* Open and close files for Bison. /* Open and close files for Bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008 Free Software Foundation, Inc. 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
@@ -136,15 +136,6 @@ xfclose (FILE *ptr)
| Compute ALL_BUT_EXT, ALL_BUT_TAB_EXT and output files extensions. | | Compute ALL_BUT_EXT, ALL_BUT_TAB_EXT and output files extensions. |
`------------------------------------------------------------------*/ `------------------------------------------------------------------*/
/* In the string S, replace all characters FROM by TO. */
static void
tr (char *s, char from, char to)
{
for (; *s; s++)
if (*s == from)
*s = to;
}
/* Compute extensions from the grammar file extension. */ /* Compute extensions from the grammar file extension. */
static void static void
compute_exts_from_gf (const char *ext) compute_exts_from_gf (const char *ext)

View File

@@ -663,3 +663,11 @@ getargs (int argc, char *argv[])
current_file = grammar_file = uniqstr_new (argv[optind]); current_file = grammar_file = uniqstr_new (argv[optind]);
MUSCLE_INSERT_C_STRING ("file_name", grammar_file); MUSCLE_INSERT_C_STRING ("file_name", grammar_file);
} }
void
tr (char *s, char from, char to)
{
for (; *s; s++)
if (*s == from)
*s = to;
}

View File

@@ -140,4 +140,7 @@ void getargs (int argc, char *argv[]);
void language_argmatch (char const *arg, int prio, location loc); void language_argmatch (char const *arg, int prio, location loc);
void skeleton_arg (const char *arg, int prio, location loc); void skeleton_arg (const char *arg, int prio, location loc);
/** In the string \c s, replace all characters \c from by \c to. */
void tr (char *s, char from, char to);
#endif /* !GETARGS_H_ */ #endif /* !GETARGS_H_ */

View File

@@ -114,7 +114,7 @@ main (int argc, char *argv[])
declarations. */ declarations. */
timevar_push (TV_CONFLICTS); timevar_push (TV_CONFLICTS);
conflicts_solve (); conflicts_solve ();
if (!muscle_percent_define_flag_if ("lr.keep_unreachable_states")) if (!muscle_percent_define_flag_if ("lr.keep-unreachable-states"))
{ {
state_number *old_to_new = xnmalloc (nstates, sizeof *old_to_new); state_number *old_to_new = xnmalloc (nstates, sizeof *old_to_new);
state_number nstates_old = nstates; state_number nstates_old = nstates;

View File

@@ -403,10 +403,20 @@ void
muscle_percent_define_insert (char const *variable, location variable_loc, muscle_percent_define_insert (char const *variable, location variable_loc,
char const *value) char const *value)
{ {
char *variable_tr = NULL;
char const *name; char const *name;
char const *loc_name; char const *loc_name;
char const *syncline_name; char const *syncline_name;
/* Permit certain names with underscores for backward compatibility. */
if (0 == strcmp (variable, "api.push_pull")
|| 0 == strcmp (variable, "lr.keep_unreachable_states"))
{
variable_tr = strdup (variable);
tr (variable_tr, '_', '-');
variable = variable_tr;
}
MUSCLE_USER_NAME_CONVERT (name, "percent_define(", variable, ")"); MUSCLE_USER_NAME_CONVERT (name, "percent_define(", variable, ")");
MUSCLE_USER_NAME_CONVERT (loc_name, "percent_define_loc(", variable, ")"); MUSCLE_USER_NAME_CONVERT (loc_name, "percent_define_loc(", variable, ")");
MUSCLE_USER_NAME_CONVERT (syncline_name, MUSCLE_USER_NAME_CONVERT (syncline_name,
@@ -427,6 +437,8 @@ muscle_percent_define_insert (char const *variable, location variable_loc,
muscle_syncline_grow (syncline_name, variable_loc); muscle_syncline_grow (syncline_name, variable_loc);
muscle_user_name_list_grow ("percent_define_user_variables", variable, muscle_user_name_list_grow ("percent_define_user_variables", variable,
variable_loc); variable_loc);
free (variable_tr);
} }
char * char *

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.4.1.52-77be. */ /* A Bison parser, made by GNU Bison 2.4.1.57-1d0f-dirty. */
/* Skeleton implementation for Bison's Yacc-like parsers in C /* Skeleton implementation for Bison's Yacc-like parsers in C
@@ -45,7 +45,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "2.4.1.52-77be" #define YYBISON_VERSION "2.4.1.57-1d0f-dirty"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.4.1.52-77be. */ /* A Bison parser, made by GNU Bison 2.4.1.57-1d0f-dirty. */
/* Skeleton interface for Bison's Yacc-like parsers in C /* Skeleton interface for Bison's Yacc-like parsers in C

View File

@@ -556,7 +556,7 @@ reader (void)
gram_parse (); gram_parse ();
/* Set front-end %define variable defaults. */ /* Set front-end %define variable defaults. */
muscle_percent_define_default ("lr.keep_unreachable_states", "false"); muscle_percent_define_default ("lr.keep-unreachable-states", "false");
{ {
char *lr_type; char *lr_type;
/* IELR would be a better default, but LALR is historically the /* IELR would be a better default, but LALR is historically the

View File

@@ -1,7 +1,7 @@
# Simple calculator. -*- Autotest -*- # Simple calculator. -*- Autotest -*-
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
# Software Foundation, Inc. # 2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -576,7 +576,7 @@ AT_CHECK_CALC_LALR([%yacc])
AT_CHECK_CALC_LALR([%error-verbose]) AT_CHECK_CALC_LALR([%error-verbose])
AT_CHECK_CALC_LALR([%define api.pure %locations]) AT_CHECK_CALC_LALR([%define api.pure %locations])
AT_CHECK_CALC_LALR([%define api.push_pull "both" %define api.pure %locations]) AT_CHECK_CALC_LALR([%define api.push-pull "both" %define api.pure %locations])
AT_CHECK_CALC_LALR([%error-verbose %locations]) AT_CHECK_CALC_LALR([%error-verbose %locations])
AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc])
@@ -585,7 +585,7 @@ AT_CHECK_CALC_LALR([%debug])
AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.push_pull "both" %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR([%define api.push-pull "both" %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])

View File

@@ -1,6 +1,7 @@
# Exercising Bison on conflicts. -*- Autotest -*- # Exercising Bison on conflicts. -*- Autotest -*-
# Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. # Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -813,7 +814,7 @@ state 7
]]) ]])
AT_DATA([[input-keep.y]], AT_DATA([[input-keep.y]],
[[%define lr.keep_unreachable_states [[%define lr.keep-unreachable-states
]]) ]])
AT_CHECK([[cat input.y >> input-keep.y]]) AT_CHECK([[cat input.y >> input-keep.y]])

View File

@@ -950,18 +950,59 @@ input.y:1.9-29: accepted value: `accepting'
]]) ]])
# Back-end. # Back-end.
AT_DATA([[input.y]],
[[%define api.push-pull "neither"
%%
start: ;
]])
AT_BISON_CHECK([[input.y]], [1], [],
[[input.y:1.9-21: invalid value for %define variable `api.push-pull': `neither'
input.y:1.9-21: accepted value: `pull'
input.y:1.9-21: accepted value: `push'
input.y:1.9-21: accepted value: `both'
]])
AT_CLEANUP
## -------------------------------- ##
## %define backward compatibility. ##
## -------------------------------- ##
AT_SETUP([[%define backward compatibility]])
# The error messages tell us whether underscores in these variables are
# being converted to dashes.
AT_DATA([[input.y]], AT_DATA([[input.y]],
[[%define api.push_pull "neither" [[%define api.push_pull "neither"
%% %%
start: ; start: ;
]]) ]])
AT_BISON_CHECK([[input.y]], [1], [], AT_BISON_CHECK([[input.y]], [1], [],
[[input.y:1.9-21: invalid value for %define variable `api.push_pull': `neither' [[input.y:1.9-21: invalid value for %define variable `api.push-pull': `neither'
input.y:1.9-21: accepted value: `pull' input.y:1.9-21: accepted value: `pull'
input.y:1.9-21: accepted value: `push' input.y:1.9-21: accepted value: `push'
input.y:1.9-21: accepted value: `both' input.y:1.9-21: accepted value: `both'
]]) ]])
AT_DATA([[input.y]],
[[%define lr.keep_unreachable_states "maybe"
%%
start: ;
]])
AT_BISON_CHECK([[input.y]], [1], [],
[[input.y:1.9-34: invalid value for %define Boolean variable `lr.keep-unreachable-states'
]])
AT_DATA([[input.y]],
[[%define foo_bar "baz"
%%
start: ;
]])
AT_BISON_CHECK([[input.y]], [0], [],
[[input.y:1.9-15: warning: %define variable `foo_bar' is not used
]])
AT_CLEANUP AT_CLEANUP
## ------------------------- ## ## ------------------------- ##

View File

@@ -1,5 +1,5 @@
# Checking Push Parsing. -*- Autotest -*- # Checking Push Parsing. -*- Autotest -*-
# Copyright (C) 2007 Free Software Foundation, Inc. # Copyright (C) 2007, 2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ AT_DATA_GRAMMAR([[input.y]],
void yyerror (char const *msg); void yyerror (char const *msg);
%} %}
%define api.pure %define api.push_pull "push" %define api.pure %define api.push-pull "push"
%% %%
@@ -93,7 +93,7 @@ AT_DATA_GRAMMAR([[input.y]],
int yylex (void); int yylex (void);
%} %}
%define api.push_pull "]$1[" %define api.push-pull "]$1["
%% %%
@@ -156,13 +156,13 @@ AT_SETUP([[Push Parsing: Unsupported Skeletons]])
AT_DATA([[input.y]], AT_DATA([[input.y]],
[[%glr-parser [[%glr-parser
%define api.push_pull "push" %define api.push-pull "push"
%% %%
start: ; start: ;
]]) ]])
AT_BISON_CHECK([[input.y]], [0], [], AT_BISON_CHECK([[input.y]], [0], [],
[[input.y:2.9-21: warning: %define variable `api.push_pull' is not used [[input.y:2.9-21: warning: %define variable `api.push-pull' is not used
]]) ]])
AT_CLEANUP AT_CLEANUP

View File

@@ -396,7 +396,7 @@ AT_TEST_LR_TYPE([[Single State Split]],
[[%left 'a' [[%left 'a'
// Conflict resolution renders state 12 unreachable for canonical LR(1). We // Conflict resolution renders state 12 unreachable for canonical LR(1). We
// keep it so that the paser table diff is easier to code. // keep it so that the paser table diff is easier to code.
%define lr.keep_unreachable_states]], %define lr.keep-unreachable-states]],
[[ [[
S: 'a' A 'a' /* rule 1 */ S: 'a' A 'a' /* rule 1 */
| 'b' A 'b' /* rule 2 */ | 'b' A 'b' /* rule 2 */
@@ -629,7 +629,7 @@ AT_TEST_LR_TYPE([[Lane Split]],
[[%left 'a' [[%left 'a'
// Conflict resolution renders state 16 unreachable for canonical LR(1). We // Conflict resolution renders state 16 unreachable for canonical LR(1). We
// keep it so that the paser table diff is easier to code. // keep it so that the paser table diff is easier to code.
%define lr.keep_unreachable_states]], %define lr.keep-unreachable-states]],
[[ [[
/* Similar to the last test case set but two states must be split. */ /* Similar to the last test case set but two states must be split. */
S: 'a' A 'a' /* rule 1 */ S: 'a' A 'a' /* rule 1 */
@@ -873,7 +873,7 @@ AT_TEST_LR_TYPE([[Complex Lane Split]],
[[%left 'a' [[%left 'a'
// Conflict resolution renders state 16 unreachable for canonical LR(1). We // Conflict resolution renders state 16 unreachable for canonical LR(1). We
// keep it so that the paser table diff is easier to code. // keep it so that the paser table diff is easier to code.
%define lr.keep_unreachable_states]], %define lr.keep-unreachable-states]],
[[ [[
/* Similar to the last test case set but forseeing the S/R conflict from the /* Similar to the last test case set but forseeing the S/R conflict from the
first state that must be split is becoming difficult. Imagine if B were first state that must be split is becoming difficult. Imagine if B were
@@ -1139,7 +1139,7 @@ dnl PARSER-EXIT-VALUE, PARSER-STDOUT, PARSER-STDERR
]])]) ]])])
AT_TEST_LR_TYPE([[Split During Added Lookahead Propagation]], AT_TEST_LR_TYPE([[Split During Added Lookahead Propagation]],
[[%define lr.keep_unreachable_states]], [[%define lr.keep-unreachable-states]],
[[ [[
/* The partial state chart diagram below is for LALR(1). State 0 is the start /* The partial state chart diagram below is for LALR(1). State 0 is the start
state. States are iterated for successor construction in numerical order. state. States are iterated for successor construction in numerical order.

View File

@@ -1,6 +1,6 @@
# Torturing Bison. -*- Autotest -*- # Torturing Bison. -*- Autotest -*-
# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007 Free Software Foundation, # Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 Free Software
# Inc. # Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -496,7 +496,7 @@ AT_PARSER_CHECK([./input 10000], 2, [], [ignore],
# just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect # just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect
# push parsers. # push parsers.
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA], AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
[[%define api.push_pull "both" [[%define api.push-pull "both"
]]) ]])
AT_PARSER_CHECK([./input 20], 0, [], [ignore], AT_PARSER_CHECK([./input 20], 0, [], [ignore],
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
@@ -534,7 +534,7 @@ AT_PARSER_CHECK([./input 10000], 2, [], [ignore],
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA], AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
[[%define api.push_pull "both" [[%define api.push-pull "both"
]]) ]])
AT_PARSER_CHECK([./input 20], 0, [], [ignore], AT_PARSER_CHECK([./input 20], 0, [], [ignore],
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]]) [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])