bison-patches
[Top][All Lists]
Advanced

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

15-default-rule.patch


From: Akim Demaille
Subject: 15-default-rule.patch
Date: Sun, 30 Jun 2002 19:27:38 +0200

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * src/output.c (action_row): Let default_rule be always a rule
        number.
        
        
Index: src/output.c
--- src/output.c Sat, 29 Jun 2002 21:11:31 +0200 akim
+++ src/output.c Sat, 29 Jun 2002 22:14:46 +0200 akim
@@ -497,11 +497,11 @@
          for (i = 0; i < state->nlookaheads; i++)
            {
              int count = 0;
-             rule_number_t rule = -state->lookaheads_rule[i]->number;
+             rule_number_t rule = state->lookaheads_rule[i]->number;
              symbol_number_t j;
 
              for (j = 0; j < ntokens; j++)
-               if (actrow[j] == rule)
+               if (actrow[j] == -rule)
                  count++;
 
              if (count > max)
@@ -521,10 +521,10 @@
            {
              int j;
              for (j = 0; j < ntokens; j++)
-               if (actrow[j] == default_rule && ! (glr_parser && conflrow[j]))
+               if (actrow[j] == -default_rule
+                   && ! (glr_parser && conflrow[j]))
                  actrow[j] = 0;
            }
-         default_rule = -default_rule;
        }
     }
 
Index: src/state.h
--- src/state.h Sat, 29 Jun 2002 16:31:51 +0200 akim
+++ src/state.h Sat, 29 Jun 2002 22:14:18 +0200 akim
@@ -185,7 +185,13 @@
   /* Nonzero if no lookahead is needed to decide what to do in state S.  */
   char consistent;
 
-  /* Used in LALR, not LR(0). */
+  /* Used in LALR, not LR(0).
+
+     When a state is not consistent (there is an S/R or R/R conflict),
+     lookaheads are needed to enable the reductions.  NLOOKAHEADS is
+     the number of lookahead guarded reductions of the
+     LOOKAHEADS_RULE.  For each rule LOOKAHEADS_RULE[R], LOOKAHEADS[R]
+     is the bitset of the lookaheads enabling this reduction.  */
   int nlookaheads;
   bitsetv lookaheads;
   rule_t **lookaheads_rule;



reply via email to

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