1 /* wikiscanner.c generated by valac, the Vala compiler
2  * generated from wikiscanner.vala, do not modify */
3 
4 /* wikiscanner.vala
5  *
6  * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
21  *
22  * Author:
23  * 	Didier 'Ptitjes Villevalois <ptitjes@free.fr>
24  */
25 
26 #include "valadoc.h"
27 #include <stdlib.h>
28 #include <string.h>
29 #include <glib.h>
30 #include <glib-object.h>
31 #include <vala.h>
32 
33 enum  {
34 	VALADOC_WIKI_SCANNER_0_PROPERTY,
35 	VALADOC_WIKI_SCANNER_NUM_PROPERTIES
36 };
37 static GParamSpec* valadoc_wiki_scanner_properties[VALADOC_WIKI_SCANNER_NUM_PROPERTIES];
38 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
39 #define _valadoc_parser_unref0(var) ((var == NULL) ? NULL : (var = (valadoc_parser_unref (var), NULL)))
40 #define _g_free0(var) (var = (g_free (var), NULL))
41 #define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
42 
43 struct _ValadocWikiScannerPrivate {
44 	ValadocSettings* _settings;
45 	ValadocParser* _parser;
46 	gchar* _content;
47 	const gchar* _index;
48 	gboolean _stop;
49 	gint _last_line;
50 	gint _last_column;
51 	gint _line;
52 	gint _column;
53 	gboolean _url_escape_mode;
54 	gboolean _code_escape_mode;
55 	gunichar _last_char;
56 	gint _skip;
57 	GString* _current_string;
58 };
59 
60 static gint ValadocWikiScanner_private_offset;
61 static gpointer valadoc_wiki_scanner_parent_class = NULL;
62 static ValadocScannerIface * valadoc_wiki_scanner_valadoc_scanner_parent_iface = NULL;
63 
64 static void valadoc_wiki_scanner_real_set_parser (ValadocScanner* base,
65                                            ValadocParser* parser);
66 static void valadoc_wiki_scanner_real_reset (ValadocWikiScanner* self);
67 static void valadoc_wiki_scanner_real_scan (ValadocScanner* base,
68                                      const gchar* content,
69                                      GError** error);
70 static void valadoc_wiki_scanner_real_end (ValadocScanner* base,
71                                     GError** error);
72 static void valadoc_wiki_scanner_emit_token (ValadocWikiScanner* self,
73                                       ValadocTokenType* type,
74                                       GError** error);
75 static void valadoc_wiki_scanner_real_stop (ValadocWikiScanner* self);
76 static gchar* valadoc_wiki_scanner_real_get_line_content (ValadocWikiScanner* self);
77 static void valadoc_wiki_scanner_real_accept (ValadocWikiScanner* self,
78                                        gunichar c,
79                                        GError** error);
80 static void valadoc_wiki_scanner_append_char (ValadocWikiScanner* self,
81                                        gunichar c);
82 static void valadoc_wiki_scanner_look_for_three (ValadocWikiScanner* self,
83                                           gunichar c,
84                                           ValadocTokenType* one,
85                                           ValadocTokenType* two,
86                                           ValadocTokenType* three,
87                                           GError** error);
88 static void valadoc_wiki_scanner_look_for_two_or_append (ValadocWikiScanner* self,
89                                                   gunichar c,
90                                                   ValadocTokenType* type,
91                                                   GError** error);
92 static void valadoc_wiki_scanner_look_for_two (ValadocWikiScanner* self,
93                                         gunichar c,
94                                         ValadocTokenType* one,
95                                         ValadocTokenType* two,
96                                         GError** error);
97 static void valadoc_wiki_scanner_look_for_five (ValadocWikiScanner* self,
98                                          gunichar c,
99                                          ValadocTokenType* one,
100                                          ValadocTokenType* two,
101                                          ValadocTokenType* three,
102                                          ValadocTokenType* four,
103                                          ValadocTokenType* five,
104                                          GError** error);
105 static gboolean valadoc_wiki_scanner_look_for (ValadocWikiScanner* self,
106                                         const gchar* str,
107                                         ValadocTokenType* type,
108                                         GError** error);
109 static gint valadoc_wiki_scanner_real_get_line_start_column (ValadocWikiScanner* self);
110 static void valadoc_wiki_scanner_get_begin (ValadocWikiScanner* self,
111                                      ValaSourceLocation* result);
112 static void valadoc_wiki_scanner_get_end (ValadocWikiScanner* self,
113                                    gint offset,
114                                    ValaSourceLocation* result);
115 static void valadoc_wiki_scanner_emit_current_word (ValadocWikiScanner* self,
116                                              GError** error);
117 static void valadoc_wiki_scanner_finalize (GObject * obj);
118 static GType valadoc_wiki_scanner_get_type_once (void);
119 
120 static inline gpointer
valadoc_wiki_scanner_get_instance_private(ValadocWikiScanner * self)121 valadoc_wiki_scanner_get_instance_private (ValadocWikiScanner* self)
122 {
123 	return G_STRUCT_MEMBER_P (self, ValadocWikiScanner_private_offset);
124 }
125 
126 static gpointer
_g_object_ref0(gpointer self)127 _g_object_ref0 (gpointer self)
128 {
129 	return self ? g_object_ref (self) : NULL;
130 }
131 
132 ValadocWikiScanner*
valadoc_wiki_scanner_construct(GType object_type,ValadocSettings * settings)133 valadoc_wiki_scanner_construct (GType object_type,
134                                 ValadocSettings* settings)
135 {
136 	ValadocWikiScanner * self = NULL;
137 	ValadocSettings* _tmp0_;
138 	g_return_val_if_fail (settings != NULL, NULL);
139 	self = (ValadocWikiScanner*) g_object_new (object_type, NULL);
140 	_tmp0_ = _g_object_ref0 (settings);
141 	_g_object_unref0 (self->priv->_settings);
142 	self->priv->_settings = _tmp0_;
143 	return self;
144 }
145 
146 ValadocWikiScanner*
valadoc_wiki_scanner_new(ValadocSettings * settings)147 valadoc_wiki_scanner_new (ValadocSettings* settings)
148 {
149 	return valadoc_wiki_scanner_construct (VALADOC_TYPE_WIKI_SCANNER, settings);
150 }
151 
152 static gpointer
_valadoc_parser_ref0(gpointer self)153 _valadoc_parser_ref0 (gpointer self)
154 {
155 	return self ? valadoc_parser_ref (self) : NULL;
156 }
157 
158 static void
valadoc_wiki_scanner_real_set_parser(ValadocScanner * base,ValadocParser * parser)159 valadoc_wiki_scanner_real_set_parser (ValadocScanner* base,
160                                       ValadocParser* parser)
161 {
162 	ValadocWikiScanner * self;
163 	ValadocParser* _tmp0_;
164 	self = (ValadocWikiScanner*) base;
165 	g_return_if_fail (parser != NULL);
166 	_tmp0_ = _valadoc_parser_ref0 (parser);
167 	_valadoc_parser_unref0 (self->priv->_parser);
168 	self->priv->_parser = _tmp0_;
169 }
170 
171 static void
valadoc_wiki_scanner_real_reset(ValadocWikiScanner * self)172 valadoc_wiki_scanner_real_reset (ValadocWikiScanner* self)
173 {
174 	GString* _tmp0_;
175 	self->priv->_stop = FALSE;
176 	self->priv->_last_line = 0;
177 	self->priv->_last_column = 0;
178 	self->priv->_line = 0;
179 	self->priv->_column = 0;
180 	self->priv->_url_escape_mode = FALSE;
181 	self->priv->_code_escape_mode = FALSE;
182 	self->priv->_last_char = (gunichar) 0;
183 	self->priv->_skip = 0;
184 	_tmp0_ = self->priv->_current_string;
185 	g_string_erase (_tmp0_, (gssize) 0, (gssize) -1);
186 }
187 
188 void
valadoc_wiki_scanner_reset(ValadocWikiScanner * self)189 valadoc_wiki_scanner_reset (ValadocWikiScanner* self)
190 {
191 	g_return_if_fail (self != NULL);
192 	VALADOC_WIKI_SCANNER_GET_CLASS (self)->reset (self);
193 }
194 
195 static gunichar
string_get_char(const gchar * self,glong index)196 string_get_char (const gchar* self,
197                  glong index)
198 {
199 	gunichar result = 0U;
200 	g_return_val_if_fail (self != NULL, 0U);
201 	result = g_utf8_get_char (((gchar*) self) + index);
202 	return result;
203 }
204 
205 static void
valadoc_wiki_scanner_real_scan(ValadocScanner * base,const gchar * content,GError ** error)206 valadoc_wiki_scanner_real_scan (ValadocScanner* base,
207                                 const gchar* content,
208                                 GError** error)
209 {
210 	ValadocWikiScanner * self;
211 	gchar* _tmp0_;
212 	GError* _inner_error0_ = NULL;
213 	self = (ValadocWikiScanner*) base;
214 	g_return_if_fail (content != NULL);
215 	_tmp0_ = g_strdup (content);
216 	_g_free0 (self->priv->_content);
217 	self->priv->_content = _tmp0_;
218 	{
219 		const gchar* _tmp1_;
220 		gboolean _tmp2_ = FALSE;
221 		_tmp1_ = self->priv->_content;
222 		self->priv->_index = _tmp1_;
223 		_tmp2_ = TRUE;
224 		while (TRUE) {
225 			gboolean _tmp5_ = FALSE;
226 			gunichar c = 0U;
227 			const gchar* _tmp7_;
228 			if (!_tmp2_) {
229 				const gchar* _tmp3_;
230 				const gchar* _tmp4_;
231 				_tmp3_ = self->priv->_index;
232 				_tmp4_ = g_utf8_next_char (_tmp3_);
233 				self->priv->_index = _tmp4_;
234 			}
235 			_tmp2_ = FALSE;
236 			if (!self->priv->_stop) {
237 				const gchar* _tmp6_;
238 				_tmp6_ = self->priv->_index;
239 				_tmp5_ = string_get_char (_tmp6_, (glong) 0) != ((gunichar) 0);
240 			} else {
241 				_tmp5_ = FALSE;
242 			}
243 			if (!_tmp5_) {
244 				break;
245 			}
246 			_tmp7_ = self->priv->_index;
247 			c = string_get_char (_tmp7_, (glong) 0);
248 			valadoc_wiki_scanner_accept (self, c, &_inner_error0_);
249 			if (G_UNLIKELY (_inner_error0_ != NULL)) {
250 				if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
251 					g_propagate_error (error, _inner_error0_);
252 					return;
253 				} else {
254 					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
255 					g_clear_error (&_inner_error0_);
256 					return;
257 				}
258 			}
259 		}
260 	}
261 }
262 
263 static void
valadoc_wiki_scanner_real_end(ValadocScanner * base,GError ** error)264 valadoc_wiki_scanner_real_end (ValadocScanner* base,
265                                GError** error)
266 {
267 	ValadocWikiScanner * self;
268 	ValadocTokenType* _tmp0_;
269 	GError* _inner_error0_ = NULL;
270 	self = (ValadocWikiScanner*) base;
271 	_tmp0_ = valadoc_token_type_EOF;
272 	valadoc_wiki_scanner_emit_token (self, _tmp0_, &_inner_error0_);
273 	if (G_UNLIKELY (_inner_error0_ != NULL)) {
274 		if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
275 			g_propagate_error (error, _inner_error0_);
276 			return;
277 		} else {
278 			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
279 			g_clear_error (&_inner_error0_);
280 			return;
281 		}
282 	}
283 }
284 
285 static void
valadoc_wiki_scanner_real_stop(ValadocWikiScanner * self)286 valadoc_wiki_scanner_real_stop (ValadocWikiScanner* self)
287 {
288 	self->priv->_stop = TRUE;
289 }
290 
291 void
valadoc_wiki_scanner_stop(ValadocWikiScanner * self)292 valadoc_wiki_scanner_stop (ValadocWikiScanner* self)
293 {
294 	g_return_if_fail (self != NULL);
295 	VALADOC_WIKI_SCANNER_GET_CLASS (self)->stop (self);
296 }
297 
298 void
valadoc_wiki_scanner_set_url_escape_mode(ValadocWikiScanner * self,gboolean escape_mode)299 valadoc_wiki_scanner_set_url_escape_mode (ValadocWikiScanner* self,
300                                           gboolean escape_mode)
301 {
302 	g_return_if_fail (self != NULL);
303 	self->priv->_url_escape_mode = escape_mode;
304 }
305 
306 void
valadoc_wiki_scanner_set_code_escape_mode(ValadocWikiScanner * self,gboolean escape_mode)307 valadoc_wiki_scanner_set_code_escape_mode (ValadocWikiScanner* self,
308                                            gboolean escape_mode)
309 {
310 	g_return_if_fail (self != NULL);
311 	self->priv->_code_escape_mode = escape_mode;
312 }
313 
314 gint
valadoc_wiki_scanner_get_line(ValadocWikiScanner * self)315 valadoc_wiki_scanner_get_line (ValadocWikiScanner* self)
316 {
317 	gint result = 0;
318 	g_return_val_if_fail (self != NULL, 0);
319 	result = self->priv->_line;
320 	return result;
321 }
322 
323 static gchar*
valadoc_wiki_scanner_real_get_line_content(ValadocWikiScanner * self)324 valadoc_wiki_scanner_real_get_line_content (ValadocWikiScanner* self)
325 {
326 	GString* builder = NULL;
327 	GString* _tmp0_;
328 	const gchar* line_start = NULL;
329 	const gchar* _tmp1_;
330 	gunichar c = 0U;
331 	GString* _tmp15_;
332 	const gchar* _tmp16_;
333 	gchar* _tmp17_;
334 	gchar* result = NULL;
335 	_tmp0_ = g_string_new ("");
336 	builder = _tmp0_;
337 	_tmp1_ = self->priv->_index;
338 	line_start = _tmp1_;
339 	while (TRUE) {
340 		gboolean _tmp2_ = FALSE;
341 		const gchar* _tmp3_;
342 		const gchar* _tmp4_;
343 		const gchar* _tmp7_;
344 		const gchar* _tmp8_;
345 		_tmp3_ = line_start;
346 		_tmp4_ = self->priv->_content;
347 		if (((gchar*) _tmp3_) > ((gchar*) _tmp4_)) {
348 			const gchar* _tmp5_;
349 			const gchar* _tmp6_;
350 			_tmp5_ = line_start;
351 			_tmp6_ = g_utf8_prev_char (_tmp5_);
352 			_tmp2_ = string_get_char (_tmp6_, (glong) 0) != ((gunichar) '\n');
353 		} else {
354 			_tmp2_ = FALSE;
355 		}
356 		if (!_tmp2_) {
357 			break;
358 		}
359 		_tmp7_ = line_start;
360 		_tmp8_ = g_utf8_prev_char (_tmp7_);
361 		line_start = _tmp8_;
362 	}
363 	while (TRUE) {
364 		gboolean _tmp9_ = FALSE;
365 		const gchar* _tmp10_;
366 		const gchar* _tmp13_;
367 		const gchar* _tmp14_;
368 		_tmp10_ = line_start;
369 		c = string_get_char (_tmp10_, (glong) 0);
370 		if (c != ((gunichar) '\n')) {
371 			_tmp9_ = c != ((gunichar) '\0');
372 		} else {
373 			_tmp9_ = FALSE;
374 		}
375 		if (!_tmp9_) {
376 			break;
377 		}
378 		if (c == ((gunichar) '\t')) {
379 			GString* _tmp11_;
380 			_tmp11_ = builder;
381 			g_string_append_c (_tmp11_, ' ');
382 		} else {
383 			GString* _tmp12_;
384 			_tmp12_ = builder;
385 			g_string_append_unichar (_tmp12_, c);
386 		}
387 		_tmp13_ = line_start;
388 		_tmp14_ = g_utf8_next_char (_tmp13_);
389 		line_start = _tmp14_;
390 	}
391 	_tmp15_ = builder;
392 	_tmp16_ = _tmp15_->str;
393 	_tmp17_ = g_strdup (_tmp16_);
394 	result = _tmp17_;
395 	_g_string_free0 (builder);
396 	return result;
397 }
398 
399 gchar*
valadoc_wiki_scanner_get_line_content(ValadocWikiScanner * self)400 valadoc_wiki_scanner_get_line_content (ValadocWikiScanner* self)
401 {
402 	g_return_val_if_fail (self != NULL, NULL);
403 	return VALADOC_WIKI_SCANNER_GET_CLASS (self)->get_line_content (self);
404 }
405 
406 static gint
string_index_of_nth_char(const gchar * self,glong c)407 string_index_of_nth_char (const gchar* self,
408                           glong c)
409 {
410 	gchar* _tmp0_;
411 	gint result = 0;
412 	g_return_val_if_fail (self != NULL, 0);
413 	_tmp0_ = g_utf8_offset_to_pointer (self, c);
414 	result = (gint) (_tmp0_ - ((gchar*) self));
415 	return result;
416 }
417 
418 gunichar
valadoc_wiki_scanner_get_next_char(ValadocWikiScanner * self,gint offset)419 valadoc_wiki_scanner_get_next_char (ValadocWikiScanner* self,
420                                     gint offset)
421 {
422 	const gchar* _tmp0_;
423 	const gchar* _tmp1_;
424 	gunichar result = 0U;
425 	g_return_val_if_fail (self != NULL, 0U);
426 	_tmp0_ = self->priv->_index;
427 	_tmp1_ = self->priv->_index;
428 	result = string_get_char (_tmp0_, (glong) string_index_of_nth_char (_tmp1_, (glong) offset));
429 	return result;
430 }
431 
432 static void
valadoc_wiki_scanner_real_accept(ValadocWikiScanner * self,gunichar c,GError ** error)433 valadoc_wiki_scanner_real_accept (ValadocWikiScanner* self,
434                                   gunichar c,
435                                   GError** error)
436 {
437 	gint _tmp0_;
438 	GError* _inner_error0_ = NULL;
439 	_tmp0_ = self->priv->_column;
440 	self->priv->_column = _tmp0_ + 1;
441 	if (self->priv->_skip == 0) {
442 		if (self->priv->_code_escape_mode) {
443 			gboolean _tmp1_ = FALSE;
444 			gboolean _tmp2_ = FALSE;
445 			if (c == ((gunichar) '}')) {
446 				_tmp2_ = valadoc_wiki_scanner_get_next_char (self, 1) == ((gunichar) '}');
447 			} else {
448 				_tmp2_ = FALSE;
449 			}
450 			if (_tmp2_) {
451 				_tmp1_ = valadoc_wiki_scanner_get_next_char (self, 2) == ((gunichar) '}');
452 			} else {
453 				_tmp1_ = FALSE;
454 			}
455 			if (_tmp1_) {
456 				ValadocTokenType* _tmp3_;
457 				self->priv->_code_escape_mode = FALSE;
458 				_tmp3_ = valadoc_token_type_TRIPLE_CLOSED_BRACE;
459 				valadoc_wiki_scanner_emit_token (self, _tmp3_, &_inner_error0_);
460 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
461 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
462 						g_propagate_error (error, _inner_error0_);
463 						return;
464 					} else {
465 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
466 						g_clear_error (&_inner_error0_);
467 						return;
468 					}
469 				}
470 				self->priv->_skip = 2;
471 			} else {
472 				valadoc_wiki_scanner_append_char (self, c);
473 			}
474 			return;
475 		} else {
476 			if (self->priv->_url_escape_mode) {
477 				switch (c) {
478 					case ';':
479 					case '/':
480 					case '?':
481 					case ':':
482 					case '@':
483 					case '#':
484 					case '=':
485 					case '&':
486 					case '$':
487 					case '-':
488 					case '_':
489 					case '.':
490 					case '+':
491 					case '!':
492 					case '*':
493 					case '\'':
494 					case '(':
495 					case ')':
496 					case ',':
497 					{
498 						valadoc_wiki_scanner_append_char (self, c);
499 						return;
500 					}
501 					default:
502 					{
503 						break;
504 					}
505 				}
506 			}
507 		}
508 		switch (c) {
509 			case '@':
510 			{
511 				ValadocTokenType* _tmp4_;
512 				_tmp4_ = valadoc_token_type_AROBASE;
513 				valadoc_wiki_scanner_emit_token (self, _tmp4_, &_inner_error0_);
514 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
515 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
516 						g_propagate_error (error, _inner_error0_);
517 						return;
518 					} else {
519 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
520 						g_clear_error (&_inner_error0_);
521 						return;
522 					}
523 				}
524 				break;
525 			}
526 			case '{':
527 			{
528 				ValadocTokenType* _tmp5_;
529 				ValadocTokenType* _tmp6_;
530 				ValadocTokenType* _tmp7_;
531 				_tmp5_ = valadoc_token_type_OPEN_BRACE;
532 				_tmp6_ = valadoc_token_type_DOUBLE_OPEN_BRACE;
533 				_tmp7_ = valadoc_token_type_TRIPLE_OPEN_BRACE;
534 				valadoc_wiki_scanner_look_for_three (self, c, _tmp5_, _tmp6_, _tmp7_, &_inner_error0_);
535 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
536 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
537 						g_propagate_error (error, _inner_error0_);
538 						return;
539 					} else {
540 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
541 						g_clear_error (&_inner_error0_);
542 						return;
543 					}
544 				}
545 				break;
546 			}
547 			case '}':
548 			{
549 				ValadocTokenType* _tmp8_;
550 				ValadocTokenType* _tmp9_;
551 				ValadocTokenType* _tmp10_;
552 				_tmp8_ = valadoc_token_type_CLOSED_BRACE;
553 				_tmp9_ = valadoc_token_type_DOUBLE_CLOSED_BRACE;
554 				_tmp10_ = valadoc_token_type_TRIPLE_CLOSED_BRACE;
555 				valadoc_wiki_scanner_look_for_three (self, c, _tmp8_, _tmp9_, _tmp10_, &_inner_error0_);
556 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
557 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
558 						g_propagate_error (error, _inner_error0_);
559 						return;
560 					} else {
561 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
562 						g_clear_error (&_inner_error0_);
563 						return;
564 					}
565 				}
566 				break;
567 			}
568 			case '[':
569 			{
570 				ValadocTokenType* _tmp11_;
571 				_tmp11_ = valadoc_token_type_DOUBLE_OPEN_BRACKET;
572 				valadoc_wiki_scanner_look_for_two_or_append (self, c, _tmp11_, &_inner_error0_);
573 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
574 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
575 						g_propagate_error (error, _inner_error0_);
576 						return;
577 					} else {
578 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
579 						g_clear_error (&_inner_error0_);
580 						return;
581 					}
582 				}
583 				break;
584 			}
585 			case ']':
586 			{
587 				ValadocTokenType* _tmp12_;
588 				_tmp12_ = valadoc_token_type_DOUBLE_CLOSED_BRACKET;
589 				valadoc_wiki_scanner_look_for_two_or_append (self, c, _tmp12_, &_inner_error0_);
590 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
591 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
592 						g_propagate_error (error, _inner_error0_);
593 						return;
594 					} else {
595 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
596 						g_clear_error (&_inner_error0_);
597 						return;
598 					}
599 				}
600 				break;
601 			}
602 			case '|':
603 			{
604 				ValadocTokenType* _tmp13_;
605 				ValadocTokenType* _tmp14_;
606 				_tmp13_ = valadoc_token_type_PIPE;
607 				_tmp14_ = valadoc_token_type_DOUBLE_PIPE;
608 				valadoc_wiki_scanner_look_for_two (self, c, _tmp13_, _tmp14_, &_inner_error0_);
609 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
610 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
611 						g_propagate_error (error, _inner_error0_);
612 						return;
613 					} else {
614 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
615 						g_clear_error (&_inner_error0_);
616 						return;
617 					}
618 				}
619 				break;
620 			}
621 			case ')':
622 			{
623 				if (valadoc_wiki_scanner_get_next_char (self, 1) == ((gunichar) ')')) {
624 					ValadocTokenType* _tmp15_;
625 					_tmp15_ = valadoc_token_type_ALIGN_RIGHT;
626 					valadoc_wiki_scanner_emit_token (self, _tmp15_, &_inner_error0_);
627 					if (G_UNLIKELY (_inner_error0_ != NULL)) {
628 						if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
629 							g_propagate_error (error, _inner_error0_);
630 							return;
631 						} else {
632 							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
633 							g_clear_error (&_inner_error0_);
634 							return;
635 						}
636 					}
637 					self->priv->_skip = 1;
638 				} else {
639 					if (valadoc_wiki_scanner_get_next_char (self, 1) == ((gunichar) '(')) {
640 						ValadocTokenType* _tmp16_;
641 						_tmp16_ = valadoc_token_type_ALIGN_CENTER;
642 						valadoc_wiki_scanner_emit_token (self, _tmp16_, &_inner_error0_);
643 						if (G_UNLIKELY (_inner_error0_ != NULL)) {
644 							if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
645 								g_propagate_error (error, _inner_error0_);
646 								return;
647 							} else {
648 								g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
649 								g_clear_error (&_inner_error0_);
650 								return;
651 							}
652 						}
653 						self->priv->_skip = 1;
654 					} else {
655 						valadoc_wiki_scanner_append_char (self, c);
656 					}
657 				}
658 				break;
659 			}
660 			case '-':
661 			{
662 				ValadocTokenType* _tmp17_;
663 				_tmp17_ = valadoc_token_type_MINUS;
664 				valadoc_wiki_scanner_emit_token (self, _tmp17_, &_inner_error0_);
665 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
666 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
667 						g_propagate_error (error, _inner_error0_);
668 						return;
669 					} else {
670 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
671 						g_clear_error (&_inner_error0_);
672 						return;
673 					}
674 				}
675 				break;
676 			}
677 			case '=':
678 			{
679 				ValadocTokenType* _tmp18_;
680 				ValadocTokenType* _tmp19_;
681 				ValadocTokenType* _tmp20_;
682 				ValadocTokenType* _tmp21_;
683 				ValadocTokenType* _tmp22_;
684 				_tmp18_ = valadoc_token_type_EQUAL_1;
685 				_tmp19_ = valadoc_token_type_EQUAL_2;
686 				_tmp20_ = valadoc_token_type_EQUAL_3;
687 				_tmp21_ = valadoc_token_type_EQUAL_4;
688 				_tmp22_ = valadoc_token_type_EQUAL_5;
689 				valadoc_wiki_scanner_look_for_five (self, c, _tmp18_, _tmp19_, _tmp20_, _tmp21_, _tmp22_, &_inner_error0_);
690 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
691 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
692 						g_propagate_error (error, _inner_error0_);
693 						return;
694 					} else {
695 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
696 						g_clear_error (&_inner_error0_);
697 						return;
698 					}
699 				}
700 				break;
701 			}
702 			case '<':
703 			{
704 				gboolean _tmp23_ = FALSE;
705 				ValadocTokenType* _tmp24_;
706 				_tmp24_ = valadoc_token_type_BREAK;
707 				_tmp23_ = valadoc_wiki_scanner_look_for (self, "<<BR>>", _tmp24_, &_inner_error0_);
708 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
709 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
710 						g_propagate_error (error, _inner_error0_);
711 						return;
712 					} else {
713 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
714 						g_clear_error (&_inner_error0_);
715 						return;
716 					}
717 				}
718 				if (!_tmp23_) {
719 					ValadocTokenType* _tmp25_;
720 					_tmp25_ = valadoc_token_type_LESS_THAN;
721 					valadoc_wiki_scanner_emit_token (self, _tmp25_, &_inner_error0_);
722 					if (G_UNLIKELY (_inner_error0_ != NULL)) {
723 						if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
724 							g_propagate_error (error, _inner_error0_);
725 							return;
726 						} else {
727 							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
728 							g_clear_error (&_inner_error0_);
729 							return;
730 						}
731 					}
732 				}
733 				break;
734 			}
735 			case '>':
736 			{
737 				ValadocTokenType* _tmp26_;
738 				_tmp26_ = valadoc_token_type_GREATER_THAN;
739 				valadoc_wiki_scanner_emit_token (self, _tmp26_, &_inner_error0_);
740 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
741 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
742 						g_propagate_error (error, _inner_error0_);
743 						return;
744 					} else {
745 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
746 						g_clear_error (&_inner_error0_);
747 						return;
748 					}
749 				}
750 				break;
751 			}
752 			case '^':
753 			{
754 				ValadocTokenType* _tmp27_;
755 				_tmp27_ = valadoc_token_type_ALIGN_TOP;
756 				valadoc_wiki_scanner_emit_token (self, _tmp27_, &_inner_error0_);
757 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
758 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
759 						g_propagate_error (error, _inner_error0_);
760 						return;
761 					} else {
762 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
763 						g_clear_error (&_inner_error0_);
764 						return;
765 					}
766 				}
767 				break;
768 			}
769 			case 'v':
770 			{
771 				gunichar next_char = 0U;
772 				gboolean _tmp28_ = FALSE;
773 				gboolean _tmp29_ = FALSE;
774 				gboolean _tmp30_ = FALSE;
775 				next_char = valadoc_wiki_scanner_get_next_char (self, 1);
776 				if (g_unichar_isalnum (self->priv->_last_char)) {
777 					_tmp30_ = TRUE;
778 				} else {
779 					_tmp30_ = self->priv->_last_char == ((gunichar) ' ');
780 				}
781 				if (_tmp30_) {
782 					_tmp29_ = TRUE;
783 				} else {
784 					_tmp29_ = g_unichar_isalnum (next_char);
785 				}
786 				if (_tmp29_) {
787 					_tmp28_ = TRUE;
788 				} else {
789 					_tmp28_ = next_char == ((gunichar) ' ');
790 				}
791 				if (_tmp28_) {
792 					valadoc_wiki_scanner_append_char (self, c);
793 				} else {
794 					ValadocTokenType* _tmp31_;
795 					_tmp31_ = valadoc_token_type_ALIGN_BOTTOM;
796 					valadoc_wiki_scanner_emit_token (self, _tmp31_, &_inner_error0_);
797 					if (G_UNLIKELY (_inner_error0_ != NULL)) {
798 						if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
799 							g_propagate_error (error, _inner_error0_);
800 							return;
801 						} else {
802 							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
803 							g_clear_error (&_inner_error0_);
804 							return;
805 						}
806 					}
807 				}
808 				break;
809 			}
810 			case '\'':
811 			{
812 				ValadocTokenType* _tmp32_;
813 				_tmp32_ = valadoc_token_type_SINGLE_QUOTE_2;
814 				valadoc_wiki_scanner_look_for_two_or_append (self, c, _tmp32_, &_inner_error0_);
815 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
816 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
817 						g_propagate_error (error, _inner_error0_);
818 						return;
819 					} else {
820 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
821 						g_clear_error (&_inner_error0_);
822 						return;
823 					}
824 				}
825 				break;
826 			}
827 			case '/':
828 			{
829 				ValadocTokenType* _tmp33_;
830 				_tmp33_ = valadoc_token_type_SLASH_2;
831 				valadoc_wiki_scanner_look_for_two_or_append (self, c, _tmp33_, &_inner_error0_);
832 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
833 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
834 						g_propagate_error (error, _inner_error0_);
835 						return;
836 					} else {
837 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
838 						g_clear_error (&_inner_error0_);
839 						return;
840 					}
841 				}
842 				break;
843 			}
844 			case '_':
845 			{
846 				ValadocTokenType* _tmp34_;
847 				_tmp34_ = valadoc_token_type_UNDERSCORE_2;
848 				valadoc_wiki_scanner_look_for_two_or_append (self, c, _tmp34_, &_inner_error0_);
849 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
850 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
851 						g_propagate_error (error, _inner_error0_);
852 						return;
853 					} else {
854 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
855 						g_clear_error (&_inner_error0_);
856 						return;
857 					}
858 				}
859 				break;
860 			}
861 			case '`':
862 			{
863 				if (valadoc_wiki_scanner_get_next_char (self, 1) == ((gunichar) '`')) {
864 					ValadocTokenType* _tmp35_;
865 					_tmp35_ = valadoc_token_type_BACK_QUOTE_2;
866 					valadoc_wiki_scanner_emit_token (self, _tmp35_, &_inner_error0_);
867 					if (G_UNLIKELY (_inner_error0_ != NULL)) {
868 						if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
869 							g_propagate_error (error, _inner_error0_);
870 							return;
871 						} else {
872 							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
873 							g_clear_error (&_inner_error0_);
874 							return;
875 						}
876 					}
877 					self->priv->_skip = 1;
878 				} else {
879 					valadoc_wiki_scanner_append_char (self, c);
880 				}
881 				break;
882 			}
883 			case '\t':
884 			{
885 				ValadocTokenType* _tmp36_;
886 				_tmp36_ = valadoc_token_type_TAB;
887 				valadoc_wiki_scanner_emit_token (self, _tmp36_, &_inner_error0_);
888 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
889 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
890 						g_propagate_error (error, _inner_error0_);
891 						return;
892 					} else {
893 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
894 						g_clear_error (&_inner_error0_);
895 						return;
896 					}
897 				}
898 				break;
899 			}
900 			case ' ':
901 			{
902 				ValadocTokenType* _tmp37_;
903 				_tmp37_ = valadoc_token_type_SPACE;
904 				valadoc_wiki_scanner_emit_token (self, _tmp37_, &_inner_error0_);
905 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
906 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
907 						g_propagate_error (error, _inner_error0_);
908 						return;
909 					} else {
910 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
911 						g_clear_error (&_inner_error0_);
912 						return;
913 					}
914 				}
915 				break;
916 			}
917 			case '\r':
918 			{
919 				break;
920 			}
921 			case '\n':
922 			{
923 				ValadocTokenType* _tmp38_;
924 				gint _tmp39_;
925 				_tmp38_ = valadoc_token_type_EOL;
926 				valadoc_wiki_scanner_emit_token (self, _tmp38_, &_inner_error0_);
927 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
928 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
929 						g_propagate_error (error, _inner_error0_);
930 						return;
931 					} else {
932 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
933 						g_clear_error (&_inner_error0_);
934 						return;
935 					}
936 				}
937 				_tmp39_ = self->priv->_line;
938 				self->priv->_line = _tmp39_ + 1;
939 				self->priv->_column = 0;
940 				self->priv->_last_column = 0;
941 				break;
942 			}
943 			default:
944 			{
945 				valadoc_wiki_scanner_append_char (self, c);
946 				break;
947 			}
948 		}
949 	} else {
950 		gint _tmp40_;
951 		_tmp40_ = self->priv->_skip;
952 		self->priv->_skip = _tmp40_ - 1;
953 	}
954 	self->priv->_last_char = c;
955 }
956 
957 void
valadoc_wiki_scanner_accept(ValadocWikiScanner * self,gunichar c,GError ** error)958 valadoc_wiki_scanner_accept (ValadocWikiScanner* self,
959                              gunichar c,
960                              GError** error)
961 {
962 	g_return_if_fail (self != NULL);
963 	VALADOC_WIKI_SCANNER_GET_CLASS (self)->accept (self, c, error);
964 }
965 
966 static void
valadoc_wiki_scanner_append_char(ValadocWikiScanner * self,gunichar c)967 valadoc_wiki_scanner_append_char (ValadocWikiScanner* self,
968                                   gunichar c)
969 {
970 	GString* _tmp0_;
971 	g_return_if_fail (self != NULL);
972 	_tmp0_ = self->priv->_current_string;
973 	g_string_append_unichar (_tmp0_, c);
974 }
975 
976 static gint
valadoc_wiki_scanner_real_get_line_start_column(ValadocWikiScanner * self)977 valadoc_wiki_scanner_real_get_line_start_column (ValadocWikiScanner* self)
978 {
979 	gint result = 0;
980 	result = 0;
981 	return result;
982 }
983 
984 gint
valadoc_wiki_scanner_get_line_start_column(ValadocWikiScanner * self)985 valadoc_wiki_scanner_get_line_start_column (ValadocWikiScanner* self)
986 {
987 	g_return_val_if_fail (self != NULL, 0);
988 	return VALADOC_WIKI_SCANNER_GET_CLASS (self)->get_line_start_column (self);
989 }
990 
991 static void
valadoc_wiki_scanner_get_begin(ValadocWikiScanner * self,ValaSourceLocation * result)992 valadoc_wiki_scanner_get_begin (ValadocWikiScanner* self,
993                                 ValaSourceLocation* result)
994 {
995 	const gchar* _tmp0_;
996 	ValaSourceLocation _tmp1_ = {0};
997 	g_return_if_fail (self != NULL);
998 	_tmp0_ = self->priv->_index;
999 	vala_source_location_init (&_tmp1_, _tmp0_, self->priv->_last_line, valadoc_wiki_scanner_get_line_start_column (self) + self->priv->_last_column);
1000 	*result = _tmp1_;
1001 	return;
1002 }
1003 
1004 static void
valadoc_wiki_scanner_get_end(ValadocWikiScanner * self,gint offset,ValaSourceLocation * result)1005 valadoc_wiki_scanner_get_end (ValadocWikiScanner* self,
1006                               gint offset,
1007                               ValaSourceLocation* result)
1008 {
1009 	const gchar* _tmp0_;
1010 	ValaSourceLocation _tmp1_ = {0};
1011 	g_return_if_fail (self != NULL);
1012 	_tmp0_ = self->priv->_index;
1013 	vala_source_location_init (&_tmp1_, _tmp0_, self->priv->_line, (valadoc_wiki_scanner_get_line_start_column (self) + self->priv->_column) + offset);
1014 	*result = _tmp1_;
1015 	return;
1016 }
1017 
1018 static void
valadoc_wiki_scanner_emit_current_word(ValadocWikiScanner * self,GError ** error)1019 valadoc_wiki_scanner_emit_current_word (ValadocWikiScanner* self,
1020                                         GError** error)
1021 {
1022 	GString* _tmp0_;
1023 	GError* _inner_error0_ = NULL;
1024 	g_return_if_fail (self != NULL);
1025 	_tmp0_ = self->priv->_current_string;
1026 	if (_tmp0_->len > ((gssize) 0)) {
1027 		ValadocParser* _tmp1_;
1028 		GString* _tmp2_;
1029 		const gchar* _tmp3_;
1030 		ValaSourceLocation _tmp4_ = {0};
1031 		ValaSourceLocation _tmp5_ = {0};
1032 		ValadocToken* _tmp6_;
1033 		ValadocToken* _tmp7_;
1034 		GString* _tmp8_;
1035 		_tmp1_ = self->priv->_parser;
1036 		_tmp2_ = self->priv->_current_string;
1037 		_tmp3_ = _tmp2_->str;
1038 		valadoc_wiki_scanner_get_begin (self, &_tmp4_);
1039 		valadoc_wiki_scanner_get_end (self, -1, &_tmp5_);
1040 		_tmp6_ = valadoc_token_new_from_word (_tmp3_, &_tmp4_, &_tmp5_);
1041 		_tmp7_ = _tmp6_;
1042 		valadoc_parser_accept_token (_tmp1_, _tmp7_, &_inner_error0_);
1043 		_g_object_unref0 (_tmp7_);
1044 		if (G_UNLIKELY (_inner_error0_ != NULL)) {
1045 			if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1046 				g_propagate_error (error, _inner_error0_);
1047 				return;
1048 			} else {
1049 				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1050 				g_clear_error (&_inner_error0_);
1051 				return;
1052 			}
1053 		}
1054 		_tmp8_ = self->priv->_current_string;
1055 		g_string_erase (_tmp8_, (gssize) 0, (gssize) -1);
1056 		self->priv->_last_line = self->priv->_line;
1057 		self->priv->_last_column = self->priv->_column - 1;
1058 	}
1059 }
1060 
1061 static void
valadoc_wiki_scanner_emit_token(ValadocWikiScanner * self,ValadocTokenType * type,GError ** error)1062 valadoc_wiki_scanner_emit_token (ValadocWikiScanner* self,
1063                                  ValadocTokenType* type,
1064                                  GError** error)
1065 {
1066 	ValadocParser* _tmp0_;
1067 	ValaSourceLocation _tmp1_ = {0};
1068 	ValaSourceLocation _tmp2_ = {0};
1069 	ValadocToken* _tmp3_;
1070 	ValadocToken* _tmp4_;
1071 	GError* _inner_error0_ = NULL;
1072 	g_return_if_fail (self != NULL);
1073 	g_return_if_fail (type != NULL);
1074 	valadoc_wiki_scanner_emit_current_word (self, &_inner_error0_);
1075 	if (G_UNLIKELY (_inner_error0_ != NULL)) {
1076 		if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1077 			g_propagate_error (error, _inner_error0_);
1078 			return;
1079 		} else {
1080 			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1081 			g_clear_error (&_inner_error0_);
1082 			return;
1083 		}
1084 	}
1085 	_tmp0_ = self->priv->_parser;
1086 	valadoc_wiki_scanner_get_begin (self, &_tmp1_);
1087 	valadoc_wiki_scanner_get_end (self, self->priv->_skip, &_tmp2_);
1088 	_tmp3_ = valadoc_token_new_from_type (type, &_tmp1_, &_tmp2_, NULL);
1089 	_tmp4_ = _tmp3_;
1090 	valadoc_parser_accept_token (_tmp0_, _tmp4_, &_inner_error0_);
1091 	_g_object_unref0 (_tmp4_);
1092 	if (G_UNLIKELY (_inner_error0_ != NULL)) {
1093 		if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1094 			g_propagate_error (error, _inner_error0_);
1095 			return;
1096 		} else {
1097 			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1098 			g_clear_error (&_inner_error0_);
1099 			return;
1100 		}
1101 	}
1102 	self->priv->_last_line = self->priv->_line;
1103 	self->priv->_last_column = self->priv->_column;
1104 }
1105 
1106 static void
valadoc_wiki_scanner_look_for_two_or_append(ValadocWikiScanner * self,gunichar c,ValadocTokenType * type,GError ** error)1107 valadoc_wiki_scanner_look_for_two_or_append (ValadocWikiScanner* self,
1108                                              gunichar c,
1109                                              ValadocTokenType* type,
1110                                              GError** error)
1111 {
1112 	GError* _inner_error0_ = NULL;
1113 	g_return_if_fail (self != NULL);
1114 	g_return_if_fail (type != NULL);
1115 	if (valadoc_wiki_scanner_get_next_char (self, 1) == c) {
1116 		valadoc_wiki_scanner_emit_token (self, type, &_inner_error0_);
1117 		if (G_UNLIKELY (_inner_error0_ != NULL)) {
1118 			if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1119 				g_propagate_error (error, _inner_error0_);
1120 				return;
1121 			} else {
1122 				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1123 				g_clear_error (&_inner_error0_);
1124 				return;
1125 			}
1126 		}
1127 		self->priv->_skip = 1;
1128 	} else {
1129 		valadoc_wiki_scanner_append_char (self, c);
1130 	}
1131 }
1132 
1133 static void
valadoc_wiki_scanner_look_for_two(ValadocWikiScanner * self,gunichar c,ValadocTokenType * one,ValadocTokenType * two,GError ** error)1134 valadoc_wiki_scanner_look_for_two (ValadocWikiScanner* self,
1135                                    gunichar c,
1136                                    ValadocTokenType* one,
1137                                    ValadocTokenType* two,
1138                                    GError** error)
1139 {
1140 	GError* _inner_error0_ = NULL;
1141 	g_return_if_fail (self != NULL);
1142 	g_return_if_fail (one != NULL);
1143 	g_return_if_fail (two != NULL);
1144 	if (valadoc_wiki_scanner_get_next_char (self, 1) == c) {
1145 		valadoc_wiki_scanner_emit_token (self, two, &_inner_error0_);
1146 		if (G_UNLIKELY (_inner_error0_ != NULL)) {
1147 			if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1148 				g_propagate_error (error, _inner_error0_);
1149 				return;
1150 			} else {
1151 				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1152 				g_clear_error (&_inner_error0_);
1153 				return;
1154 			}
1155 		}
1156 		self->priv->_skip = 1;
1157 	} else {
1158 		valadoc_wiki_scanner_emit_token (self, one, &_inner_error0_);
1159 		if (G_UNLIKELY (_inner_error0_ != NULL)) {
1160 			if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1161 				g_propagate_error (error, _inner_error0_);
1162 				return;
1163 			} else {
1164 				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1165 				g_clear_error (&_inner_error0_);
1166 				return;
1167 			}
1168 		}
1169 	}
1170 }
1171 
1172 static void
valadoc_wiki_scanner_look_for_three(ValadocWikiScanner * self,gunichar c,ValadocTokenType * one,ValadocTokenType * two,ValadocTokenType * three,GError ** error)1173 valadoc_wiki_scanner_look_for_three (ValadocWikiScanner* self,
1174                                      gunichar c,
1175                                      ValadocTokenType* one,
1176                                      ValadocTokenType* two,
1177                                      ValadocTokenType* three,
1178                                      GError** error)
1179 {
1180 	GError* _inner_error0_ = NULL;
1181 	g_return_if_fail (self != NULL);
1182 	g_return_if_fail (one != NULL);
1183 	g_return_if_fail (two != NULL);
1184 	g_return_if_fail (three != NULL);
1185 	if (valadoc_wiki_scanner_get_next_char (self, 1) == c) {
1186 		if (valadoc_wiki_scanner_get_next_char (self, 2) == c) {
1187 			valadoc_wiki_scanner_emit_token (self, three, &_inner_error0_);
1188 			if (G_UNLIKELY (_inner_error0_ != NULL)) {
1189 				if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1190 					g_propagate_error (error, _inner_error0_);
1191 					return;
1192 				} else {
1193 					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1194 					g_clear_error (&_inner_error0_);
1195 					return;
1196 				}
1197 			}
1198 			self->priv->_skip = 2;
1199 		} else {
1200 			valadoc_wiki_scanner_emit_token (self, two, &_inner_error0_);
1201 			if (G_UNLIKELY (_inner_error0_ != NULL)) {
1202 				if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1203 					g_propagate_error (error, _inner_error0_);
1204 					return;
1205 				} else {
1206 					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1207 					g_clear_error (&_inner_error0_);
1208 					return;
1209 				}
1210 			}
1211 			self->priv->_skip = 1;
1212 		}
1213 	} else {
1214 		valadoc_wiki_scanner_emit_token (self, one, &_inner_error0_);
1215 		if (G_UNLIKELY (_inner_error0_ != NULL)) {
1216 			if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1217 				g_propagate_error (error, _inner_error0_);
1218 				return;
1219 			} else {
1220 				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1221 				g_clear_error (&_inner_error0_);
1222 				return;
1223 			}
1224 		}
1225 	}
1226 }
1227 
1228 static void
valadoc_wiki_scanner_look_for_five(ValadocWikiScanner * self,gunichar c,ValadocTokenType * one,ValadocTokenType * two,ValadocTokenType * three,ValadocTokenType * four,ValadocTokenType * five,GError ** error)1229 valadoc_wiki_scanner_look_for_five (ValadocWikiScanner* self,
1230                                     gunichar c,
1231                                     ValadocTokenType* one,
1232                                     ValadocTokenType* two,
1233                                     ValadocTokenType* three,
1234                                     ValadocTokenType* four,
1235                                     ValadocTokenType* five,
1236                                     GError** error)
1237 {
1238 	GError* _inner_error0_ = NULL;
1239 	g_return_if_fail (self != NULL);
1240 	g_return_if_fail (one != NULL);
1241 	g_return_if_fail (two != NULL);
1242 	g_return_if_fail (three != NULL);
1243 	g_return_if_fail (four != NULL);
1244 	g_return_if_fail (five != NULL);
1245 	if (valadoc_wiki_scanner_get_next_char (self, 1) == c) {
1246 		if (valadoc_wiki_scanner_get_next_char (self, 2) == c) {
1247 			if (valadoc_wiki_scanner_get_next_char (self, 3) == c) {
1248 				if (valadoc_wiki_scanner_get_next_char (self, 4) == c) {
1249 					valadoc_wiki_scanner_emit_token (self, five, &_inner_error0_);
1250 					if (G_UNLIKELY (_inner_error0_ != NULL)) {
1251 						if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1252 							g_propagate_error (error, _inner_error0_);
1253 							return;
1254 						} else {
1255 							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1256 							g_clear_error (&_inner_error0_);
1257 							return;
1258 						}
1259 					}
1260 					self->priv->_skip = 4;
1261 				} else {
1262 					valadoc_wiki_scanner_emit_token (self, four, &_inner_error0_);
1263 					if (G_UNLIKELY (_inner_error0_ != NULL)) {
1264 						if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1265 							g_propagate_error (error, _inner_error0_);
1266 							return;
1267 						} else {
1268 							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1269 							g_clear_error (&_inner_error0_);
1270 							return;
1271 						}
1272 					}
1273 					self->priv->_skip = 3;
1274 				}
1275 			} else {
1276 				valadoc_wiki_scanner_emit_token (self, three, &_inner_error0_);
1277 				if (G_UNLIKELY (_inner_error0_ != NULL)) {
1278 					if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1279 						g_propagate_error (error, _inner_error0_);
1280 						return;
1281 					} else {
1282 						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1283 						g_clear_error (&_inner_error0_);
1284 						return;
1285 					}
1286 				}
1287 				self->priv->_skip = 2;
1288 			}
1289 		} else {
1290 			valadoc_wiki_scanner_emit_token (self, two, &_inner_error0_);
1291 			if (G_UNLIKELY (_inner_error0_ != NULL)) {
1292 				if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1293 					g_propagate_error (error, _inner_error0_);
1294 					return;
1295 				} else {
1296 					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1297 					g_clear_error (&_inner_error0_);
1298 					return;
1299 				}
1300 			}
1301 			self->priv->_skip = 1;
1302 		}
1303 	} else {
1304 		valadoc_wiki_scanner_emit_token (self, one, &_inner_error0_);
1305 		if (G_UNLIKELY (_inner_error0_ != NULL)) {
1306 			if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1307 				g_propagate_error (error, _inner_error0_);
1308 				return;
1309 			} else {
1310 				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1311 				g_clear_error (&_inner_error0_);
1312 				return;
1313 			}
1314 		}
1315 	}
1316 }
1317 
1318 static gchar
string_get(const gchar * self,glong index)1319 string_get (const gchar* self,
1320             glong index)
1321 {
1322 	gchar _tmp0_;
1323 	gchar result = '\0';
1324 	g_return_val_if_fail (self != NULL, '\0');
1325 	_tmp0_ = ((gchar*) self)[index];
1326 	result = _tmp0_;
1327 	return result;
1328 }
1329 
1330 static gboolean
valadoc_wiki_scanner_look_for(ValadocWikiScanner * self,const gchar * str,ValadocTokenType * type,GError ** error)1331 valadoc_wiki_scanner_look_for (ValadocWikiScanner* self,
1332                                const gchar* str,
1333                                ValadocTokenType* type,
1334                                GError** error)
1335 {
1336 	gint _tmp6_;
1337 	gint _tmp7_;
1338 	GError* _inner_error0_ = NULL;
1339 	gboolean result = FALSE;
1340 	g_return_val_if_fail (self != NULL, FALSE);
1341 	g_return_val_if_fail (str != NULL, FALSE);
1342 	g_return_val_if_fail (type != NULL, FALSE);
1343 	{
1344 		gint i = 0;
1345 		i = 1;
1346 		{
1347 			gboolean _tmp0_ = FALSE;
1348 			_tmp0_ = TRUE;
1349 			while (TRUE) {
1350 				gint _tmp2_;
1351 				gint _tmp3_;
1352 				if (!_tmp0_) {
1353 					gint _tmp1_;
1354 					_tmp1_ = i;
1355 					i = _tmp1_ + 1;
1356 				}
1357 				_tmp0_ = FALSE;
1358 				_tmp2_ = strlen (str);
1359 				_tmp3_ = _tmp2_;
1360 				if (!(i < _tmp3_)) {
1361 					break;
1362 				}
1363 				if (valadoc_wiki_scanner_get_next_char (self, i) != ((gunichar) string_get (str, (glong) i))) {
1364 					result = FALSE;
1365 					return result;
1366 				}
1367 			}
1368 		}
1369 	}
1370 	valadoc_wiki_scanner_emit_token (self, type, &_inner_error0_);
1371 	if (G_UNLIKELY (_inner_error0_ != NULL)) {
1372 		if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
1373 			gboolean _tmp4_ = FALSE;
1374 			g_propagate_error (error, _inner_error0_);
1375 			return _tmp4_;
1376 		} else {
1377 			gboolean _tmp5_ = FALSE;
1378 			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
1379 			g_clear_error (&_inner_error0_);
1380 			return _tmp5_;
1381 		}
1382 	}
1383 	_tmp6_ = strlen (str);
1384 	_tmp7_ = _tmp6_;
1385 	self->priv->_skip = (gint) (_tmp7_ - 1);
1386 	result = TRUE;
1387 	return result;
1388 }
1389 
1390 static void
valadoc_wiki_scanner_class_init(ValadocWikiScannerClass * klass,gpointer klass_data)1391 valadoc_wiki_scanner_class_init (ValadocWikiScannerClass * klass,
1392                                  gpointer klass_data)
1393 {
1394 	valadoc_wiki_scanner_parent_class = g_type_class_peek_parent (klass);
1395 	g_type_class_adjust_private_offset (klass, &ValadocWikiScanner_private_offset);
1396 	((ValadocWikiScannerClass *) klass)->reset = (void (*) (ValadocWikiScanner*)) valadoc_wiki_scanner_real_reset;
1397 	((ValadocWikiScannerClass *) klass)->stop = (void (*) (ValadocWikiScanner*)) valadoc_wiki_scanner_real_stop;
1398 	((ValadocWikiScannerClass *) klass)->get_line_content = (gchar* (*) (ValadocWikiScanner*)) valadoc_wiki_scanner_real_get_line_content;
1399 	((ValadocWikiScannerClass *) klass)->accept = (void (*) (ValadocWikiScanner*, gunichar, GError**)) valadoc_wiki_scanner_real_accept;
1400 	((ValadocWikiScannerClass *) klass)->get_line_start_column = (gint (*) (ValadocWikiScanner*)) valadoc_wiki_scanner_real_get_line_start_column;
1401 	G_OBJECT_CLASS (klass)->finalize = valadoc_wiki_scanner_finalize;
1402 }
1403 
1404 static void
valadoc_wiki_scanner_valadoc_scanner_interface_init(ValadocScannerIface * iface,gpointer iface_data)1405 valadoc_wiki_scanner_valadoc_scanner_interface_init (ValadocScannerIface * iface,
1406                                                      gpointer iface_data)
1407 {
1408 	valadoc_wiki_scanner_valadoc_scanner_parent_iface = g_type_interface_peek_parent (iface);
1409 	iface->set_parser = (void (*) (ValadocScanner*, ValadocParser*)) valadoc_wiki_scanner_real_set_parser;
1410 	iface->reset = (void (*) (ValadocScanner*)) valadoc_wiki_scanner_reset;
1411 	iface->scan = (void (*) (ValadocScanner*, const gchar*, GError**)) valadoc_wiki_scanner_real_scan;
1412 	iface->end = (void (*) (ValadocScanner*, GError**)) valadoc_wiki_scanner_real_end;
1413 	iface->stop = (void (*) (ValadocScanner*)) valadoc_wiki_scanner_stop;
1414 	iface->get_line_content = (gchar* (*) (ValadocScanner*)) valadoc_wiki_scanner_get_line_content;
1415 }
1416 
1417 static void
valadoc_wiki_scanner_instance_init(ValadocWikiScanner * self,gpointer klass)1418 valadoc_wiki_scanner_instance_init (ValadocWikiScanner * self,
1419                                     gpointer klass)
1420 {
1421 	GString* _tmp0_;
1422 	self->priv = valadoc_wiki_scanner_get_instance_private (self);
1423 	_tmp0_ = g_string_new ("");
1424 	self->priv->_current_string = _tmp0_;
1425 }
1426 
1427 static void
valadoc_wiki_scanner_finalize(GObject * obj)1428 valadoc_wiki_scanner_finalize (GObject * obj)
1429 {
1430 	ValadocWikiScanner * self;
1431 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_TYPE_WIKI_SCANNER, ValadocWikiScanner);
1432 	_g_object_unref0 (self->priv->_settings);
1433 	_valadoc_parser_unref0 (self->priv->_parser);
1434 	_g_free0 (self->priv->_content);
1435 	_g_string_free0 (self->priv->_current_string);
1436 	G_OBJECT_CLASS (valadoc_wiki_scanner_parent_class)->finalize (obj);
1437 }
1438 
1439 static GType
valadoc_wiki_scanner_get_type_once(void)1440 valadoc_wiki_scanner_get_type_once (void)
1441 {
1442 	static const GTypeInfo g_define_type_info = { sizeof (ValadocWikiScannerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_wiki_scanner_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocWikiScanner), 0, (GInstanceInitFunc) valadoc_wiki_scanner_instance_init, NULL };
1443 	static const GInterfaceInfo valadoc_scanner_info = { (GInterfaceInitFunc) valadoc_wiki_scanner_valadoc_scanner_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
1444 	GType valadoc_wiki_scanner_type_id;
1445 	valadoc_wiki_scanner_type_id = g_type_register_static (G_TYPE_OBJECT, "ValadocWikiScanner", &g_define_type_info, 0);
1446 	g_type_add_interface_static (valadoc_wiki_scanner_type_id, VALADOC_TYPE_SCANNER, &valadoc_scanner_info);
1447 	ValadocWikiScanner_private_offset = g_type_add_instance_private (valadoc_wiki_scanner_type_id, sizeof (ValadocWikiScannerPrivate));
1448 	return valadoc_wiki_scanner_type_id;
1449 }
1450 
1451 GType
valadoc_wiki_scanner_get_type(void)1452 valadoc_wiki_scanner_get_type (void)
1453 {
1454 	static volatile gsize valadoc_wiki_scanner_type_id__volatile = 0;
1455 	if (g_once_init_enter (&valadoc_wiki_scanner_type_id__volatile)) {
1456 		GType valadoc_wiki_scanner_type_id;
1457 		valadoc_wiki_scanner_type_id = valadoc_wiki_scanner_get_type_once ();
1458 		g_once_init_leave (&valadoc_wiki_scanner_type_id__volatile, valadoc_wiki_scanner_type_id);
1459 	}
1460 	return valadoc_wiki_scanner_type_id__volatile;
1461 }
1462 
1463