/* girdocumentationimporter.c generated by valac, the Vala compiler
 * generated from girdocumentationimporter.vala, do not modify */

/* girdocumentationimporter.vala
 *
 * Copyright (C) 2008-2010  Jürg Billeter
 * Copyright (C) 2011       Luca Bruno
 * Copyright (C) 2011-2014  Florian Brosch
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
 * 	Luca Bruno <lucabru@src.gnome.org>
 *  Florian Brosch <flo.brosch@gmail.com>
 */

#include <glib.h>
#include <glib-object.h>
#include "valadoc.h"
#include <stdlib.h>
#include <string.h>
#include <valagee.h>

enum  {
	VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_0_PROPERTY,
	VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_FILE_EXTENSION_PROPERTY,
	VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_NUM_PROPERTIES
};
static GParamSpec* valadoc_importer_gir_documentation_importer_properties[VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))

#define VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_TYPE_IMPLICIT_PARAMETER_POS (valadoc_importer_gir_documentation_importer_implicit_parameter_pos_get_type ())
typedef struct _ValadocImporterGirDocumentationImporterImplicitParameterPos ValadocImporterGirDocumentationImporterImplicitParameterPos;
#define _valadoc_api_source_comment_unref0(var) ((var == NULL) ? NULL : (var = (valadoc_api_source_comment_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _ValadocImporterGirDocumentationImporterPrivate {
	ValadocMarkupTokenType current_token;
	ValadocMarkupSourceLocation begin;
	ValadocMarkupSourceLocation end;
	ValadocMarkupReader* reader;
	ValadocDocumentationParser* parser;
	ValadocErrorReporter* reporter;
	ValadocApiSourceFile* file;
	gchar* parent_c_identifier;
};

struct _ValadocImporterGirDocumentationImporterImplicitParameterPos {
	gint parameter;
	gint position;
};


static gpointer valadoc_importer_gir_documentation_importer_parent_class = NULL;

