bison-patches
[Top][All Lists]
Advanced

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

FYI: parse_action


From: Akim Demaille
Subject: FYI: parse_action
Date: 02 May 2002 18:16:25 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

Now that parse_guard is dead...

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * src/reader.c (parse_braces): Merge into...
        (parse_action): this.

Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.172
diff -u -u -r1.172 reader.c
--- src/reader.c 2 May 2002 15:06:46 -0000 1.172
+++ src/reader.c 2 May 2002 16:15:56 -0000
@@ -1264,22 +1264,24 @@
 
 /*------------------------------------------------------------------.
 | Assuming that a `{' has just been seen, copy everything up to the |
-| matching `}' into the actions file.  RULE_LENGTH is the number of |
-| values in the current rule so far, which says where to find `$0'  |
-| with respect to the top of the stack.                             |
+| matching `}' into ACTION_OBSTACK.                                 |
+|                                                                   |
+| RULE_LENGTH is the number of values in the current rule so far,   |
+| which says where to find `$0' with respect to the top of the      |
+| stack.  It is not the same as the rule->length in the case of mid |
+| rule actions.                                                     |
 |                                                                   |
 | This routine is used for actions.                                 |
 `------------------------------------------------------------------*/
 
 static void
-parse_braces (symbol_list *rule, int rule_length)
+parse_action (symbol_list *rule, int rule_length)
 {
-  int c;
-  int count;
-
-  count = 1;
+  int count = 1;
+  rule->action_line = lineno;
   while (count > 0)
     {
+      int c;
       while ((c = getc (finput)) != '}')
        switch (c)
          {
@@ -1323,14 +1325,6 @@
     }
 
   obstack_1grow (&action_obstack, '\0');
-}
-
-
-static void
-parse_action (symbol_list *rule, int rule_length)
-{
-  rule->action_line = lineno;
-  parse_braces (rule, rule_length);
   rule->action = obstack_finish (&action_obstack);
 }
 



reply via email to

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