bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: symbol declarations after rules


From: Joel E. Denny
Subject: Re: symbol declarations after rules
Date: Sun, 25 Jun 2006 23:29:14 -0400 (EDT)

On Sun, 25 Jun 2006, Joel E. Denny wrote:

> +2006-06-25  Joel E. Denny  <address@hidden>
> +
> +     Clean up yesterday's patch.
> +     * parse-gram.y (rhs): Move grammar_midrule_action invocation from here
> +     to...
> +     * src/reader.c (grammar_current_rule_action_append): ... here for
> +     consistency with grammar_current_rule_symbol_append.
> +     * tests/regression.at (Braced code in declaration in rules section):
> +     Make yyerror and yylex static as usual.

More cleanup in preparation for a rather large patch.

Joel

Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1514
diff -p -u -r1.1514 ChangeLog
--- ChangeLog   25 Jun 2006 06:59:54 -0000      1.1514
+++ ChangeLog   26 Jun 2006 03:25:07 -0000
@@ -1,3 +1,14 @@
+2006-06-26  Joel E. Denny  <address@hidden>
+
+        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  <address@hidden>
 
        Clean up yesterday's patch.
Index: src/reader.c
===================================================================
RCS file: /sources/bison/bison/src/reader.c,v
retrieving revision 1.258
diff -p -u -r1.258 reader.c
--- src/reader.c        25 Jun 2006 06:59:54 -0000      1.258
+++ src/reader.c        26 Jun 2006 03:25:07 -0000
@@ -180,7 +180,7 @@ grammar_symbol_append (symbol *sym, loca
 /* 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 (cons
 {
   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);
 }
 
 
Index: src/reader.h
===================================================================
RCS file: /sources/bison/bison/src/reader.h,v
retrieving revision 1.52
diff -p -u -r1.52 reader.h
--- src/reader.h        23 Jun 2006 20:17:28 -0000      1.52
+++ src/reader.h        26 Jun 2006 03:25:07 -0000
@@ -52,7 +52,6 @@ void grammar_current_rule_dprec_set (int
 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);
 
Index: src/scan-code.h
===================================================================
RCS file: /sources/bison/bison/src/scan-code.h,v
retrieving revision 1.1
diff -p -u -r1.1 scan-code.h
--- src/scan-code.h     6 Jun 2006 16:40:06 -0000       1.1
+++ src/scan-code.h     26 Jun 2006 03:25:07 -0000
@@ -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);
Index: src/scan-code.l
===================================================================
RCS file: /sources/bison/bison/src/scan-code.l,v
retrieving revision 1.5
diff -p -u -r1.5 scan-code.l
--- src/scan-code.l     24 Jun 2006 06:51:27 -0000      1.5
+++ src/scan-code.l     26 Jun 2006 03:25:07 -0000
@@ -357,9 +357,10 @@ translate_action (int sc_context, symbol
 }
 
 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 *






reply via email to

[Prev in Thread] Current Thread [Next in Thread]