#define VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALADOC_IMPORTER_TYPE_GIR_DOCUMENTATION_IMPORTER, ValadocImporterGirDocumentationImporterPrivate))
#define VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_GIR_VERSION "1.2"
static void valadoc_importer_gir_documentation_importer_real_process (ValadocImporterDocumentationImporter* base, const gchar* source_file);
static void valadoc_importer_gir_documentation_importer_next (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_repository (ValadocImporterGirDocumentationImporter* self);
static ValadocApiFormalParameter* valadoc_importer_gir_documentation_importer_find_parameter (ValadocImporterGirDocumentationImporter* self, ValadocApiNode* node, const gchar* name);
static inline gchar* valadoc_importer_gir_documentation_importer_get_cparameter_name (ValadocImporterGirDocumentationImporter* self, gchar** param_names, int param_names_length1, gint length_pos);
static GType valadoc_importer_gir_documentation_importer_implicit_parameter_pos_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
static ValadocImporterGirDocumentationImporterImplicitParameterPos* valadoc_importer_gir_documentation_importer_implicit_parameter_pos_dup (const ValadocImporterGirDocumentationImporterImplicitParameterPos* self);
static void valadoc_importer_gir_documentation_importer_implicit_parameter_pos_free (ValadocImporterGirDocumentationImporterImplicitParameterPos* self);
static void valadoc_importer_gir_documentation_importer_attach_comment (ValadocImporterGirDocumentationImporter* self, const gchar* cname, ValadocApiGirSourceComment* comment, gchar** param_names, int param_names_length1, ValadocImporterGirDocumentationImporterImplicitParameterPos* destroy_notifies, int destroy_notifies_length1, ValadocImporterGirDocumentationImporterImplicitParameterPos* closures, int closures_length1, ValadocImporterGirDocumentationImporterImplicitParameterPos* array_lengths, int array_lengths_length1, gint array_length_ret);
G_GNUC_INTERNAL void valadoc_api_formal_parameter_set_implicit_destroy_cparameter_name (ValadocApiFormalParameter* self, const gchar* value);
G_GNUC_INTERNAL void valadoc_api_formal_parameter_set_implicit_closure_cparameter_name (ValadocApiFormalParameter* self, const gchar* value);
G_GNUC_INTERNAL void valadoc_api_formal_parameter_set_implicit_array_length_cparameter_name (ValadocApiFormalParameter* self, const gchar* value);
G_GNUC_INTERNAL void valadoc_api_callable_set_implicit_array_length_cparameter_name (ValadocApiCallable* self, const gchar* value);
G_GNUC_INTERNAL void valadoc_api_node_set_documentation (ValadocApiNode* self, ValadocContentComment* value);
static void valadoc_importer_gir_documentation_importer_warning (ValadocImporterGirDocumentationImporter* self, const gchar* message);
static void valadoc_importer_gir_documentation_importer_error (ValadocImporterGirDocumentationImporter* self, const gchar* message);
static void valadoc_importer_gir_documentation_importer_start_element (ValadocImporterGirDocumentationImporter* self, const gchar* name);
static void valadoc_importer_gir_documentation_importer_end_element (ValadocImporterGirDocumentationImporter* self, const gchar* name);
static void valadoc_importer_gir_documentation_importer_parse_namespace (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_include (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_package (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_c_include (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_skip_element (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_alias (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_enumeration (ValadocImporterGirDocumentationImporter* self, const gchar* element_name);
static void valadoc_importer_gir_documentation_importer_parse_bitfield (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_method (ValadocImporterGirDocumentationImporter* self, const gchar* element_name);
static void valadoc_importer_gir_documentation_importer_parse_callback (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_record (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_class (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_interface (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_boxed (ValadocImporterGirDocumentationImporter* self, const gchar* element_name);
static void valadoc_importer_gir_documentation_importer_parse_union (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_constant (ValadocImporterGirDocumentationImporter* self);
static ValadocApiGirSourceComment* valadoc_importer_gir_documentation_importer_parse_symbol_doc (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_type (ValadocImporterGirDocumentationImporter* self, gint* array_length_pos);
static ValadocApiSourceComment* valadoc_importer_gir_documentation_importer_parse_doc (ValadocImporterGirDocumentationImporter* self, const gchar* element_name);
static void valadoc_importer_gir_documentation_importer_parse_enumeration_member (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_return_value (ValadocImporterGirDocumentationImporter* self, ValadocApiSourceComment* * comment, gint* array_length_ret);
static void valadoc_importer_gir_documentation_importer_parse_parameter (ValadocImporterGirDocumentationImporter* self, ValadocApiSourceComment* * comment, gchar* * param_name, gint* destroy_pos, gint* closure_pos, gint* array_length_pos);
static void valadoc_importer_gir_documentation_importer_parse_field (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_constructor (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_property (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_signal (ValadocImporterGirDocumentationImporter* self);
static void valadoc_importer_gir_documentation_importer_parse_function (ValadocImporterGirDocumentationImporter* self, const gchar* element_name);
static void _vala_array_add3 (gchar** * array, int* length, int* size, gchar* value);
static void valadoc_importer_gir_documentation_importer_implicit_parameter_pos_init (ValadocImporterGirDocumentationImporterImplicitParameterPos *self, gint parameter, gint position);
static void _vala_array_add4 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array, int* length, int* size, const ValadocImporterGirDocumentationImporterImplicitParameterPos* value);
static void _vala_array_add5 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array, int* length, int* size, const ValadocImporterGirDocumentationImporterImplicitParameterPos* value);
static void _vala_array_add6 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array, int* length, int* size, const ValadocImporterGirDocumentationImporterImplicitParameterPos* value);
static void valadoc_importer_gir_documentation_importer_finalize (GObject * obj);
static void _vala_valadoc_importer_gir_documentation_importer_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


ValadocImporterGirDocumentationImporter* valadoc_importer_gir_documentation_importer_construct (GType object_type, ValadocApiTree* tree, ValadocDocumentationParser* parser, ValadocModuleLoader* modules, ValadocSettings* settings, ValadocErrorReporter* reporter) {
	ValadocImporterGirDocumentationImporter * self = NULL;
	ValadocApiTree* _tmp0_;
	ValadocModuleLoader* _tmp1_;
	ValadocSettings* _tmp2_;
	ValadocErrorReporter* _tmp3_;
	ValadocErrorReporter* _tmp4_;
	ValadocDocumentationParser* _tmp5_;
	ValadocDocumentationParser* _tmp6_;
	g_return_val_if_fail (tree != NULL, NULL);
	g_return_val_if_fail (parser != NULL, NULL);
	g_return_val_if_fail (modules != NULL, NULL);
	g_return_val_if_fail (settings != NULL, NULL);
	g_return_val_if_fail (reporter != NULL, NULL);
	_tmp0_ = tree;
	_tmp1_ = modules;
	_tmp2_ = settings;
	self = (ValadocImporterGirDocumentationImporter*) valadoc_importer_documentation_importer_construct (object_type, _tmp0_, _tmp1_, _tmp2_);
	_tmp3_ = reporter;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (self->priv->reporter);
	self->priv->reporter = _tmp4_;
	_tmp5_ = parser;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (self->priv->parser);
	self->priv->parser = _tmp6_;
	return self;
}


ValadocImporterGirDocumentationImporter* valadoc_importer_gir_documentation_importer_new (ValadocApiTree* tree, ValadocDocumentationParser* parser, ValadocModuleLoader* modules, ValadocSettings* settings, ValadocErrorReporter* reporter) {
	return valadoc_importer_gir_documentation_importer_construct (VALADOC_IMPORTER_TYPE_GIR_DOCUMENTATION_IMPORTER, tree, parser, modules, settings, reporter);
}


static void valadoc_importer_gir_documentation_importer_real_process (ValadocImporterDocumentationImporter* base, const gchar* source_file) {
	ValadocImporterGirDocumentationImporter * self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	ValadocApiPackage* _tmp3_;
	ValadocApiPackage* _tmp4_;
	const gchar* _tmp5_;
	ValadocApiSourceFile* _tmp6_;
	const gchar* _tmp7_;
	ValadocErrorReporter* _tmp8_;
	ValadocMarkupReader* _tmp9_;
	self = (ValadocImporterGirDocumentationImporter*) base;
	g_return_if_fail (source_file != NULL);
	_tmp0_ = source_file;
	_tmp1_ = g_path_get_basename (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = valadoc_api_package_new (_tmp2_, TRUE, NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = source_file;
	_tmp6_ = valadoc_api_source_file_new (_tmp4_, _tmp5_, NULL, NULL);
	_g_object_unref0 (self->priv->file);
	self->priv->file = _tmp6_;
	_g_object_unref0 (_tmp4_);
	_g_free0 (_tmp2_);
	_tmp7_ = source_file;
	_tmp8_ = self->priv->reporter;
	_tmp9_ = valadoc_markup_reader_new (_tmp7_, _tmp8_);
	_g_object_unref0 (self->priv->reader);
	self->priv->reader = _tmp9_;
	valadoc_importer_gir_documentation_importer_next (self);
	valadoc_importer_gir_documentation_importer_next (self);
	valadoc_importer_gir_documentation_importer_next (self);
	valadoc_importer_gir_documentation_importer_parse_repository (self);
	_g_object_unref0 (self->priv->reader);
	self->priv->reader = NULL;
	_g_object_unref0 (self->priv->file);
	self->priv->file = NULL;
}


static gpointer _vala_iterable_ref0 (gpointer self) {
	return self ? vala_iterable_ref (self) : NULL;
}


static ValadocApiFormalParameter* valadoc_importer_gir_documentation_importer_find_parameter (ValadocImporterGirDocumentationImporter* self, ValadocApiNode* node, const gchar* name) {
	ValadocApiFormalParameter* result = NULL;
	ValaList* parameters = NULL;
	ValadocApiNode* _tmp0_;
	ValaList* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = node;
	_tmp1_ = valadoc_api_node_get_children_by_type (_tmp0_, VALADOC_API_NODE_TYPE_FORMAL_PARAMETER, FALSE);
	parameters = _tmp1_;
	{
		ValaList* _param_list = NULL;
		ValaList* _tmp2_;
		ValaList* _tmp3_;
		gint _param_size = 0;
		ValaList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _param_index = 0;
		_tmp2_ = parameters;
		_tmp3_ = _vala_iterable_ref0 (_tmp2_);
		_param_list = _tmp3_;
		_tmp4_ = _param_list;
		_tmp5_ = vala_collection_get_size ((ValaCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_param_size = _tmp6_;
		_param_index = -1;
		while (TRUE) {
			gint _tmp7_;
			gint _tmp8_;
			gint _tmp9_;
			ValadocApiNode* param = NULL;
			ValaList* _tmp10_;
			gint _tmp11_;
			gpointer _tmp12_;
			ValadocApiNode* _tmp13_;
			const gchar* _tmp14_;
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			_tmp7_ = _param_index;
			_param_index = _tmp7_ + 1;
			_tmp8_ = _param_index;
			_tmp9_ = _param_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _param_list;
			_tmp11_ = _param_index;
			_tmp12_ = vala_list_get (_tmp10_, _tmp11_);
			param = (ValadocApiNode*) _tmp12_;
			_tmp13_ = param;
			_tmp14_ = valadoc_api_node_get_name ((ValadocApiNode*) G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, VALADOC_API_TYPE_FORMAL_PARAMETER, ValadocApiFormalParameter));
			_tmp15_ = _tmp14_;
			_tmp16_ = name;
			if (g_strcmp0 (_tmp15_, _tmp16_) == 0) {
				ValadocApiNode* _tmp17_;
				ValadocApiFormalParameter* _tmp18_;
				_tmp17_ = param;
				_tmp18_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, VALADOC_API_TYPE_FORMAL_PARAMETER, ValadocApiFormalParameter));
				result = _tmp18_;
				_g_object_unref0 (param);
				_vala_iterable_unref0 (_param_list);
				_vala_iterable_unref0 (parameters);
				return result;
			}
			_g_object_unref0 (param);
		}
		_vala_iterable_unref0 (_param_list);
	}
	result = NULL;
	_vala_iterable_unref0 (parameters);
	return result;
}


static inline gchar* valadoc_importer_gir_documentation_importer_get_cparameter_name (ValadocImporterGirDocumentationImporter* self, gchar** param_names, int param_names_length1, gint length_pos) {
	gchar* result = NULL;
	gboolean _tmp0_ = FALSE;
	gint _tmp1_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gint _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = length_pos;
	if (_tmp1_ < 0) {
		_tmp0_ = TRUE;
	} else {
		gchar** _tmp2_;
		gint _tmp2__length1;
		gint _tmp3_;
		_tmp2_ = param_names;
		_tmp2__length1 = param_names_length1;
		_tmp3_ = length_pos;
		_tmp0_ = _tmp2__length1 < _tmp3_;
	}
	if (_tmp0_) {
		result = NULL;
		return result;
	}
	_tmp4_ = param_names;
	_tmp4__length1 = param_names_length1;
	_tmp5_ = length_pos;
	_tmp6_ = _tmp4_[_tmp5_];
	_tmp7_ = g_strdup (_tmp6_);
	result = _tmp7_;
	return result;
}


static void valadoc_importer_gir_documentation_importer_attach_comment (ValadocImporterGirDocumentationImporter* self, const gchar* cname, ValadocApiGirSourceComment* comment, gchar** param_names, int param_names_length1, ValadocImporterGirDocumentationImporterImplicitParameterPos* destroy_notifies, int destroy_notifies_length1, ValadocImporterGirDocumentationImporterImplicitParameterPos* closures, int closures_length1, ValadocImporterGirDocumentationImporterImplicitParameterPos* array_lengths, int array_lengths_length1, gint array_length_ret) {
	ValadocApiGirSourceComment* _tmp0_;
	ValadocApiNode* node = NULL;
	ValadocApiTree* _tmp1_;
	const gchar* _tmp2_;
	ValadocApiNode* _tmp3_;
	ValadocApiNode* _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	ValadocContentComment* content = NULL;
	ValadocDocumentationParser* _tmp54_;
	ValadocApiNode* _tmp55_;
	ValadocApiGirSourceComment* _tmp56_;
	ValadocContentComment* _tmp57_;
	ValadocContentComment* _tmp58_;
	ValadocApiNode* _tmp59_;
	ValadocContentComment* _tmp60_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cname != NULL);
	_tmp0_ = comment;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = ((ValadocImporterDocumentationImporter*) self)->tree;
	_tmp2_ = cname;
	_tmp3_ = valadoc_api_tree_search_symbol_cstr (_tmp1_, NULL, _tmp2_);
	node = _tmp3_;
	_tmp4_ = node;
	if (_tmp4_ == NULL) {
		_g_object_unref0 (node);
		return;
	}
	_tmp5_ = param_names;
	_tmp5__length1 = param_names_length1;
	if (_tmp5_ != NULL) {
		ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp6_;
		gint _tmp6__length1;
		ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp20_;
		gint _tmp20__length1;
		ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp34_;
		gint _tmp34__length1;
		ValadocApiNode* _tmp48_;
		_tmp6_ = destroy_notifies;
		_tmp6__length1 = destroy_notifies_length1;
		{
			ValadocImporterGirDocumentationImporterImplicitParameterPos* pos_collection = NULL;
			gint pos_collection_length1 = 0;
			gint _pos_collection_size_ = 0;
			gint pos_it = 0;
			pos_collection = _tmp6_;
			pos_collection_length1 = _tmp6__length1;
			for (pos_it = 0; pos_it < _tmp6__length1; pos_it = pos_it + 1) {
				ValadocImporterGirDocumentationImporterImplicitParameterPos pos = {0};
				pos = pos_collection[pos_it];
				{
					ValadocApiFormalParameter* param = NULL;
					ValadocApiNode* _tmp7_;
					gchar** _tmp8_;
					gint _tmp8__length1;
					ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp9_;
					gint _tmp10_;
					const gchar* _tmp11_;
					ValadocApiFormalParameter* _tmp12_;
					ValadocApiFormalParameter* _tmp13_;
					ValadocApiFormalParameter* _tmp14_;
					gchar** _tmp15_;
					gint _tmp15__length1;
					ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp16_;
					gint _tmp17_;
					gchar* _tmp18_;
					gchar* _tmp19_;
					_tmp7_ = node;
					_tmp8_ = param_names;
					_tmp8__length1 = param_names_length1;
					_tmp9_ = pos;
					_tmp10_ = _tmp9_.parameter;
					_tmp11_ = _tmp8_[_tmp10_];
					_tmp12_ = valadoc_importer_gir_documentation_importer_find_parameter (self, _tmp7_, _tmp11_);
					param = _tmp12_;
					_tmp13_ = param;
					if (_tmp13_ == NULL) {
						_g_object_unref0 (param);
						continue;
					}
					_tmp14_ = param;
					_tmp15_ = param_names;
					_tmp15__length1 = param_names_length1;
					_tmp16_ = pos;
					_tmp17_ = _tmp16_.position;
					_tmp18_ = valadoc_importer_gir_documentation_importer_get_cparameter_name (self, _tmp15_, _tmp15__length1, _tmp17_);
					_tmp19_ = _tmp18_;
					valadoc_api_formal_parameter_set_implicit_destroy_cparameter_name (_tmp14_, _tmp19_);
					_g_free0 (_tmp19_);
					_g_object_unref0 (param);
				}
			}
		}
		_tmp20_ = closures;
		_tmp20__length1 = closures_length1;
		{
			ValadocImporterGirDocumentationImporterImplicitParameterPos* pos_collection = NULL;
			gint pos_collection_length1 = 0;
			gint _pos_collection_size_ = 0;
			gint pos_it = 0;
			pos_collection = _tmp20_;
			pos_collection_length1 = _tmp20__length1;
			for (pos_it = 0; pos_it < _tmp20__length1; pos_it = pos_it + 1) {
				ValadocImporterGirDocumentationImporterImplicitParameterPos pos = {0};
				pos = pos_collection[pos_it];
				{
					ValadocApiFormalParameter* param = NULL;
					ValadocApiNode* _tmp21_;
					gchar** _tmp22_;
					gint _tmp22__length1;
					ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp23_;
					gint _tmp24_;
					const gchar* _tmp25_;
					ValadocApiFormalParameter* _tmp26_;
					ValadocApiFormalParameter* _tmp27_;
					ValadocApiFormalParameter* _tmp28_;
					gchar** _tmp29_;
					gint _tmp29__length1;
					ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp30_;
					gint _tmp31_;
					gchar* _tmp32_;
					gchar* _tmp33_;
					_tmp21_ = node;
					_tmp22_ = param_names;
					_tmp22__length1 = param_names_length1;
					_tmp23_ = pos;
					_tmp24_ = _tmp23_.parameter;
					_tmp25_ = _tmp22_[_tmp24_];
					_tmp26_ = valadoc_importer_gir_documentation_importer_find_parameter (self, _tmp21_, _tmp25_);
					param = _tmp26_;
					_tmp27_ = param;
					if (_tmp27_ == NULL) {
						_g_object_unref0 (param);
						continue;
					}
					_tmp28_ = param;
					_tmp29_ = param_names;
					_tmp29__length1 = param_names_length1;
					_tmp30_ = pos;
					_tmp31_ = _tmp30_.position;
					_tmp32_ = valadoc_importer_gir_documentation_importer_get_cparameter_name (self, _tmp29_, _tmp29__length1, _tmp31_);
					_tmp33_ = _tmp32_;
					valadoc_api_formal_parameter_set_implicit_closure_cparameter_name (_tmp28_, _tmp33_);
					_g_free0 (_tmp33_);
					_g_object_unref0 (param);
				}
			}
		}
		_tmp34_ = array_lengths;
		_tmp34__length1 = array_lengths_length1;
		{
			ValadocImporterGirDocumentationImporterImplicitParameterPos* pos_collection = NULL;
			gint pos_collection_length1 = 0;
			gint _pos_collection_size_ = 0;
			gint pos_it = 0;
			pos_collection = _tmp34_;
			pos_collection_length1 = _tmp34__length1;
			for (pos_it = 0; pos_it < _tmp34__length1; pos_it = pos_it + 1) {
				ValadocImporterGirDocumentationImporterImplicitParameterPos pos = {0};
				pos = pos_collection[pos_it];
				{
					ValadocApiFormalParameter* param = NULL;
					ValadocApiNode* _tmp35_;
					gchar** _tmp36_;
					gint _tmp36__length1;
					ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp37_;
					gint _tmp38_;
					const gchar* _tmp39_;
					ValadocApiFormalParameter* _tmp40_;
					ValadocApiFormalParameter* _tmp41_;
					ValadocApiFormalParameter* _tmp42_;
					gchar** _tmp43_;
					gint _tmp43__length1;
					ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp44_;
					gint _tmp45_;
					gchar* _tmp46_;
					gchar* _tmp47_;
					_tmp35_ = node;
					_tmp36_ = param_names;
					_tmp36__length1 = param_names_length1;
					_tmp37_ = pos;
					_tmp38_ = _tmp37_.parameter;
					_tmp39_ = _tmp36_[_tmp38_];
					_tmp40_ = valadoc_importer_gir_documentation_importer_find_parameter (self, _tmp35_, _tmp39_);
					param = _tmp40_;
					_tmp41_ = param;
					if (_tmp41_ == NULL) {
						_g_object_unref0 (param);
						continue;
					}
					_tmp42_ = param;
					_tmp43_ = param_names;
					_tmp43__length1 = param_names_length1;
					_tmp44_ = pos;
					_tmp45_ = _tmp44_.position;
					_tmp46_ = valadoc_importer_gir_documentation_importer_get_cparameter_name (self, _tmp43_, _tmp43__length1, _tmp45_);
					_tmp47_ = _tmp46_;
					valadoc_api_formal_parameter_set_implicit_array_length_cparameter_name (_tmp42_, _tmp47_);
					_g_free0 (_tmp47_);
					_g_object_unref0 (param);
				}
			}
		}
		_tmp48_ = node;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp48_, VALADOC_API_TYPE_CALLABLE)) {
			ValadocApiNode* _tmp49_;
			gchar** _tmp50_;
			gint _tmp50__length1;
			gint _tmp51_;
			gchar* _tmp52_;
			gchar* _tmp53_;
			_tmp49_ = node;
			_tmp50_ = param_names;
			_tmp50__length1 = param_names_length1;
			_tmp51_ = array_length_ret;
			_tmp52_ = valadoc_importer_gir_documentation_importer_get_cparameter_name (self, _tmp50_, _tmp50__length1, _tmp51_);
			_tmp53_ = _tmp52_;
			valadoc_api_callable_set_implicit_array_length_cparameter_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp49_, VALADOC_API_TYPE_CALLABLE, ValadocApiCallable), _tmp53_);
			_g_free0 (_tmp53_);
		}
	}
	_tmp54_ = self->priv->parser;
	_tmp55_ = node;
	_tmp56_ = comment;
	_tmp57_ = valadoc_documentation_parser_parse (_tmp54_, _tmp55_, (ValadocApiSourceComment*) _tmp56_);
	content = _tmp57_;
	_tmp58_ = content;
	if (_tmp58_ == NULL) {
		_g_object_unref0 (content);
		_g_object_unref0 (node);
		return;
	}
	_tmp59_ = node;
	_tmp60_ = content;
	valadoc_api_node_set_documentation (_tmp59_, _tmp60_);
	_g_object_unref0 (content);
	_g_object_unref0 (node);
}


static void valadoc_importer_gir_documentation_importer_warning (ValadocImporterGirDocumentationImporter* self, const gchar* message) {
	ValadocErrorReporter* _tmp0_;
	ValadocApiSourceFile* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	ValadocMarkupSourceLocation _tmp4_;
	gint _tmp5_;
	ValadocMarkupSourceLocation _tmp6_;
	gint _tmp7_;
	ValadocMarkupSourceLocation _tmp8_;
	gint _tmp9_;
	ValadocMarkupReader* _tmp10_;
	ValadocMarkupSourceLocation _tmp11_;
	gint _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = self->priv->reporter;
	_tmp1_ = self->priv->file;
	_tmp2_ = valadoc_api_source_file_get_relative_path (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->begin;
	_tmp5_ = _tmp4_.line;
	_tmp6_ = self->priv->begin;
	_tmp7_ = _tmp6_.column;
	_tmp8_ = self->priv->end;
	_tmp9_ = _tmp8_.column;
	_tmp10_ = self->priv->reader;
	_tmp11_ = self->priv->begin;
	_tmp12_ = _tmp11_.line;
	_tmp13_ = valadoc_markup_reader_get_line_content (_tmp10_, _tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = message;
	valadoc_error_reporter_warning (_tmp0_, _tmp3_, (glong) _tmp5_, (glong) _tmp7_, (glong) _tmp9_, _tmp14_, "%s", _tmp15_);
	_g_free0 (_tmp14_);
}


static void valadoc_importer_gir_documentation_importer_error (ValadocImporterGirDocumentationImporter* self, const gchar* message) {
	ValadocErrorReporter* _tmp0_;
	ValadocApiSourceFile* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	ValadocMarkupSourceLocation _tmp4_;
	gint _tmp5_;
	ValadocMarkupSourceLocation _tmp6_;
	gint _tmp7_;
	ValadocMarkupSourceLocation _tmp8_;
	gint _tmp9_;
	ValadocMarkupReader* _tmp10_;
	ValadocMarkupSourceLocation _tmp11_;
	gint _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = self->priv->reporter;
	_tmp1_ = self->priv->file;
	_tmp2_ = valadoc_api_source_file_get_relative_path (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->begin;
	_tmp5_ = _tmp4_.line;
	_tmp6_ = self->priv->begin;
	_tmp7_ = _tmp6_.column;
	_tmp8_ = self->priv->end;
	_tmp9_ = _tmp8_.column;
	_tmp10_ = self->priv->reader;
	_tmp11_ = self->priv->begin;
	_tmp12_ = _tmp11_.line;
	_tmp13_ = valadoc_markup_reader_get_line_content (_tmp10_, _tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = message;
	valadoc_error_reporter_error (_tmp0_, _tmp3_, (glong) _tmp5_, (glong) _tmp7_, (glong) _tmp9_, _tmp14_, "%s", _tmp15_);
	_g_free0 (_tmp14_);
}


static void valadoc_importer_gir_documentation_importer_next (ValadocImporterGirDocumentationImporter* self) {
	ValadocMarkupReader* _tmp0_;
	ValadocMarkupSourceLocation _tmp1_ = {0};
	ValadocMarkupSourceLocation _tmp2_ = {0};
	ValadocMarkupTokenType _tmp3_;
	gboolean _tmp4_ = FALSE;
	ValadocMarkupTokenType _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->reader;
	_tmp3_ = valadoc_markup_reader_read_token (_tmp0_, &_tmp1_, &_tmp2_);
	self->priv->begin = _tmp1_;
	self->priv->end = _tmp2_;
	self->priv->current_token = _tmp3_;
	_tmp5_ = self->priv->current_token;
	if (_tmp5_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT) {
		ValadocMarkupReader* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp6_ = self->priv->reader;
		_tmp7_ = valadoc_markup_reader_get_name (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp4_ = g_strcmp0 (_tmp8_, "annotation") == 0;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		valadoc_importer_gir_documentation_importer_next (self);
		valadoc_importer_gir_documentation_importer_next (self);
	}
}


static void valadoc_importer_gir_documentation_importer_start_element (ValadocImporterGirDocumentationImporter* self, const gchar* name) {
	gboolean _tmp0_ = FALSE;
	ValadocMarkupTokenType _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_tmp1_ = self->priv->current_token;
	if (_tmp1_ != VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT) {
		_tmp0_ = TRUE;
	} else {
		ValadocMarkupReader* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp2_ = self->priv->reader;
		_tmp3_ = valadoc_markup_reader_get_name (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = name;
		_tmp0_ = g_strcmp0 (_tmp4_, _tmp5_) != 0;
	}
	if (_tmp0_) {
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp6_ = name;
		_tmp7_ = g_strdup_printf ("expected start element of `%s'", _tmp6_);
		_tmp8_ = _tmp7_;
		valadoc_importer_gir_documentation_importer_error (self, _tmp8_);
		_g_free0 (_tmp8_);
	}
}


static void valadoc_importer_gir_documentation_importer_end_element (ValadocImporterGirDocumentationImporter* self, const gchar* name) {
	gboolean _tmp0_ = FALSE;
	ValadocMarkupTokenType _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_tmp1_ = self->priv->current_token;
	if (_tmp1_ != VALADOC_MARKUP_TOKEN_TYPE_END_ELEMENT) {
		_tmp0_ = TRUE;
	} else {
		ValadocMarkupReader* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp2_ = self->priv->reader;
		_tmp3_ = valadoc_markup_reader_get_name (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = name;
		_tmp0_ = g_strcmp0 (_tmp4_, _tmp5_) != 0;
	}
	if (_tmp0_) {
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp6_ = name;
		_tmp7_ = g_strdup_printf ("expected end element of `%s'", _tmp6_);
		_tmp8_ = _tmp7_;
		valadoc_importer_gir_documentation_importer_error (self, _tmp8_);
		_g_free0 (_tmp8_);
	}
	valadoc_importer_gir_documentation_importer_next (self);
}


static void valadoc_importer_gir_documentation_importer_parse_repository (ValadocImporterGirDocumentationImporter* self) {
	ValadocMarkupReader* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "repository");
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_attribute (_tmp0_, "version");
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strcmp0 (_tmp2_, VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_GIR_VERSION) != 0;
	_g_free0 (_tmp2_);
	if (_tmp3_) {
		ValadocMarkupReader* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp4_ = self->priv->reader;
		_tmp5_ = valadoc_markup_reader_get_attribute (_tmp4_, "version");
		_tmp6_ = _tmp5_;
		_tmp7_ = g_strdup_printf ("unsupported GIR version %s (supported: %s)", _tmp6_, VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_GIR_VERSION);
		_tmp8_ = _tmp7_;
		valadoc_importer_gir_documentation_importer_error (self, _tmp8_);
		_g_free0 (_tmp8_);
		_g_free0 (_tmp6_);
		return;
	}
	valadoc_importer_gir_documentation_importer_next (self);
	while (TRUE) {
		ValadocMarkupTokenType _tmp9_;
		ValadocMarkupReader* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		_tmp9_ = self->priv->current_token;
		if (!(_tmp9_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
			break;
		}
		_tmp10_ = self->priv->reader;
		_tmp11_ = valadoc_markup_reader_get_name (_tmp10_);
		_tmp12_ = _tmp11_;
		if (g_strcmp0 (_tmp12_, "namespace") == 0) {
			valadoc_importer_gir_documentation_importer_parse_namespace (self);
		} else {
			ValadocMarkupReader* _tmp13_;
			const gchar* _tmp14_;
			const gchar* _tmp15_;
			_tmp13_ = self->priv->reader;
			_tmp14_ = valadoc_markup_reader_get_name (_tmp13_);
			_tmp15_ = _tmp14_;
			if (g_strcmp0 (_tmp15_, "include") == 0) {
				valadoc_importer_gir_documentation_importer_parse_include (self);
			} else {
				ValadocMarkupReader* _tmp16_;
				const gchar* _tmp17_;
				const gchar* _tmp18_;
				_tmp16_ = self->priv->reader;
				_tmp17_ = valadoc_markup_reader_get_name (_tmp16_);
				_tmp18_ = _tmp17_;
				if (g_strcmp0 (_tmp18_, "package") == 0) {
					valadoc_importer_gir_documentation_importer_parse_package (self);
				} else {
					ValadocMarkupReader* _tmp19_;
					const gchar* _tmp20_;
					const gchar* _tmp21_;
					_tmp19_ = self->priv->reader;
					_tmp20_ = valadoc_markup_reader_get_name (_tmp19_);
					_tmp21_ = _tmp20_;
					if (g_strcmp0 (_tmp21_, "c:include") == 0) {
						valadoc_importer_gir_documentation_importer_parse_c_include (self);
					} else {
						ValadocMarkupReader* _tmp22_;
						const gchar* _tmp23_;
						const gchar* _tmp24_;
						gchar* _tmp25_;
						gchar* _tmp26_;
						_tmp22_ = self->priv->reader;
						_tmp23_ = valadoc_markup_reader_get_name (_tmp22_);
						_tmp24_ = _tmp23_;
						_tmp25_ = g_strdup_printf ("unknown child element `%s' in `repository'", _tmp24_);
						_tmp26_ = _tmp25_;
						valadoc_importer_gir_documentation_importer_error (self, _tmp26_);
						_g_free0 (_tmp26_);
						valadoc_importer_gir_documentation_importer_skip_element (self);
					}
				}
			}
		}
	}
	valadoc_importer_gir_documentation_importer_end_element (self, "repository");
}


static void valadoc_importer_gir_documentation_importer_parse_include (ValadocImporterGirDocumentationImporter* self) {
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "include");
	valadoc_importer_gir_documentation_importer_next (self);
	valadoc_importer_gir_documentation_importer_end_element (self, "include");
}


static void valadoc_importer_gir_documentation_importer_parse_package (ValadocImporterGirDocumentationImporter* self) {
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "package");
	valadoc_importer_gir_documentation_importer_next (self);
	valadoc_importer_gir_documentation_importer_end_element (self, "package");
}


static void valadoc_importer_gir_documentation_importer_parse_c_include (ValadocImporterGirDocumentationImporter* self) {
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "c:include");
	valadoc_importer_gir_documentation_importer_next (self);
	valadoc_importer_gir_documentation_importer_end_element (self, "c:include");
}


static void valadoc_importer_gir_documentation_importer_skip_element (ValadocImporterGirDocumentationImporter* self) {
	gint level = 0;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_next (self);
	level = 1;
	while (TRUE) {
		gint _tmp0_;
		ValadocMarkupTokenType _tmp1_;
		_tmp0_ = level;
		if (!(_tmp0_ > 0)) {
			break;
		}
		_tmp1_ = self->priv->current_token;
		if (_tmp1_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT) {
			gint _tmp2_;
			_tmp2_ = level;
			level = _tmp2_ + 1;
		} else {
			ValadocMarkupTokenType _tmp3_;
			_tmp3_ = self->priv->current_token;
			if (_tmp3_ == VALADOC_MARKUP_TOKEN_TYPE_END_ELEMENT) {
				gint _tmp4_;
				_tmp4_ = level;
				level = _tmp4_ - 1;
			} else {
				ValadocMarkupTokenType _tmp5_;
				_tmp5_ = self->priv->current_token;
				if (_tmp5_ == VALADOC_MARKUP_TOKEN_TYPE_EOF) {
					valadoc_importer_gir_documentation_importer_error (self, "unexpected end of file");
					break;
				}
			}
		}
		valadoc_importer_gir_documentation_importer_next (self);
	}
}


static void valadoc_importer_gir_documentation_importer_parse_namespace (ValadocImporterGirDocumentationImporter* self) {
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "namespace");
	valadoc_importer_gir_documentation_importer_next (self);
	while (TRUE) {
		ValadocMarkupTokenType _tmp0_;
		ValadocMarkupReader* _tmp1_;
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		_tmp0_ = self->priv->current_token;
		if (!(_tmp0_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
			break;
		}
		_tmp1_ = self->priv->reader;
		_tmp2_ = valadoc_markup_reader_get_name (_tmp1_);
		_tmp3_ = _tmp2_;
		if (g_strcmp0 (_tmp3_, "alias") == 0) {
			valadoc_importer_gir_documentation_importer_parse_alias (self);
		} else {
			ValadocMarkupReader* _tmp4_;
			const gchar* _tmp5_;
			const gchar* _tmp6_;
			_tmp4_ = self->priv->reader;
			_tmp5_ = valadoc_markup_reader_get_name (_tmp4_);
			_tmp6_ = _tmp5_;
			if (g_strcmp0 (_tmp6_, "enumeration") == 0) {
				valadoc_importer_gir_documentation_importer_parse_enumeration (self, "enumeration");
			} else {
				ValadocMarkupReader* _tmp7_;
				const gchar* _tmp8_;
				const gchar* _tmp9_;
				_tmp7_ = self->priv->reader;
				_tmp8_ = valadoc_markup_reader_get_name (_tmp7_);
				_tmp9_ = _tmp8_;
				if (g_strcmp0 (_tmp9_, "bitfield") == 0) {
					valadoc_importer_gir_documentation_importer_parse_bitfield (self);
				} else {
					ValadocMarkupReader* _tmp10_;
					const gchar* _tmp11_;
					const gchar* _tmp12_;
					_tmp10_ = self->priv->reader;
					_tmp11_ = valadoc_markup_reader_get_name (_tmp10_);
					_tmp12_ = _tmp11_;
					if (g_strcmp0 (_tmp12_, "function") == 0) {
						valadoc_importer_gir_documentation_importer_parse_method (self, "function");
					} else {
						ValadocMarkupReader* _tmp13_;
						const gchar* _tmp14_;
						const gchar* _tmp15_;
						_tmp13_ = self->priv->reader;
						_tmp14_ = valadoc_markup_reader_get_name (_tmp13_);
						_tmp15_ = _tmp14_;
						if (g_strcmp0 (_tmp15_, "callback") == 0) {
							valadoc_importer_gir_documentation_importer_parse_callback (self);
						} else {
							ValadocMarkupReader* _tmp16_;
							const gchar* _tmp17_;
							const gchar* _tmp18_;
							_tmp16_ = self->priv->reader;
							_tmp17_ = valadoc_markup_reader_get_name (_tmp16_);
							_tmp18_ = _tmp17_;
							if (g_strcmp0 (_tmp18_, "record") == 0) {
								valadoc_importer_gir_documentation_importer_parse_record (self);
							} else {
								ValadocMarkupReader* _tmp19_;
								const gchar* _tmp20_;
								const gchar* _tmp21_;
								_tmp19_ = self->priv->reader;
								_tmp20_ = valadoc_markup_reader_get_name (_tmp19_);
								_tmp21_ = _tmp20_;
								if (g_strcmp0 (_tmp21_, "class") == 0) {
									valadoc_importer_gir_documentation_importer_parse_class (self);
								} else {
									ValadocMarkupReader* _tmp22_;
									const gchar* _tmp23_;
									const gchar* _tmp24_;
									_tmp22_ = self->priv->reader;
									_tmp23_ = valadoc_markup_reader_get_name (_tmp22_);
									_tmp24_ = _tmp23_;
									if (g_strcmp0 (_tmp24_, "interface") == 0) {
										valadoc_importer_gir_documentation_importer_parse_interface (self);
									} else {
										ValadocMarkupReader* _tmp25_;
										const gchar* _tmp26_;
										const gchar* _tmp27_;
										_tmp25_ = self->priv->reader;
										_tmp26_ = valadoc_markup_reader_get_name (_tmp25_);
										_tmp27_ = _tmp26_;
										if (g_strcmp0 (_tmp27_, "glib:boxed") == 0) {
											valadoc_importer_gir_documentation_importer_parse_boxed (self, "glib:boxed");
										} else {
											ValadocMarkupReader* _tmp28_;
											const gchar* _tmp29_;
											const gchar* _tmp30_;
											_tmp28_ = self->priv->reader;
											_tmp29_ = valadoc_markup_reader_get_name (_tmp28_);
											_tmp30_ = _tmp29_;
											if (g_strcmp0 (_tmp30_, "union") == 0) {
												valadoc_importer_gir_documentation_importer_parse_union (self);
											} else {
												ValadocMarkupReader* _tmp31_;
												const gchar* _tmp32_;
												const gchar* _tmp33_;
												_tmp31_ = self->priv->reader;
												_tmp32_ = valadoc_markup_reader_get_name (_tmp31_);
												_tmp33_ = _tmp32_;
												if (g_strcmp0 (_tmp33_, "constant") == 0) {
													valadoc_importer_gir_documentation_importer_parse_constant (self);
												} else {
													ValadocMarkupReader* _tmp34_;
													const gchar* _tmp35_;
													const gchar* _tmp36_;
													gchar* _tmp37_;
													gchar* _tmp38_;
													_tmp34_ = self->priv->reader;
													_tmp35_ = valadoc_markup_reader_get_name (_tmp34_);
													_tmp36_ = _tmp35_;
													_tmp37_ = g_strdup_printf ("unknown child element `%s' in `namespace'", _tmp36_);
													_tmp38_ = _tmp37_;
													valadoc_importer_gir_documentation_importer_error (self, _tmp38_);
													_g_free0 (_tmp38_);
													valadoc_importer_gir_documentation_importer_skip_element (self);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	valadoc_importer_gir_documentation_importer_end_element (self, "namespace");
}


static void valadoc_importer_gir_documentation_importer_parse_alias (ValadocImporterGirDocumentationImporter* self) {
	gchar* c_identifier = NULL;
	ValadocMarkupReader* _tmp0_;
	gchar* _tmp1_;
	ValadocApiGirSourceComment* comment = NULL;
	ValadocApiGirSourceComment* _tmp2_;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "alias");
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_attribute (_tmp0_, "c:type");
	c_identifier = _tmp1_;
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp2_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	comment = _tmp2_;
	valadoc_importer_gir_documentation_importer_attach_comment (self, c_identifier, comment, NULL, 0, NULL, 0, NULL, 0, NULL, 0, -1);
	valadoc_importer_gir_documentation_importer_parse_type (self, NULL);
	valadoc_importer_gir_documentation_importer_end_element (self, "alias");
	_valadoc_api_source_comment_unref0 (comment);
	_g_free0 (c_identifier);
}


static ValadocApiGirSourceComment* valadoc_importer_gir_documentation_importer_parse_symbol_doc (ValadocImporterGirDocumentationImporter* self) {
	ValadocApiGirSourceComment* result = NULL;
	ValadocApiGirSourceComment* comment = NULL;
	ValadocMarkupReader* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	comment = NULL;
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_name (_tmp0_);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, "doc") == 0) {
		ValadocMarkupTokenType _tmp3_;
		valadoc_importer_gir_documentation_importer_start_element (self, "doc");
		valadoc_importer_gir_documentation_importer_next (self);
		_tmp3_ = self->priv->current_token;
		if (_tmp3_ == VALADOC_MARKUP_TOKEN_TYPE_TEXT) {
			ValadocMarkupReader* _tmp4_;
			const gchar* _tmp5_;
			const gchar* _tmp6_;
			ValadocApiSourceFile* _tmp7_;
			ValadocMarkupSourceLocation _tmp8_;
			gint _tmp9_;
			ValadocMarkupSourceLocation _tmp10_;
			gint _tmp11_;
			ValadocMarkupSourceLocation _tmp12_;
			gint _tmp13_;
			ValadocMarkupSourceLocation _tmp14_;
			gint _tmp15_;
			ValadocApiGirSourceComment* _tmp16_;
			_tmp4_ = self->priv->reader;
			_tmp5_ = valadoc_markup_reader_get_content (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp7_ = self->priv->file;
			_tmp8_ = self->priv->begin;
			_tmp9_ = _tmp8_.line;
			_tmp10_ = self->priv->begin;
			_tmp11_ = _tmp10_.column;
			_tmp12_ = self->priv->end;
			_tmp13_ = _tmp12_.line;
			_tmp14_ = self->priv->end;
			_tmp15_ = _tmp14_.column;
			_tmp16_ = valadoc_api_gir_source_comment_new (_tmp6_, _tmp7_, _tmp9_, _tmp11_, _tmp13_, _tmp15_);
			_valadoc_api_source_comment_unref0 (comment);
			comment = _tmp16_;
			valadoc_importer_gir_documentation_importer_next (self);
		}
		valadoc_importer_gir_documentation_importer_end_element (self, "doc");
	}
	while (TRUE) {
		ValadocMarkupReader* _tmp17_;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		_tmp17_ = self->priv->reader;
		_tmp18_ = valadoc_markup_reader_get_name (_tmp17_);
		_tmp19_ = _tmp18_;
		if (g_strcmp0 (_tmp19_, "doc-deprecated") == 0) {
			ValadocApiSourceComment* doc_deprecated = NULL;
			ValadocApiSourceComment* _tmp20_;
			ValadocApiSourceComment* _tmp21_;
			_tmp20_ = valadoc_importer_gir_documentation_importer_parse_doc (self, "doc-deprecated");
			doc_deprecated = _tmp20_;
			_tmp21_ = doc_deprecated;
			if (_tmp21_ != NULL) {
				ValadocApiGirSourceComment* _tmp22_;
				ValadocApiGirSourceComment* _tmp33_;
				ValadocApiSourceComment* _tmp34_;
				_tmp22_ = comment;
				if (_tmp22_ == NULL) {
					ValadocApiSourceFile* _tmp23_;
					ValadocMarkupSourceLocation _tmp24_;
					gint _tmp25_;
					ValadocMarkupSourceLocation _tmp26_;
					gint _tmp27_;
					ValadocMarkupSourceLocation _tmp28_;
					gint _tmp29_;
					ValadocMarkupSourceLocation _tmp30_;
					gint _tmp31_;
					ValadocApiGirSourceComment* _tmp32_;
					_tmp23_ = self->priv->file;
					_tmp24_ = self->priv->begin;
					_tmp25_ = _tmp24_.line;
					_tmp26_ = self->priv->end;
					_tmp27_ = _tmp26_.line;
					_tmp28_ = self->priv->begin;
					_tmp29_ = _tmp28_.line;
					_tmp30_ = self->priv->end;
					_tmp31_ = _tmp30_.line;
					_tmp32_ = valadoc_api_gir_source_comment_new ("", _tmp23_, _tmp25_, _tmp27_, _tmp29_, _tmp31_);
					_valadoc_api_source_comment_unref0 (comment);
					comment = _tmp32_;
				}
				_tmp33_ = comment;
				_tmp34_ = doc_deprecated;
				valadoc_api_gir_source_comment_set_deprecated_comment (_tmp33_, _tmp34_);
			}
			_valadoc_api_source_comment_unref0 (doc_deprecated);
		} else {
			ValadocMarkupReader* _tmp35_;
			const gchar* _tmp36_;
			const gchar* _tmp37_;
			_tmp35_ = self->priv->reader;
			_tmp36_ = valadoc_markup_reader_get_name (_tmp35_);
			_tmp37_ = _tmp36_;
			if (g_strcmp0 (_tmp37_, "doc-version") == 0) {
				ValadocApiSourceComment* doc_version = NULL;
				ValadocApiSourceComment* _tmp38_;
				ValadocApiSourceComment* _tmp39_;
				_tmp38_ = valadoc_importer_gir_documentation_importer_parse_doc (self, "doc-version");
				doc_version = _tmp38_;
				_tmp39_ = doc_version;
				if (_tmp39_ != NULL) {
					ValadocApiGirSourceComment* _tmp40_;
					ValadocApiGirSourceComment* _tmp51_;
					ValadocApiSourceComment* _tmp52_;
					_tmp40_ = comment;
					if (_tmp40_ == NULL) {
						ValadocApiSourceFile* _tmp41_;
						ValadocMarkupSourceLocation _tmp42_;
						gint _tmp43_;
						ValadocMarkupSourceLocation _tmp44_;
						gint _tmp45_;
						ValadocMarkupSourceLocation _tmp46_;
						gint _tmp47_;
						ValadocMarkupSourceLocation _tmp48_;
						gint _tmp49_;
						ValadocApiGirSourceComment* _tmp50_;
						_tmp41_ = self->priv->file;
						_tmp42_ = self->priv->begin;
						_tmp43_ = _tmp42_.line;
						_tmp44_ = self->priv->end;
						_tmp45_ = _tmp44_.line;
						_tmp46_ = self->priv->begin;
						_tmp47_ = _tmp46_.line;
						_tmp48_ = self->priv->end;
						_tmp49_ = _tmp48_.line;
						_tmp50_ = valadoc_api_gir_source_comment_new ("", _tmp41_, _tmp43_, _tmp45_, _tmp47_, _tmp49_);
						_valadoc_api_source_comment_unref0 (comment);
						comment = _tmp50_;
					}
					_tmp51_ = comment;
					_tmp52_ = doc_version;
					valadoc_api_gir_source_comment_set_version_comment (_tmp51_, _tmp52_);
				}
				_valadoc_api_source_comment_unref0 (doc_version);
			} else {
				ValadocMarkupReader* _tmp53_;
				const gchar* _tmp54_;
				const gchar* _tmp55_;
				_tmp53_ = self->priv->reader;
				_tmp54_ = valadoc_markup_reader_get_name (_tmp53_);
				_tmp55_ = _tmp54_;
				if (g_strcmp0 (_tmp55_, "doc-stability") == 0) {
					ValadocApiSourceComment* doc_stability = NULL;
					ValadocApiSourceComment* _tmp56_;
					ValadocApiSourceComment* _tmp57_;
					_tmp56_ = valadoc_importer_gir_documentation_importer_parse_doc (self, "doc-stability");
					doc_stability = _tmp56_;
					_tmp57_ = doc_stability;
					if (_tmp57_ != NULL) {
						ValadocApiGirSourceComment* _tmp58_;
						ValadocApiGirSourceComment* _tmp69_;
						ValadocApiSourceComment* _tmp70_;
						_tmp58_ = comment;
						if (_tmp58_ == NULL) {
							ValadocApiSourceFile* _tmp59_;
							ValadocMarkupSourceLocation _tmp60_;
							gint _tmp61_;
							ValadocMarkupSourceLocation _tmp62_;
							gint _tmp63_;
							ValadocMarkupSourceLocation _tmp64_;
							gint _tmp65_;
							ValadocMarkupSourceLocation _tmp66_;
							gint _tmp67_;
							ValadocApiGirSourceComment* _tmp68_;
							_tmp59_ = self->priv->file;
							_tmp60_ = self->priv->begin;
							_tmp61_ = _tmp60_.line;
							_tmp62_ = self->priv->end;
							_tmp63_ = _tmp62_.line;
							_tmp64_ = self->priv->begin;
							_tmp65_ = _tmp64_.line;
							_tmp66_ = self->priv->end;
							_tmp67_ = _tmp66_.line;
							_tmp68_ = valadoc_api_gir_source_comment_new ("", _tmp59_, _tmp61_, _tmp63_, _tmp65_, _tmp67_);
							_valadoc_api_source_comment_unref0 (comment);
							comment = _tmp68_;
						}
						_tmp69_ = comment;
						_tmp70_ = doc_stability;
						valadoc_api_gir_source_comment_set_stability_comment (_tmp69_, _tmp70_);
					}
					_valadoc_api_source_comment_unref0 (doc_stability);
				} else {
					break;
				}
			}
		}
	}
	result = comment;
	return result;
}


static ValadocApiSourceComment* valadoc_importer_gir_documentation_importer_parse_doc (ValadocImporterGirDocumentationImporter* self, const gchar* element_name) {
	ValadocApiSourceComment* result = NULL;
	ValadocMarkupReader* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	ValadocApiSourceComment* comment = NULL;
	ValadocMarkupTokenType _tmp5_;
	const gchar* _tmp19_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (element_name != NULL, NULL);
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_name (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = element_name;
	if (g_strcmp0 (_tmp2_, _tmp3_) != 0) {
		result = NULL;
		return result;
	}
	_tmp4_ = element_name;
	valadoc_importer_gir_documentation_importer_start_element (self, _tmp4_);
	valadoc_importer_gir_documentation_importer_next (self);
	comment = NULL;
	_tmp5_ = self->priv->current_token;
	if (_tmp5_ == VALADOC_MARKUP_TOKEN_TYPE_TEXT) {
		ValadocMarkupReader* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		ValadocApiSourceFile* _tmp9_;
		ValadocMarkupSourceLocation _tmp10_;
		gint _tmp11_;
		ValadocMarkupSourceLocation _tmp12_;
		gint _tmp13_;
		ValadocMarkupSourceLocation _tmp14_;
		gint _tmp15_;
		ValadocMarkupSourceLocation _tmp16_;
		gint _tmp17_;
		ValadocApiSourceComment* _tmp18_;
		_tmp6_ = self->priv->reader;
		_tmp7_ = valadoc_markup_reader_get_content (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = self->priv->file;
		_tmp10_ = self->priv->begin;
		_tmp11_ = _tmp10_.line;
		_tmp12_ = self->priv->begin;
		_tmp13_ = _tmp12_.column;
		_tmp14_ = self->priv->end;
		_tmp15_ = _tmp14_.line;
		_tmp16_ = self->priv->end;
		_tmp17_ = _tmp16_.column;
		_tmp18_ = valadoc_api_source_comment_new (_tmp8_, _tmp9_, _tmp11_, _tmp13_, _tmp15_, _tmp17_);
		_valadoc_api_source_comment_unref0 (comment);
		comment = _tmp18_;
		valadoc_importer_gir_documentation_importer_next (self);
	}
	_tmp19_ = element_name;
	valadoc_importer_gir_documentation_importer_end_element (self, _tmp19_);
	result = comment;
	return result;
}


static void valadoc_importer_gir_documentation_importer_parse_enumeration (ValadocImporterGirDocumentationImporter* self, const gchar* element_name) {
	const gchar* _tmp0_;
	ValadocMarkupReader* _tmp1_;
	gchar* _tmp2_;
	ValadocApiGirSourceComment* comment = NULL;
	ValadocApiGirSourceComment* _tmp3_;
	const gchar* _tmp4_;
	ValadocApiGirSourceComment* _tmp5_;
	const gchar* _tmp19_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (element_name != NULL);
	_tmp0_ = element_name;
	valadoc_importer_gir_documentation_importer_start_element (self, _tmp0_);
	_tmp1_ = self->priv->reader;
	_tmp2_ = valadoc_markup_reader_get_attribute (_tmp1_, "c:type");
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = _tmp2_;
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp3_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	comment = _tmp3_;
	_tmp4_ = self->priv->parent_c_identifier;
	_tmp5_ = comment;
	valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp4_, _tmp5_, NULL, 0, NULL, 0, NULL, 0, NULL, 0, -1);
	while (TRUE) {
		ValadocMarkupTokenType _tmp6_;
		ValadocMarkupReader* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		_tmp6_ = self->priv->current_token;
		if (!(_tmp6_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
			break;
		}
		_tmp7_ = self->priv->reader;
		_tmp8_ = valadoc_markup_reader_get_name (_tmp7_);
		_tmp9_ = _tmp8_;
		if (g_strcmp0 (_tmp9_, "member") == 0) {
			valadoc_importer_gir_documentation_importer_parse_enumeration_member (self);
		} else {
			ValadocMarkupReader* _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			_tmp10_ = self->priv->reader;
			_tmp11_ = valadoc_markup_reader_get_name (_tmp10_);
			_tmp12_ = _tmp11_;
			if (g_strcmp0 (_tmp12_, "function") == 0) {
				valadoc_importer_gir_documentation_importer_skip_element (self);
			} else {
				ValadocMarkupReader* _tmp13_;
				const gchar* _tmp14_;
				const gchar* _tmp15_;
				const gchar* _tmp16_;
				gchar* _tmp17_;
				gchar* _tmp18_;
				_tmp13_ = self->priv->reader;
				_tmp14_ = valadoc_markup_reader_get_name (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp16_ = element_name;
				_tmp17_ = g_strdup_printf ("unknown child element `%s' in `%s'", _tmp15_, _tmp16_);
				_tmp18_ = _tmp17_;
				valadoc_importer_gir_documentation_importer_error (self, _tmp18_);
				_g_free0 (_tmp18_);
				valadoc_importer_gir_documentation_importer_skip_element (self);
			}
		}
	}
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = NULL;
	_tmp19_ = element_name;
	valadoc_importer_gir_documentation_importer_end_element (self, _tmp19_);
	_valadoc_api_source_comment_unref0 (comment);
}


static void valadoc_importer_gir_documentation_importer_parse_bitfield (ValadocImporterGirDocumentationImporter* self) {
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_parse_enumeration (self, "bitfield");
}


static void valadoc_importer_gir_documentation_importer_parse_enumeration_member (ValadocImporterGirDocumentationImporter* self) {
	gchar* c_identifier = NULL;
	ValadocMarkupReader* _tmp0_;
	gchar* _tmp1_;
	ValadocApiGirSourceComment* comment = NULL;
	ValadocApiGirSourceComment* _tmp2_;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "member");
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_attribute (_tmp0_, "c:identifier");
	c_identifier = _tmp1_;
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp2_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	comment = _tmp2_;
	valadoc_importer_gir_documentation_importer_attach_comment (self, c_identifier, comment, NULL, 0, NULL, 0, NULL, 0, NULL, 0, -1);
	valadoc_importer_gir_documentation_importer_end_element (self, "member");
	_valadoc_api_source_comment_unref0 (comment);
	_g_free0 (c_identifier);
}


static void valadoc_importer_gir_documentation_importer_parse_return_value (ValadocImporterGirDocumentationImporter* self, ValadocApiSourceComment* * comment, gint* array_length_ret) {
	ValadocApiSourceComment* _vala_comment = NULL;
	gint _vala_array_length_ret = 0;
	ValadocApiSourceComment* _tmp0_;
	gint _tmp1_ = 0;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "return-value");
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp0_ = valadoc_importer_gir_documentation_importer_parse_doc (self, "doc");
	_valadoc_api_source_comment_unref0 (_vala_comment);
	_vala_comment = _tmp0_;
	valadoc_importer_gir_documentation_importer_parse_type (self, &_tmp1_);
	_vala_array_length_ret = _tmp1_;
	valadoc_importer_gir_documentation_importer_end_element (self, "return-value");
	if (comment) {
		*comment = _vala_comment;
	} else {
		_valadoc_api_source_comment_unref0 (_vala_comment);
	}
	if (array_length_ret) {
		*array_length_ret = _vala_array_length_ret;
	}
}


static void valadoc_importer_gir_documentation_importer_parse_parameter (ValadocImporterGirDocumentationImporter* self, ValadocApiSourceComment* * comment, gchar* * param_name, gint* destroy_pos, gint* closure_pos, gint* array_length_pos) {
	ValadocApiSourceComment* _vala_comment = NULL;
	gchar* _vala_param_name = NULL;
	gint _vala_destroy_pos = 0;
	gint _vala_closure_pos = 0;
	gint _vala_array_length_pos = 0;
	ValadocMarkupReader* _tmp0_;
	gchar* _tmp1_;
	gchar* closure = NULL;
	ValadocMarkupReader* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* destroy = NULL;
	ValadocMarkupReader* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	ValadocApiSourceComment* _tmp14_;
	ValadocMarkupReader* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "parameter");
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_attribute (_tmp0_, "name");
	_g_free0 (_vala_param_name);
	_vala_param_name = _tmp1_;
	_vala_array_length_pos = -1;
	_vala_destroy_pos = -1;
	_vala_closure_pos = -1;
	_tmp2_ = self->priv->reader;
	_tmp3_ = valadoc_markup_reader_get_attribute (_tmp2_, "closure");
	closure = _tmp3_;
	_tmp4_ = closure;
	if (_tmp4_ != NULL) {
		const gchar* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		_tmp5_ = closure;
		_tmp6_ = atoi (_tmp5_);
		_vala_closure_pos = _tmp6_;
		_tmp7_ = _vala_closure_pos;
		if (_tmp7_ < 0) {
			valadoc_importer_gir_documentation_importer_warning (self, "invalid closure position");
		}
	}
	_tmp8_ = self->priv->reader;
	_tmp9_ = valadoc_markup_reader_get_attribute (_tmp8_, "destroy");
	destroy = _tmp9_;
	_tmp10_ = destroy;
	if (_tmp10_ != NULL) {
		const gchar* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		_tmp11_ = destroy;
		_tmp12_ = atoi (_tmp11_);
		_vala_destroy_pos = _tmp12_;
		_tmp13_ = _vala_destroy_pos;
		if (_tmp13_ < 0) {
			valadoc_importer_gir_documentation_importer_warning (self, "invalid destroy position");
		}
	}
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp14_ = valadoc_importer_gir_documentation_importer_parse_doc (self, "doc");
	_valadoc_api_source_comment_unref0 (_vala_comment);
	_vala_comment = _tmp14_;
	_tmp15_ = self->priv->reader;
	_tmp16_ = valadoc_markup_reader_get_name (_tmp15_);
	_tmp17_ = _tmp16_;
	if (g_strcmp0 (_tmp17_, "varargs") == 0) {
		gchar* _tmp18_;
		valadoc_importer_gir_documentation_importer_start_element (self, "varargs");
		_tmp18_ = g_strdup ("...");
		_g_free0 (_vala_param_name);
		_vala_param_name = _tmp18_;
		valadoc_importer_gir_documentation_importer_next (self);
		valadoc_importer_gir_documentation_importer_end_element (self, "varargs");
	} else {
		gint _tmp19_ = 0;
		valadoc_importer_gir_documentation_importer_parse_type (self, &_tmp19_);
		_vala_array_length_pos = _tmp19_;
	}
	valadoc_importer_gir_documentation_importer_end_element (self, "parameter");
	_g_free0 (destroy);
	_g_free0 (closure);
	if (comment) {
		*comment = _vala_comment;
	} else {
		_valadoc_api_source_comment_unref0 (_vala_comment);
	}
	if (param_name) {
		*param_name = _vala_param_name;
	} else {
		_g_free0 (_vala_param_name);
	}
	if (destroy_pos) {
		*destroy_pos = _vala_destroy_pos;
	}
	if (closure_pos) {
		*closure_pos = _vala_closure_pos;
	}
	if (array_length_pos) {
		*array_length_pos = _vala_array_length_pos;
	}
}


static void valadoc_importer_gir_documentation_importer_parse_type (ValadocImporterGirDocumentationImporter* self, gint* array_length_pos) {
	gint _vala_array_length_pos = 0;
	ValadocMarkupReader* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_vala_array_length_pos = -1;
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_name (_tmp0_);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, "array") == 0) {
		gchar* length = NULL;
		ValadocMarkupReader* _tmp3_;
		gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp3_ = self->priv->reader;
		_tmp4_ = valadoc_markup_reader_get_attribute (_tmp3_, "length");
		length = _tmp4_;
		_tmp5_ = length;
		if (_tmp5_ != NULL) {
			const gchar* _tmp6_;
			gint _tmp7_;
			gint _tmp8_;
			_tmp6_ = length;
			_tmp7_ = atoi (_tmp6_);
			_vala_array_length_pos = _tmp7_;
			_tmp8_ = _vala_array_length_pos;
			if (_tmp8_ < 0) {
				valadoc_importer_gir_documentation_importer_warning (self, "invalid array lenght position");
			}
		}
		valadoc_importer_gir_documentation_importer_skip_element (self);
		_g_free0 (length);
	} else {
		valadoc_importer_gir_documentation_importer_skip_element (self);
	}
	if (array_length_pos) {
		*array_length_pos = _vala_array_length_pos;
	}
}


static void valadoc_importer_gir_documentation_importer_parse_record (ValadocImporterGirDocumentationImporter* self) {
	ValadocMarkupReader* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp3_;
	gboolean is_type_struct = FALSE;
	ValadocMarkupReader* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gboolean _tmp7_;
	ValadocApiGirSourceComment* comment = NULL;
	ValadocApiGirSourceComment* _tmp8_;
	gboolean _tmp9_;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "record");
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_attribute (_tmp0_, "c:type");
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = _tmp1_;
	_tmp2_ = self->priv->parent_c_identifier;
	_tmp3_ = g_str_has_suffix (_tmp2_, "Private");
	if (_tmp3_) {
		_g_free0 (self->priv->parent_c_identifier);
		self->priv->parent_c_identifier = NULL;
		valadoc_importer_gir_documentation_importer_skip_element (self);
		return;
	}
	_tmp4_ = self->priv->reader;
	_tmp5_ = valadoc_markup_reader_get_attribute (_tmp4_, "glib:is-gtype-struct-for");
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp6_ != NULL;
	_g_free0 (_tmp6_);
	is_type_struct = _tmp7_;
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp8_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	comment = _tmp8_;
	_tmp9_ = is_type_struct;
	if (_tmp9_ == FALSE) {
		const gchar* _tmp10_;
		ValadocApiGirSourceComment* _tmp11_;
		_tmp10_ = self->priv->parent_c_identifier;
		_tmp11_ = comment;
		valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp10_, _tmp11_, NULL, 0, NULL, 0, NULL, 0, NULL, 0, -1);
	}
	while (TRUE) {
		ValadocMarkupTokenType _tmp12_;
		ValadocMarkupReader* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		_tmp12_ = self->priv->current_token;
		if (!(_tmp12_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
			break;
		}
		_tmp13_ = self->priv->reader;
		_tmp14_ = valadoc_markup_reader_get_name (_tmp13_);
		_tmp15_ = _tmp14_;
		if (g_strcmp0 (_tmp15_, "field") == 0) {
			valadoc_importer_gir_documentation_importer_parse_field (self);
		} else {
			ValadocMarkupReader* _tmp16_;
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			_tmp16_ = self->priv->reader;
			_tmp17_ = valadoc_markup_reader_get_name (_tmp16_);
			_tmp18_ = _tmp17_;
			if (g_strcmp0 (_tmp18_, "constructor") == 0) {
				valadoc_importer_gir_documentation_importer_parse_constructor (self);
			} else {
				ValadocMarkupReader* _tmp19_;
				const gchar* _tmp20_;
				const gchar* _tmp21_;
				_tmp19_ = self->priv->reader;
				_tmp20_ = valadoc_markup_reader_get_name (_tmp19_);
				_tmp21_ = _tmp20_;
				if (g_strcmp0 (_tmp21_, "method") == 0) {
					valadoc_importer_gir_documentation_importer_parse_method (self, "method");
				} else {
					ValadocMarkupReader* _tmp22_;
					const gchar* _tmp23_;
					const gchar* _tmp24_;
					_tmp22_ = self->priv->reader;
					_tmp23_ = valadoc_markup_reader_get_name (_tmp22_);
					_tmp24_ = _tmp23_;
					if (g_strcmp0 (_tmp24_, "function") == 0) {
						valadoc_importer_gir_documentation_importer_skip_element (self);
					} else {
						ValadocMarkupReader* _tmp25_;
						const gchar* _tmp26_;
						const gchar* _tmp27_;
						_tmp25_ = self->priv->reader;
						_tmp26_ = valadoc_markup_reader_get_name (_tmp25_);
						_tmp27_ = _tmp26_;
						if (g_strcmp0 (_tmp27_, "union") == 0) {
							valadoc_importer_gir_documentation_importer_parse_union (self);
						} else {
							ValadocMarkupReader* _tmp28_;
							const gchar* _tmp29_;
							const gchar* _tmp30_;
							gchar* _tmp31_;
							gchar* _tmp32_;
							_tmp28_ = self->priv->reader;
							_tmp29_ = valadoc_markup_reader_get_name (_tmp28_);
							_tmp30_ = _tmp29_;
							_tmp31_ = g_strdup_printf ("unknown child element `%s' in `record'", _tmp30_);
							_tmp32_ = _tmp31_;
							valadoc_importer_gir_documentation_importer_error (self, _tmp32_);
							_g_free0 (_tmp32_);
							valadoc_importer_gir_documentation_importer_skip_element (self);
						}
					}
				}
			}
		}
	}
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = NULL;
	valadoc_importer_gir_documentation_importer_end_element (self, "record");
	_valadoc_api_source_comment_unref0 (comment);
}


static void valadoc_importer_gir_documentation_importer_parse_class (ValadocImporterGirDocumentationImporter* self) {
	ValadocMarkupReader* _tmp0_;
	gchar* _tmp1_;
	ValadocApiGirSourceComment* comment = NULL;
	ValadocApiGirSourceComment* _tmp2_;
	const gchar* _tmp3_;
	ValadocApiGirSourceComment* _tmp4_;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "class");
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_attribute (_tmp0_, "c:type");
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = _tmp1_;
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp2_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	comment = _tmp2_;
	_tmp3_ = self->priv->parent_c_identifier;
	_tmp4_ = comment;
	valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp3_, _tmp4_, NULL, 0, NULL, 0, NULL, 0, NULL, 0, -1);
	while (TRUE) {
		ValadocMarkupTokenType _tmp5_;
		ValadocMarkupReader* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp5_ = self->priv->current_token;
		if (!(_tmp5_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
			break;
		}
		_tmp6_ = self->priv->reader;
		_tmp7_ = valadoc_markup_reader_get_name (_tmp6_);
		_tmp8_ = _tmp7_;
		if (g_strcmp0 (_tmp8_, "implements") == 0) {
			valadoc_importer_gir_documentation_importer_skip_element (self);
		} else {
			ValadocMarkupReader* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			_tmp9_ = self->priv->reader;
			_tmp10_ = valadoc_markup_reader_get_name (_tmp9_);
			_tmp11_ = _tmp10_;
			if (g_strcmp0 (_tmp11_, "constant") == 0) {
				valadoc_importer_gir_documentation_importer_parse_constant (self);
			} else {
				ValadocMarkupReader* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				_tmp12_ = self->priv->reader;
				_tmp13_ = valadoc_markup_reader_get_name (_tmp12_);
				_tmp14_ = _tmp13_;
				if (g_strcmp0 (_tmp14_, "field") == 0) {
					valadoc_importer_gir_documentation_importer_parse_field (self);
				} else {
					ValadocMarkupReader* _tmp15_;
					const gchar* _tmp16_;
					const gchar* _tmp17_;
					_tmp15_ = self->priv->reader;
					_tmp16_ = valadoc_markup_reader_get_name (_tmp15_);
					_tmp17_ = _tmp16_;
					if (g_strcmp0 (_tmp17_, "property") == 0) {
						valadoc_importer_gir_documentation_importer_parse_property (self);
					} else {
						ValadocMarkupReader* _tmp18_;
						const gchar* _tmp19_;
						const gchar* _tmp20_;
						_tmp18_ = self->priv->reader;
						_tmp19_ = valadoc_markup_reader_get_name (_tmp18_);
						_tmp20_ = _tmp19_;
						if (g_strcmp0 (_tmp20_, "constructor") == 0) {
							valadoc_importer_gir_documentation_importer_parse_constructor (self);
						} else {
							ValadocMarkupReader* _tmp21_;
							const gchar* _tmp22_;
							const gchar* _tmp23_;
							_tmp21_ = self->priv->reader;
							_tmp22_ = valadoc_markup_reader_get_name (_tmp21_);
							_tmp23_ = _tmp22_;
							if (g_strcmp0 (_tmp23_, "function") == 0) {
								valadoc_importer_gir_documentation_importer_parse_method (self, "function");
							} else {
								ValadocMarkupReader* _tmp24_;
								const gchar* _tmp25_;
								const gchar* _tmp26_;
								_tmp24_ = self->priv->reader;
								_tmp25_ = valadoc_markup_reader_get_name (_tmp24_);
								_tmp26_ = _tmp25_;
								if (g_strcmp0 (_tmp26_, "method") == 0) {
									valadoc_importer_gir_documentation_importer_parse_method (self, "method");
								} else {
									ValadocMarkupReader* _tmp27_;
									const gchar* _tmp28_;
									const gchar* _tmp29_;
									_tmp27_ = self->priv->reader;
									_tmp28_ = valadoc_markup_reader_get_name (_tmp27_);
									_tmp29_ = _tmp28_;
									if (g_strcmp0 (_tmp29_, "virtual-method") == 0) {
										valadoc_importer_gir_documentation_importer_parse_method (self, "virtual-method");
									} else {
										ValadocMarkupReader* _tmp30_;
										const gchar* _tmp31_;
										const gchar* _tmp32_;
										_tmp30_ = self->priv->reader;
										_tmp31_ = valadoc_markup_reader_get_name (_tmp30_);
										_tmp32_ = _tmp31_;
										if (g_strcmp0 (_tmp32_, "union") == 0) {
											valadoc_importer_gir_documentation_importer_parse_union (self);
										} else {
											ValadocMarkupReader* _tmp33_;
											const gchar* _tmp34_;
											const gchar* _tmp35_;
											_tmp33_ = self->priv->reader;
											_tmp34_ = valadoc_markup_reader_get_name (_tmp33_);
											_tmp35_ = _tmp34_;
											if (g_strcmp0 (_tmp35_, "glib:signal") == 0) {
												valadoc_importer_gir_documentation_importer_parse_signal (self);
											} else {
												ValadocMarkupReader* _tmp36_;
												const gchar* _tmp37_;
												const gchar* _tmp38_;
												gchar* _tmp39_;
												gchar* _tmp40_;
												_tmp36_ = self->priv->reader;
												_tmp37_ = valadoc_markup_reader_get_name (_tmp36_);
												_tmp38_ = _tmp37_;
												_tmp39_ = g_strdup_printf ("unknown child element `%s' in `class'", _tmp38_);
												_tmp40_ = _tmp39_;
												valadoc_importer_gir_documentation_importer_error (self, _tmp40_);
												_g_free0 (_tmp40_);
												valadoc_importer_gir_documentation_importer_skip_element (self);
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = NULL;
	valadoc_importer_gir_documentation_importer_end_element (self, "class");
	_valadoc_api_source_comment_unref0 (comment);
}


static void valadoc_importer_gir_documentation_importer_parse_interface (ValadocImporterGirDocumentationImporter* self) {
	ValadocMarkupReader* _tmp0_;
	gchar* _tmp1_;
	ValadocApiGirSourceComment* comment = NULL;
	ValadocApiGirSourceComment* _tmp2_;
	const gchar* _tmp3_;
	ValadocApiGirSourceComment* _tmp4_;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "interface");
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_attribute (_tmp0_, "c:type");
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = _tmp1_;
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp2_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	comment = _tmp2_;
	_tmp3_ = self->priv->parent_c_identifier;
	_tmp4_ = comment;
	valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp3_, _tmp4_, NULL, 0, NULL, 0, NULL, 0, NULL, 0, -1);
	while (TRUE) {
		ValadocMarkupTokenType _tmp5_;
		ValadocMarkupReader* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp5_ = self->priv->current_token;
		if (!(_tmp5_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
			break;
		}
		_tmp6_ = self->priv->reader;
		_tmp7_ = valadoc_markup_reader_get_name (_tmp6_);
		_tmp8_ = _tmp7_;
		if (g_strcmp0 (_tmp8_, "prerequisite") == 0) {
			valadoc_importer_gir_documentation_importer_skip_element (self);
		} else {
			ValadocMarkupReader* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			_tmp9_ = self->priv->reader;
			_tmp10_ = valadoc_markup_reader_get_name (_tmp9_);
			_tmp11_ = _tmp10_;
			if (g_strcmp0 (_tmp11_, "field") == 0) {
				valadoc_importer_gir_documentation_importer_parse_field (self);
			} else {
				ValadocMarkupReader* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				_tmp12_ = self->priv->reader;
				_tmp13_ = valadoc_markup_reader_get_name (_tmp12_);
				_tmp14_ = _tmp13_;
				if (g_strcmp0 (_tmp14_, "property") == 0) {
					valadoc_importer_gir_documentation_importer_parse_property (self);
				} else {
					ValadocMarkupReader* _tmp15_;
					const gchar* _tmp16_;
					const gchar* _tmp17_;
					_tmp15_ = self->priv->reader;
					_tmp16_ = valadoc_markup_reader_get_name (_tmp15_);
					_tmp17_ = _tmp16_;
					if (g_strcmp0 (_tmp17_, "virtual-method") == 0) {
						valadoc_importer_gir_documentation_importer_parse_method (self, "virtual-method");
					} else {
						ValadocMarkupReader* _tmp18_;
						const gchar* _tmp19_;
						const gchar* _tmp20_;
						_tmp18_ = self->priv->reader;
						_tmp19_ = valadoc_markup_reader_get_name (_tmp18_);
						_tmp20_ = _tmp19_;
						if (g_strcmp0 (_tmp20_, "function") == 0) {
							valadoc_importer_gir_documentation_importer_parse_method (self, "function");
						} else {
							ValadocMarkupReader* _tmp21_;
							const gchar* _tmp22_;
							const gchar* _tmp23_;
							_tmp21_ = self->priv->reader;
							_tmp22_ = valadoc_markup_reader_get_name (_tmp21_);
							_tmp23_ = _tmp22_;
							if (g_strcmp0 (_tmp23_, "method") == 0) {
								valadoc_importer_gir_documentation_importer_parse_method (self, "method");
							} else {
								ValadocMarkupReader* _tmp24_;
								const gchar* _tmp25_;
								const gchar* _tmp26_;
								_tmp24_ = self->priv->reader;
								_tmp25_ = valadoc_markup_reader_get_name (_tmp24_);
								_tmp26_ = _tmp25_;
								if (g_strcmp0 (_tmp26_, "glib:signal") == 0) {
									valadoc_importer_gir_documentation_importer_parse_signal (self);
								} else {
									ValadocMarkupReader* _tmp27_;
									const gchar* _tmp28_;
									const gchar* _tmp29_;
									gchar* _tmp30_;
									gchar* _tmp31_;
									_tmp27_ = self->priv->reader;
									_tmp28_ = valadoc_markup_reader_get_name (_tmp27_);
									_tmp29_ = _tmp28_;
									_tmp30_ = g_strdup_printf ("unknown child element `%s' in `interface'", _tmp29_);
									_tmp31_ = _tmp30_;
									valadoc_importer_gir_documentation_importer_error (self, _tmp31_);
									_g_free0 (_tmp31_);
									valadoc_importer_gir_documentation_importer_skip_element (self);
								}
							}
						}
					}
				}
			}
		}
	}
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = NULL;
	valadoc_importer_gir_documentation_importer_end_element (self, "interface");
	_valadoc_api_source_comment_unref0 (comment);
}


static void valadoc_importer_gir_documentation_importer_parse_field (ValadocImporterGirDocumentationImporter* self) {
	gchar* c_identifier = NULL;
	ValadocMarkupReader* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	ValadocApiGirSourceComment* _tmp8_;
	ValadocApiGirSourceComment* _tmp9_;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "field");
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_attribute (_tmp0_, "name");
	c_identifier = _tmp1_;
	_tmp2_ = self->priv->parent_c_identifier;
	if (_tmp2_ != NULL) {
		const gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp3_ = self->priv->parent_c_identifier;
		_tmp4_ = g_strconcat (_tmp3_, ".", NULL);
		_tmp5_ = _tmp4_;
		_tmp6_ = c_identifier;
		_tmp7_ = g_strconcat (_tmp5_, _tmp6_, NULL);
		_g_free0 (c_identifier);
		c_identifier = _tmp7_;
		_g_free0 (_tmp5_);
	}
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp8_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	_tmp9_ = _tmp8_;
	_valadoc_api_source_comment_unref0 (_tmp9_);
	valadoc_importer_gir_documentation_importer_parse_type (self, NULL);
	valadoc_importer_gir_documentation_importer_end_element (self, "field");
	_g_free0 (c_identifier);
}


static gchar* string_replace (const gchar* self, const gchar* old, const gchar* replacement) {
	gchar* result = NULL;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp2_;
		_tmp2_ = old;
		_tmp1_ = (*((gchar*) _tmp2_)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		_tmp3_ = old;
		_tmp4_ = replacement;
		_tmp0_ = g_strcmp0 (_tmp3_, _tmp4_) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp5_;
		_tmp5_ = g_strdup (self);
		result = _tmp5_;
		return result;
	}
	{
		GRegex* regex = NULL;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		GRegex* _tmp9_;
		GRegex* _tmp10_;
		gchar* _tmp11_ = NULL;
		GRegex* _tmp12_;
		const gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		_tmp6_ = old;
		_tmp7_ = g_regex_escape_string (_tmp6_, -1);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_regex_new (_tmp8_, 0, 0, &_inner_error_);
		_tmp10_ = _tmp9_;
		_g_free0 (_tmp8_);
		regex = _tmp10_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch19_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
		_tmp12_ = regex;
		_tmp13_ = replacement;
		_tmp14_ = g_regex_replace_literal (_tmp12_, self, (gssize) -1, 0, _tmp13_, 0, &_inner_error_);
		_tmp11_ = _tmp14_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch19_g_regex_error;
			}
			_g_regex_unref0 (regex);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
		_tmp15_ = _tmp11_;
		_tmp11_ = NULL;
		result = _tmp15_;
		_g_free0 (_tmp11_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally19;
	__catch19_g_regex_error:
	{
		GError* e = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (e);
	}
	__finally19:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
}


static void valadoc_importer_gir_documentation_importer_parse_property (ValadocImporterGirDocumentationImporter* self) {
	gchar* c_identifier = NULL;
	const gchar* _tmp0_;
	ValadocMarkupReader* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	ValadocApiGirSourceComment* comment = NULL;
	ValadocApiGirSourceComment* _tmp8_;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "property");
	_tmp0_ = self->priv->parent_c_identifier;
	_tmp1_ = self->priv->reader;
	_tmp2_ = valadoc_markup_reader_get_attribute (_tmp1_, "name");
	_tmp3_ = _tmp2_;
	_tmp4_ = string_replace (_tmp3_, "-", "_");
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strdup_printf ("%s:%s", _tmp0_, _tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	c_identifier = _tmp7_;
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp8_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	comment = _tmp8_;
	valadoc_importer_gir_documentation_importer_attach_comment (self, c_identifier, comment, NULL, 0, NULL, 0, NULL, 0, NULL, 0, -1);
	valadoc_importer_gir_documentation_importer_parse_type (self, NULL);
	valadoc_importer_gir_documentation_importer_end_element (self, "property");
	_valadoc_api_source_comment_unref0 (comment);
	_g_free0 (c_identifier);
}


static void valadoc_importer_gir_documentation_importer_parse_callback (ValadocImporterGirDocumentationImporter* self) {
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_parse_function (self, "callback");
}


static void valadoc_importer_gir_documentation_importer_parse_constructor (ValadocImporterGirDocumentationImporter* self) {
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_parse_function (self, "constructor");
}


static void _vala_array_add3 (gchar** * array, int* length, int* size, gchar* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


static void _vala_array_add4 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array, int* length, int* size, const ValadocImporterGirDocumentationImporterImplicitParameterPos* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (ValadocImporterGirDocumentationImporterImplicitParameterPos, *array, *size);
	}
	(*array)[(*length)++] = *value;
}


static void _vala_array_add5 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array, int* length, int* size, const ValadocImporterGirDocumentationImporterImplicitParameterPos* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (ValadocImporterGirDocumentationImporterImplicitParameterPos, *array, *size);
	}
	(*array)[(*length)++] = *value;
}


static void _vala_array_add6 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array, int* length, int* size, const ValadocImporterGirDocumentationImporterImplicitParameterPos* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (ValadocImporterGirDocumentationImporterImplicitParameterPos, *array, *size);
	}
	(*array)[(*length)++] = *value;
}


static void valadoc_importer_gir_documentation_importer_parse_function (ValadocImporterGirDocumentationImporter* self, const gchar* element_name) {
	const gchar* _tmp0_;
	gchar* c_identifier = NULL;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GQuark _tmp4_ = 0U;
	static GQuark _tmp3_label0 = 0;
	static GQuark _tmp3_label1 = 0;
	static GQuark _tmp3_label2 = 0;
	static GQuark _tmp3_label3 = 0;
	static GQuark _tmp3_label4 = 0;
	static GQuark _tmp3_label5 = 0;
	ValadocApiGirSourceComment* comment = NULL;
	ValadocApiGirSourceComment* _tmp23_;
	ValadocImporterGirDocumentationImporterImplicitParameterPos* destroy_notifies = NULL;
	ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp24_;
	gint destroy_notifies_length1;
	gint _destroy_notifies_size_;
	ValadocImporterGirDocumentationImporterImplicitParameterPos* array_lengths = NULL;
	ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp25_;
	gint array_lengths_length1;
	gint _array_lengths_size_;
	ValadocImporterGirDocumentationImporterImplicitParameterPos* closures = NULL;
	ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp26_;
	gint closures_length1;
	gint _closures_size_;
	gchar** param_names = NULL;
	gchar** _tmp27_;
	gint param_names_length1;
	gint _param_names_size_;
	gint array_length_ret = 0;
	gboolean _tmp28_ = FALSE;
	ValadocMarkupTokenType _tmp29_;
	gboolean _tmp49_ = FALSE;
	ValadocMarkupTokenType _tmp50_;
	const gchar* _tmp129_;
	ValadocApiGirSourceComment* _tmp130_;
	gchar** _tmp131_;
	gint _tmp131__length1;
	ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp132_;
	gint _tmp132__length1;
	ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp133_;
	gint _tmp133__length1;
	ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp134_;
	gint _tmp134__length1;
	gint _tmp135_;
	const gchar* _tmp136_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (element_name != NULL);
	_tmp0_ = element_name;
	valadoc_importer_gir_documentation_importer_start_element (self, _tmp0_);
	c_identifier = NULL;
	_tmp1_ = element_name;
	_tmp2_ = _tmp1_;
	_tmp4_ = (NULL == _tmp2_) ? 0 : g_quark_from_string (_tmp2_);
	if (((_tmp4_ == ((0 != _tmp3_label0) ? _tmp3_label0 : (_tmp3_label0 = g_quark_from_static_string ("constructor")))) || (_tmp4_ == ((0 != _tmp3_label1) ? _tmp3_label1 : (_tmp3_label1 = g_quark_from_static_string ("function"))))) || (_tmp4_ == ((0 != _tmp3_label2) ? _tmp3_label2 : (_tmp3_label2 = g_quark_from_static_string ("method"))))) {
		switch (0) {
			default:
			{
				ValadocMarkupReader* _tmp5_;
				gchar* _tmp6_;
				_tmp5_ = self->priv->reader;
				_tmp6_ = valadoc_markup_reader_get_attribute (_tmp5_, "c:identifier");
				_g_free0 (c_identifier);
				c_identifier = _tmp6_;
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label3) ? _tmp3_label3 : (_tmp3_label3 = g_quark_from_static_string ("callback")))) {
		switch (0) {
			default:
			{
				ValadocMarkupReader* _tmp7_;
				gchar* _tmp8_;
				_tmp7_ = self->priv->reader;
				_tmp8_ = valadoc_markup_reader_get_attribute (_tmp7_, "c:type");
				_g_free0 (c_identifier);
				c_identifier = _tmp8_;
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label4) ? _tmp3_label4 : (_tmp3_label4 = g_quark_from_static_string ("virtual-method")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp9_;
				ValadocMarkupReader* _tmp10_;
				gchar* _tmp11_;
				gchar* _tmp12_;
				gchar* _tmp13_;
				gchar* _tmp14_;
				gchar* _tmp15_;
				_tmp9_ = self->priv->parent_c_identifier;
				_tmp10_ = self->priv->reader;
				_tmp11_ = valadoc_markup_reader_get_attribute (_tmp10_, "name");
				_tmp12_ = _tmp11_;
				_tmp13_ = string_replace (_tmp12_, "-", "_");
				_tmp14_ = _tmp13_;
				_tmp15_ = g_strdup_printf ("%s->%s", _tmp9_, _tmp14_);
				_g_free0 (c_identifier);
				c_identifier = _tmp15_;
				_g_free0 (_tmp14_);
				_g_free0 (_tmp12_);
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label5) ? _tmp3_label5 : (_tmp3_label5 = g_quark_from_static_string ("glib:signal")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp16_;
				ValadocMarkupReader* _tmp17_;
				gchar* _tmp18_;
				gchar* _tmp19_;
				gchar* _tmp20_;
				gchar* _tmp21_;
				gchar* _tmp22_;
				_tmp16_ = self->priv->parent_c_identifier;
				_tmp17_ = self->priv->reader;
				_tmp18_ = valadoc_markup_reader_get_attribute (_tmp17_, "name");
				_tmp19_ = _tmp18_;
				_tmp20_ = string_replace (_tmp19_, "-", "_");
				_tmp21_ = _tmp20_;
				_tmp22_ = g_strdup_printf ("%s::%s", _tmp16_, _tmp21_);
				_g_free0 (c_identifier);
				c_identifier = _tmp22_;
				_g_free0 (_tmp21_);
				_g_free0 (_tmp19_);
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				valadoc_importer_gir_documentation_importer_skip_element (self);
				_g_free0 (c_identifier);
				return;
			}
		}
	}
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp23_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	comment = _tmp23_;
	_tmp24_ = g_new0 (ValadocImporterGirDocumentationImporterImplicitParameterPos, 0);
	destroy_notifies = _tmp24_;
	destroy_notifies_length1 = 0;
	_destroy_notifies_size_ = destroy_notifies_length1;
	_tmp25_ = g_new0 (ValadocImporterGirDocumentationImporterImplicitParameterPos, 0);
	array_lengths = _tmp25_;
	array_lengths_length1 = 0;
	_array_lengths_size_ = array_lengths_length1;
	_tmp26_ = g_new0 (ValadocImporterGirDocumentationImporterImplicitParameterPos, 0);
	closures = _tmp26_;
	closures_length1 = 0;
	_closures_size_ = closures_length1;
	_tmp27_ = g_new0 (gchar*, 0 + 1);
	param_names = _tmp27_;
	param_names_length1 = 0;
	_param_names_size_ = param_names_length1;
	array_length_ret = -1;
	_tmp29_ = self->priv->current_token;
	if (_tmp29_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT) {
		ValadocMarkupReader* _tmp30_;
		const gchar* _tmp31_;
		const gchar* _tmp32_;
		_tmp30_ = self->priv->reader;
		_tmp31_ = valadoc_markup_reader_get_name (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp28_ = g_strcmp0 (_tmp32_, "return-value") == 0;
	} else {
		_tmp28_ = FALSE;
	}
	if (_tmp28_) {
		ValadocApiSourceComment* return_comment = NULL;
		ValadocApiSourceComment* _tmp33_ = NULL;
		gint _tmp34_ = 0;
		ValadocApiSourceComment* _tmp35_;
		valadoc_importer_gir_documentation_importer_parse_return_value (self, &_tmp33_, &_tmp34_);
		_valadoc_api_source_comment_unref0 (return_comment);
		return_comment = _tmp33_;
		array_length_ret = _tmp34_;
		_tmp35_ = return_comment;
		if (_tmp35_ != NULL) {
			ValadocApiGirSourceComment* _tmp36_;
			ValadocApiGirSourceComment* _tmp47_;
			ValadocApiSourceComment* _tmp48_;
			_tmp36_ = comment;
			if (_tmp36_ == NULL) {
				ValadocApiSourceFile* _tmp37_;
				ValadocMarkupSourceLocation _tmp38_;
				gint _tmp39_;
				ValadocMarkupSourceLocation _tmp40_;
				gint _tmp41_;
				ValadocMarkupSourceLocation _tmp42_;
				gint _tmp43_;
				ValadocMarkupSourceLocation _tmp44_;
				gint _tmp45_;
				ValadocApiGirSourceComment* _tmp46_;
				_tmp37_ = self->priv->file;
				_tmp38_ = self->priv->begin;
				_tmp39_ = _tmp38_.line;
				_tmp40_ = self->priv->begin;
				_tmp41_ = _tmp40_.column;
				_tmp42_ = self->priv->end;
				_tmp43_ = _tmp42_.line;
				_tmp44_ = self->priv->end;
				_tmp45_ = _tmp44_.column;
				_tmp46_ = valadoc_api_gir_source_comment_new ("", _tmp37_, _tmp39_, _tmp41_, _tmp43_, _tmp45_);
				_valadoc_api_source_comment_unref0 (comment);
				comment = _tmp46_;
			}
			_tmp47_ = comment;
			_tmp48_ = return_comment;
			valadoc_api_gir_source_comment_set_return_comment (_tmp47_, _tmp48_);
		}
		_valadoc_api_source_comment_unref0 (return_comment);
	}
	_tmp50_ = self->priv->current_token;
	if (_tmp50_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT) {
		ValadocMarkupReader* _tmp51_;
		const gchar* _tmp52_;
		const gchar* _tmp53_;
		_tmp51_ = self->priv->reader;
		_tmp52_ = valadoc_markup_reader_get_name (_tmp51_);
		_tmp53_ = _tmp52_;
		_tmp49_ = g_strcmp0 (_tmp53_, "parameters") == 0;
	} else {
		_tmp49_ = FALSE;
	}
	if (_tmp49_) {
		gboolean _tmp54_ = FALSE;
		ValadocMarkupTokenType _tmp55_;
		valadoc_importer_gir_documentation_importer_start_element (self, "parameters");
		valadoc_importer_gir_documentation_importer_next (self);
		_tmp55_ = self->priv->current_token;
		if (_tmp55_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT) {
			ValadocMarkupReader* _tmp56_;
			const gchar* _tmp57_;
			const gchar* _tmp58_;
			_tmp56_ = self->priv->reader;
			_tmp57_ = valadoc_markup_reader_get_name (_tmp56_);
			_tmp58_ = _tmp57_;
			_tmp54_ = g_strcmp0 (_tmp58_, "instance-parameter") == 0;
		} else {
			_tmp54_ = FALSE;
		}
		if (_tmp54_) {
			gchar* instance_param_name = NULL;
			ValadocMarkupReader* _tmp59_;
			gchar* _tmp60_;
			ValadocApiSourceComment* param_comment = NULL;
			ValadocApiSourceComment* _tmp61_;
			ValadocApiSourceComment* _tmp62_;
			_tmp59_ = self->priv->reader;
			_tmp60_ = valadoc_markup_reader_get_attribute (_tmp59_, "name");
			instance_param_name = _tmp60_;
			valadoc_importer_gir_documentation_importer_next (self);
			_tmp61_ = valadoc_importer_gir_documentation_importer_parse_doc (self, "doc");
			param_comment = _tmp61_;
			valadoc_importer_gir_documentation_importer_parse_type (self, NULL);
			valadoc_importer_gir_documentation_importer_end_element (self, "instance-parameter");
			_tmp62_ = param_comment;
			if (_tmp62_ != NULL) {
				ValadocApiGirSourceComment* _tmp63_;
				ValadocApiGirSourceComment* _tmp74_;
				const gchar* _tmp75_;
				ValadocApiSourceComment* _tmp76_;
				ValadocApiGirSourceComment* _tmp77_;
				const gchar* _tmp78_;
				_tmp63_ = comment;
				if (_tmp63_ == NULL) {
					ValadocApiSourceFile* _tmp64_;
					ValadocMarkupSourceLocation _tmp65_;
					gint _tmp66_;
					ValadocMarkupSourceLocation _tmp67_;
					gint _tmp68_;
					ValadocMarkupSourceLocation _tmp69_;
					gint _tmp70_;
					ValadocMarkupSourceLocation _tmp71_;
					gint _tmp72_;
					ValadocApiGirSourceComment* _tmp73_;
					_tmp64_ = self->priv->file;
					_tmp65_ = self->priv->begin;
					_tmp66_ = _tmp65_.line;
					_tmp67_ = self->priv->begin;
					_tmp68_ = _tmp67_.column;
					_tmp69_ = self->priv->end;
					_tmp70_ = _tmp69_.line;
					_tmp71_ = self->priv->end;
					_tmp72_ = _tmp71_.column;
					_tmp73_ = valadoc_api_gir_source_comment_new ("", _tmp64_, _tmp66_, _tmp68_, _tmp70_, _tmp72_);
					_valadoc_api_source_comment_unref0 (comment);
					comment = _tmp73_;
				}
				_tmp74_ = comment;
				_tmp75_ = instance_param_name;
				_tmp76_ = param_comment;
				valadoc_api_gir_source_comment_add_parameter_content (_tmp74_, _tmp75_, _tmp76_);
				_tmp77_ = comment;
				_tmp78_ = instance_param_name;
				valadoc_api_gir_source_comment_set_instance_param_name (_tmp77_, _tmp78_);
			}
			_valadoc_api_source_comment_unref0 (param_comment);
			_g_free0 (instance_param_name);
		}
		{
			gint pcount = 0;
			pcount = 0;
			{
				gboolean _tmp79_ = FALSE;
				_tmp79_ = TRUE;
				while (TRUE) {
					ValadocMarkupTokenType _tmp81_;
					ValadocApiSourceComment* param_comment = NULL;
					gint array_length_pos = 0;
					gint destroy_pos = 0;
					gint closure_pos = 0;
					gchar* param_name = NULL;
					ValadocApiSourceComment* _tmp82_ = NULL;
					gchar* _tmp83_ = NULL;
					gint _tmp84_ = 0;
					gint _tmp85_ = 0;
					gint _tmp86_ = 0;
					gchar** _tmp87_;
					gint _tmp87__length1;
					const gchar* _tmp88_;
					gchar* _tmp89_;
					gboolean _tmp90_ = FALSE;
					gint _tmp91_;
					gboolean _tmp98_ = FALSE;
					gint _tmp99_;
					gboolean _tmp106_ = FALSE;
					gint _tmp107_;
					ValadocApiSourceComment* _tmp114_;
					if (!_tmp79_) {
						gint _tmp80_;
						_tmp80_ = pcount;
						pcount = _tmp80_ + 1;
					}
					_tmp79_ = FALSE;
					_tmp81_ = self->priv->current_token;
					if (!(_tmp81_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
						break;
					}
					valadoc_importer_gir_documentation_importer_parse_parameter (self, &_tmp82_, &_tmp83_, &_tmp84_, &_tmp85_, &_tmp86_);
					_valadoc_api_source_comment_unref0 (param_comment);
					param_comment = _tmp82_;
					_g_free0 (param_name);
					param_name = _tmp83_;
					destroy_pos = _tmp84_;
					closure_pos = _tmp85_;
					array_length_pos = _tmp86_;
					_tmp87_ = param_names;
					_tmp87__length1 = param_names_length1;
					_tmp88_ = param_name;
					_tmp89_ = g_strdup (_tmp88_);
					_vala_array_add3 (&param_names, &param_names_length1, &_param_names_size_, _tmp89_);
					_tmp91_ = destroy_pos;
					if (_tmp91_ >= 0) {
						gint _tmp92_;
						gint _tmp93_;
						_tmp92_ = pcount;
						_tmp93_ = destroy_pos;
						_tmp90_ = _tmp92_ != _tmp93_;
					} else {
						_tmp90_ = FALSE;
					}
					if (_tmp90_) {
						ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp94_;
						gint _tmp94__length1;
						gint _tmp95_;
						gint _tmp96_;
						ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp97_ = {0};
						_tmp94_ = destroy_notifies;
						_tmp94__length1 = destroy_notifies_length1;
						_tmp95_ = pcount;
						_tmp96_ = destroy_pos;
						valadoc_importer_gir_documentation_importer_implicit_parameter_pos_init (&_tmp97_, _tmp95_, _tmp96_);
						_vala_array_add4 (&destroy_notifies, &destroy_notifies_length1, &_destroy_notifies_size_, &_tmp97_);
					}
					_tmp99_ = closure_pos;
					if (_tmp99_ >= 0) {
						gint _tmp100_;
						gint _tmp101_;
						_tmp100_ = pcount;
						_tmp101_ = closure_pos;
						_tmp98_ = _tmp100_ != _tmp101_;
					} else {
						_tmp98_ = FALSE;
					}
					if (_tmp98_) {
						ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp102_;
						gint _tmp102__length1;
						gint _tmp103_;
						gint _tmp104_;
						ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp105_ = {0};
						_tmp102_ = closures;
						_tmp102__length1 = closures_length1;
						_tmp103_ = pcount;
						_tmp104_ = closure_pos;
						valadoc_importer_gir_documentation_importer_implicit_parameter_pos_init (&_tmp105_, _tmp103_, _tmp104_);
						_vala_array_add5 (&closures, &closures_length1, &_closures_size_, &_tmp105_);
					}
					_tmp107_ = array_length_pos;
					if (_tmp107_ >= 0) {
						gint _tmp108_;
						gint _tmp109_;
						_tmp108_ = pcount;
						_tmp109_ = destroy_pos;
						_tmp106_ = _tmp108_ != _tmp109_;
					} else {
						_tmp106_ = FALSE;
					}
					if (_tmp106_) {
						ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp110_;
						gint _tmp110__length1;
						gint _tmp111_;
						gint _tmp112_;
						ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp113_ = {0};
						_tmp110_ = array_lengths;
						_tmp110__length1 = array_lengths_length1;
						_tmp111_ = pcount;
						_tmp112_ = array_length_pos;
						valadoc_importer_gir_documentation_importer_implicit_parameter_pos_init (&_tmp113_, _tmp111_, _tmp112_);
						_vala_array_add6 (&array_lengths, &array_lengths_length1, &_array_lengths_size_, &_tmp113_);
					}
					_tmp114_ = param_comment;
					if (_tmp114_ != NULL) {
						ValadocApiGirSourceComment* _tmp115_;
						ValadocApiGirSourceComment* _tmp126_;
						const gchar* _tmp127_;
						ValadocApiSourceComment* _tmp128_;
						_tmp115_ = comment;
						if (_tmp115_ == NULL) {
							ValadocApiSourceFile* _tmp116_;
							ValadocMarkupSourceLocation _tmp117_;
							gint _tmp118_;
							ValadocMarkupSourceLocation _tmp119_;
							gint _tmp120_;
							ValadocMarkupSourceLocation _tmp121_;
							gint _tmp122_;
							ValadocMarkupSourceLocation _tmp123_;
							gint _tmp124_;
							ValadocApiGirSourceComment* _tmp125_;
							_tmp116_ = self->priv->file;
							_tmp117_ = self->priv->begin;
							_tmp118_ = _tmp117_.line;
							_tmp119_ = self->priv->begin;
							_tmp120_ = _tmp119_.column;
							_tmp121_ = self->priv->end;
							_tmp122_ = _tmp121_.line;
							_tmp123_ = self->priv->end;
							_tmp124_ = _tmp123_.column;
							_tmp125_ = valadoc_api_gir_source_comment_new ("", _tmp116_, _tmp118_, _tmp120_, _tmp122_, _tmp124_);
							_valadoc_api_source_comment_unref0 (comment);
							comment = _tmp125_;
						}
						_tmp126_ = comment;
						_tmp127_ = param_name;
						_tmp128_ = param_comment;
						valadoc_api_gir_source_comment_add_parameter_content (_tmp126_, _tmp127_, _tmp128_);
					}
					_g_free0 (param_name);
					_valadoc_api_source_comment_unref0 (param_comment);
				}
			}
		}
		valadoc_importer_gir_documentation_importer_end_element (self, "parameters");
	}
	_tmp129_ = c_identifier;
	_tmp130_ = comment;
	_tmp131_ = param_names;
	_tmp131__length1 = param_names_length1;
	_tmp132_ = destroy_notifies;
	_tmp132__length1 = destroy_notifies_length1;
	_tmp133_ = closures;
	_tmp133__length1 = closures_length1;
	_tmp134_ = array_lengths;
	_tmp134__length1 = array_lengths_length1;
	_tmp135_ = array_length_ret;
	valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp129_, _tmp130_, _tmp131_, _tmp131__length1, _tmp132_, _tmp132__length1, _tmp133_, _tmp133__length1, _tmp134_, _tmp134__length1, _tmp135_);
	_tmp136_ = element_name;
	valadoc_importer_gir_documentation_importer_end_element (self, _tmp136_);
	param_names = (_vala_array_free (param_names, param_names_length1, (GDestroyNotify) g_free), NULL);
	closures = (g_free (closures), NULL);
	array_lengths = (g_free (array_lengths), NULL);
	destroy_notifies = (g_free (destroy_notifies), NULL);
	_valadoc_api_source_comment_unref0 (comment);
	_g_free0 (c_identifier);
}


static void valadoc_importer_gir_documentation_importer_parse_method (ValadocImporterGirDocumentationImporter* self, const gchar* element_name) {
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (element_name != NULL);
	_tmp0_ = element_name;
	valadoc_importer_gir_documentation_importer_parse_function (self, _tmp0_);
}


static void valadoc_importer_gir_documentation_importer_parse_signal (ValadocImporterGirDocumentationImporter* self) {
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_parse_function (self, "glib:signal");
}


static void valadoc_importer_gir_documentation_importer_parse_boxed (ValadocImporterGirDocumentationImporter* self, const gchar* element_name) {
	const gchar* _tmp0_;
	ValadocMarkupReader* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	ValadocApiGirSourceComment* _tmp6_;
	ValadocApiGirSourceComment* _tmp7_;
	const gchar* _tmp29_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (element_name != NULL);
	_tmp0_ = element_name;
	valadoc_importer_gir_documentation_importer_start_element (self, _tmp0_);
	_tmp1_ = self->priv->reader;
	_tmp2_ = valadoc_markup_reader_get_attribute (_tmp1_, "name");
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = _tmp2_;
	_tmp3_ = self->priv->parent_c_identifier;
	if (_tmp3_ == NULL) {
		ValadocMarkupReader* _tmp4_;
		gchar* _tmp5_;
		_tmp4_ = self->priv->reader;
		_tmp5_ = valadoc_markup_reader_get_attribute (_tmp4_, "glib:name");
		_g_free0 (self->priv->parent_c_identifier);
		self->priv->parent_c_identifier = _tmp5_;
	}
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp6_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	_tmp7_ = _tmp6_;
	_valadoc_api_source_comment_unref0 (_tmp7_);
	while (TRUE) {
		ValadocMarkupTokenType _tmp8_;
		ValadocMarkupReader* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp8_ = self->priv->current_token;
		if (!(_tmp8_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
			break;
		}
		_tmp9_ = self->priv->reader;
		_tmp10_ = valadoc_markup_reader_get_name (_tmp9_);
		_tmp11_ = _tmp10_;
		if (g_strcmp0 (_tmp11_, "field") == 0) {
			valadoc_importer_gir_documentation_importer_parse_field (self);
		} else {
			ValadocMarkupReader* _tmp12_;
			const gchar* _tmp13_;
			const gchar* _tmp14_;
			_tmp12_ = self->priv->reader;
			_tmp13_ = valadoc_markup_reader_get_name (_tmp12_);
			_tmp14_ = _tmp13_;
			if (g_strcmp0 (_tmp14_, "constructor") == 0) {
				valadoc_importer_gir_documentation_importer_parse_constructor (self);
			} else {
				ValadocMarkupReader* _tmp15_;
				const gchar* _tmp16_;
				const gchar* _tmp17_;
				_tmp15_ = self->priv->reader;
				_tmp16_ = valadoc_markup_reader_get_name (_tmp15_);
				_tmp17_ = _tmp16_;
				if (g_strcmp0 (_tmp17_, "method") == 0) {
					valadoc_importer_gir_documentation_importer_parse_method (self, "method");
				} else {
					ValadocMarkupReader* _tmp18_;
					const gchar* _tmp19_;
					const gchar* _tmp20_;
					_tmp18_ = self->priv->reader;
					_tmp19_ = valadoc_markup_reader_get_name (_tmp18_);
					_tmp20_ = _tmp19_;
					if (g_strcmp0 (_tmp20_, "function") == 0) {
						valadoc_importer_gir_documentation_importer_skip_element (self);
					} else {
						ValadocMarkupReader* _tmp21_;
						const gchar* _tmp22_;
						const gchar* _tmp23_;
						_tmp21_ = self->priv->reader;
						_tmp22_ = valadoc_markup_reader_get_name (_tmp21_);
						_tmp23_ = _tmp22_;
						if (g_strcmp0 (_tmp23_, "union") == 0) {
							valadoc_importer_gir_documentation_importer_parse_union (self);
						} else {
							ValadocMarkupReader* _tmp24_;
							const gchar* _tmp25_;
							const gchar* _tmp26_;
							gchar* _tmp27_;
							gchar* _tmp28_;
							_tmp24_ = self->priv->reader;
							_tmp25_ = valadoc_markup_reader_get_name (_tmp24_);
							_tmp26_ = _tmp25_;
							_tmp27_ = g_strdup_printf ("unknown child element `%s' in `class'", _tmp26_);
							_tmp28_ = _tmp27_;
							valadoc_importer_gir_documentation_importer_error (self, _tmp28_);
							_g_free0 (_tmp28_);
							valadoc_importer_gir_documentation_importer_skip_element (self);
						}
					}
				}
			}
		}
	}
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = NULL;
	_tmp29_ = element_name;
	valadoc_importer_gir_documentation_importer_end_element (self, _tmp29_);
}


static void valadoc_importer_gir_documentation_importer_parse_union (ValadocImporterGirDocumentationImporter* self) {
	ValadocMarkupReader* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	ValadocApiGirSourceComment* comment = NULL;
	ValadocApiGirSourceComment* _tmp3_;
	const gchar* _tmp4_;
	ValadocApiGirSourceComment* _tmp5_;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "union");
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_attribute (_tmp0_, "c:type");
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = _tmp1_;
	_tmp2_ = self->priv->parent_c_identifier;
	if (_tmp2_ == NULL) {
		valadoc_importer_gir_documentation_importer_skip_element (self);
		return;
	}
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp3_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	comment = _tmp3_;
	_tmp4_ = self->priv->parent_c_identifier;
	_tmp5_ = comment;
	valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp4_, _tmp5_, NULL, 0, NULL, 0, NULL, 0, NULL, 0, -1);
	while (TRUE) {
		ValadocMarkupTokenType _tmp6_;
		ValadocMarkupReader* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		_tmp6_ = self->priv->current_token;
		if (!(_tmp6_ == VALADOC_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
			break;
		}
		_tmp7_ = self->priv->reader;
		_tmp8_ = valadoc_markup_reader_get_name (_tmp7_);
		_tmp9_ = _tmp8_;
		if (g_strcmp0 (_tmp9_, "field") == 0) {
			valadoc_importer_gir_documentation_importer_parse_field (self);
		} else {
			ValadocMarkupReader* _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			_tmp10_ = self->priv->reader;
			_tmp11_ = valadoc_markup_reader_get_name (_tmp10_);
			_tmp12_ = _tmp11_;
			if (g_strcmp0 (_tmp12_, "constructor") == 0) {
				valadoc_importer_gir_documentation_importer_parse_constructor (self);
			} else {
				ValadocMarkupReader* _tmp13_;
				const gchar* _tmp14_;
				const gchar* _tmp15_;
				_tmp13_ = self->priv->reader;
				_tmp14_ = valadoc_markup_reader_get_name (_tmp13_);
				_tmp15_ = _tmp14_;
				if (g_strcmp0 (_tmp15_, "method") == 0) {
					valadoc_importer_gir_documentation_importer_parse_method (self, "method");
				} else {
					ValadocMarkupReader* _tmp16_;
					const gchar* _tmp17_;
					const gchar* _tmp18_;
					_tmp16_ = self->priv->reader;
					_tmp17_ = valadoc_markup_reader_get_name (_tmp16_);
					_tmp18_ = _tmp17_;
					if (g_strcmp0 (_tmp18_, "function") == 0) {
						valadoc_importer_gir_documentation_importer_skip_element (self);
					} else {
						ValadocMarkupReader* _tmp19_;
						const gchar* _tmp20_;
						const gchar* _tmp21_;
						_tmp19_ = self->priv->reader;
						_tmp20_ = valadoc_markup_reader_get_name (_tmp19_);
						_tmp21_ = _tmp20_;
						if (g_strcmp0 (_tmp21_, "record") == 0) {
							valadoc_importer_gir_documentation_importer_parse_record (self);
						} else {
							ValadocMarkupReader* _tmp22_;
							const gchar* _tmp23_;
							const gchar* _tmp24_;
							gchar* _tmp25_;
							gchar* _tmp26_;
							_tmp22_ = self->priv->reader;
							_tmp23_ = valadoc_markup_reader_get_name (_tmp22_);
							_tmp24_ = _tmp23_;
							_tmp25_ = g_strdup_printf ("unknown child element `%s' in `union'", _tmp24_);
							_tmp26_ = _tmp25_;
							valadoc_importer_gir_documentation_importer_error (self, _tmp26_);
							_g_free0 (_tmp26_);
							valadoc_importer_gir_documentation_importer_skip_element (self);
						}
					}
				}
			}
		}
	}
	_g_free0 (self->priv->parent_c_identifier);
	self->priv->parent_c_identifier = NULL;
	valadoc_importer_gir_documentation_importer_end_element (self, "union");
	_valadoc_api_source_comment_unref0 (comment);
}


static void valadoc_importer_gir_documentation_importer_parse_constant (ValadocImporterGirDocumentationImporter* self) {
	gchar* c_identifier = NULL;
	ValadocMarkupReader* _tmp0_;
	gchar* _tmp1_;
	ValadocApiGirSourceComment* comment = NULL;
	ValadocApiGirSourceComment* _tmp2_;
	g_return_if_fail (self != NULL);
	valadoc_importer_gir_documentation_importer_start_element (self, "constant");
	_tmp0_ = self->priv->reader;
	_tmp1_ = valadoc_markup_reader_get_attribute (_tmp0_, "c:type");
	c_identifier = _tmp1_;
	valadoc_importer_gir_documentation_importer_next (self);
	_tmp2_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
	comment = _tmp2_;
	valadoc_importer_gir_documentation_importer_attach_comment (self, c_identifier, comment, NULL, 0, NULL, 0, NULL, 0, NULL, 0, -1);
	valadoc_importer_gir_documentation_importer_parse_type (self, NULL);
	valadoc_importer_gir_documentation_importer_end_element (self, "constant");
	_valadoc_api_source_comment_unref0 (comment);
	_g_free0 (c_identifier);
}


static const gchar* valadoc_importer_gir_documentation_importer_real_get_file_extension (ValadocImporterDocumentationImporter* base) {
	const gchar* result;
	ValadocImporterGirDocumentationImporter* self;
	self = (ValadocImporterGirDocumentationImporter*) base;
	result = "gir";
	return result;
}


static void valadoc_importer_gir_documentation_importer_implicit_parameter_pos_init (ValadocImporterGirDocumentationImporterImplicitParameterPos *self, gint parameter, gint position) {
	gint _tmp0_;
	gint _tmp1_;
	memset (self, 0, sizeof (ValadocImporterGirDocumentationImporterImplicitParameterPos));
	_tmp0_ = parameter;
	(*self).parameter = _tmp0_;
	_tmp1_ = position;
	(*self).position = _tmp1_;
}


static ValadocImporterGirDocumentationImporterImplicitParameterPos* valadoc_importer_gir_documentation_importer_implicit_parameter_pos_dup (const ValadocImporterGirDocumentationImporterImplicitParameterPos* self) {
	ValadocImporterGirDocumentationImporterImplicitParameterPos* dup;
	dup = g_new0 (ValadocImporterGirDocumentationImporterImplicitParameterPos, 1);
	memcpy (dup, self, sizeof (ValadocImporterGirDocumentationImporterImplicitParameterPos));
	return dup;
}


static void valadoc_importer_gir_documentation_importer_implicit_parameter_pos_free (ValadocImporterGirDocumentationImporterImplicitParameterPos* self) {
	g_free (self);
}


static GType valadoc_importer_gir_documentation_importer_implicit_parameter_pos_get_type (void) {
	static volatile gsize valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id__volatile = 0;
	if (g_once_init_enter (&valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id__volatile)) {
		GType valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id;
		valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id = g_boxed_type_register_static ("ValadocImporterGirDocumentationImporterImplicitParameterPos", (GBoxedCopyFunc) valadoc_importer_gir_documentation_importer_implicit_parameter_pos_dup, (GBoxedFreeFunc) valadoc_importer_gir_documentation_importer_implicit_parameter_pos_free);
		g_once_init_leave (&valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id__volatile, valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id);
	}
	return valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id__volatile;
}


static void valadoc_importer_gir_documentation_importer_class_init (ValadocImporterGirDocumentationImporterClass * klass) {
	valadoc_importer_gir_documentation_importer_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ValadocImporterGirDocumentationImporterPrivate));
	((ValadocImporterDocumentationImporterClass *) klass)->process = (void (*) (ValadocImporterDocumentationImporter *, const gchar*)) valadoc_importer_gir_documentation_importer_real_process;
	VALADOC_IMPORTER_DOCUMENTATION_IMPORTER_CLASS (klass)->get_file_extension = valadoc_importer_gir_documentation_importer_real_get_file_extension;
	G_OBJECT_CLASS (klass)->get_property = _vala_valadoc_importer_gir_documentation_importer_get_property;
	G_OBJECT_CLASS (klass)->finalize = valadoc_importer_gir_documentation_importer_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_FILE_EXTENSION_PROPERTY, valadoc_importer_gir_documentation_importer_properties[VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_FILE_EXTENSION_PROPERTY] = g_param_spec_string ("file-extension", "file-extension", "file-extension", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void valadoc_importer_gir_documentation_importer_instance_init (ValadocImporterGirDocumentationImporter * self) {
	self->priv = VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_GET_PRIVATE (self);
}


static void valadoc_importer_gir_documentation_importer_finalize (GObject * obj) {
	ValadocImporterGirDocumentationImporter * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_IMPORTER_TYPE_GIR_DOCUMENTATION_IMPORTER, ValadocImporterGirDocumentationImporter);
	_g_object_unref0 (self->priv->reader);
	_g_object_unref0 (self->priv->parser);
	_g_object_unref0 (self->priv->reporter);
	_g_object_unref0 (self->priv->file);
	_g_free0 (self->priv->parent_c_identifier);
	G_OBJECT_CLASS (valadoc_importer_gir_documentation_importer_parent_class)->finalize (obj);
}


GType valadoc_importer_gir_documentation_importer_get_type (void) {
	static volatile gsize valadoc_importer_gir_documentation_importer_type_id__volatile = 0;
	if (g_once_init_enter (&valadoc_importer_gir_documentation_importer_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ValadocImporterGirDocumentationImporterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_importer_gir_documentation_importer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocImporterGirDocumentationImporter), 0, (GInstanceInitFunc) valadoc_importer_gir_documentation_importer_instance_init, NULL };
		GType valadoc_importer_gir_documentation_importer_type_id;
		valadoc_importer_gir_documentation_importer_type_id = g_type_register_static (VALADOC_IMPORTER_TYPE_DOCUMENTATION_IMPORTER, "ValadocImporterGirDocumentationImporter", &g_define_type_info, 0);
		g_once_init_leave (&valadoc_importer_gir_documentation_importer_type_id__volatile, valadoc_importer_gir_documentation_importer_type_id);
	}
	return valadoc_importer_gir_documentation_importer_type_id__volatile;
}


static void _vala_valadoc_importer_gir_documentation_importer_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	ValadocImporterGirDocumentationImporter * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_IMPORTER_TYPE_GIR_DOCUMENTATION_IMPORTER, ValadocImporterGirDocumentationImporter);
	switch (property_id) {
		case VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_FILE_EXTENSION_PROPERTY:
		g_value_set_string (value, valadoc_importer_documentation_importer_get_file_extension ((ValadocImporterDocumentationImporter*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



