Functions to retrieve rules for a symbol and symbols from a rule are
provided.
--This line, and those below, will be ignored--
Files to commit:
<can't compute list>
This list might be incomplete or outdated if editing the log
message was not invoked from an up-to-date changes buffer!
git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-4
left, NULL, (gpointer*)&l))
{
l = g_malloc (sizeof (GList**));
+ *l = NULL;
g_hash_table_insert (grammar->grammar, left, l);
}
{
rule_append (rule, right);
}
+
+GList* grammar_get_rules (Grammar* grammar, symbol_t* left)
+{
+ GList** l;
+ if (!g_hash_table_lookup_extended (grammar->grammar,
+ left, NULL, (gpointer*)&l))
+ {
+ return NULL;
+ }
+ return g_list_first (*l);
+}
+
+GList* grammar_get_rule (rule_t* rule)
+{
+ return rule->right;
+}
rule_t* grammar_rule_new (Grammar*, symbol_t*);
void grammar_rule_append (rule_t*, symbol_t*);
+GList* grammar_get_rules (Grammar*, symbol_t*);
+GList* grammar_get_rule (rule_t*);
#endif