Debug for LR(1) parser
[cascardo/grammar.git] / item.c
diff --git a/item.c b/item.c
index ef98647..f1f61ce 100644 (file)
--- a/item.c
+++ b/item.c
@@ -1,17 +1,10 @@
 #include <grammar.h>
 #include <first.h>
+#include <item.h>
 #ifdef DEBUG
 #include <stdio.h>
 #endif
 
-typedef struct
-{
-  symbol_t* left;
-  rule_t* right;
-  GList* dot;
-  symbol_t* lookahead;
-} item_t;
-
 item_t* item_new (symbol_t* left, rule_t* right, symbol_t* lookahead)
 {
   item_t* item;
@@ -420,7 +413,8 @@ GHashTable* item_collection_goto (GHashTable* collection, grammar_t* grammar,
     }
 }
 
-void item_set_collection (grammar_t* grammar, GHashTable* first, symbol_t* start)
+GHashTable* item_set_collection (grammar_t* grammar, GHashTable* first,
+                                symbol_t* start)
 {
   GHashTable* collection;
   GHashTable* item_set;
@@ -469,5 +463,5 @@ void item_set_collection (grammar_t* grammar, GHashTable* first, symbol_t* start
 #ifdef DEBUG
   item_collection_print (collection);
 #endif
-  g_hash_table_destroy (collection);
+  return collection;
 }