mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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:
@@ -1,7 +1,7 @@
|
||||
# Simple calculator. -*- Autotest -*-
|
||||
|
||||
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
|
||||
# Software Foundation, Inc.
|
||||
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
||||
# 2009 Free Software Foundation, Inc.
|
||||
|
||||
# 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
|
||||
@@ -576,7 +576,7 @@ AT_CHECK_CALC_LALR([%yacc])
|
||||
AT_CHECK_CALC_LALR([%error-verbose])
|
||||
|
||||
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 %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([%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}])
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# 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
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -813,7 +814,7 @@ state 7
|
||||
]])
|
||||
|
||||
AT_DATA([[input-keep.y]],
|
||||
[[%define lr.keep_unreachable_states
|
||||
[[%define lr.keep-unreachable-states
|
||||
]])
|
||||
AT_CHECK([[cat input.y >> input-keep.y]])
|
||||
|
||||
|
||||
@@ -950,18 +950,59 @@ input.y:1.9-29: accepted value: `accepting'
|
||||
]])
|
||||
|
||||
# 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]],
|
||||
[[%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: 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_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
|
||||
|
||||
## ------------------------- ##
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# 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
|
||||
# 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);
|
||||
%}
|
||||
|
||||
%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);
|
||||
%}
|
||||
|
||||
%define api.push_pull "]$1["
|
||||
%define api.push-pull "]$1["
|
||||
|
||||
%%
|
||||
|
||||
@@ -156,13 +156,13 @@ AT_SETUP([[Push Parsing: Unsupported Skeletons]])
|
||||
|
||||
AT_DATA([[input.y]],
|
||||
[[%glr-parser
|
||||
%define api.push_pull "push"
|
||||
%define api.push-pull "push"
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
|
||||
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
|
||||
|
||||
@@ -396,7 +396,7 @@ AT_TEST_LR_TYPE([[Single State Split]],
|
||||
[[%left 'a'
|
||||
// Conflict resolution renders state 12 unreachable for canonical LR(1). We
|
||||
// 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 */
|
||||
| 'b' A 'b' /* rule 2 */
|
||||
@@ -629,7 +629,7 @@ AT_TEST_LR_TYPE([[Lane Split]],
|
||||
[[%left 'a'
|
||||
// Conflict resolution renders state 16 unreachable for canonical LR(1). We
|
||||
// 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. */
|
||||
S: 'a' A 'a' /* rule 1 */
|
||||
@@ -873,7 +873,7 @@ AT_TEST_LR_TYPE([[Complex Lane Split]],
|
||||
[[%left 'a'
|
||||
// Conflict resolution renders state 16 unreachable for canonical LR(1). We
|
||||
// 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
|
||||
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]],
|
||||
[[%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
|
||||
state. States are iterated for successor construction in numerical order.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Torturing Bison. -*- Autotest -*-
|
||||
# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007 Free Software Foundation,
|
||||
# Inc.
|
||||
# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# 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
|
||||
@@ -496,7 +496,7 @@ AT_PARSER_CHECK([./input 10000], 2, [], [ignore],
|
||||
# just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect
|
||||
# push parsers.
|
||||
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
|
||||
[[%define api.push_pull "both"
|
||||
[[%define api.push-pull "both"
|
||||
]])
|
||||
AT_PARSER_CHECK([./input 20], 0, [], [ignore],
|
||||
[[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"]])
|
||||
|
||||
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
|
||||
[[%define api.push_pull "both"
|
||||
[[%define api.push-pull "both"
|
||||
]])
|
||||
AT_PARSER_CHECK([./input 20], 0, [], [ignore],
|
||||
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
|
||||
|
||||
Reference in New Issue
Block a user