From 8dd162d3ff10fd7fb6f748a885f8055232691c48 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 21 Jun 2004 20:20:31 +0000 Subject: [PATCH] Use "look-ahead" instead of "lookahead", consistently. --- ChangeLog | 25 ++++++++++++++ NEWS | 9 +++-- REFERENCES | 9 +++-- TODO | 4 +-- data/glr.c | 8 ++--- data/lalr1.cc | 14 ++++---- data/yacc.c | 22 ++++++------ doc/bison.texinfo | 32 +++++++++--------- src/conflicts.c | 76 ++++++++++++++++++++--------------------- src/getargs.c | 8 +++-- src/getargs.h | 4 +-- src/lalr.c | 80 +++++++++++++++++++++---------------------- src/lalr.h | 4 +-- src/main.c | 6 ++-- src/output.c | 2 +- src/print.c | 86 +++++++++++++++++++++++------------------------ src/print_graph.c | 10 +++--- src/state.c | 16 ++++----- src/state.h | 12 +++---- src/tables.c | 16 ++++----- src/tables.h | 4 +-- tests/calc.at | 6 ++-- tests/torture.at | 18 +++++----- 23 files changed, 253 insertions(+), 218 deletions(-) diff --git a/ChangeLog b/ChangeLog index 31853884..3f67a0c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2004-06-21 Paul Eggert + + * NEWS, TODO, doc/bison.texinfo: + Use "look-ahead" instead of "lookahead", to be consistent. + * REFERENCES: Fix incorrect reference to DeRemer and Pennello, + while we're fixing "look-ahead". + * src/conflicts.c (shift_set): Renamed from shiftset. + (look_ahead_set): Renamed from lookaheadset. + * src/print.c: Likewise. + * src/getargs.c (report_args): Add "look-ahead" as the new canonical + name for "lookahead". + (report_types, usage): Likewise. + * src/getargs.h (report_look_ahead_tokens): Renamed from + report_lookaheads. + * src/lalr.c (compute_look_ahead_tokens): Renamed from + compute_lookaheads. + (state_look_ahead_tokens_count): Renamed from state_lookaheads_count. + (look_ahead_tokens_print): Renamed from lookaheads_print. + * src/state.c (state_rule_look_ahead_tokens_print): Renamed from + state_rule_lookaheads_print. + * src/state.h: Likewise. + (reductions.look_ahead_tokens): Renamed from lookaheads. + * tests/torture.at (AT_DATA_LOOK_AHEAD_TOKENS_GRAMMAR): Renamed from + AT_DATA_LOOKAHEADS_GRAMMAR. + 2004-06-03 Paul Eggert * README: Update location of patched M4 distribution. diff --git a/NEWS b/NEWS index bc66e854..b3cc477c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,11 @@ Bison News ---------- +Changes in version 1.875e: + +* The option `--report=lookahead' was changed to `--report=look-ahead'. + The old spelling still works, but is not documented and will be removed. + Changes in version 1.875d, 2004-05-21: * Unescaped newlines are no longer allowed in character constants or @@ -288,8 +293,8 @@ Changes in version 1.50, 2002-10-04: produces additional information: - itemset complete the core item sets with their closure - - lookahead - explicitly associate lookaheads to items + - lookahead [changed to `look-ahead' in 1.875e and later] + explicitly associate look-ahead tokens to items - solved describe shift/reduce conflicts solving. Bison used to systematically output this information on top of diff --git a/REFERENCES b/REFERENCES index b02eb18c..075d9b9a 100644 --- a/REFERENCES +++ b/REFERENCES @@ -19,12 +19,15 @@ kludges that Johnson had to perpetrate to make Yacc fit in a PDP-11. Also, Bison uses a faster but less space-efficient encoding for the parse tables (see Corbett's PhD thesis from Berkeley, "Static Semantics in Compiler Error Recovery", June 1985, Report No. UCB/CSD -85/251), and more modern technique for generating the lookahead sets. -(See "Efficient Construction of LALR(1) Lookahead Sets" by F. DeRemer -and A. Pennello, in ACM TOPLS Vol 4 No 4, October 1982. Their +85/251), and more modern technique for generating the look-ahead sets. +(See Frank DeRemer and Thomas Pennello, "Efficient Computation of +LALR(1) Look-Ahead Sets", ACM Transactions on Programming Languages +and Systems (TOPLAS) 4, 4 (October 1982), 615-649. Their technique is the standard one now.) paul rubin free software foundation +[DeRemer-Pennello reference corrected by Paul Eggert , + 2004-06-21.] diff --git a/TODO b/TODO index a3005240..4762559e 100644 --- a/TODO +++ b/TODO @@ -29,7 +29,7 @@ Currently, the GLR parser cannot compile with a C++ compiler. ** GLR How would Paul like to display the conflicted actions? In particular, -what when two reductions are possible on a given lookahead, but one is +what when two reductions are possible on a given look-ahead token, but one is part of $default. Should we make the two reductions explicit, or just keep $default? See the following point. @@ -337,7 +337,7 @@ the parser with a means to create the (visual) parse tree. ----- -Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Bison. diff --git a/data/glr.c b/data/glr.c index b7e5c82d..2a332124 100644 --- a/data/glr.c +++ b/data/glr.c @@ -60,7 +60,7 @@ m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) # b4_lyyerror_args # ---------------- -# Same as above, but on the lookahead, hence yyllocp instead of yylocp. +# Same as above, but on the look-ahead, hence yyllocp instead of yylocp. m4_define([b4_lyyerror_args], [b4_pure_if([b4_location_if([yyllocp, ])])dnl m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) @@ -82,14 +82,14 @@ m4_define([b4_pure_formals], # b4_lpure_args # ------------- -# Same as above, but on the lookahead, hence yyllocp instead of yylocp. +# Same as above, but on the look-ahead, hence yyllocp instead of yylocp. m4_define([b4_lpure_args], [b4_pure_if([b4_location_if([, yyllocp])])[]b4_user_args]) # b4_lpure_formals # ---------------- -# Same as above, but on the lookahead, hence yyllocp instead of yylocp. +# Same as above, but on the look-ahead, hence yyllocp instead of yylocp. m4_define([b4_lpure_formals], [b4_pure_if([b4_location_if([YYLTYPE *yyllocp])])[]b4_user_formals]) @@ -1686,7 +1686,7 @@ yyreportSyntaxError (yyGLRStack* yystack, /* Recover from a syntax error on YYSTACK, assuming that YYTOKENP, YYLVALP, and YYLLOCP point to the syntactic category, semantic - value, and location of the lookahead. */ + value, and location of the look-ahead. */ static void yyrecoverSyntaxError (yyGLRStack* yystack, YYSTYPE* yylvalp, YYLTYPE* yyllocp]b4_user_formals[) diff --git a/data/lalr1.cc b/data/lalr1.cc index 9ac1677d..fdd8c259 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -307,14 +307,14 @@ namespace yy int debug_; std::ostream &cdebug_; - /* Lookahead and lookahead in internal form. */ + /* Look-ahead and look-ahead in internal form. */ int looka_; int ilooka_; /* Message. */ std::string message; - /* Semantic value and location of lookahead token. */ + /* Semantic value and location of look-ahead token. */ SemanticType value; LocationType location; /* Beginning of the last erroneous token popped off. */ @@ -394,12 +394,12 @@ yy::]b4_parser_class_name[::parse () /* Backup. */ yybackup: - /* Try to take a decision without lookahead. */ + /* Try to take a decision without look-ahead. */ n_ = pact_[state_]; if (n_ == pact_ninf_) goto yydefault; - /* Read a lookahead token. */ + /* Read a look-ahead token. */ if (looka_ == empty_) { YYCDEBUG << "Reading a token: "; @@ -452,7 +452,7 @@ yy::]b4_parser_class_name[::parse () if (n_ == final_) goto yyacceptlab; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ #if YYDEBUG YYCDEBUG << "Shifting token " << looka_ << " (" << name_[ilooka_] << "), "; @@ -546,7 +546,7 @@ b4_syncline([@oline@], [@ofile@])[ error_start_ = location.begin; if (errstatus_ == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ /* Return failure if at end of input. */ @@ -580,7 +580,7 @@ b4_syncline([@oline@], [@ofile@])[ } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; diff --git a/data/yacc.c b/data/yacc.c index 0957600e..c7415e2d 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -713,15 +713,15 @@ m4_divert_push([KILL])# ======================== M4 code. # Declare the variables that are global, or local to YYPARSE if # pure-parser. m4_define([b4_declare_parser_variables], -[/* The lookahead symbol. */ +[/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs;b4_location_if([ -/* Location data for the lookahead symbol. */ +/* Location data for the look-ahead symbol. */ YYLTYPE yylloc;]) ]) m4_divert_pop([KILL])dnl# ====================== End of M4 code. @@ -751,7 +751,7 @@ b4_c_function_def([yyparse], [int], b4_parse_param) int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: @@ -906,18 +906,18 @@ b4_syncline([@oline@], [@ofile@])])dnl yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -952,7 +952,7 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); /* Discard the token being shifted unless it is eof. */ @@ -1108,7 +1108,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1134,7 +1134,7 @@ yyerrlab: } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; diff --git a/doc/bison.texinfo b/doc/bison.texinfo index c1dcbd26..1feb4073 100644 --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@ -5187,13 +5187,13 @@ return_spec: Bison produces @emph{deterministic} parsers that choose uniquely when to reduce and which reduction to apply -based on a summary of the preceding input and on one extra token of lookahead. +based on a summary of the preceding input and on one extra token of look-ahead. As a result, normal Bison handles a proper subset of the family of context-free languages. Ambiguous grammars, since they have strings with more than one possible sequence of reductions cannot have deterministic parsers in this sense. The same is true of languages that require more than one symbol of -lookahead, since the parser lacks the information necessary to make a +look-ahead, since the parser lacks the information necessary to make a decision at the point it must be made in a shift-reduce parser. Finally, as previously mentioned (@pxref{Mystery Conflicts}), there are languages where Bison's particular choice of how to @@ -5805,16 +5805,16 @@ beginning of the parsing, in the initial rule, right before the start symbol (here, @code{exp}). When the parser returns to this state right after having reduced a rule that produced an @code{exp}, the control flow jumps to state 2. If there is no such transition on a nonterminal -symbol, and the lookahead is a @code{NUM}, then this token is shifted on +symbol, and the look-ahead is a @code{NUM}, then this token is shifted on the parse stack, and the control flow jumps to state 1. Any other -lookahead triggers a syntax error.'' +look-ahead triggers a syntax error.'' @cindex core, item set @cindex item set core @cindex kernel, item set @cindex item set core Even though the only active rule in state 0 seems to be rule 0, the -report lists @code{NUM} as a lookahead symbol because @code{NUM} can be +report lists @code{NUM} as a look-ahead token because @code{NUM} can be at the beginning of any rule deriving an @code{exp}. By default Bison reports the so-called @dfn{core} or @dfn{kernel} of the item set, but if you want to see more detail you can invoke @command{bison} with @@ -5848,7 +5848,7 @@ state 1 @end example @noindent -the rule 5, @samp{exp: NUM;}, is completed. Whatever the lookahead +the rule 5, @samp{exp: NUM;}, is completed. Whatever the look-ahead token (@samp{$default}), the parser will reduce it. If it was coming from state 0, then, after this reduction it will return to state 0, and will jump to state 2 (@samp{exp: go to state 2}). @@ -5871,7 +5871,7 @@ state 2 @noindent In state 2, the automaton can only shift a symbol. For instance, -because of the item @samp{exp -> exp . '+' exp}, if the lookahead if +because of the item @samp{exp -> exp . '+' exp}, if the look-ahead if @samp{+}, it will be shifted on the parse stack, and the automaton control will jump to state 4, corresponding to the item @samp{exp -> exp '+' . exp}. Since there is no default action, any other token than @@ -5948,7 +5948,7 @@ state 8 $default reduce using rule 1 (exp) @end example -Indeed, there are two actions associated to the lookahead @samp{/}: +Indeed, there are two actions associated to the look-ahead @samp{/}: either shifting (and going to state 7), or reducing rule 1. The conflict means that either the grammar is ambiguous, or the parser lacks information to make the right decision. Indeed the grammar is @@ -5966,14 +5966,14 @@ Note that all the previous states had a single possible action: either shifting the next token and going to the corresponding state, or reducing a single rule. In the other cases, i.e., when shifting @emph{and} reducing is possible or when @emph{several} reductions are -possible, the lookahead is required to select the action. State 8 is -one such state: if the lookahead is @samp{*} or @samp{/} then the action +possible, the look-ahead is required to select the action. State 8 is +one such state: if the look-ahead is @samp{*} or @samp{/} then the action is shifting, otherwise the action is reducing rule 1. In other words, the first two items, corresponding to rule 1, are not eligible when the -lookahead is @samp{*}, since we specified that @samp{*} has higher -precedence that @samp{+}. More generally, some items are eligible only -with some set of possible lookaheads. When run with -@option{--report=lookahead}, Bison specifies these lookaheads: +look-ahead token is @samp{*}, since we specified that @samp{*} has higher +precedence than @samp{+}. More generally, some items are eligible only +with some set of possible look-ahead tokens. When run with +@option{--report=look-ahead}, Bison specifies these look-ahead tokens: @example state 8 @@ -6319,9 +6319,9 @@ separated list of @var{things} among: Description of the grammar, conflicts (resolved and unresolved), and @acronym{LALR} automaton. -@item lookahead +@item look-ahead Implies @code{state} and augments the description of the automaton with -each rule's lookahead set. +each rule's look-ahead set. @item itemset Implies @code{state} and augments the description of the automaton with diff --git a/src/conflicts.c b/src/conflicts.c index 2edd1e8b..73ad45e9 100644 --- a/src/conflicts.c +++ b/src/conflicts.c @@ -41,8 +41,8 @@ int expected_rr_conflicts = -1; static char *conflicts = NULL; struct obstack solved_conflicts_obstack; -static bitset shiftset; -static bitset lookaheadset; +static bitset shift_set; +static bitset look_ahead_set; @@ -146,7 +146,7 @@ flush_shift (state *s, int token) transitions *trans = s->transitions; int i; - bitset_reset (lookaheadset, token); + bitset_reset (look_ahead_set, token); for (i = 0; i < trans->num; i++) if (!TRANSITION_IS_DISABLED (trans, i) && TRANSITION_SYMBOL (trans, i) == token) @@ -154,16 +154,16 @@ flush_shift (state *s, int token) } -/*-------------------------------------------------------------------. -| Turn off the reduce recorded for the specified token for the | -| specified lookahead. Used when we resolve a shift-reduce conflict | -| in favor of the shift. | -`-------------------------------------------------------------------*/ +/*--------------------------------------------------------------------. +| Turn off the reduce recorded for the specified token for the | +| specified look-ahead. Used when we resolve a shift-reduce conflict | +| in favor of the shift. | +`--------------------------------------------------------------------*/ static void -flush_reduce (bitset lookaheads, int token) +flush_reduce (bitset look_ahead_tokens, int token) { - bitset_reset (lookaheads, token); + bitset_reset (look_ahead_tokens, token); } @@ -173,7 +173,7 @@ flush_reduce (bitset lookaheads, int token) | rule has a precedence. A conflict is resolved by modifying the | | shift or reduce tables so that there is no longer a conflict. | | | -| LOOKAHEAD is the number of the lookahead bitset to consider. | +| RULENO is the number of the look-ahead bitset to consider. | | | | ERRORS can be used to store discovered explicit errors. | `------------------------------------------------------------------*/ @@ -186,12 +186,12 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors) /* Find the rule to reduce by to get precedence of reduction. */ rule *redrule = reds->rules[ruleno]; int redprec = redrule->prec->prec; - bitset lookaheads = reds->lookaheads[ruleno]; + bitset look_ahead_tokens = reds->look_ahead_tokens[ruleno]; int nerrs = 0; for (i = 0; i < ntokens; i++) - if (bitset_test (lookaheads, i) - && bitset_test (lookaheadset, i) + if (bitset_test (look_ahead_tokens, i) + && bitset_test (look_ahead_set, i) && symbols[i]->prec) { /* Shift-reduce conflict occurs for token number i @@ -205,7 +205,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors) else if (symbols[i]->prec > redprec) { log_resolution (redrule, i, shift_resolution); - flush_reduce (lookaheads, i); + flush_reduce (look_ahead_tokens, i); } else /* Matching precedence levels. @@ -217,7 +217,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors) { case right_assoc: log_resolution (redrule, i, right_resolution); - flush_reduce (lookaheads, i); + flush_reduce (look_ahead_tokens, i); break; case left_assoc: @@ -228,7 +228,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors) case non_assoc: log_resolution (redrule, i, nonassoc_resolution); flush_shift (s, i); - flush_reduce (lookaheads, i); + flush_reduce (look_ahead_tokens, i); /* Record an explicit error for this token. */ errors[nerrs++] = symbols[i]; break; @@ -257,7 +257,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors) | Solve the S/R conflicts of state S using the | | precedence/associativity, and flag it inconsistent if it still has | | conflicts. ERRORS can be used as storage to compute the list of | -| lookaheads on which S raises a syntax error (%nonassoc). | +| look-ahead tokens on which S raises a syntax error (%nonassoc). | `-------------------------------------------------------------------*/ static void @@ -270,27 +270,27 @@ set_conflicts (state *s, symbol **errors) if (s->consistent) return; - bitset_zero (lookaheadset); + bitset_zero (look_ahead_set); FOR_EACH_SHIFT (trans, i) - bitset_set (lookaheadset, TRANSITION_SYMBOL (trans, i)); + bitset_set (look_ahead_set, TRANSITION_SYMBOL (trans, i)); - /* Loop over all rules which require lookahead in this state. First + /* Loop over all rules which require look-ahead in this state. First check for shift-reduce conflict, and try to resolve using precedence. */ for (i = 0; i < reds->num; ++i) if (reds->rules[i]->prec && reds->rules[i]->prec->prec - && !bitset_disjoint_p (reds->lookaheads[i], lookaheadset)) + && !bitset_disjoint_p (reds->look_ahead_tokens[i], look_ahead_set)) resolve_sr_conflict (s, i, errors); - /* Loop over all rules which require lookahead in this state. Check + /* Loop over all rules which require look-ahead in this state. Check for conflicts not resolved above. */ for (i = 0; i < reds->num; ++i) { - if (!bitset_disjoint_p (reds->lookaheads[i], lookaheadset)) + if (!bitset_disjoint_p (reds->look_ahead_tokens[i], look_ahead_set)) conflicts[s->number] = 1; - bitset_or (lookaheadset, lookaheadset, reds->lookaheads[i]); + bitset_or (look_ahead_set, look_ahead_set, reds->look_ahead_tokens[i]); } } @@ -304,12 +304,12 @@ void conflicts_solve (void) { state_number i; - /* List of lookaheads on which we explicitly raise a syntax error. */ + /* List of look-ahead tokens on which we explicitly raise a syntax error. */ symbol **errors = MALLOC (errors, ntokens + 1); CALLOC (conflicts, nstates); - shiftset = bitset_create (ntokens, BITSET_FIXED); - lookaheadset = bitset_create (ntokens, BITSET_FIXED); + shift_set = bitset_create (ntokens, BITSET_FIXED); + look_ahead_set = bitset_create (ntokens, BITSET_FIXED); obstack_init (&solved_conflicts_obstack); for (i = 0; i < nstates; i++) @@ -341,18 +341,18 @@ count_sr_conflicts (state *s) if (!trans) return 0; - bitset_zero (lookaheadset); - bitset_zero (shiftset); + bitset_zero (look_ahead_set); + bitset_zero (shift_set); FOR_EACH_SHIFT (trans, i) - bitset_set (shiftset, TRANSITION_SYMBOL (trans, i)); + bitset_set (shift_set, TRANSITION_SYMBOL (trans, i)); for (i = 0; i < reds->num; ++i) - bitset_or (lookaheadset, lookaheadset, reds->lookaheads[i]); + bitset_or (look_ahead_set, look_ahead_set, reds->look_ahead_tokens[i]); - bitset_and (lookaheadset, lookaheadset, shiftset); + bitset_and (look_ahead_set, look_ahead_set, shift_set); - src_count = bitset_count (lookaheadset); + src_count = bitset_count (look_ahead_set); return src_count; } @@ -377,7 +377,7 @@ count_rr_conflicts (state *s, bool one_per_token) int count = 0; int j; for (j = 0; j < reds->num; ++j) - if (bitset_test (reds->lookaheads[j], i)) + if (bitset_test (reds->look_ahead_tokens[j], i)) count++; if (count >= 2) @@ -432,7 +432,7 @@ conflicts_output (FILE *out) /*--------------------------------------------------------. | Total the number of S/R and R/R conflicts. Unlike the | | code in conflicts_output, however, count EACH pair of | -| reductions for the same state and lookahead as one | +| reductions for the same state and look-ahead as one | | conflict. | `--------------------------------------------------------*/ @@ -523,7 +523,7 @@ void conflicts_free (void) { XFREE (conflicts); - bitset_free (shiftset); - bitset_free (lookaheadset); + bitset_free (shift_set); + bitset_free (look_ahead_set); obstack_free (&solved_conflicts_obstack, NULL); } diff --git a/src/getargs.c b/src/getargs.c index ba7627ef..75968c0d 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -138,7 +138,7 @@ static const char * const report_args[] = "none", "state", "states", "itemset", "itemsets", - "lookahead", "lookaheads", + "look-ahead", "lookahead", "lookaheads", "solved", "all", 0 @@ -149,7 +149,9 @@ static const int report_types[] = report_none, report_states, report_states, report_states | report_itemsets, report_states | report_itemsets, - report_states | report_lookaheads, report_states | report_lookaheads, + report_states | report_look_ahead_tokens, + report_states | report_look_ahead_tokens, + report_states | report_look_ahead_tokens, report_states | report_solved_conflicts, report_all }; @@ -237,7 +239,7 @@ Output:\n\ THINGS is a list of comma separated words that can include:\n\ `state' describe the states\n\ `itemset' complete the core item sets with their closure\n\ - `lookahead' explicitly associate lookaheads to items\n\ + `look-ahead' explicitly associate look-ahead tokens to items\n\ `solved' describe shift/reduce conflicts solving\n\ `all' include all the above information\n\ `none' disable the report\n\ diff --git a/src/getargs.h b/src/getargs.h index 630e8ced..de060b4f 100644 --- a/src/getargs.h +++ b/src/getargs.h @@ -1,5 +1,5 @@ /* Parse command line arguments for bison. - Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003 + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -76,7 +76,7 @@ enum report report_none = 0, report_states = 1 << 0, report_itemsets = 1 << 1, - report_lookaheads = 1 << 2, + report_look_ahead_tokens= 1 << 2, report_solved_conflicts = 1 << 3, report_all = ~0 }; diff --git a/src/lalr.c b/src/lalr.c index 7273805a..b66e9c3f 100644 --- a/src/lalr.c +++ b/src/lalr.c @@ -1,6 +1,6 @@ /* Compute look-ahead criteria for Bison. - Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003 + Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -22,7 +22,7 @@ /* Compute how to make the finite state machine deterministic; find - which rules need lookahead in each state, and which lookahead + which rules need look-ahead in each state, and which look-ahead tokens they accept. */ #include "system.h" @@ -215,9 +215,9 @@ add_lookback_edge (state *s, rule *r, int gotono) { int ri = state_reduction_find (s, r); goto_list *sp = MALLOC (sp, 1); - sp->next = lookback[(s->reductions->lookaheads - LA) + ri]; + sp->next = lookback[(s->reductions->look_ahead_tokens - LA) + ri]; sp->value = gotono; - lookback[(s->reductions->lookaheads - LA) + ri] = sp; + lookback[(s->reductions->look_ahead_tokens - LA) + ri] = sp; } @@ -306,7 +306,7 @@ compute_FOLLOWS (void) static void -compute_lookaheads (void) +compute_look_ahead_tokens (void) { size_t i; goto_list *sp; @@ -324,27 +324,27 @@ compute_lookaheads (void) } -/*-----------------------------------------------------------. -| Count the number of lookaheads required for S (NLOOKAHEADS | -| member). | -`-----------------------------------------------------------*/ +/*-----------------------------------------------------. +| Count the number of look-ahead tokens required for S | +| (N_LOOK_AHEAD_TOKENS member). | +`-----------------------------------------------------*/ static int -state_lookaheads_count (state *s) +state_look_ahead_tokens_count (state *s) { int k; - int nlookaheads = 0; + int n_look_ahead_tokens = 0; reductions *rp = s->reductions; transitions *sp = s->transitions; - /* We need a lookahead either to distinguish different + /* We need a look-ahead either to distinguish different reductions (i.e., there are two or more), or to distinguish a reduction from a shift. Otherwise, it is straightforward, and the state is `consistent'. */ if (rp->num > 1 || (rp->num == 1 && sp->num && !TRANSITION_IS_DISABLED (sp, 0) && TRANSITION_IS_SHIFT (sp, 0))) - nlookaheads += rp->num; + n_look_ahead_tokens += rp->num; else s->consistent = 1; @@ -355,13 +355,13 @@ state_lookaheads_count (state *s) break; } - return nlookaheads; + return n_look_ahead_tokens; } -/*----------------------------------------------. -| Compute LA, NLA, and the lookaheads members. | -`----------------------------------------------*/ +/*-----------------------------------------------------. +| Compute LA, NLA, and the look_ahead_tokens members. | +`-----------------------------------------------------*/ static void initialize_LA (void) @@ -369,10 +369,10 @@ initialize_LA (void) state_number i; bitsetv pLA; - /* Compute the total number of reductions requiring a lookahead. */ + /* Compute the total number of reductions requiring a look-ahead. */ nLA = 0; for (i = 0; i < nstates; i++) - nLA += state_lookaheads_count (states[i]); + nLA += state_look_ahead_tokens_count (states[i]); /* Avoid having to special case 0. */ if (!nLA) nLA = 1; @@ -380,54 +380,54 @@ initialize_LA (void) pLA = LA = bitsetv_create (nLA, ntokens, BITSET_FIXED); CALLOC (lookback, nLA); - /* Initialize the members LOOKAHEADS for each state which reductions - require lookaheads. */ + /* Initialize the members LOOK_AHEAD_TOKENS for each state whose reductions + require look-ahead tokens. */ for (i = 0; i < nstates; i++) { - int count = state_lookaheads_count (states[i]); + int count = state_look_ahead_tokens_count (states[i]); if (count) { - states[i]->reductions->lookaheads = pLA; + states[i]->reductions->look_ahead_tokens = pLA; pLA += count; } } } -/*---------------------------------------. -| Output the lookaheads for each state. | -`---------------------------------------*/ +/*----------------------------------------------. +| Output the look-ahead tokens for each state. | +`----------------------------------------------*/ static void -lookaheads_print (FILE *out) +look_ahead_tokens_print (FILE *out) { state_number i; int j, k; - fprintf (out, "Lookaheads: BEGIN\n"); + fprintf (out, "Look-ahead tokens: BEGIN\n"); for (i = 0; i < nstates; ++i) { reductions *reds = states[i]->reductions; bitset_iterator iter; - int nlookaheads = 0; + int n_look_ahead_tokens = 0; - if (reds->lookaheads) + if (reds->look_ahead_tokens) for (k = 0; k < reds->num; ++k) - if (reds->lookaheads[k]) - ++nlookaheads; + if (reds->look_ahead_tokens[k]) + ++n_look_ahead_tokens; - fprintf (out, "State %d: %d lookaheads\n", - i, nlookaheads); + fprintf (out, "State %d: %d look-ahead tokens\n", + i, n_look_ahead_tokens); - if (reds->lookaheads) + if (reds->look_ahead_tokens) for (j = 0; j < reds->num; ++j) - BITSET_FOR_EACH (iter, reds->lookaheads[j], k, 0) + BITSET_FOR_EACH (iter, reds->look_ahead_tokens[j], k, 0) { fprintf (out, " on %d (%s) -> rule %d\n", k, symbols[k]->tag, reds->rules[j]->number); }; } - fprintf (out, "Lookaheads: END\n"); + fprintf (out, "Look-ahead tokens: END\n"); } void @@ -438,10 +438,10 @@ lalr (void) initialize_F (); build_relations (); compute_FOLLOWS (); - compute_lookaheads (); + compute_look_ahead_tokens (); if (trace_flag & trace_sets) - lookaheads_print (stderr); + look_ahead_tokens_print (stderr); } @@ -450,6 +450,6 @@ lalr_free (void) { state_number s; for (s = 0; s < nstates; ++s) - states[s]->reductions->lookaheads = NULL; + states[s]->reductions->look_ahead_tokens = NULL; bitsetv_free (LA); } diff --git a/src/lalr.h b/src/lalr.h index ce10edd0..cd50046b 100644 --- a/src/lalr.h +++ b/src/lalr.h @@ -33,12 +33,12 @@ # include "state.h" /* Compute how to make the finite state machine deterministic; find - which rules need lookahead in each state, and which lookahead + which rules need look-ahead in each state, and which look-ahead tokens they accept. */ void lalr (void); -/* Release the information related to lookaheads. Can be performed +/* Release the information related to look-ahead tokens. Can be performed once the action tables are computed. */ void lalr_free (void); diff --git a/src/main.c b/src/main.c index 87ecbaba..59402c3e 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ /* Top level entry point of Bison. - Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000, 2001, 2002 + Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -107,7 +107,7 @@ main (int argc, char *argv[]) timevar_pop (TV_LALR); /* Find and record any conflicts: places where one token of - lookahead is not enough to disambiguate the parsing. In file + look-ahead is not enough to disambiguate the parsing. In file conflicts. Also resolve s/r conflicts based on precedence declarations. */ timevar_push (TV_CONFLICTS); @@ -147,7 +147,7 @@ main (int argc, char *argv[]) if (complaint_issued) goto finish; - /* Lookaheads are no longer needed. */ + /* Look-ahead tokens are no longer needed. */ timevar_push (TV_FREE); lalr_free (); timevar_pop (TV_FREE); diff --git a/src/output.c b/src/output.c index 68dd2dff..d004604e 100644 --- a/src/output.c +++ b/src/output.c @@ -454,7 +454,7 @@ static void prepare_actions (void) { /* Figure out the actions for the specified state, indexed by - lookahead token type. */ + look-ahead token type. */ muscle_insert_rule_number_table ("defact", yydefact, yydefact[0], 1, nstates); diff --git a/src/print.c b/src/print.c index 4f855244..88ac657c 100644 --- a/src/print.c +++ b/src/print.c @@ -1,6 +1,6 @@ /* Print information on generated parser, for bison, - Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003 + Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -39,8 +39,8 @@ #include "state.h" #include "symtab.h" -static bitset shiftset; -static bitset lookaheadset; +static bitset shift_set; +static bitset look_ahead_set; #if 0 static void @@ -111,9 +111,9 @@ print_core (FILE *out, state *s) for (/* Nothing */; *sp >= 0; ++sp) fprintf (out, " %s", symbols[*sp]->tag); - /* Display the lookaheads? */ - if (report_flag & report_lookaheads) - state_rule_lookaheads_print (s, &rules[r], out); + /* Display the look-ahead tokens? */ + if (report_flag & report_look_ahead_tokens) + state_rule_look_ahead_tokens_print (s, &rules[r], out); fputc ('\n', out); } @@ -132,7 +132,7 @@ print_transitions (state *s, FILE *out, bool display_transitions_p) size_t width = 0; int i; - /* Compute the width of the lookaheads column. */ + /* Compute the width of the look-ahead token column. */ for (i = 0; i < trans->num; i++) if (!TRANSITION_IS_DISABLED (trans, i) && TRANSITION_IS_SHIFT (trans, i) == display_transitions_p) @@ -148,7 +148,7 @@ print_transitions (state *s, FILE *out, bool display_transitions_p) fputc ('\n', out); width += 2; - /* Report lookaheads and shifts. */ + /* Report look-ahead tokens and shifts. */ for (i = 0; i < trans->num; i++) if (!TRANSITION_IS_DISABLED (trans, i) && TRANSITION_IS_SHIFT (trans, i) == display_transitions_p) @@ -180,7 +180,7 @@ print_errs (FILE *out, state *s) size_t width = 0; int i; - /* Compute the width of the lookaheads column. */ + /* Compute the width of the look-ahead token column. */ for (i = 0; i < errp->num; ++i) if (errp->symbols[i]) max_length (&width, errp->symbols[i]->tag); @@ -192,7 +192,7 @@ print_errs (FILE *out, state *s) fputc ('\n', out); width += 2; - /* Report lookaheads and errors. */ + /* Report look-ahead tokens and errors. */ for (i = 0; i < errp->num; ++i) if (errp->symbols[i]) { @@ -218,13 +218,13 @@ state_default_rule (state *s) int cmax = 0; int i; - /* No need for a lookahead. */ + /* No need for a look-ahead. */ if (s->consistent) return reds->rules[0]; - /* 1. Each reduction is possibly masked by the lookaheads on which + /* 1. Each reduction is possibly masked by the look-ahead tokens on which we shift (S/R conflicts)... */ - bitset_zero (shiftset); + bitset_zero (shift_set); { transitions *trans = s->transitions; FOR_EACH_SHIFT (trans, i) @@ -233,27 +233,27 @@ state_default_rule (state *s) default rule. */ if (TRANSITION_IS_ERROR (trans, i)) return NULL; - bitset_set (shiftset, TRANSITION_SYMBOL (trans, i)); + bitset_set (shift_set, TRANSITION_SYMBOL (trans, i)); } } - /* 2. Each reduction is possibly masked by the lookaheads on which + /* 2. Each reduction is possibly masked by the look-ahead tokens on which we raise an error (due to %nonassoc). */ { errs *errp = s->errs; for (i = 0; i < errp->num; i++) if (errp->symbols[i]) - bitset_set (shiftset, errp->symbols[i]->number); + bitset_set (shift_set, errp->symbols[i]->number); } for (i = 0; i < reds->num; ++i) { int count = 0; - /* How many non-masked lookaheads are there for this reduction? - */ - bitset_andn (lookaheadset, reds->lookaheads[i], shiftset); - count = bitset_count (lookaheadset); + /* How many non-masked look-ahead tokens are there for this + reduction? */ + bitset_andn (look_ahead_set, reds->look_ahead_tokens[i], shift_set); + count = bitset_count (look_ahead_set); if (count > cmax) { @@ -264,27 +264,27 @@ state_default_rule (state *s) /* 3. And finally, each reduction is possibly masked by previous reductions (in R/R conflicts, we keep the first reductions). */ - bitset_or (shiftset, shiftset, reds->lookaheads[i]); + bitset_or (shift_set, shift_set, reds->look_ahead_tokens[i]); } return default_rule; } -/*--------------------------------------------------------------------. -| Report a reduction of RULE on LOOKAHEADS (which can be `default'). | -| If not ENABLED, the rule is masked by a shift or a reduce (S/R and | -| R/R conflicts). | -`--------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------. +| Report a reduction of RULE on LOOK_AHEAD_TOKEN (which can be `default'). | +| If not ENABLED, the rule is masked by a shift or a reduce (S/R and | +| R/R conflicts). | +`--------------------------------------------------------------------------*/ static void print_reduction (FILE *out, size_t width, - const char *lookahead, + const char *look_ahead_token, rule *r, bool enabled) { int j; - fprintf (out, " %s", lookahead); - for (j = width - strlen (lookahead); j > 0; --j) + fprintf (out, " %s", look_ahead_token); + for (j = width - strlen (look_ahead_token); j > 0; --j) fputc (' ', out); if (!enabled) fputc ('[', out); @@ -316,21 +316,21 @@ print_reductions (FILE *out, state *s) default_rule = state_default_rule (s); - bitset_zero (shiftset); + bitset_zero (shift_set); FOR_EACH_SHIFT (trans, i) - bitset_set (shiftset, TRANSITION_SYMBOL (trans, i)); + bitset_set (shift_set, TRANSITION_SYMBOL (trans, i)); - /* Compute the width of the lookaheads column. */ + /* Compute the width of the look-ahead token column. */ if (default_rule) width = strlen (_("$default")); - if (reds->lookaheads) + if (reds->look_ahead_tokens) for (i = 0; i < ntokens; i++) { - bool count = bitset_test (shiftset, i); + bool count = bitset_test (shift_set, i); for (j = 0; j < reds->num; ++j) - if (bitset_test (reds->lookaheads[j], i)) + if (bitset_test (reds->look_ahead_tokens[j], i)) { if (! count) { @@ -352,15 +352,15 @@ print_reductions (FILE *out, state *s) fputc ('\n', out); width += 2; - /* Report lookaheads (or $default) and reductions. */ - if (reds->lookaheads) + /* Report look-ahead tokens (or $default) and reductions. */ + if (reds->look_ahead_tokens) for (i = 0; i < ntokens; i++) { bool defaulted = false; - bool count = bitset_test (shiftset, i); + bool count = bitset_test (shift_set, i); for (j = 0; j < reds->num; ++j) - if (bitset_test (reds->lookaheads[j], i)) + if (bitset_test (reds->look_ahead_tokens[j], i)) { if (! count) { @@ -562,12 +562,12 @@ print_results (void) if (report_flag & report_itemsets) new_closure (nritems); /* Storage for print_reductions. */ - shiftset = bitset_create (ntokens, BITSET_FIXED); - lookaheadset = bitset_create (ntokens, BITSET_FIXED); + shift_set = bitset_create (ntokens, BITSET_FIXED); + look_ahead_set = bitset_create (ntokens, BITSET_FIXED); for (i = 0; i < nstates; i++) print_state (out, states[i]); - bitset_free (shiftset); - bitset_free (lookaheadset); + bitset_free (shift_set); + bitset_free (look_ahead_set); if (report_flag & report_itemsets) free_closure (); diff --git a/src/print_graph.c b/src/print_graph.c index 80b0d3b1..5923b7ce 100644 --- a/src/print_graph.c +++ b/src/print_graph.c @@ -1,6 +1,6 @@ /* Output a VCG description on generated parser, for Bison, - Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -88,21 +88,21 @@ print_core (struct obstack *oout, state *s) for (/* Nothing */; *sp >= 0; ++sp) obstack_fgrow1 (oout, " %s", symbols[*sp]->tag); - /* Experimental feature: display the lookaheads. */ - if (report_flag & report_lookaheads) + /* Experimental feature: display the look-ahead tokens. */ + if (report_flag & report_look_ahead_tokens) { /* Find the reduction we are handling. */ reductions *reds = s->reductions; int redno = state_reduction_find (s, &rules[r]); /* Print them if there are. */ - if (reds->lookaheads && redno != -1) + if (reds->look_ahead_tokens && redno != -1) { bitset_iterator biter; int k; char const *sep = ""; obstack_sgrow (oout, "["); - BITSET_FOR_EACH (biter, reds->lookaheads[redno], k, 0) + BITSET_FOR_EACH (biter, reds->look_ahead_tokens[redno], k, 0) { obstack_fgrow2 (oout, "%s%s", sep, symbols[k]->tag); sep = ", "; diff --git a/src/state.c b/src/state.c index 445c86fd..f8d17d1f 100644 --- a/src/state.c +++ b/src/state.c @@ -102,7 +102,7 @@ reductions_new (int num, rule **reds) size_t rules_size = num * sizeof *reds; reductions *res = xmalloc (offsetof (reductions, rules) + rules_size); res->num = num; - res->lookaheads = NULL; + res->look_ahead_tokens = NULL; memcpy (res->rules, reds, rules_size); return res; } @@ -219,26 +219,26 @@ state_errs_set (state *s, int num, symbol **tokens) -/*-----------------------------------------------------. -| Print on OUT all the lookaheads such that S wants to | -| reduce R. | -`-----------------------------------------------------*/ +/*---------------------------------------------------. +| Print on OUT all the look-ahead tokens such that S | +| wants to reduce R. | +`---------------------------------------------------*/ void -state_rule_lookaheads_print (state *s, rule *r, FILE *out) +state_rule_look_ahead_tokens_print (state *s, rule *r, FILE *out) { /* Find the reduction we are handling. */ reductions *reds = s->reductions; int red = state_reduction_find (s, r); /* Print them if there are. */ - if (reds->lookaheads && red != -1) + if (reds->look_ahead_tokens && red != -1) { bitset_iterator biter; int k; char const *sep = ""; fprintf (out, " ["); - BITSET_FOR_EACH (biter, reds->lookaheads[red], k, 0) + BITSET_FOR_EACH (biter, reds->look_ahead_tokens[red], k, 0) { fprintf (out, "%s%s", sep, symbols[k]->tag); sep = ", "; diff --git a/src/state.h b/src/state.h index 2c6c45a5..6954d803 100644 --- a/src/state.h +++ b/src/state.h @@ -46,11 +46,11 @@ Each core contains a vector of NITEMS items which are the indices in the RITEMS vector of the items that are selected in this state. - The two types of actions are shifts/gotos (push the lookahead token + The two types of actions are shifts/gotos (push the look-ahead token and read another/goto to the state designated by a nterm) and reductions (combine the last n things on the stack via a rule, replace them with the symbol that the rule derives, and leave the - lookahead token alone). When the states are generated, these + look-ahead token alone). When the states are generated, these actions are represented in two other lists. Each transition structure describes the possible transitions out @@ -185,7 +185,7 @@ errs *errs_new (int num, symbol **tokens); typedef struct { short int num; - bitset *lookaheads; + bitset *look_ahead_tokens; rule *rules[1]; } reductions; @@ -203,7 +203,7 @@ struct state reductions *reductions; errs *errs; - /* Nonzero if no lookahead is needed to decide what to do in state S. */ + /* Nonzero if no look-ahead is needed to decide what to do in state S. */ char consistent; /* If some conflicts were solved thanks to precedence/associativity, @@ -234,9 +234,9 @@ int state_reduction_find (state *s, rule *r); /* Set the errs of STATE. */ void state_errs_set (state *s, int num, symbol **errors); -/* Print on OUT all the lookaheads such that this STATE wants to +/* Print on OUT all the look-ahead tokens such that this STATE wants to reduce R. */ -void state_rule_lookaheads_print (state *s, rule *r, FILE *out); +void state_rule_look_ahead_tokens_print (state *s, rule *r, FILE *out); /* Create/destroy the states hash table. */ void state_hash_new (void); diff --git a/src/tables.c b/src/tables.c index af5a5cb5..50dd4535 100644 --- a/src/tables.c +++ b/src/tables.c @@ -194,7 +194,7 @@ conflict_row (state *s) /* Find all reductions for token J, and record all that do not match ACTROW[J]. */ for (i = 0; i < reds->num; i += 1) - if (bitset_test (reds->lookaheads[i], j) + if (bitset_test (reds->look_ahead_tokens[i], j) && (actrow[j] != rule_number_as_item_number (reds->rules[i]->number))) { @@ -215,8 +215,8 @@ conflict_row (state *s) /*------------------------------------------------------------------. -| Decide what to do for each type of token if seen as the lookahead | -| token in specified state. The value returned is used as the | +| Decide what to do for each type of token if seen as the | +| look-ahead in specified state. The value returned is used as the | | default action (yydefact) for the state. In addition, ACTROW is | | filled with what to do for each kind of token, index by symbol | | number, with zero meaning do the default action. The value | @@ -224,7 +224,7 @@ conflict_row (state *s) | situation is an error. The parser recognizes this value | | specially. | | | -| This is where conflicts are resolved. The loop over lookahead | +| This is where conflicts are resolved. The loop over look-ahead | | rules considered lower-numbered rules last, and the last rule | | considered that likes a token gets to handle it. | | | @@ -249,17 +249,17 @@ action_row (state *s) for (i = 0; i < ntokens; i++) actrow[i] = conflrow[i] = 0; - if (reds->lookaheads) + if (reds->look_ahead_tokens) { int j; bitset_iterator biter; /* loop over all the rules available here which require - lookahead (in reverse order to give precedence to the first + look-ahead (in reverse order to give precedence to the first rule) */ for (i = reds->num - 1; i >= 0; --i) /* and find each token which the rule finds acceptable to come next */ - BITSET_FOR_EACH (biter, reds->lookaheads[i], j, 0) + BITSET_FOR_EACH (biter, reds->look_ahead_tokens[i], j, 0) { /* and record this rule as the rule to use if that token follows. */ @@ -406,7 +406,7 @@ save_row (state_number s) /*------------------------------------------------------------------. | Figure out the actions for the specified state, indexed by | -| lookahead token type. | +| look-ahead token type. | | | | The YYDEFACT table is output now. The detailed info is saved for | | putting into YYTABLE later. | diff --git a/src/tables.h b/src/tables.h index cda1e67d..962b7367 100644 --- a/src/tables.h +++ b/src/tables.h @@ -1,5 +1,5 @@ /* Prepare the LALR and GLR parser tables. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -56,7 +56,7 @@ something else to do. YYPACT[S] = index in YYTABLE of the portion describing state S. - The lookahead token's type is used to index that portion to find + The look-ahead token's type is used to index that portion to find out what to do. If the value in YYTABLE is positive, we shift the token and go to diff --git a/tests/calc.at b/tests/calc.at index f54cebcb..47f05919 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -494,8 +494,8 @@ _AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4], # # - test the action associated to `error' # -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the +# - check the look-ahead that triggers an error is not discarded +# when we enter error recovery. Below, the look-ahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # @@ -509,7 +509,7 @@ _AT_CHECK_CALC_ERROR([$1], [0], calc: error: 4444 != 1]) # The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. +# POSIX says the look-ahead causing the error should not be discarded. _AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [62], [1.9: syntax error, unexpected "number" calc: error: 2222 != 1]) diff --git a/tests/torture.at b/tests/torture.at index 4882d83e..31432cc8 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -1,5 +1,5 @@ # Torturing Bison. -*- Autotest -*- -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2004 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 @@ -256,11 +256,11 @@ AT_CLEANUP -# AT_DATA_LOOKAHEADS_GRAMMAR(FILE-NAME, SIZE) +# AT_DATA_LOOK_AHEAD_TOKENS_GRAMMAR(FILE-NAME, SIZE) # ------------------------------------------- # Create FILE-NAME, containing a self checking parser for a grammar -# requiring SIZE lookaheads. -m4_define([AT_DATA_LOOKAHEADS_GRAMMAR], +# requiring SIZE look-ahead tokens. +m4_define([AT_DATA_LOOK_AHEAD_TOKENS_GRAMMAR], [AT_DATA([[gengram.pl]], [[#! /usr/bin/perl -w @@ -359,13 +359,13 @@ mv stdout $1 ]) -## ----------------- ## -## Many lookaheads. ## -## ----------------- ## +## ------------------------ ## +## Many look-ahead tokens. ## +## ------------------------ ## -AT_SETUP([Many lookaheads]) +AT_SETUP([Many look-ahead tokens]) -AT_DATA_LOOKAHEADS_GRAMMAR([input.y], [1000]) +AT_DATA_LOOK_AHEAD_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. -- 2.45.2