X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/882be728b2481ed2f83805ab8d2cbbab2830f39c..f9d52903f176fbcf07edf8102cdb69f4744b2ddb:/src/reader.c diff --git a/src/reader.c b/src/reader.c index 3f007541..2289d26e 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1,7 +1,7 @@ /* Input parser for Bison - Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003, - 2005, 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000-2003, 2005-2007, + 2009-2011 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -231,7 +231,7 @@ grammar_current_rule_begin (symbol *lhs, location loc, p = grammar_symbol_append (lhs, loc); if (lhs_name) - assign_named_ref(p, lhs_name); + assign_named_ref (p, named_ref_copy (lhs_name)); current_rule = grammar_end; @@ -327,8 +327,8 @@ grammar_rule_check (const symbol_list *r) if (r->ruleprec && r->ruleprec->tag[0] != '\'' && r->ruleprec->tag[0] != '"' && !r->ruleprec->declared && !r->ruleprec->prec) - complain_at (r->location, _("token for %%prec is not defined: %s"), - r->ruleprec->tag); + warn_at (r->location, _("token for %%prec is not defined: %s"), + r->ruleprec->tag); } @@ -377,7 +377,8 @@ grammar_midrule_action (void) code_props_rule_action_init (&midrule->action_props, current_rule->action_props.code, current_rule->action_props.location, - midrule, 0); + midrule, 0, + current_rule->action_props.is_predicate); code_props_none_init (¤t_rule->action_props); if (previous_rule_end) @@ -468,14 +469,14 @@ grammar_current_rule_symbol_append (symbol *sym, location loc, void grammar_current_rule_action_append (const char *action, location loc, - named_ref *name) + named_ref *name, bool is_predicate) { if (current_rule->action_props.code) grammar_midrule_action (); /* After all symbol declarations have been parsed, packgram invokes code_props_translate_code. */ code_props_rule_action_init (¤t_rule->action_props, action, loc, - current_rule, name); + current_rule, name, is_predicate); } @@ -516,6 +517,7 @@ packgram (void) rules[ruleno].useful = true; rules[ruleno].action = p->action_props.code; rules[ruleno].action_location = p->action_props.location; + rules[ruleno].is_predicate = p->action_props.is_predicate; /* If the midrule's $$ is set or its $n is used, remove the `$' from the symbol name so that it's a user-defined symbol so that the default @@ -630,7 +632,7 @@ prepare_percent_define_front_end_variables (void) muscle_percent_define_default ("lr.type", "lalr"); lr_type = muscle_percent_define_get ("lr.type"); if (0 != strcmp (lr_type, "canonical-lr")) - muscle_percent_define_default ("lr.default-reductions", "all"); + muscle_percent_define_default ("lr.default-reductions", "full"); else muscle_percent_define_default ("lr.default-reductions", "accepting"); free (lr_type); @@ -640,7 +642,7 @@ prepare_percent_define_front_end_variables (void) { static char const * const values[] = { "lr.type", "lalr", "ielr", "canonical-lr", NULL, - "lr.default-reductions", "all", "consistent", "accepting", NULL, + "lr.default-reductions", "full", "consistent", "accepting", NULL, NULL }; muscle_percent_define_check_values (values);