]> git.saurik.com Git - bison.git/blobdiff - src/ielr.c
Merge remote-tracking branch 'origin/maint'
[bison.git] / src / ielr.c
index dfe981a53c31e6ebacd94c1bec9dd71f3ab30c87..55005231705e38fa5370be6dc21dcbaa3ad9fdb0 100644 (file)
@@ -1,6 +1,6 @@
 /* IELR main implementation.
 
 /* IELR main implementation.
 
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009-2013 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -35,7 +35,7 @@
 #include "state.h"
 #include "symtab.h"
 
 #include "state.h"
 #include "symtab.h"
 
-/** Records the value of the \%define variable "lr.type".  */
+/** Records the value of the \%define variable lr.type.  */
 typedef enum { LR_TYPE__LALR, LR_TYPE__IELR, LR_TYPE__CANONICAL_LR } LrType;
 
 /**
 typedef enum { LR_TYPE__LALR, LR_TYPE__IELR, LR_TYPE__CANONICAL_LR } LrType;
 
 /**
@@ -504,15 +504,15 @@ ielr_compute_annotation_lists (bitsetv follow_kernel_items,
       (*annotation_listsp)[i] = NULL;
       annotation_counts[i] = 0;
     }
       (*annotation_listsp)[i] = NULL;
       annotation_counts[i] = 0;
     }
-  for (i = 0; i < nstates; ++i)
-    AnnotationList__compute_from_inadequacies (states[i], follow_kernel_items,
-                                               always_follows, predecessors,
-                                               item_lookahead_sets,
-                                               *inadequacy_listsp,
-                                               *annotation_listsp,
-                                               annotation_counts,
-                                               &max_contributions,
-                                               annotations_obstackp);
+  {
+    InadequacyListNodeCount inadequacy_list_node_count = 0;
+    for (i = 0; i < nstates; ++i)
+      AnnotationList__compute_from_inadequacies (
+        states[i], follow_kernel_items, always_follows, predecessors,
+        item_lookahead_sets, *inadequacy_listsp, *annotation_listsp,
+        annotation_counts, &max_contributions, annotations_obstackp,
+        &inadequacy_list_node_count);
+  }
   *max_annotationsp = 0;
   for (i = 0; i < nstates; ++i)
     {
   *max_annotationsp = 0;
   for (i = 0; i < nstates; ++i)
     {
@@ -758,8 +758,8 @@ ielr_compute_state (bitsetv follow_kernel_items, bitsetv always_follows,
                     if (!bitset_empty_p (lookaheads[i]))
                       break;
                   }
                     if (!bitset_empty_p (lookaheads[i]))
                       break;
                   }
-                // bitset_equal_p uses the size of the first argument, so
-                // lookaheads[i] must be the second argument.
+                /* bitset_equal_p uses the size of the first argument,
+                   so lookaheads[i] must be the second argument.  */
                 else if (!bitset_equal_p ((*this_isocorep)->lookaheads[i],
                                           lookaheads[i]))
                   break;
                 else if (!bitset_equal_p ((*this_isocorep)->lookaheads[i],
                                           lookaheads[i]))
                   break;
@@ -1095,11 +1095,11 @@ ielr (void)
   /* Examine user options.  */
   {
     char *type = muscle_percent_define_get ("lr.type");
   /* Examine user options.  */
   {
     char *type = muscle_percent_define_get ("lr.type");
-    if (0 == strcmp (type, "lalr"))
+    if (STREQ (type, "lalr"))
       lr_type = LR_TYPE__LALR;
       lr_type = LR_TYPE__LALR;
-    else if (0 == strcmp (type, "ielr"))
+    else if (STREQ (type, "ielr"))
       lr_type = LR_TYPE__IELR;
       lr_type = LR_TYPE__IELR;
-    else if (0 == strcmp (type, "canonical-lr"))
+    else if (STREQ (type, "canonical-lr"))
       lr_type = LR_TYPE__CANONICAL_LR;
     else
       aver (false);
       lr_type = LR_TYPE__CANONICAL_LR;
     else
       aver (false);
@@ -1187,8 +1187,8 @@ ielr (void)
   free (to_state);
   if (lr_type == LR_TYPE__CANONICAL_LR)
     {
   free (to_state);
   if (lr_type == LR_TYPE__CANONICAL_LR)
     {
-      // Reduction lookaheads are computed in ielr_split_states above but are
-      // timed as part of phase 4.
+      /* Reduction lookaheads are computed in ielr_split_states above
+         but are timed as part of phase 4. */
       set_goto_map ();
     }
   else
       set_goto_map ();
     }
   else