From: Thadeu Lima de Souza Cascardo Date: Sun, 23 Oct 2005 22:28:36 +0000 (+0000) Subject: merge with lr1 branch X-Git-Tag: cascardo@tlscascardo--private,libgrammatic--regular--0.1--base-0~9 X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fgrammar.git;a=commitdiff_plain;h=cdbf495ba8308a218b8e2ee3ea8b6b9559471b2d merge with lr1 branch Patches applied: * cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-4 Item collection building returns the collection git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject-lr1--0.1--patch-3 --- cdbf495ba8308a218b8e2ee3ea8b6b9559471b2d diff --cc item.c index ef98647,c4c5373..eef188d --- a/item.c +++ b/item.c @@@ -407,20 -432,18 +407,21 @@@ GHashTable* item_collection_goto (GHash return NULL; } goto_item_set = item_set_goto (item_set, grammar, first, symbol); - if (!item_collection_add (collection, goto_item_set)) - return_item_set = NULL; + if (!item_collection_add (collection, goto_item_set, &old_item_set)) + { + g_hash_table_insert (symbols, symbol, old_item_set); + g_hash_table_destroy (goto_item_set); + return NULL; + } else - return_item_set = goto_item_set; - goto_state = item_collection_lookup (collection, goto_item_set); - g_hash_table_insert (state->symbols, symbol, - GINT_TO_POINTER (goto_state->code)); - return return_item_set; + { + g_hash_table_insert (symbols, symbol, goto_item_set); + return goto_item_set; + } } - void item_set_collection (grammar_t* grammar, GHashTable* first, symbol_t* start) -GHashTable* item_set_collection (Grammar* grammar, GHashTable* first, ++GHashTable* item_set_collection (grammar_t* grammar, GHashTable* first, + symbol_t* start) { GHashTable* collection; GHashTable* item_set;