/* ToNfa Kleene star. */ static GObject *to_nfa_kleene_star (CompilerKitVisitor *self, GObject *obj) { CompilerKitKleeneStar *star; g_assert(COMPILERKIT_IS_KLEENE_STAR(obj)); star = COMPILERKIT_KLEENE_STAR (obj); compilerkit_visitor_visit(self, compilerkit_kleene_star_get_node (star)); return NULL; }
/** * compilerkit_kleene_star_dispose: * @fn compilerkit_kleene_star_dispose * Reverse what compilerkit_kleene_star_init allocated. * @pre GObject is not NULL. * @param GObject* An object to dispose. * @return void */ static void compilerkit_kleene_star_dispose (GObject* object) { CompilerKitKleeneStar *self = COMPILERKIT_KLEENE_STAR (object); CompilerKitKleeneStarPrivate* priv; priv = COMPILERKIT_KLEENE_STAR_GET_PRIVATE (self); g_object_unref (priv->node); G_OBJECT_CLASS (compilerkit_kleene_star_parent_class)->dispose (object); }
/* StringBuilder Kleene star. */ static GObject *string_builder_kleene_star (CompilerKitVisitor *self, GObject *obj) { CompilerKitKleeneStar *star; GString *str = (GString *) compilerkit_visitor_get_state(self); g_assert(COMPILERKIT_IS_KLEENE_STAR(obj)); star = COMPILERKIT_KLEENE_STAR (obj); g_string_append_c (str, '('); compilerkit_visitor_visit(self, compilerkit_kleene_star_get_node (star)); g_string_append (str, ")*"); return NULL; }
void test_positive_closure(void) { GObject *regex, *positive_closure; CompilerKitConcatenation *cat; CompilerKitKleeneStar *star; regex = compilerkit_concatenation_new (compilerkit_symbol_new('a'), compilerkit_symbol_new('b')); positive_closure = compilerkit_positive_closure_new (regex); g_assert (COMPILERKIT_IS_CONCATENATION(positive_closure)); cat = COMPILERKIT_CONCATENATION(positive_closure); g_assert (compilerkit_concatenation_get_left (cat) == regex); g_assert (COMPILERKIT_IS_KLEENE_STAR (compilerkit_concatenation_get_right (cat))); star = COMPILERKIT_KLEENE_STAR (compilerkit_concatenation_get_right (cat)); g_assert (compilerkit_kleene_star_get_node (star) == regex); }
/** * compilerkit_kleene_star_new: * @fn compilerkit_kleene_star_new * @memberof CompilerKitKleeneStar * Construct a CompilerKitKleeneStar instance. * @pre None * @param None * @return A new CompilerKitKleeneStar struct. */ CompilerKitKleeneStar* compilerkit_kleene_star_new (GObject *node) { CompilerKitKleeneStar* result = COMPILERKIT_KLEENE_STAR (g_object_new (COMPILERKIT_TYPE_KLEENE_STAR, NULL)); result->priv->node = node; return result; }