]> git.saurik.com Git - bison.git/commitdiff
* src/output.c (action_row): Let default_rule be always a rule
authorAkim Demaille <akim@epita.fr>
Sun, 30 Jun 2002 17:32:35 +0000 (17:32 +0000)
committerAkim Demaille <akim@epita.fr>
Sun, 30 Jun 2002 17:32:35 +0000 (17:32 +0000)
number.

ChangeLog
src/output.c
src/state.h

index 71ccbe169766c79a4d99419424bfff09f80d0c8b..637a57fcd55158185ce975d9305dac73bf5efd29 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-06-30  Akim Demaille  <akim@epita.fr>
+
+       * src/output.c (action_row): Let default_rule be always a rule
+       number.
+
+       
 2002-06-30  Akim Demaille  <akim@epita.fr>
 
        * src/closure.c (print_firsts, print_fderives, closure):
 2002-06-30  Akim Demaille  <akim@epita.fr>
 
        * src/closure.c (print_firsts, print_fderives, closure):
index 858bb98fd7be9e5a17bcc79523042d5be2e127ed..6b082f573d6c51128cbfe4c0a7cba16292de1236 100644 (file)
@@ -497,11 +497,11 @@ action_row (state_t *state)
          for (i = 0; i < state->nlookaheads; i++)
            {
              int count = 0;
          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++)
              symbol_number_t j;
 
              for (j = 0; j < ntokens; j++)
-               if (actrow[j] == rule)
+               if (actrow[j] == -rule)
                  count++;
 
              if (count > max)
                  count++;
 
              if (count > max)
@@ -521,10 +521,10 @@ action_row (state_t *state)
            {
              int j;
              for (j = 0; j < ntokens; j++)
            {
              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;
            }
                  actrow[j] = 0;
            }
-         default_rule = -default_rule;
        }
     }
 
        }
     }
 
index 674e1714acf698699fa6bbc725ca63e9d7e85857..08d9fa363bdf5713932b30e118641265824fffa2 100644 (file)
@@ -185,7 +185,13 @@ typedef struct state_s
   /* Nonzero if no lookahead is needed to decide what to do in state S.  */
   char consistent;
 
   /* 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;
   int nlookaheads;
   bitsetv lookaheads;
   rule_t **lookaheads_rule;