GtkMateDoublePattern* gtk_mate_double_pattern_create_from_plist (GeeArrayList* all_patterns, PListDict* pd) { PListString* ns; GtkMateDoublePattern* pattern; PListString* _tmp0_; PListString* _tmp3_; char* _tmp5_; const char* _tmp4_; OnigRx* _tmp6_; PListString* _tmp7_; char* _tmp9_; const char* _tmp8_; PListString* _tmp10_; PListNode* n; PListNode* _tmp14_; PListNode* _tmp16_; GeeHashMap* _tmp17_; GeeArrayList* _tmp18_; PListNode* ps; GtkMatePattern* subpattern; PListNode* _tmp20_; gboolean _tmp21_; gboolean _tmp22_; GtkMateDoublePattern* _tmp25_; g_return_val_if_fail (all_patterns != NULL, NULL); g_return_val_if_fail (pd != NULL, NULL); ns = NULL; pattern = g_object_ref_sink (gtk_mate_double_pattern_new ()); _tmp0_ = NULL; ns = (_tmp0_ = PLIST_STRING (plist_dict_get (pd, "name")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp0_); if (ns != NULL) { char* _tmp2_; const char* _tmp1_; _tmp2_ = NULL; _tmp1_ = NULL; ((GtkMatePattern*) pattern)->name = (_tmp2_ = (_tmp1_ = ns->str, (_tmp1_ == NULL) ? NULL : g_strdup (_tmp1_)), ((GtkMatePattern*) pattern)->name = (g_free (((GtkMatePattern*) pattern)->name), NULL), _tmp2_); } _tmp3_ = NULL; ns = (_tmp3_ = PLIST_STRING (plist_dict_get (pd, "begin")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp3_); _tmp5_ = NULL; _tmp4_ = NULL; pattern->begin_string = (_tmp5_ = (_tmp4_ = ns->str, (_tmp4_ == NULL) ? NULL : g_strdup (_tmp4_)), pattern->begin_string = (g_free (pattern->begin_string), NULL), _tmp5_); _tmp6_ = NULL; pattern->begin = (_tmp6_ = onig_rx_make1 (ns->str), (pattern->begin == NULL) ? NULL : (pattern->begin = (g_object_unref (pattern->begin), NULL)), _tmp6_); _tmp7_ = NULL; ns = (_tmp7_ = PLIST_STRING (plist_dict_get (pd, "end")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp7_); _tmp9_ = NULL; _tmp8_ = NULL; pattern->end_string = (_tmp9_ = (_tmp8_ = ns->str, (_tmp8_ == NULL) ? NULL : g_strdup (_tmp8_)), pattern->end_string = (g_free (pattern->end_string), NULL), _tmp9_); _tmp10_ = NULL; ns = (_tmp10_ = PLIST_STRING (plist_dict_get (pd, "contentName")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp10_); if (ns != NULL) { char* _tmp12_; const char* _tmp11_; _tmp12_ = NULL; _tmp11_ = NULL; pattern->content_name = (_tmp12_ = (_tmp11_ = ns->str, (_tmp11_ == NULL) ? NULL : g_strdup (_tmp11_)), pattern->content_name = (g_free (pattern->content_name), NULL), _tmp12_); } n = plist_dict_get (pd, "beginCaptures"); if (n != NULL) { GeeHashMap* _tmp13_; _tmp13_ = NULL; pattern->begin_captures = (_tmp13_ = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->begin_captures == NULL) ? NULL : (pattern->begin_captures = (g_object_unref (pattern->begin_captures), NULL)), _tmp13_); } _tmp14_ = NULL; n = (_tmp14_ = plist_dict_get (pd, "captures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp14_); if (n != NULL) { GeeHashMap* _tmp15_; _tmp15_ = NULL; pattern->both_captures = (_tmp15_ = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->both_captures == NULL) ? NULL : (pattern->both_captures = (g_object_unref (pattern->both_captures), NULL)), _tmp15_); } _tmp16_ = NULL; n = (_tmp16_ = plist_dict_get (pd, "endCaptures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp16_); _tmp17_ = NULL; pattern->end_captures = (_tmp17_ = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->end_captures == NULL) ? NULL : (pattern->end_captures = (g_object_unref (pattern->end_captures), NULL)), _tmp17_); _tmp18_ = NULL; pattern->patterns = (_tmp18_ = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (pattern->patterns == NULL) ? NULL : (pattern->patterns = (g_object_unref (pattern->patterns), NULL)), _tmp18_); ps = plist_dict_get (pd, "patterns"); subpattern = NULL; if (ps != NULL) { { GeeIterator* _p_it; _p_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (ps)->array); while (gee_iterator_next (_p_it)) { PListNode* p; GtkMatePattern* _tmp19_; p = (PListNode*) gee_iterator_get (_p_it); _tmp19_ = NULL; subpattern = (_tmp19_ = gtk_mate_pattern_create_from_plist (all_patterns, PLIST_DICT (p)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp19_); if (subpattern != NULL) { gee_collection_add ((GeeCollection*) pattern->patterns, subpattern); } (p == NULL) ? NULL : (p = (g_object_unref (p), NULL)); } (_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL)); } } _tmp20_ = NULL; n = (_tmp20_ = plist_dict_get (pd, "disabled"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp20_); _tmp21_ = FALSE; _tmp22_ = FALSE; if (n != NULL) { _tmp22_ = PLIST_IS_INTEGER (n); } else { _tmp22_ = FALSE; } if (_tmp22_) { _tmp21_ = PLIST_INTEGER (n)->value == 1; } else { _tmp21_ = FALSE; } if (_tmp21_) { ((GtkMatePattern*) pattern)->disabled = TRUE; } else { gboolean _tmp23_; gboolean _tmp24_; _tmp23_ = FALSE; _tmp24_ = FALSE; if (n != NULL) { _tmp24_ = PLIST_IS_STRING (n); } else { _tmp24_ = FALSE; } if (_tmp24_) { _tmp23_ = _vala_strcmp0 (PLIST_STRING (n)->str, "1") == 0; } else { _tmp23_ = FALSE; } if (_tmp23_) { ((GtkMatePattern*) pattern)->disabled = TRUE; } else { ((GtkMatePattern*) pattern)->disabled = FALSE; } } gee_collection_add ((GeeCollection*) all_patterns, (GtkMatePattern*) pattern); _tmp25_ = NULL; return (_tmp25_ = pattern, (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), (ps == NULL) ? NULL : (ps = (g_object_unref (ps), NULL)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp25_); }
GtkMateDoublePattern* gtk_mate_double_pattern_create_from_plist (GeeArrayList* all_patterns, PListDict* pd) { PListString* ns; GtkMateDoublePattern* pattern; PListString* _tmp0; PListString* _tmp3; char* _tmp5; const char* _tmp4; OnigRx* _tmp6; PListString* _tmp7; char* _tmp9; const char* _tmp8; PListString* _tmp10; PListNode* n; PListNode* _tmp14; PListNode* _tmp16; GeeHashMap* _tmp17; GeeArrayList* _tmp18; PListNode* ps; GtkMatePattern* subpattern; PListNode* _tmp20; gboolean _tmp21; gboolean _tmp22; GtkMateDoublePattern* _tmp25; g_return_val_if_fail (all_patterns != NULL, NULL); g_return_val_if_fail (pd != NULL, NULL); ns = NULL; pattern = g_object_ref_sink (gtk_mate_double_pattern_new ()); _tmp0 = NULL; ns = (_tmp0 = PLIST_STRING (plist_dict_get (pd, "name")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp0); if (ns != NULL) { char* _tmp2; const char* _tmp1; _tmp2 = NULL; _tmp1 = NULL; ((GtkMatePattern*) pattern)->name = (_tmp2 = (_tmp1 = ns->str, (_tmp1 == NULL) ? NULL : g_strdup (_tmp1)), ((GtkMatePattern*) pattern)->name = (g_free (((GtkMatePattern*) pattern)->name), NULL), _tmp2); } _tmp3 = NULL; ns = (_tmp3 = PLIST_STRING (plist_dict_get (pd, "begin")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp3); _tmp5 = NULL; _tmp4 = NULL; pattern->begin_string = (_tmp5 = (_tmp4 = ns->str, (_tmp4 == NULL) ? NULL : g_strdup (_tmp4)), pattern->begin_string = (g_free (pattern->begin_string), NULL), _tmp5); _tmp6 = NULL; pattern->begin = (_tmp6 = onig_rx_make1 (ns->str), (pattern->begin == NULL) ? NULL : (pattern->begin = (g_object_unref (pattern->begin), NULL)), _tmp6); _tmp7 = NULL; ns = (_tmp7 = PLIST_STRING (plist_dict_get (pd, "end")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp7); _tmp9 = NULL; _tmp8 = NULL; pattern->end_string = (_tmp9 = (_tmp8 = ns->str, (_tmp8 == NULL) ? NULL : g_strdup (_tmp8)), pattern->end_string = (g_free (pattern->end_string), NULL), _tmp9); _tmp10 = NULL; ns = (_tmp10 = PLIST_STRING (plist_dict_get (pd, "contentName")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp10); if (ns != NULL) { char* _tmp12; const char* _tmp11; _tmp12 = NULL; _tmp11 = NULL; pattern->content_name = (_tmp12 = (_tmp11 = ns->str, (_tmp11 == NULL) ? NULL : g_strdup (_tmp11)), pattern->content_name = (g_free (pattern->content_name), NULL), _tmp12); } n = plist_dict_get (pd, "beginCaptures"); if (n != NULL) { GeeHashMap* _tmp13; _tmp13 = NULL; pattern->begin_captures = (_tmp13 = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->begin_captures == NULL) ? NULL : (pattern->begin_captures = (g_object_unref (pattern->begin_captures), NULL)), _tmp13); } _tmp14 = NULL; n = (_tmp14 = plist_dict_get (pd, "captures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp14); if (n != NULL) { GeeHashMap* _tmp15; _tmp15 = NULL; pattern->both_captures = (_tmp15 = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->both_captures == NULL) ? NULL : (pattern->both_captures = (g_object_unref (pattern->both_captures), NULL)), _tmp15); } _tmp16 = NULL; n = (_tmp16 = plist_dict_get (pd, "endCaptures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp16); _tmp17 = NULL; pattern->end_captures = (_tmp17 = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->end_captures == NULL) ? NULL : (pattern->end_captures = (g_object_unref (pattern->end_captures), NULL)), _tmp17); _tmp18 = NULL; pattern->patterns = (_tmp18 = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (pattern->patterns == NULL) ? NULL : (pattern->patterns = (g_object_unref (pattern->patterns), NULL)), _tmp18); ps = plist_dict_get (pd, "patterns"); subpattern = NULL; if (ps != NULL) { { GeeIterator* _p_it; _p_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (ps)->array); while (gee_iterator_next (_p_it)) { PListNode* p; GtkMatePattern* _tmp19; p = (PListNode*) gee_iterator_get (_p_it); _tmp19 = NULL; subpattern = (_tmp19 = gtk_mate_pattern_create_from_plist (all_patterns, PLIST_DICT (p)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp19); if (subpattern != NULL) { gee_collection_add ((GeeCollection*) pattern->patterns, subpattern); } (p == NULL) ? NULL : (p = (g_object_unref (p), NULL)); } (_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL)); } } _tmp20 = NULL; n = (_tmp20 = plist_dict_get (pd, "disabled"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp20); _tmp21 = FALSE; _tmp22 = FALSE; if (n != NULL) { _tmp22 = PLIST_IS_INTEGER (n); } else { _tmp22 = FALSE; } if (_tmp22) { _tmp21 = PLIST_INTEGER (n)->value == 1; } else { _tmp21 = FALSE; } if (_tmp21) { ((GtkMatePattern*) pattern)->disabled = TRUE; } else { gboolean _tmp23; gboolean _tmp24; _tmp23 = FALSE; _tmp24 = FALSE; if (n != NULL) { _tmp24 = PLIST_IS_STRING (n); } else { _tmp24 = FALSE; } if (_tmp24) { _tmp23 = _vala_strcmp0 (PLIST_STRING (n)->str, "1") == 0; } else { _tmp23 = FALSE; } if (_tmp23) { ((GtkMatePattern*) pattern)->disabled = TRUE; } else { ((GtkMatePattern*) pattern)->disabled = FALSE; } } gee_collection_add ((GeeCollection*) all_patterns, (GtkMatePattern*) pattern); _tmp25 = NULL; return (_tmp25 = pattern, (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), (ps == NULL) ? NULL : (ps = (g_object_unref (ps), NULL)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp25); }
/* Loads the properties of the grammar that are required for parsing. Loads patterns into memory, and sets up possible patterns.*/ void gtk_mate_grammar_init_for_use (GtkMateGrammar* self) { PListNode* fsm; PListNode* ftm; GeeArrayList* _tmp2; GeeArrayList* _tmp3; PListNode* ps; GtkMatePattern* pattern; GeeHashMap* _tmp5; PListDict* pd; PListDict* pd1; PListNode* pa1; g_return_if_fail (self != NULL); if (self->loaded) { return; } self->loaded = TRUE; /*stdout.printf("initializing grammar for use: %s\n", name);*/ fsm = plist_dict_get (self->priv->_plist, "foldingStartMarker"); if (fsm != NULL) { OnigRx* _tmp0; _tmp0 = NULL; self->folding_start_marker = (_tmp0 = onig_rx_make1 (PLIST_STRING (fsm)->str), (self->folding_start_marker == NULL) ? NULL : (self->folding_start_marker = (g_object_unref (self->folding_start_marker), NULL)), _tmp0); } ftm = plist_dict_get (self->priv->_plist, "foldingStopMarker"); if (ftm != NULL) { OnigRx* _tmp1; _tmp1 = NULL; self->folding_stop_marker = (_tmp1 = onig_rx_make1 (PLIST_STRING (ftm)->str), (self->folding_stop_marker == NULL) ? NULL : (self->folding_stop_marker = (g_object_unref (self->folding_stop_marker), NULL)), _tmp1); } _tmp2 = NULL; self->all_patterns = (_tmp2 = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (self->all_patterns == NULL) ? NULL : (self->all_patterns = (g_object_unref (self->all_patterns), NULL)), _tmp2); /* stdout.printf("getting patterns\n");*/ _tmp3 = NULL; self->patterns = (_tmp3 = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (self->patterns == NULL) ? NULL : (self->patterns = (g_object_unref (self->patterns), NULL)), _tmp3); ps = plist_dict_get (self->priv->_plist, "patterns"); pattern = NULL; if (ps != NULL) { { GeeIterator* _p_it; _p_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (ps)->array); while (gee_iterator_next (_p_it)) { PListNode* p; GtkMatePattern* _tmp4; p = (PListNode*) gee_iterator_get (_p_it); _tmp4 = NULL; pattern = (_tmp4 = gtk_mate_pattern_create_from_plist (self->all_patterns, PLIST_DICT (p)), (pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL)), _tmp4); gtk_mate_pattern_set_grammar (pattern, self); if (pattern != NULL) { gee_collection_add ((GeeCollection*) self->patterns, pattern); } (p == NULL) ? NULL : (p = (g_object_unref (p), NULL)); } (_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL)); } } /* stdout.printf("getting repository\n");*/ _tmp5 = NULL; self->repository = (_tmp5 = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, GEE_TYPE_ARRAY_LIST, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_str_hash, g_str_equal, g_direct_equal), (self->repository == NULL) ? NULL : (self->repository = (g_object_unref (self->repository), NULL)), _tmp5); pd = PLIST_DICT (plist_dict_get (self->priv->_plist, "repository")); pd1 = NULL; pa1 = NULL; if (pd != NULL) { { GeeSet* _tmp6; GeeIterator* _tmp7; GeeIterator* _key_it; _tmp6 = NULL; _tmp7 = NULL; _key_it = (_tmp7 = gee_iterable_iterator ((GeeIterable*) (_tmp6 = gee_map_get_keys ((GeeMap*) pd->map))), (_tmp6 == NULL) ? NULL : (_tmp6 = (g_object_unref (_tmp6), NULL)), _tmp7); while (gee_iterator_next (_key_it)) { char* key; GeeArrayList* repo_array; PListDict* _tmp8; gboolean _tmp9; PListNode* _tmp10; gboolean _tmp11; key = (char*) gee_iterator_get (_key_it); /* stdout.printf("convert repo name: %s\n", key);*/ repo_array = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal); _tmp8 = NULL; pd1 = (_tmp8 = PLIST_DICT (plist_dict_get (pd, key)), (pd1 == NULL) ? NULL : (pd1 = (g_object_unref (pd1), NULL)), _tmp8); _tmp9 = FALSE; _tmp10 = NULL; if ((_tmp11 = (_tmp10 = plist_dict_get (pd1, "begin")) != NULL, (_tmp10 == NULL) ? NULL : (_tmp10 = (g_object_unref (_tmp10), NULL)), _tmp11)) { _tmp9 = TRUE; } else { PListNode* _tmp12; _tmp12 = NULL; _tmp9 = (_tmp12 = plist_dict_get (pd1, "match")) != NULL; (_tmp12 == NULL) ? NULL : (_tmp12 = (g_object_unref (_tmp12), NULL)); } /* repository name can go straight to a pattern*/ if (_tmp9) { GtkMatePattern* _tmp13; _tmp13 = NULL; pattern = (_tmp13 = gtk_mate_pattern_create_from_plist (self->all_patterns, PLIST_DICT (pd1)), (pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL)), _tmp13); gtk_mate_pattern_set_grammar (pattern, self); if (pattern != NULL) { gee_collection_add ((GeeCollection*) repo_array, pattern); } } else { PListNode* _tmp14; _tmp14 = NULL; if ((pa1 = (_tmp14 = plist_dict_get (pd1, "patterns"), (pa1 == NULL) ? NULL : (pa1 = (g_object_unref (pa1), NULL)), _tmp14)) != NULL) { { GeeIterator* _ps1_it; _ps1_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (pa1)->array); while (gee_iterator_next (_ps1_it)) { PListNode* ps1; GtkMatePattern* _tmp15; ps1 = (PListNode*) gee_iterator_get (_ps1_it); _tmp15 = NULL; pattern = (_tmp15 = gtk_mate_pattern_create_from_plist (self->all_patterns, PLIST_DICT (ps1)), (pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL)), _tmp15); gtk_mate_pattern_set_grammar (pattern, self); if (pattern != NULL) { gee_collection_add ((GeeCollection*) repo_array, pattern); } (ps1 == NULL) ? NULL : (ps1 = (g_object_unref (ps1), NULL)); } (_ps1_it == NULL) ? NULL : (_ps1_it = (g_object_unref (_ps1_it), NULL)); } } } gee_map_set ((GeeMap*) self->repository, key, repo_array); key = (g_free (key), NULL); (repo_array == NULL) ? NULL : (repo_array = (g_object_unref (repo_array), NULL)); } (_key_it == NULL) ? NULL : (_key_it = (g_object_unref (_key_it), NULL)); } } /* stdout.printf("all_patterns: %d\n", all_patterns.size);*/ { GeeIterator* _p_it; /* stdout.printf("all_patterns: %d\n", all_patterns.size);*/ _p_it = gee_iterable_iterator ((GeeIterable*) self->all_patterns); /* stdout.printf("all_patterns: %d\n", all_patterns.size);*/ while (gee_iterator_next (_p_it)) { GtkMatePattern* p; /* stdout.printf("all_patterns: %d\n", all_patterns.size);*/ p = (GtkMatePattern*) gee_iterator_get (_p_it); if (GTK_MATE_IS_DOUBLE_PATTERN (p)) { gtk_mate_pattern_replace_include_patterns (GTK_MATE_DOUBLE_PATTERN (p)->patterns, self); } (p == NULL) ? NULL : (p = (g_object_unref (p), NULL)); } (_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL)); } gtk_mate_pattern_replace_include_patterns (self->patterns, self); (fsm == NULL) ? NULL : (fsm = (g_object_unref (fsm), NULL)); (ftm == NULL) ? NULL : (ftm = (g_object_unref (ftm), NULL)); (ps == NULL) ? NULL : (ps = (g_object_unref (ps), NULL)); (pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL)); (pd == NULL) ? NULL : (pd = (g_object_unref (pd), NULL)); (pd1 == NULL) ? NULL : (pd1 = (g_object_unref (pd1), NULL)); (pa1 == NULL) ? NULL : (pa1 = (g_object_unref (pa1), NULL)); }