mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 05:13:04 +00:00
style: split a function in two
grammar_current_rule_action_append was used in two different places:
for actual action (`{...}`), and for predicates (`%?{...}`). Let's
split this in two different functions.
* src/reader.h, src/reader.c (grammar_current_rule_predicate_append): New.
Extracted from...
(grammar_current_rule_action_append): here.
Remove arguments that don't apply.
Adjust dependencies.
This commit is contained in:
17
src/reader.c
17
src/reader.c
@@ -522,18 +522,27 @@ grammar_current_rule_symbol_append (symbol *sym, location loc,
|
||||
sym->content->status = needed;
|
||||
}
|
||||
|
||||
/* Attach an ACTION to the current rule. */
|
||||
|
||||
void
|
||||
grammar_current_rule_action_append (const char *action, location loc,
|
||||
named_ref *name, bool is_predicate)
|
||||
named_ref *name)
|
||||
{
|
||||
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, is_predicate);
|
||||
current_rule, name,
|
||||
/* is_predicate */ false);
|
||||
}
|
||||
|
||||
void
|
||||
grammar_current_rule_predicate_append (const char *pred, location loc)
|
||||
{
|
||||
if (current_rule->action_props.code)
|
||||
grammar_midrule_action ();
|
||||
code_props_rule_action_init (¤t_rule->action_props, pred, loc,
|
||||
current_rule, NULL,
|
||||
/* is_predicate */ true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user