ASTMatcher.cpp 69.7 KB
Newer Older
1 2 3 4
/**************************************************************************
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/

30 31 32 33 34 35 36 37 38

//
//  W A R N I N G
//  -------------
//
// This file is automatically generated.
// Changes will be lost.
//

Roberto Raggi's avatar
Roberto Raggi committed
39
#include "AST.h"
40 41 42 43
#include "ASTMatcher.h"

using namespace CPlusPlus;

Roberto Raggi's avatar
Roberto Raggi committed
44
ASTMatcher::ASTMatcher()
Roberto Raggi's avatar
Roberto Raggi committed
45 46 47 48 49
{ }

ASTMatcher::~ASTMatcher()
{ }

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
bool ASTMatcher::match(ObjCSelectorArgumentAST *node, ObjCSelectorArgumentAST *pattern)
{
    (void) node;
    (void) pattern;

    pattern->name_token = node->name_token;

    pattern->colon_token = node->colon_token;

    return true;
}

bool ASTMatcher::match(ObjCSelectorAST *node, ObjCSelectorAST *pattern)
{
    (void) node;
    (void) pattern;

    if (! pattern->selector_argument_list)
        pattern->selector_argument_list = node->selector_argument_list;
    else if (! AST::match(node->selector_argument_list, pattern->selector_argument_list, this))
        return false;

    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
75
bool ASTMatcher::match(SimpleSpecifierAST *node, SimpleSpecifierAST *pattern)
76
{
77 78 79 80 81
    (void) node;
    (void) pattern;

    pattern->specifier_token = node->specifier_token;

82 83 84
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
85
bool ASTMatcher::match(AttributeSpecifierAST *node, AttributeSpecifierAST *pattern)
86
{
87 88 89 90 91 92 93 94 95 96 97 98
    (void) node;
    (void) pattern;

    pattern->attribute_token = node->attribute_token;

    pattern->first_lparen_token = node->first_lparen_token;

    pattern->second_lparen_token = node->second_lparen_token;

    if (! pattern->attribute_list)
        pattern->attribute_list = node->attribute_list;
    else if (! AST::match(node->attribute_list, pattern->attribute_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
99
        return false;
100 101 102 103 104

    pattern->first_rparen_token = node->first_rparen_token;

    pattern->second_rparen_token = node->second_rparen_token;

105 106 107
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
108
bool ASTMatcher::match(AttributeAST *node, AttributeAST *pattern)
109
{
110 111 112 113 114 115 116 117 118 119 120 121
    (void) node;
    (void) pattern;

    pattern->identifier_token = node->identifier_token;

    pattern->lparen_token = node->lparen_token;

    pattern->tag_token = node->tag_token;

    if (! pattern->expression_list)
        pattern->expression_list = node->expression_list;
    else if (! AST::match(node->expression_list, pattern->expression_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
122
        return false;
123 124 125

    pattern->rparen_token = node->rparen_token;

126 127 128
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
129
bool ASTMatcher::match(TypeofSpecifierAST *node, TypeofSpecifierAST *pattern)
130
{
131 132 133 134 135 136 137 138 139 140
    (void) node;
    (void) pattern;

    pattern->typeof_token = node->typeof_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
141
        return false;
142 143 144

    pattern->rparen_token = node->rparen_token;

145 146 147
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
148
bool ASTMatcher::match(DeclaratorAST *node, DeclaratorAST *pattern)
149
{
150 151 152 153 154 155
    (void) node;
    (void) pattern;

    if (! pattern->attribute_list)
        pattern->attribute_list = node->attribute_list;
    else if (! AST::match(node->attribute_list, pattern->attribute_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
156
        return false;
157 158 159 160

    if (! pattern->ptr_operator_list)
        pattern->ptr_operator_list = node->ptr_operator_list;
    else if (! AST::match(node->ptr_operator_list, pattern->ptr_operator_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
161
        return false;
162 163 164 165

    if (! pattern->core_declarator)
        pattern->core_declarator = node->core_declarator;
    else if (! AST::match(node->core_declarator, pattern->core_declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
166
        return false;
167 168 169 170

    if (! pattern->postfix_declarator_list)
        pattern->postfix_declarator_list = node->postfix_declarator_list;
    else if (! AST::match(node->postfix_declarator_list, pattern->postfix_declarator_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
171
        return false;
172 173 174 175

    if (! pattern->post_attribute_list)
        pattern->post_attribute_list = node->post_attribute_list;
    else if (! AST::match(node->post_attribute_list, pattern->post_attribute_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
176
        return false;
177 178 179 180 181 182

    pattern->equals_token = node->equals_token;

    if (! pattern->initializer)
        pattern->initializer = node->initializer;
    else if (! AST::match(node->initializer, pattern->initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
183
        return false;
184

185 186 187
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
188
bool ASTMatcher::match(SimpleDeclarationAST *node, SimpleDeclarationAST *pattern)
189
{
190 191 192 193 194 195 196 197
    (void) node;
    (void) pattern;

    pattern->qt_invokable_token = node->qt_invokable_token;

    if (! pattern->decl_specifier_list)
        pattern->decl_specifier_list = node->decl_specifier_list;
    else if (! AST::match(node->decl_specifier_list, pattern->decl_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
198
        return false;
199 200 201 202

    if (! pattern->declarator_list)
        pattern->declarator_list = node->declarator_list;
    else if (! AST::match(node->declarator_list, pattern->declarator_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
203
        return false;
204 205 206

    pattern->semicolon_token = node->semicolon_token;

207 208 209
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
210
bool ASTMatcher::match(EmptyDeclarationAST *node, EmptyDeclarationAST *pattern)
211
{
212 213 214 215 216
    (void) node;
    (void) pattern;

    pattern->semicolon_token = node->semicolon_token;

217 218 219
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
220
bool ASTMatcher::match(AccessDeclarationAST *node, AccessDeclarationAST *pattern)
221
{
222 223 224 225 226 227 228 229 230
    (void) node;
    (void) pattern;

    pattern->access_specifier_token = node->access_specifier_token;

    pattern->slots_token = node->slots_token;

    pattern->colon_token = node->colon_token;

231 232 233
    return true;
}

234
bool ASTMatcher::match(QtPropertyDeclarationItemAST *node, QtPropertyDeclarationItemAST *pattern)
235 236 237 238
{
    (void) node;
    (void) pattern;

239
    pattern->item_name_token = node->item_name_token;
240

241 242 243
    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
244
        return false;
245

246 247
    return true;
}
248

249 250 251 252
bool ASTMatcher::match(QtPropertyDeclarationAST *node, QtPropertyDeclarationAST *pattern)
{
    (void) node;
    (void) pattern;
253

254
    pattern->property_specifier_token = node->property_specifier_token;
255

256
    pattern->lparen_token = node->lparen_token;
257

258 259 260
    if (! pattern->type_id)
        pattern->type_id = node->type_id;
    else if (! AST::match(node->type_id, pattern->type_id, this))
261 262
        return false;

263 264 265
    if (! pattern->property_name)
        pattern->property_name = node->property_name;
    else if (! AST::match(node->property_name, pattern->property_name, this))
266 267
        return false;

268 269 270
    if (! pattern->property_declaration_items)
        pattern->property_declaration_items = node->property_declaration_items;
    else if (! AST::match(node->property_declaration_items, pattern->property_declaration_items, this))
271 272
        return false;

273 274
    pattern->rparen_token = node->rparen_token;

275 276 277
    return true;
}

278
bool ASTMatcher::match(QtEnumDeclarationAST *node, QtEnumDeclarationAST *pattern)
279 280 281 282 283 284
{
    (void) node;
    (void) pattern;

    pattern->enum_specifier_token = node->enum_specifier_token;

285 286
    pattern->lparen_token = node->lparen_token;

287 288 289 290 291
    if (! pattern->enumerator_list)
        pattern->enumerator_list = node->enumerator_list;
    else if (! AST::match(node->enumerator_list, pattern->enumerator_list, this))
        return false;

292 293
    pattern->rparen_token = node->rparen_token;

294 295 296
    return true;
}

297
bool ASTMatcher::match(QtFlagsDeclarationAST *node, QtFlagsDeclarationAST *pattern)
298 299 300 301 302 303
{
    (void) node;
    (void) pattern;

    pattern->flags_specifier_token = node->flags_specifier_token;

304 305
    pattern->lparen_token = node->lparen_token;

306 307 308
    if (! pattern->flag_enums_list)
        pattern->flag_enums_list = node->flag_enums_list;
    else if (! AST::match(node->flag_enums_list, pattern->flag_enums_list, this))
309 310
        return false;

311 312
    pattern->rparen_token = node->rparen_token;

313 314 315
    return true;
}

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
bool ASTMatcher::match(QtInterfaceNameAST *node, QtInterfaceNameAST *pattern)
{
    (void) node;
    (void) pattern;

    if (! pattern->interface_name)
        pattern->interface_name = node->interface_name;
    else if (! AST::match(node->interface_name, pattern->interface_name, this))
        return false;

    if (! pattern->constraint_list)
        pattern->constraint_list = node->constraint_list;
    else if (! AST::match(node->constraint_list, pattern->constraint_list, this))
        return false;

    return true;
}

bool ASTMatcher::match(QtInterfacesDeclarationAST *node, QtInterfacesDeclarationAST *pattern)
{
    (void) node;
    (void) pattern;

    pattern->interfaces_token = node->interfaces_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->interface_name_list)
        pattern->interface_name_list = node->interface_name_list;
    else if (! AST::match(node->interface_name_list, pattern->interface_name_list, this))
        return false;

    pattern->rparen_token = node->rparen_token;

    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
353
bool ASTMatcher::match(AsmDefinitionAST *node, AsmDefinitionAST *pattern)
354
{
355 356 357 358 359 360 361 362 363 364 365 366 367
    (void) node;
    (void) pattern;

    pattern->asm_token = node->asm_token;

    pattern->volatile_token = node->volatile_token;

    pattern->lparen_token = node->lparen_token;

    pattern->rparen_token = node->rparen_token;

    pattern->semicolon_token = node->semicolon_token;

368 369 370
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
371
bool ASTMatcher::match(BaseSpecifierAST *node, BaseSpecifierAST *pattern)
372
{
373 374 375 376 377 378 379 380 381 382
    (void) node;
    (void) pattern;

    pattern->virtual_token = node->virtual_token;

    pattern->access_specifier_token = node->access_specifier_token;

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
383
        return false;
384

385 386 387
    return true;
}

388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
bool ASTMatcher::match(CompoundExpressionAST *node, CompoundExpressionAST *pattern)
{
    (void) node;
    (void) pattern;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->compoundStatement)
        pattern->compoundStatement = node->compoundStatement;
    else if (! AST::match(node->compoundStatement, pattern->compoundStatement, this))
        return false;

    pattern->rparen_token = node->rparen_token;

    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
405
bool ASTMatcher::match(CompoundLiteralAST *node, CompoundLiteralAST *pattern)
406
{
407 408 409 410 411 412 413 414
    (void) node;
    (void) pattern;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->type_id)
        pattern->type_id = node->type_id;
    else if (! AST::match(node->type_id, pattern->type_id, this))
Roberto Raggi's avatar
Roberto Raggi committed
415
        return false;
416 417 418 419 420 421

    pattern->rparen_token = node->rparen_token;

    if (! pattern->initializer)
        pattern->initializer = node->initializer;
    else if (! AST::match(node->initializer, pattern->initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
422
        return false;
423

424 425 426
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
427
bool ASTMatcher::match(QtMethodAST *node, QtMethodAST *pattern)
428
{
429 430 431 432 433 434 435 436 437 438
    (void) node;
    (void) pattern;

    pattern->method_token = node->method_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
439
        return false;
440

441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
    pattern->rparen_token = node->rparen_token;

    return true;
}

bool ASTMatcher::match(QtMemberDeclarationAST *node, QtMemberDeclarationAST *pattern)
{
    (void) node;
    (void) pattern;

    pattern->q_token = node->q_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->type_id)
        pattern->type_id = node->type_id;
    else if (! AST::match(node->type_id, pattern->type_id, this))
        return false;

460 461
    pattern->rparen_token = node->rparen_token;

462 463 464
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
465
bool ASTMatcher::match(BinaryExpressionAST *node, BinaryExpressionAST *pattern)
466
{
467 468 469 470 471 472
    (void) node;
    (void) pattern;

    if (! pattern->left_expression)
        pattern->left_expression = node->left_expression;
    else if (! AST::match(node->left_expression, pattern->left_expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
473
        return false;
474 475 476 477 478 479

    pattern->binary_op_token = node->binary_op_token;

    if (! pattern->right_expression)
        pattern->right_expression = node->right_expression;
    else if (! AST::match(node->right_expression, pattern->right_expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
480
        return false;
481

482 483 484
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
485
bool ASTMatcher::match(CastExpressionAST *node, CastExpressionAST *pattern)
486
{
487 488 489 490 491 492 493 494
    (void) node;
    (void) pattern;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->type_id)
        pattern->type_id = node->type_id;
    else if (! AST::match(node->type_id, pattern->type_id, this))
Roberto Raggi's avatar
Roberto Raggi committed
495
        return false;
496 497 498 499 500 501

    pattern->rparen_token = node->rparen_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
502
        return false;
503

504 505 506
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
507
bool ASTMatcher::match(ClassSpecifierAST *node, ClassSpecifierAST *pattern)
508
{
509 510 511 512 513 514 515 516
    (void) node;
    (void) pattern;

    pattern->classkey_token = node->classkey_token;

    if (! pattern->attribute_list)
        pattern->attribute_list = node->attribute_list;
    else if (! AST::match(node->attribute_list, pattern->attribute_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
517
        return false;
518 519 520 521

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
522
        return false;
523 524 525 526 527 528

    pattern->colon_token = node->colon_token;

    if (! pattern->base_clause_list)
        pattern->base_clause_list = node->base_clause_list;
    else if (! AST::match(node->base_clause_list, pattern->base_clause_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
529
        return false;
530 531 532 533 534 535

    pattern->lbrace_token = node->lbrace_token;

    if (! pattern->member_specifier_list)
        pattern->member_specifier_list = node->member_specifier_list;
    else if (! AST::match(node->member_specifier_list, pattern->member_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
536
        return false;
537 538 539

    pattern->rbrace_token = node->rbrace_token;

540 541 542
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
543
bool ASTMatcher::match(CaseStatementAST *node, CaseStatementAST *pattern)
544
{
545 546 547 548 549 550 551 552
    (void) node;
    (void) pattern;

    pattern->case_token = node->case_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
553
        return false;
554 555 556 557 558 559

    pattern->colon_token = node->colon_token;

    if (! pattern->statement)
        pattern->statement = node->statement;
    else if (! AST::match(node->statement, pattern->statement, this))
Roberto Raggi's avatar
Roberto Raggi committed
560
        return false;
561

562 563 564
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
565
bool ASTMatcher::match(CompoundStatementAST *node, CompoundStatementAST *pattern)
566
{
567 568 569 570 571 572 573 574
    (void) node;
    (void) pattern;

    pattern->lbrace_token = node->lbrace_token;

    if (! pattern->statement_list)
        pattern->statement_list = node->statement_list;
    else if (! AST::match(node->statement_list, pattern->statement_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
575
        return false;
576 577 578

    pattern->rbrace_token = node->rbrace_token;

579 580 581
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
582
bool ASTMatcher::match(ConditionAST *node, ConditionAST *pattern)
583
{
584 585 586 587 588 589
    (void) node;
    (void) pattern;

    if (! pattern->type_specifier_list)
        pattern->type_specifier_list = node->type_specifier_list;
    else if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
590
        return false;
591 592 593 594

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
595
        return false;
596

597 598 599
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
600
bool ASTMatcher::match(ConditionalExpressionAST *node, ConditionalExpressionAST *pattern)
601
{
602 603 604 605 606 607
    (void) node;
    (void) pattern;

    if (! pattern->condition)
        pattern->condition = node->condition;
    else if (! AST::match(node->condition, pattern->condition, this))
Roberto Raggi's avatar
Roberto Raggi committed
608
        return false;
609 610 611 612 613 614

    pattern->question_token = node->question_token;

    if (! pattern->left_expression)
        pattern->left_expression = node->left_expression;
    else if (! AST::match(node->left_expression, pattern->left_expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
615
        return false;
616 617 618 619 620 621

    pattern->colon_token = node->colon_token;

    if (! pattern->right_expression)
        pattern->right_expression = node->right_expression;
    else if (! AST::match(node->right_expression, pattern->right_expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
622
        return false;
623

624 625 626
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
627
bool ASTMatcher::match(CppCastExpressionAST *node, CppCastExpressionAST *pattern)
628
{
629 630 631 632 633 634 635 636 637 638
    (void) node;
    (void) pattern;

    pattern->cast_token = node->cast_token;

    pattern->less_token = node->less_token;

    if (! pattern->type_id)
        pattern->type_id = node->type_id;
    else if (! AST::match(node->type_id, pattern->type_id, this))
Roberto Raggi's avatar
Roberto Raggi committed
639
        return false;
640 641 642 643 644 645 646 647

    pattern->greater_token = node->greater_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
648
        return false;
649 650 651

    pattern->rparen_token = node->rparen_token;

652 653 654
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
655
bool ASTMatcher::match(CtorInitializerAST *node, CtorInitializerAST *pattern)
656
{
657 658 659 660 661 662 663 664
    (void) node;
    (void) pattern;

    pattern->colon_token = node->colon_token;

    if (! pattern->member_initializer_list)
        pattern->member_initializer_list = node->member_initializer_list;
    else if (! AST::match(node->member_initializer_list, pattern->member_initializer_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
665
        return false;
666

667 668 669
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
670
bool ASTMatcher::match(DeclarationStatementAST *node, DeclarationStatementAST *pattern)
671
{
672 673 674 675 676 677
    (void) node;
    (void) pattern;

    if (! pattern->declaration)
        pattern->declaration = node->declaration;
    else if (! AST::match(node->declaration, pattern->declaration, this))
Roberto Raggi's avatar
Roberto Raggi committed
678
        return false;
679

680 681 682
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
683
bool ASTMatcher::match(DeclaratorIdAST *node, DeclaratorIdAST *pattern)
684
{
685 686 687 688 689 690
    (void) node;
    (void) pattern;

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
691
        return false;
692

693 694 695
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
696
bool ASTMatcher::match(NestedDeclaratorAST *node, NestedDeclaratorAST *pattern)
697
{
698 699 700 701 702 703 704 705
    (void) node;
    (void) pattern;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
706
        return false;
707 708 709

    pattern->rparen_token = node->rparen_token;

710 711 712
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
713
bool ASTMatcher::match(FunctionDeclaratorAST *node, FunctionDeclaratorAST *pattern)
714
{
715 716 717 718 719 720 721 722
    (void) node;
    (void) pattern;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->parameters)
        pattern->parameters = node->parameters;
    else if (! AST::match(node->parameters, pattern->parameters, this))
Roberto Raggi's avatar
Roberto Raggi committed
723
        return false;
724 725 726 727 728 729

    pattern->rparen_token = node->rparen_token;

    if (! pattern->cv_qualifier_list)
        pattern->cv_qualifier_list = node->cv_qualifier_list;
    else if (! AST::match(node->cv_qualifier_list, pattern->cv_qualifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
730
        return false;
731 732 733 734

    if (! pattern->exception_specification)
        pattern->exception_specification = node->exception_specification;
    else if (! AST::match(node->exception_specification, pattern->exception_specification, this))
Roberto Raggi's avatar
Roberto Raggi committed
735
        return false;
736 737 738 739

    if (! pattern->as_cpp_initializer)
        pattern->as_cpp_initializer = node->as_cpp_initializer;
    else if (! AST::match(node->as_cpp_initializer, pattern->as_cpp_initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
740
        return false;
741

742 743 744
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
745
bool ASTMatcher::match(ArrayDeclaratorAST *node, ArrayDeclaratorAST *pattern)
746
{
747 748 749 750 751 752 753 754
    (void) node;
    (void) pattern;

    pattern->lbracket_token = node->lbracket_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
755
        return false;
756 757 758

    pattern->rbracket_token = node->rbracket_token;

759 760 761
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
762
bool ASTMatcher::match(DeleteExpressionAST *node, DeleteExpressionAST *pattern)
763
{
764 765 766 767 768 769 770 771 772 773 774 775 776 777
    (void) node;
    (void) pattern;

    pattern->scope_token = node->scope_token;

    pattern->delete_token = node->delete_token;

    pattern->lbracket_token = node->lbracket_token;

    pattern->rbracket_token = node->rbracket_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
778
        return false;
779

780 781 782
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
783
bool ASTMatcher::match(DoStatementAST *node, DoStatementAST *pattern)
784
{
785 786 787 788 789 790 791 792
    (void) node;
    (void) pattern;

    pattern->do_token = node->do_token;

    if (! pattern->statement)
        pattern->statement = node->statement;
    else if (! AST::match(node->statement, pattern->statement, this))
Roberto Raggi's avatar
Roberto Raggi committed
793
        return false;
794 795 796 797 798 799 800 801

    pattern->while_token = node->while_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
802
        return false;
803 804 805 806 807

    pattern->rparen_token = node->rparen_token;

    pattern->semicolon_token = node->semicolon_token;

808 809 810
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
811
bool ASTMatcher::match(NamedTypeSpecifierAST *node, NamedTypeSpecifierAST *pattern)
812
{
813 814 815 816 817 818
    (void) node;
    (void) pattern;

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
819
        return false;
820

821 822 823
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
824
bool ASTMatcher::match(ElaboratedTypeSpecifierAST *node, ElaboratedTypeSpecifierAST *pattern)
825
{
826 827 828 829 830 831 832 833
    (void) node;
    (void) pattern;

    pattern->classkey_token = node->classkey_token;

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
834
        return false;
835

836 837 838
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
839
bool ASTMatcher::match(EnumSpecifierAST *node, EnumSpecifierAST *pattern)
840
{
841 842 843 844 845 846 847 848
    (void) node;
    (void) pattern;

    pattern->enum_token = node->enum_token;

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
849
        return false;
850 851 852 853 854 855

    pattern->lbrace_token = node->lbrace_token;

    if (! pattern->enumerator_list)
        pattern->enumerator_list = node->enumerator_list;
    else if (! AST::match(node->enumerator_list, pattern->enumerator_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
856
        return false;
857 858 859

    pattern->rbrace_token = node->rbrace_token;

860 861 862
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
863
bool ASTMatcher::match(EnumeratorAST *node, EnumeratorAST *pattern)
864
{
865 866 867 868 869 870 871 872 873 874
    (void) node;
    (void) pattern;

    pattern->identifier_token = node->identifier_token;

    pattern->equal_token = node->equal_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
875
        return false;
876

877 878 879
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
880
bool ASTMatcher::match(ExceptionDeclarationAST *node, ExceptionDeclarationAST *pattern)
881
{
882 883 884 885 886 887
    (void) node;
    (void) pattern;

    if (! pattern->type_specifier_list)
        pattern->type_specifier_list = node->type_specifier_list;
    else if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
888
        return false;
889 890 891 892

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
893
        return false;
894 895 896

    pattern->dot_dot_dot_token = node->dot_dot_dot_token;

897 898 899
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
900
bool ASTMatcher::match(ExceptionSpecificationAST *node, ExceptionSpecificationAST *pattern)
901
{
902 903 904 905 906 907 908 909 910 911 912 913
    (void) node;
    (void) pattern;

    pattern->throw_token = node->throw_token;

    pattern->lparen_token = node->lparen_token;

    pattern->dot_dot_dot_token = node->dot_dot_dot_token;

    if (! pattern->type_id_list)
        pattern->type_id_list = node->type_id_list;
    else if (! AST::match(node->type_id_list, pattern->type_id_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
914
        return false;
915 916 917

    pattern->rparen_token = node->rparen_token;

918 919 920
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
921
bool ASTMatcher::match(ExpressionOrDeclarationStatementAST *node, ExpressionOrDeclarationStatementAST *pattern)
922
{
923 924 925 926 927 928
    (void) node;
    (void) pattern;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
929
        return false;
930 931 932 933

    if (! pattern->declaration)
        pattern->declaration = node->declaration;
    else if (! AST::match(node->declaration, pattern->declaration, this))
Roberto Raggi's avatar
Roberto Raggi committed
934
        return false;
935

936 937 938
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
939
bool ASTMatcher::match(ExpressionStatementAST *node, ExpressionStatementAST *pattern)
940
{
941 942 943 944 945 946
    (void) node;
    (void) pattern;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
947
        return false;
948 949 950

    pattern->semicolon_token = node->semicolon_token;

951 952 953
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
954
bool ASTMatcher::match(FunctionDefinitionAST *node, FunctionDefinitionAST *pattern)
955
{
956 957 958 959 960 961 962 963
    (void) node;
    (void) pattern;

    pattern->qt_invokable_token = node->qt_invokable_token;

    if (! pattern->decl_specifier_list)
        pattern->decl_specifier_list = node->decl_specifier_list;
    else if (! AST::match(node->decl_specifier_list, pattern->decl_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
964
        return false;
965 966 967 968

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
969
        return false;
970 971 972 973

    if (! pattern->ctor_initializer)
        pattern->ctor_initializer = node->ctor_initializer;
    else if (! AST::match(node->ctor_initializer, pattern->ctor_initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
974
        return false;
975 976 977 978

    if (! pattern->function_body)
        pattern->function_body = node->function_body;
    else if (! AST::match(node->function_body, pattern->function_body, this))
Roberto Raggi's avatar
Roberto Raggi committed
979
        return false;
980

981 982 983
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
984
bool ASTMatcher::match(ForeachStatementAST *node, ForeachStatementAST *pattern)
985
{
986 987 988 989 990 991 992 993 994 995
    (void) node;
    (void) pattern;

    pattern->foreach_token = node->foreach_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->type_specifier_list)
        pattern->type_specifier_list = node->type_specifier_list;
    else if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
996
        return false;
997 998 999 1000

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
1001
        return false;
1002 1003 1004 1005

    if (! pattern->initializer)
        pattern->initializer = node->initializer;
    else if (! AST::match(node->initializer, pattern->initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
1006
        return false;
1007 1008 1009 1010 1011 1012

    pattern->comma_token = node->comma_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
1013
        return false;
Roberto Raggi's avatar