X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fgrammar.git;a=blobdiff_plain;f=lr1.c;h=2124bb1e8d8b02989c87f06ab8a3add592ba0e82;hp=d7f2d9821e2e43f5e68366f2b0e66b447c521b03;hb=6cc79eec169468a13248d59f81c0bb463f296cdb;hpb=335666b364746a70a6fdae72b4695db0c21b5b24 diff --git a/lr1.c b/lr1.c index d7f2d98..2124bb1 100644 --- a/lr1.c +++ b/lr1.c @@ -1,5 +1,6 @@ #include #include +#include enum { PARSER_SHIFT, PARSER_REDUCE, PARSER_ACCEPT }; @@ -67,7 +68,7 @@ void transition_delete (transition_t* transition) g_free (transition); } -static void lr1_push (lr1_t* parser, gint st, gpointer attrib) +void lr1_push (lr1_t* parser, gint st, gpointer attrib) { state_t* state; state = g_malloc (sizeof (state_t)); @@ -103,7 +104,6 @@ lr1_t* lr1_new (nextcb cb, gpointer data) parser->data = data; parser->stack = NULL; - lr1_push (parser, 0, NULL); parser->table = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_hash_table_destroy); @@ -236,7 +236,7 @@ gpointer lr1_build (lr1_t* parser) for (l = grammar_get_rule (transition->right); l != NULL; - l = g_list_previous (l)) + l = g_list_next (l)) { gpointer attr; if (!lr1_pop (parser, &attr))