/* ToNfa complement. */ static GObject *to_nfa_complement (CompilerKitVisitor *self, GObject *obj) { CompilerKitComplement *comp; g_assert(COMPILERKIT_IS_COMPLEMENT(obj)); comp = COMPILERKIT_COMPLEMENT (obj); compilerkit_visitor_visit(self, compilerkit_complement_get_node (comp)); return NULL; }
int main (int argc, char ** argv) { GObject* complement; GObject* rejectingRegex; g_type_init(); complement = compilerkit_complement_new(compilerkit_empty_set_get_instance());//creates a complement object that accepted anything but the given regex //in this case, it will accept anything except the empty set rejectingRegex = compilerkit_complement_get_node(complement);//returns the regex which should be rejected g_object_unref (complement); }
/* StringBuilder complement. */ static GObject *string_builder_complement (CompilerKitVisitor *self, GObject *obj) { CompilerKitComplement *comp; GString *str = (GString *) compilerkit_visitor_get_state(self); g_assert(COMPILERKIT_IS_COMPLEMENT(obj)); comp = COMPILERKIT_COMPLEMENT (obj); g_string_append_c (str, '!'); compilerkit_visitor_visit(self, compilerkit_complement_get_node (comp)); return NULL; }