From e256e17f572408a91d2014d6b8be1b11e5910b40 Mon Sep 17 00:00:00 2001 From: "Joel E. Denny" Date: Mon, 26 Jun 2006 03:28:57 +0000 Subject: [PATCH 1/1] More cleanup. * src/reader.c (current_rule): Declare it static since it's no longer used outside this file. (grammar_current_rule_action_append): Remove redundant arguments from translate_rule_action invocation. * src/reader.h (current_rule): Remove this unused extern. * src/scan-code.h (translate_rule_action): Remove redundant arguments. * src/scan-code.l (translate_rule_action): Likewise. --- ChangeLog | 11 +++++++++++ src/reader.c | 5 +++-- src/reader.h | 1 - src/scan-code.h | 4 ++-- src/scan-code.l | 5 +++-- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08224ae5..65ffbdad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-06-26 Joel E. Denny + + More cleanup. + * src/reader.c (current_rule): Declare it static since it's no longer + used outside this file. + (grammar_current_rule_action_append): Remove redundant arguments from + translate_rule_action invocation. + * src/reader.h (current_rule): Remove this unused extern. + * src/scan-code.h (translate_rule_action): Remove redundant arguments. + * src/scan-code.l (translate_rule_action): Likewise. + 2006-06-25 Joel E. Denny Clean up yesterday's patch. diff --git a/src/reader.c b/src/reader.c index 73cbd5d9..2c05c19a 100644 --- a/src/reader.c +++ b/src/reader.c @@ -180,7 +180,7 @@ grammar_symbol_append (symbol *sym, location loc) /* The rule currently being defined, and the previous rule. CURRENT_RULE points to the first LHS of the current rule, while PREVIOUS_RULE_END points to the *end* of the previous rule (NULL). */ -symbol_list *current_rule = NULL; +static symbol_list *current_rule = NULL; static symbol_list *previous_rule_end = NULL; @@ -405,8 +405,9 @@ grammar_current_rule_action_append (const char *action, location loc) { if (current_rule->action) grammar_midrule_action (); - current_rule->action = translate_rule_action (current_rule, action, loc); + current_rule->action = action; current_rule->action_location = loc; + current_rule->action = translate_rule_action (current_rule); } diff --git a/src/reader.h b/src/reader.h index a16bfaf3..7b2cbac6 100644 --- a/src/reader.h +++ b/src/reader.h @@ -52,7 +52,6 @@ void grammar_current_rule_dprec_set (int dprec, location loc); void grammar_current_rule_merge_set (uniqstr name, location loc); void grammar_current_rule_symbol_append (symbol *sym, location loc); void grammar_current_rule_action_append (const char *action, location loc); -extern symbol_list *current_rule; void reader (void); void free_merger_functions (void); diff --git a/src/scan-code.h b/src/scan-code.h index 8d979357..cf5be875 100644 --- a/src/scan-code.h +++ b/src/scan-code.h @@ -33,9 +33,9 @@ extern int max_left_semantic_context; void code_scanner_free (void); -/* The action A contains $$, $1 etc. referring to the values +/* The action of the rule R contains $$, $1 etc. referring to the values of the rule R. */ -const char *translate_rule_action (symbol_list *r, const char *a, location l); +const char *translate_rule_action (symbol_list *r); /* The action A refers to $$ and @$ only, referring to a symbol. */ const char *translate_symbol_action (const char *a, location l); diff --git a/src/scan-code.l b/src/scan-code.l index 4e464a7a..aa58521c 100644 --- a/src/scan-code.l +++ b/src/scan-code.l @@ -357,9 +357,10 @@ translate_action (int sc_context, symbol_list *rule, const char *a, location l) } const char * -translate_rule_action (symbol_list *rule, const char *a, location l) +translate_rule_action (symbol_list *rule) { - return translate_action (SC_RULE_ACTION, rule, a, l); + return translate_action (SC_RULE_ACTION, rule, rule->action, + rule->action_location); } const char * -- 2.45.2