mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 06:13:02 +00:00
For consistency, use lookahead' instead of look-ahead' or
`look_ahead'. Discussed starting at <http://lists.gnu.org/archive/html/bison-patches/2006-01/msg00049.html> and then at <http://lists.gnu.org/archive/html/bison-patches/2006-06/msg00017.html>. * NEWS: For the next release, note the change to `--report'. * TODO, doc/bison.1: Update English. * doc/bison.texinfo: Update English. (Understanding Your Parser, Bison Options): Document as `--report=lookahead' rather than `--report=look-ahead'. * src/conflicts.c: Update English in comments. (lookahead_set): Rename from look_ahead_set. (flush_reduce): Rename argument look_ahead_tokens to lookahead_tokens. (resolve_sr_conflict): Rename local look_ahead_tokens to lookahead_tokens, and update other uses. (flush_shift, set_conflicts, conflicts_solve, count_sr_conflicts, count_rr_conflicts, conflicts_free): Update uses. * src/getargs.c (report_args): Move "lookahead" before alternate spellings. (report_types): Update uses. (usage): For `--report' usage description, state `lookahead' spelling rather than `look-ahead'. * src/getargs.h (report.report_lookahead_tokens): Rename from report_look_ahead_tokens. * src/lalr.c: Update English in comments. (compute_lookahead_tokens): Rename from compute_look_ahead_tokens. (state_lookahead_tokens_count): Rename from state_look_ahead_tokens_count. Rename local n_look_ahead_tokens to n_lookahead_tokens. (lookahead_tokens_print): Rename from look_ahead_tokens_print. Rename local n_look_ahead_tokens to n_lookahead_tokens. Update other uses. Update English in output. (add_lookback_edge, initialize_LA, lalr, lalr_free): Update uses. * src/print.c: Update English in comments. (lookahead_set): Rename from look_ahead_set. (print_reduction): Rename argument lookahead_token from look_ahead_token. (print_core, state_default_rule, print_reductions, print_results): Update uses. * src/print_graph.c: Update English in comments. (print_core): Update uses. * src/state.c: Update English in comments. (reductions_new): Update uses. (state_rule_lookahead_tokens_print): Rename from state_rule_look_ahead_tokens_print, and update other uses. * src/state.h: Update English in comments. (reductions.lookahead_tokens): Rename from look_ahead_tokens. (state_rule_lookahead_tokens_print): Rename from state_rule_look_ahead_tokens_print. * src/tables.c: Update English in comments. (conflict_row, action_row): Update uses. * tests/glr-regression.at (Incorrect lookahead during deterministic GLR, Incorrect lookahead during nondeterministic GLR): Rename print_look_ahead to print_lookahead. * tests/torture.at: Update English in comments. (AT_DATA_LOOKAHEAD_TOKENS_GRAMMAR): Rename from AT_DATA_LOOK_AHEAD_TOKENS_GRAMMAR. (Many lookahead tokens): Update uses. * data/glr.c: Update English in comments. * lalr1.cc: Likewise. * yacc.c: Likewise. * src/conflicts.h: Likewise. * src/lalr.h: Likewise. * src/main.c: Likewise. * src/output.c: Likewise. * src/parse-gram.c: Likewise. * src/tables.h: Likewise. * tests/calc.at: Likewise.
This commit is contained in:
@@ -503,8 +503,8 @@ _AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4],
|
||||
#
|
||||
# - test the action associated to `error'
|
||||
#
|
||||
# - check the look-ahead that triggers an error is not discarded
|
||||
# when we enter error recovery. Below, the look-ahead causing the
|
||||
# - check the lookahead that triggers an error is not discarded
|
||||
# when we enter error recovery. Below, the lookahead causing the
|
||||
# first error is ")", which is needed to recover from the error and
|
||||
# produce the "0" that triggers the "0 != 1" error.
|
||||
#
|
||||
@@ -518,7 +518,7 @@ _AT_CHECK_CALC_ERROR([$1], [0],
|
||||
calc: error: 4444 != 1])
|
||||
|
||||
# The same, but this time exercising explicitly triggered syntax errors.
|
||||
# POSIX says the look-ahead causing the error should not be discarded.
|
||||
# POSIX says the lookahead causing the error should not be discarded.
|
||||
_AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [102],
|
||||
[1.9: syntax error, unexpected number
|
||||
calc: error: 2222 != 1])
|
||||
|
||||
@@ -1090,7 +1090,7 @@ AT_DATA_GRAMMAR([glr-regr13.y],
|
||||
#include <stdio.h>
|
||||
static void yyerror (char const *);
|
||||
static int yylex (void);
|
||||
static void print_look_ahead (char const *);
|
||||
static void print_lookahead (char const *);
|
||||
#define USE(value)
|
||||
%}
|
||||
|
||||
@@ -1104,32 +1104,32 @@ AT_DATA_GRAMMAR([glr-regr13.y],
|
||||
start:
|
||||
defstate_init defstate_shift 'b' change_lookahead 'a' {
|
||||
USE ($3);
|
||||
print_look_ahead ("start <- defstate_init defstate_shift 'b'");
|
||||
print_lookahead ("start <- defstate_init defstate_shift 'b'");
|
||||
}
|
||||
;
|
||||
defstate_init:
|
||||
{
|
||||
print_look_ahead ("defstate_init <- empty string");
|
||||
print_lookahead ("defstate_init <- empty string");
|
||||
}
|
||||
;
|
||||
defstate_shift:
|
||||
nondefstate defstate_look 'a' {
|
||||
USE ($3);
|
||||
print_look_ahead ("defstate_shift <- nondefstate defstate_look 'a'");
|
||||
print_lookahead ("defstate_shift <- nondefstate defstate_look 'a'");
|
||||
}
|
||||
;
|
||||
defstate_look:
|
||||
{
|
||||
print_look_ahead ("defstate_look <- empty string");
|
||||
print_lookahead ("defstate_look <- empty string");
|
||||
}
|
||||
;
|
||||
nondefstate:
|
||||
{
|
||||
print_look_ahead ("nondefstate <- empty string");
|
||||
print_lookahead ("nondefstate <- empty string");
|
||||
}
|
||||
| 'b' {
|
||||
USE ($1);
|
||||
print_look_ahead ("nondefstate <- 'b'");
|
||||
print_lookahead ("nondefstate <- 'b'");
|
||||
}
|
||||
;
|
||||
change_lookahead:
|
||||
@@ -1158,7 +1158,7 @@ yylex (void)
|
||||
}
|
||||
|
||||
static void
|
||||
print_look_ahead (char const *reduction)
|
||||
print_lookahead (char const *reduction)
|
||||
{
|
||||
printf ("%s:\n yychar=", reduction);
|
||||
if (yychar == YYEMPTY)
|
||||
@@ -1238,7 +1238,7 @@ AT_DATA_GRAMMAR([glr-regr14.y],
|
||||
#include <stdio.h>
|
||||
static void yyerror (char const *);
|
||||
static int yylex (void);
|
||||
static void print_look_ahead (char const *);
|
||||
static void print_lookahead (char const *);
|
||||
static char merge (union YYSTYPE, union YYSTYPE);
|
||||
#define USE(value)
|
||||
%}
|
||||
@@ -1252,7 +1252,7 @@ AT_DATA_GRAMMAR([glr-regr14.y],
|
||||
start:
|
||||
merge 'c' stack_explosion {
|
||||
USE ($2); USE ($3);
|
||||
print_look_ahead ("start <- merge 'c' stack_explosion");
|
||||
print_lookahead ("start <- merge 'c' stack_explosion");
|
||||
}
|
||||
;
|
||||
|
||||
@@ -1260,44 +1260,44 @@ start:
|
||||
merge:
|
||||
nonconflict1 'a' 'b' nonconflict2 %dprec 1 {
|
||||
USE ($2); USE ($3);
|
||||
print_look_ahead ("merge <- nonconflict1 'a' 'b' nonconflict2");
|
||||
print_lookahead ("merge <- nonconflict1 'a' 'b' nonconflict2");
|
||||
}
|
||||
| conflict defstate_look 'a' nonconflict2 'b' defstate_shift %dprec 2 {
|
||||
USE ($3); USE ($5);
|
||||
print_look_ahead ("merge <- conflict defstate_look 'a' nonconflict2 'b'"
|
||||
print_lookahead ("merge <- conflict defstate_look 'a' nonconflict2 'b'"
|
||||
" defstate_shift");
|
||||
}
|
||||
;
|
||||
|
||||
nonconflict1:
|
||||
{
|
||||
print_look_ahead ("nonconflict1 <- empty string");
|
||||
print_lookahead ("nonconflict1 <- empty string");
|
||||
}
|
||||
;
|
||||
nonconflict2:
|
||||
{
|
||||
print_look_ahead ("nonconflict2 <- empty string");
|
||||
print_lookahead ("nonconflict2 <- empty string");
|
||||
}
|
||||
| 'a' {
|
||||
USE ($1);
|
||||
print_look_ahead ("nonconflict2 <- 'a'");
|
||||
print_lookahead ("nonconflict2 <- 'a'");
|
||||
}
|
||||
;
|
||||
conflict:
|
||||
{
|
||||
print_look_ahead ("conflict <- empty string");
|
||||
print_lookahead ("conflict <- empty string");
|
||||
}
|
||||
;
|
||||
defstate_look:
|
||||
{
|
||||
print_look_ahead ("defstate_look <- empty string");
|
||||
print_lookahead ("defstate_look <- empty string");
|
||||
}
|
||||
;
|
||||
|
||||
/* yychar != YYEMPTY but lookahead need is yyfalse. */
|
||||
defstate_shift:
|
||||
{
|
||||
print_look_ahead ("defstate_shift <- empty string");
|
||||
print_lookahead ("defstate_shift <- empty string");
|
||||
}
|
||||
;
|
||||
|
||||
@@ -1364,7 +1364,7 @@ yylex (void)
|
||||
}
|
||||
|
||||
static void
|
||||
print_look_ahead (char const *reduction)
|
||||
print_lookahead (char const *reduction)
|
||||
{
|
||||
printf ("%s:\n yychar=", reduction);
|
||||
if (yychar == YYEMPTY)
|
||||
|
||||
@@ -257,11 +257,11 @@ AT_CLEANUP
|
||||
|
||||
|
||||
|
||||
# AT_DATA_LOOK_AHEAD_TOKENS_GRAMMAR(FILE-NAME, SIZE)
|
||||
# AT_DATA_LOOKAHEAD_TOKENS_GRAMMAR(FILE-NAME, SIZE)
|
||||
# --------------------------------------------------
|
||||
# Create FILE-NAME, containing a self checking parser for a grammar
|
||||
# requiring SIZE look-ahead tokens.
|
||||
m4_define([AT_DATA_LOOK_AHEAD_TOKENS_GRAMMAR],
|
||||
# requiring SIZE lookahead tokens.
|
||||
m4_define([AT_DATA_LOOKAHEAD_TOKENS_GRAMMAR],
|
||||
[AT_DATA([[gengram.pl]],
|
||||
[[#! /usr/bin/perl -w
|
||||
|
||||
@@ -362,12 +362,12 @@ mv stdout $1
|
||||
|
||||
|
||||
## ------------------------ ##
|
||||
## Many look-ahead tokens. ##
|
||||
## Many lookahead tokens. ##
|
||||
## ------------------------ ##
|
||||
|
||||
AT_SETUP([Many look-ahead tokens])
|
||||
AT_SETUP([Many lookahead tokens])
|
||||
|
||||
AT_DATA_LOOK_AHEAD_TOKENS_GRAMMAR([input.y], [1000])
|
||||
AT_DATA_LOOKAHEAD_TOKENS_GRAMMAR([input.y], [1000])
|
||||
|
||||
# GNU m4 requires about 70 MiB for this test on a 32-bit host.
|
||||
# Ask for 200 MiB, which should be plenty even on a 64-bit host.
|
||||
|
||||
Reference in New Issue
Block a user