1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793
|
/* sequencerule.c generated by valac, the Vala compiler
* generated from sequencerule.vala, do not modify */
/* sequencerule.vala
*
* Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois
*
* 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:
* Didier 'Ptitjes Villevalois <ptitjes@free.fr>
*/
#include "valadoc.h"
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#define VALADOC_TYPE_SEQUENCE_RULE (valadoc_sequence_rule_get_type ())
#define VALADOC_SEQUENCE_RULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALADOC_TYPE_SEQUENCE_RULE, ValadocSequenceRule))
#define VALADOC_SEQUENCE_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALADOC_TYPE_SEQUENCE_RULE, ValadocSequenceRuleClass))
#define VALADOC_IS_SEQUENCE_RULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALADOC_TYPE_SEQUENCE_RULE))
#define VALADOC_IS_SEQUENCE_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALADOC_TYPE_SEQUENCE_RULE))
#define VALADOC_SEQUENCE_RULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALADOC_TYPE_SEQUENCE_RULE, ValadocSequenceRuleClass))
typedef struct _ValadocSequenceRule ValadocSequenceRule;
typedef struct _ValadocSequenceRuleClass ValadocSequenceRuleClass;
typedef struct _ValadocSequenceRulePrivate ValadocSequenceRulePrivate;
enum {
VALADOC_SEQUENCE_RULE_0_PROPERTY,
VALADOC_SEQUENCE_RULE_NUM_PROPERTIES
};
static GParamSpec* valadoc_sequence_rule_properties[VALADOC_SEQUENCE_RULE_NUM_PROPERTIES];
#define VALADOC_SEQUENCE_RULE_TYPE_STATE (valadoc_sequence_rule_state_get_type ())
#define VALADOC_SEQUENCE_RULE_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALADOC_SEQUENCE_RULE_TYPE_STATE, ValadocSequenceRuleState))
#define VALADOC_SEQUENCE_RULE_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALADOC_SEQUENCE_RULE_TYPE_STATE, ValadocSequenceRuleStateClass))
#define VALADOC_SEQUENCE_RULE_IS_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALADOC_SEQUENCE_RULE_TYPE_STATE))
#define VALADOC_SEQUENCE_RULE_IS_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALADOC_SEQUENCE_RULE_TYPE_STATE))
#define VALADOC_SEQUENCE_RULE_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALADOC_SEQUENCE_RULE_TYPE_STATE, ValadocSequenceRuleStateClass))
typedef struct _ValadocSequenceRuleState ValadocSequenceRuleState;
typedef struct _ValadocSequenceRuleStateClass ValadocSequenceRuleStateClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ValadocSequenceRuleStatePrivate ValadocSequenceRuleStatePrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
enum {
VALADOC_SEQUENCE_RULE_STATE_0_PROPERTY,
VALADOC_SEQUENCE_RULE_STATE_NUM_PROPERTIES
};
static GParamSpec* valadoc_sequence_rule_state_properties[VALADOC_SEQUENCE_RULE_STATE_NUM_PROPERTIES];
struct _ValadocSequenceRule {
ValadocRule parent_instance;
ValadocSequenceRulePrivate * priv;
};
struct _ValadocSequenceRuleClass {
ValadocRuleClass parent_class;
};
struct _ValadocSequenceRulePrivate {
GObject** _scheme;
gint _scheme_length1;
gint __scheme_size_;
};
struct _ValadocSequenceRuleState {
GObject parent_instance;
gint index;
ValadocSequenceRuleStatePrivate * priv;
};
struct _ValadocSequenceRuleStateClass {
GObjectClass parent_class;
};
static gint ValadocSequenceRule_private_offset;
static gpointer valadoc_sequence_rule_parent_class = NULL;
static gpointer valadoc_sequence_rule_state_parent_class = NULL;
G_GNUC_INTERNAL GType valadoc_sequence_rule_get_type (void) G_GNUC_CONST G_GNUC_UNUSED ;
G_GNUC_INTERNAL ValadocSequenceRule* valadoc_sequence_rule_new (GObject** scheme,
gint scheme_length1);
G_GNUC_INTERNAL ValadocSequenceRule* valadoc_sequence_rule_construct (GType object_type,
GObject** scheme,
gint scheme_length1);
static GObject** _vala_array_dup3 (GObject** self,
gssize length);
static gboolean valadoc_sequence_rule_real_is_optional (ValadocRule* base);
static gboolean valadoc_sequence_rule_real_starts_with_token (ValadocRule* base,
ValadocToken* token);
static gboolean valadoc_sequence_rule_test_token (ValadocSequenceRule* self,
gint from_index,
ValadocToken* token);
static gboolean valadoc_sequence_rule_test_reduce (ValadocSequenceRule* self,
gint from_index,
ValadocToken* token);
static gboolean valadoc_sequence_rule_real_accept_token (ValadocRule* base,
ValadocToken* token,
ValadocParserCallback* parser,
ValadocRuleForward forward,
GError** error);
static GType valadoc_sequence_rule_state_get_type (void) G_GNUC_CONST G_GNUC_UNUSED ;
static ValadocSequenceRuleState* valadoc_sequence_rule_state_new (void);
static ValadocSequenceRuleState* valadoc_sequence_rule_state_construct (GType object_type);
static gboolean valadoc_sequence_rule_real_would_accept_token (ValadocRule* base,
ValadocToken* token,
GObject* rule_state);
static gboolean valadoc_sequence_rule_real_would_reduce (ValadocRule* base,
ValadocToken* token,
GObject* rule_state);
static gchar* valadoc_sequence_rule_real_to_string (ValadocRule* base,
GObject* rule_state);
static void valadoc_sequence_rule_state_finalize (GObject * obj);
static GType valadoc_sequence_rule_state_get_type_once (void);
static void valadoc_sequence_rule_finalize (GObject * obj);
static GType valadoc_sequence_rule_get_type_once (void);
static void _vala_array_destroy (gpointer array,
gssize array_length,
GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
gssize array_length,
GDestroyNotify destroy_func);
static inline gpointer
valadoc_sequence_rule_get_instance_private (ValadocSequenceRule* self)
{
return G_STRUCT_MEMBER_P (self, ValadocSequenceRule_private_offset);
}
static gpointer
_g_object_ref0 (gpointer self)
{
return self ? g_object_ref (self) : NULL;
}
static GObject**
_vala_array_dup3 (GObject** self,
gssize length)
{
if (length >= 0) {
GObject** result;
gssize i;
result = g_new0 (GObject*, length + 1);
for (i = 0; i < length; i++) {
GObject* _tmp0_;
_tmp0_ = _g_object_ref0 (self[i]);
result[i] = _tmp0_;
}
return result;
}
return NULL;
}
G_GNUC_INTERNAL ValadocSequenceRule*
valadoc_sequence_rule_construct (GType object_type,
GObject** scheme,
gint scheme_length1)
{
ValadocSequenceRule * self = NULL;
GObject** _tmp0_;
gint _tmp0__length1;
self = (ValadocSequenceRule*) valadoc_rule_construct (object_type);
_tmp0_ = (scheme != NULL) ? _vala_array_dup3 (scheme, scheme_length1) : scheme;
_tmp0__length1 = scheme_length1;
self->priv->_scheme = (_vala_array_free (self->priv->_scheme, self->priv->_scheme_length1, (GDestroyNotify) g_object_unref), NULL);
self->priv->_scheme = _tmp0_;
self->priv->_scheme_length1 = _tmp0__length1;
self->priv->__scheme_size_ = self->priv->_scheme_length1;
return self;
}
G_GNUC_INTERNAL ValadocSequenceRule*
valadoc_sequence_rule_new (GObject** scheme,
gint scheme_length1)
{
return valadoc_sequence_rule_construct (VALADOC_TYPE_SEQUENCE_RULE, scheme, scheme_length1);
}
static gboolean
valadoc_sequence_rule_real_is_optional (ValadocRule* base)
{
ValadocSequenceRule * self;
gboolean result;
self = (ValadocSequenceRule*) base;
result = FALSE;
return result;
}
static gboolean
valadoc_sequence_rule_real_starts_with_token (ValadocRule* base,
ValadocToken* token)
{
ValadocSequenceRule * self;
gboolean result;
self = (ValadocSequenceRule*) base;
g_return_val_if_fail (token != NULL, FALSE);
result = valadoc_sequence_rule_test_token (self, 0, token);
return result;
}
static gboolean
valadoc_sequence_rule_test_token (ValadocSequenceRule* self,
gint from_index,
ValadocToken* token)
{
gint i = 0;
gboolean result;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (token != NULL, FALSE);
i = from_index;
while (TRUE) {
GObject** _tmp0_;
gint _tmp0__length1;
GObject** _tmp1_;
gint _tmp1__length1;
GObject* _tmp2_;
GObject** _tmp3_;
gint _tmp3__length1;
GObject* _tmp4_;
gint _tmp5_;
_tmp0_ = self->priv->_scheme;
_tmp0__length1 = self->priv->_scheme_length1;
if (!(i < _tmp0__length1)) {
break;
}
_tmp1_ = self->priv->_scheme;
_tmp1__length1 = self->priv->_scheme_length1;
_tmp2_ = _tmp1_[i];
if (valadoc_rule_has_start_token ((ValadocRule*) self, _tmp2_, token)) {
result = TRUE;
return result;
}
_tmp3_ = self->priv->_scheme;
_tmp3__length1 = self->priv->_scheme_length1;
_tmp4_ = _tmp3_[i];
if (!valadoc_rule_is_optional_rule ((ValadocRule*) self, _tmp4_)) {
break;
}
_tmp5_ = i;
i = _tmp5_ + 1;
}
result = FALSE;
return result;
}
static gboolean
valadoc_sequence_rule_test_reduce (ValadocSequenceRule* self,
gint from_index,
ValadocToken* token)
{
gint i = 0;
gboolean result;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (token != NULL, FALSE);
i = from_index;
while (TRUE) {
GObject** _tmp0_;
gint _tmp0__length1;
GObject** _tmp1_;
gint _tmp1__length1;
GObject* _tmp2_;
gint _tmp3_;
_tmp0_ = self->priv->_scheme;
_tmp0__length1 = self->priv->_scheme_length1;
if (!(i < _tmp0__length1)) {
break;
}
_tmp1_ = self->priv->_scheme;
_tmp1__length1 = self->priv->_scheme_length1;
_tmp2_ = _tmp1_[i];
if (!valadoc_rule_is_optional_rule ((ValadocRule*) self, _tmp2_)) {
result = FALSE;
return result;
}
_tmp3_ = i;
i = _tmp3_ + 1;
}
result = TRUE;
return result;
}
static gboolean
valadoc_sequence_rule_real_accept_token (ValadocRule* base,
ValadocToken* token,
ValadocParserCallback* parser,
ValadocRuleForward forward,
GError** error)
{
ValadocSequenceRule * self;
ValadocSequenceRuleState* state = NULL;
GObject* _tmp0_;
ValadocSequenceRuleState* _tmp1_;
ValadocSequenceRuleState* _tmp2_;
ValadocSequenceRuleState* _tmp5_;
GObject* scheme_element = NULL;
gboolean handled = FALSE;
ValadocSequenceRuleState* _tmp33_;
GObject** _tmp34_;
gint _tmp34__length1;
GObject* _tmp37_;
GError* _inner_error0_ = NULL;
gboolean result;
self = (ValadocSequenceRule*) base;
g_return_val_if_fail (token != NULL, FALSE);
g_return_val_if_fail (parser != NULL, FALSE);
_tmp0_ = valadoc_parser_callback_get_rule_state (parser);
_tmp1_ = VALADOC_SEQUENCE_RULE_IS_STATE (_tmp0_) ? ((ValadocSequenceRuleState*) _tmp0_) : NULL;
if (_tmp1_ == NULL) {
_g_object_unref0 (_tmp0_);
}
state = _tmp1_;
_tmp2_ = state;
if (_tmp2_ == NULL) {
ValadocSequenceRuleState* _tmp3_;
ValadocSequenceRuleState* _tmp4_;
_tmp3_ = valadoc_sequence_rule_state_new ();
_g_object_unref0 (state);
state = _tmp3_;
_tmp4_ = state;
valadoc_parser_callback_set_rule_state (parser, (GObject*) _tmp4_);
}
_tmp5_ = state;
if (_tmp5_->index == 0) {
valadoc_rule_do_start ((ValadocRule*) self, parser, &_inner_error0_);
if (G_UNLIKELY (_inner_error0_ != NULL)) {
if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
gboolean _tmp6_ = FALSE;
g_propagate_error (error, _inner_error0_);
_g_object_unref0 (state);
return _tmp6_;
} else {
gboolean _tmp7_ = FALSE;
_g_object_unref0 (state);
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);
g_clear_error (&_inner_error0_);
return _tmp7_;
}
}
} else {
ValadocSequenceRuleState* _tmp8_;
GObject** _tmp9_;
gint _tmp9__length1;
_tmp8_ = state;
_tmp9_ = self->priv->_scheme;
_tmp9__length1 = self->priv->_scheme_length1;
if (_tmp8_->index == _tmp9__length1) {
valadoc_rule_do_reduce ((ValadocRule*) self, parser, &_inner_error0_);
if (G_UNLIKELY (_inner_error0_ != NULL)) {
if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
gboolean _tmp10_ = FALSE;
g_propagate_error (error, _inner_error0_);
_g_object_unref0 (state);
return _tmp10_;
} else {
gboolean _tmp11_ = FALSE;
_g_object_unref0 (state);
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);
g_clear_error (&_inner_error0_);
return _tmp11_;
}
}
result = FALSE;
_g_object_unref0 (state);
return result;
}
}
scheme_element = NULL;
{
gboolean _tmp12_ = FALSE;
_tmp12_ = TRUE;
while (TRUE) {
GObject** _tmp15_;
gint _tmp15__length1;
ValadocSequenceRuleState* _tmp16_;
GObject* _tmp17_;
GObject* _tmp18_;
gboolean _tmp19_ = FALSE;
GObject* _tmp20_;
gboolean _tmp21_ = FALSE;
gboolean _tmp22_;
GObject* _tmp27_;
ValadocSequenceRuleState* _tmp31_;
gint _tmp32_;
if (!_tmp12_) {
ValadocSequenceRuleState* _tmp13_;
GObject** _tmp14_;
gint _tmp14__length1;
_tmp13_ = state;
_tmp14_ = self->priv->_scheme;
_tmp14__length1 = self->priv->_scheme_length1;
if (!(_tmp13_->index < _tmp14__length1)) {
break;
}
}
_tmp12_ = FALSE;
_tmp15_ = self->priv->_scheme;
_tmp15__length1 = self->priv->_scheme_length1;
_tmp16_ = state;
_tmp17_ = _tmp15_[_tmp16_->index];
_tmp18_ = _g_object_ref0 (_tmp17_);
_g_object_unref0 (scheme_element);
scheme_element = _tmp18_;
_tmp20_ = scheme_element;
_tmp22_ = valadoc_rule_try_to_apply ((ValadocRule*) self, _tmp20_, token, parser, &_tmp21_, &_inner_error0_);
handled = _tmp21_;
_tmp19_ = _tmp22_;
if (G_UNLIKELY (_inner_error0_ != NULL)) {
if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
gboolean _tmp23_ = FALSE;
g_propagate_error (error, _inner_error0_);
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
return _tmp23_;
} else {
gboolean _tmp24_ = FALSE;
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
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);
g_clear_error (&_inner_error0_);
return _tmp24_;
}
}
if (_tmp19_) {
ValadocSequenceRuleState* _tmp25_;
gint _tmp26_;
_tmp25_ = state;
_tmp26_ = _tmp25_->index;
_tmp25_->index = _tmp26_ + 1;
result = handled;
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
return result;
}
_tmp27_ = scheme_element;
if (!valadoc_rule_is_optional_rule ((ValadocRule*) self, _tmp27_)) {
break;
} else {
GObject* _tmp28_;
_tmp28_ = scheme_element;
valadoc_rule_do_skip (G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, VALADOC_TYPE_RULE, ValadocRule), parser, &_inner_error0_);
if (G_UNLIKELY (_inner_error0_ != NULL)) {
if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
gboolean _tmp29_ = FALSE;
g_propagate_error (error, _inner_error0_);
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
return _tmp29_;
} else {
gboolean _tmp30_ = FALSE;
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
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);
g_clear_error (&_inner_error0_);
return _tmp30_;
}
}
}
_tmp31_ = state;
_tmp32_ = _tmp31_->index;
_tmp31_->index = _tmp32_ + 1;
}
}
_tmp33_ = state;
_tmp34_ = self->priv->_scheme;
_tmp34__length1 = self->priv->_scheme_length1;
if (_tmp33_->index == _tmp34__length1) {
valadoc_rule_do_reduce ((ValadocRule*) self, parser, &_inner_error0_);
if (G_UNLIKELY (_inner_error0_ != NULL)) {
if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
gboolean _tmp35_ = FALSE;
g_propagate_error (error, _inner_error0_);
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
return _tmp35_;
} else {
gboolean _tmp36_ = FALSE;
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
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);
g_clear_error (&_inner_error0_);
return _tmp36_;
}
}
result = FALSE;
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
return result;
}
_tmp37_ = scheme_element;
if (VALADOC_IS_TOKEN_TYPE (_tmp37_)) {
GObject* _tmp38_;
const gchar* _tmp39_;
gchar* _tmp40_;
gchar* _tmp41_;
_tmp38_ = scheme_element;
_tmp39_ = valadoc_token_type_to_pretty_string (G_TYPE_CHECK_INSTANCE_CAST (_tmp38_, VALADOC_TYPE_TOKEN_TYPE, ValadocTokenType));
_tmp40_ = g_strdup_printf ("expected %s", _tmp39_);
_tmp41_ = _tmp40_;
valadoc_parser_callback_error (parser, token, _tmp41_, &_inner_error0_);
_g_free0 (_tmp41_);
if (G_UNLIKELY (_inner_error0_ != NULL)) {
if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
gboolean _tmp42_ = FALSE;
g_propagate_error (error, _inner_error0_);
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
return _tmp42_;
} else {
gboolean _tmp43_ = FALSE;
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
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);
g_clear_error (&_inner_error0_);
return _tmp43_;
}
}
} else {
valadoc_parser_callback_error (parser, token, "unexpected token", &_inner_error0_);
if (G_UNLIKELY (_inner_error0_ != NULL)) {
if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
gboolean _tmp44_ = FALSE;
g_propagate_error (error, _inner_error0_);
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
return _tmp44_;
} else {
gboolean _tmp45_ = FALSE;
_g_object_unref0 (scheme_element);
_g_object_unref0 (state);
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);
g_clear_error (&_inner_error0_);
return _tmp45_;
}
}
}
g_assert_not_reached ();
}
static gboolean
valadoc_sequence_rule_real_would_accept_token (ValadocRule* base,
ValadocToken* token,
GObject* rule_state)
{
ValadocSequenceRule * self;
ValadocSequenceRuleState* state = NULL;
ValadocSequenceRuleState* _tmp0_;
gboolean result;
self = (ValadocSequenceRule*) base;
g_return_val_if_fail (token != NULL, FALSE);
_tmp0_ = _g_object_ref0 (VALADOC_SEQUENCE_RULE_IS_STATE (rule_state) ? ((ValadocSequenceRuleState*) rule_state) : NULL);
state = _tmp0_;
result = valadoc_sequence_rule_test_token (self, state->index, token);
_g_object_unref0 (state);
return result;
}
static gboolean
valadoc_sequence_rule_real_would_reduce (ValadocRule* base,
ValadocToken* token,
GObject* rule_state)
{
ValadocSequenceRule * self;
ValadocSequenceRuleState* state = NULL;
ValadocSequenceRuleState* _tmp0_;
gboolean _tmp1_ = FALSE;
ValadocSequenceRuleState* _tmp2_;
GObject** _tmp3_;
gint _tmp3__length1;
gboolean result;
self = (ValadocSequenceRule*) base;
g_return_val_if_fail (token != NULL, FALSE);
_tmp0_ = _g_object_ref0 (VALADOC_SEQUENCE_RULE_IS_STATE (rule_state) ? ((ValadocSequenceRuleState*) rule_state) : NULL);
state = _tmp0_;
_tmp2_ = state;
_tmp3_ = self->priv->_scheme;
_tmp3__length1 = self->priv->_scheme_length1;
if (_tmp2_->index == _tmp3__length1) {
_tmp1_ = TRUE;
} else {
ValadocSequenceRuleState* _tmp4_;
_tmp4_ = state;
_tmp1_ = valadoc_sequence_rule_test_reduce (self, _tmp4_->index, token);
}
result = _tmp1_;
_g_object_unref0 (state);
return result;
}
static gchar*
valadoc_sequence_rule_real_to_string (ValadocRule* base,
GObject* rule_state)
{
ValadocSequenceRule * self;
ValadocSequenceRuleState* state = NULL;
ValadocSequenceRuleState* _tmp0_;
ValadocSequenceRuleState* _tmp1_;
const gchar* _tmp3_ = NULL;
const gchar* _tmp4_;
const gchar* _tmp5_;
ValadocSequenceRuleState* _tmp8_;
GObject** _tmp9_;
gint _tmp9__length1;
gchar* _tmp10_;
gchar* result;
self = (ValadocSequenceRule*) base;
_tmp0_ = _g_object_ref0 (VALADOC_SEQUENCE_RULE_IS_STATE (rule_state) ? ((ValadocSequenceRuleState*) rule_state) : NULL);
state = _tmp0_;
_tmp1_ = state;
if (_tmp1_ == NULL) {
ValadocSequenceRuleState* _tmp2_;
_tmp2_ = valadoc_sequence_rule_state_new ();
_g_object_unref0 (state);
state = _tmp2_;
}
_tmp4_ = valadoc_rule_get_name ((ValadocRule*) self);
_tmp5_ = _tmp4_;
if (_tmp5_ != NULL) {
const gchar* _tmp6_;
const gchar* _tmp7_;
_tmp6_ = valadoc_rule_get_name ((ValadocRule*) self);
_tmp7_ = _tmp6_;
_tmp3_ = _tmp7_;
} else {
_tmp3_ = " ";
}
_tmp8_ = state;
_tmp9_ = self->priv->_scheme;
_tmp9__length1 = self->priv->_scheme_length1;
_tmp10_ = g_strdup_printf ("%-15s%-15s(index=%d/%d)", _tmp3_, "[seq]", _tmp8_->index, _tmp9__length1);
result = _tmp10_;
_g_object_unref0 (state);
return result;
}
static ValadocSequenceRuleState*
valadoc_sequence_rule_state_construct (GType object_type)
{
ValadocSequenceRuleState * self = NULL;
self = (ValadocSequenceRuleState*) g_object_new (object_type, NULL);
return self;
}
static ValadocSequenceRuleState*
valadoc_sequence_rule_state_new (void)
{
return valadoc_sequence_rule_state_construct (VALADOC_SEQUENCE_RULE_TYPE_STATE);
}
static void
valadoc_sequence_rule_state_class_init (ValadocSequenceRuleStateClass * klass,
gpointer klass_data)
{
valadoc_sequence_rule_state_parent_class = g_type_class_peek_parent (klass);
G_OBJECT_CLASS (klass)->finalize = valadoc_sequence_rule_state_finalize;
}
static void
valadoc_sequence_rule_state_instance_init (ValadocSequenceRuleState * self,
gpointer klass)
{
self->index = 0;
}
static void
valadoc_sequence_rule_state_finalize (GObject * obj)
{
ValadocSequenceRuleState * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_SEQUENCE_RULE_TYPE_STATE, ValadocSequenceRuleState);
G_OBJECT_CLASS (valadoc_sequence_rule_state_parent_class)->finalize (obj);
}
static GType
valadoc_sequence_rule_state_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (ValadocSequenceRuleStateClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_sequence_rule_state_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocSequenceRuleState), 0, (GInstanceInitFunc) valadoc_sequence_rule_state_instance_init, NULL };
GType valadoc_sequence_rule_state_type_id;
valadoc_sequence_rule_state_type_id = g_type_register_static (G_TYPE_OBJECT, "ValadocSequenceRuleState", &g_define_type_info, 0);
return valadoc_sequence_rule_state_type_id;
}
static GType
valadoc_sequence_rule_state_get_type (void)
{
static volatile gsize valadoc_sequence_rule_state_type_id__once = 0;
if (g_once_init_enter (&valadoc_sequence_rule_state_type_id__once)) {
GType valadoc_sequence_rule_state_type_id;
valadoc_sequence_rule_state_type_id = valadoc_sequence_rule_state_get_type_once ();
g_once_init_leave (&valadoc_sequence_rule_state_type_id__once, valadoc_sequence_rule_state_type_id);
}
return valadoc_sequence_rule_state_type_id__once;
}
static void
valadoc_sequence_rule_class_init (ValadocSequenceRuleClass * klass,
gpointer klass_data)
{
valadoc_sequence_rule_parent_class = g_type_class_peek_parent (klass);
g_type_class_adjust_private_offset (klass, &ValadocSequenceRule_private_offset);
((ValadocRuleClass *) klass)->is_optional = (gboolean (*) (ValadocRule*)) valadoc_sequence_rule_real_is_optional;
((ValadocRuleClass *) klass)->starts_with_token = (gboolean (*) (ValadocRule*, ValadocToken*)) valadoc_sequence_rule_real_starts_with_token;
((ValadocRuleClass *) klass)->accept_token = (gboolean (*) (ValadocRule*, ValadocToken*, ValadocParserCallback*, ValadocRuleForward, GError**)) valadoc_sequence_rule_real_accept_token;
((ValadocRuleClass *) klass)->would_accept_token = (gboolean (*) (ValadocRule*, ValadocToken*, GObject*)) valadoc_sequence_rule_real_would_accept_token;
((ValadocRuleClass *) klass)->would_reduce = (gboolean (*) (ValadocRule*, ValadocToken*, GObject*)) valadoc_sequence_rule_real_would_reduce;
((ValadocRuleClass *) klass)->to_string = (gchar* (*) (ValadocRule*, GObject*)) valadoc_sequence_rule_real_to_string;
G_OBJECT_CLASS (klass)->finalize = valadoc_sequence_rule_finalize;
}
static void
valadoc_sequence_rule_instance_init (ValadocSequenceRule * self,
gpointer klass)
{
self->priv = valadoc_sequence_rule_get_instance_private (self);
}
static void
valadoc_sequence_rule_finalize (GObject * obj)
{
ValadocSequenceRule * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_TYPE_SEQUENCE_RULE, ValadocSequenceRule);
self->priv->_scheme = (_vala_array_free (self->priv->_scheme, self->priv->_scheme_length1, (GDestroyNotify) g_object_unref), NULL);
G_OBJECT_CLASS (valadoc_sequence_rule_parent_class)->finalize (obj);
}
static GType
valadoc_sequence_rule_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (ValadocSequenceRuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_sequence_rule_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocSequenceRule), 0, (GInstanceInitFunc) valadoc_sequence_rule_instance_init, NULL };
GType valadoc_sequence_rule_type_id;
valadoc_sequence_rule_type_id = g_type_register_static (VALADOC_TYPE_RULE, "ValadocSequenceRule", &g_define_type_info, 0);
ValadocSequenceRule_private_offset = g_type_add_instance_private (valadoc_sequence_rule_type_id, sizeof (ValadocSequenceRulePrivate));
return valadoc_sequence_rule_type_id;
}
G_GNUC_INTERNAL GType
valadoc_sequence_rule_get_type (void)
{
static volatile gsize valadoc_sequence_rule_type_id__once = 0;
if (g_once_init_enter (&valadoc_sequence_rule_type_id__once)) {
GType valadoc_sequence_rule_type_id;
valadoc_sequence_rule_type_id = valadoc_sequence_rule_get_type_once ();
g_once_init_leave (&valadoc_sequence_rule_type_id__once, valadoc_sequence_rule_type_id);
}
return valadoc_sequence_rule_type_id__once;
}
static void
_vala_array_destroy (gpointer array,
gssize array_length,
GDestroyNotify destroy_func)
{
if ((array != NULL) && (destroy_func != NULL)) {
gssize 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,
gssize array_length,
GDestroyNotify destroy_func)
{
_vala_array_destroy (array, array_length, destroy_func);
g_free (array);
}
|