Fixed code for printing item sets
authorThadeu Lima de Souza Cascardo <cascardo@dcc.ufmg.br>
Thu, 29 Sep 2005 17:51:56 +0000 (17:51 +0000)
committerThadeu Lima de Souza Cascardo <cascardo@dcc.ufmg.br>
Thu, 29 Sep 2005 17:51:56 +0000 (17:51 +0000)
Fixed some littel code for the debugging of the computing of item sets.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-16

item.c

diff --git a/item.c b/item.c
index fd017e2..a752dbd 100644 (file)
--- a/item.c
+++ b/item.c
@@ -74,7 +74,7 @@ void item_print (item_t* item)
 {
   GList* l;
   fprintf (stdout, "%s -> ", g_quark_to_string (item->left->value));
-  l = grammar_rule_get (item->right);
+  l = grammar_get_rule (item->right);
   while (l != NULL)
     {
       symbol_t* symbol;
@@ -84,6 +84,7 @@ void item_print (item_t* item)
          fprintf (stdout, ".");
        }
       fprintf (stdout, " %s ", g_quark_to_string (symbol->value));
+      l = g_list_next (l);
     }
   if (item->dot == NULL)
     {
@@ -344,7 +345,7 @@ void item_set_print_goto (gpointer key, gpointer val, gpointer data)
   symbol_t* symbol;
   gint code;
   state_t* state;
-  symbol = (symbol_t*) symbol;
+  symbol = (symbol_t*) key;
   code = GINT_TO_POINTER (val);
   state = (state_t*) data;
   fprintf (stdout, "GOTO (%d, %s) =\t %d\n", state->code,