ASTMatcher.cpp 76.4 KB
Newer Older
1
2
3
4
/**************************************************************************
**
** This file is part of Qt Creator
**
con's avatar
con committed
5
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6
**
hjk's avatar
hjk committed
7
** Contact: Nokia Corporation (info@qt.nokia.com)
8
9
10
11
**
**
** GNU Lesser General Public License Usage
**
hjk's avatar
hjk committed
12
13
14
15
16
17
** 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.
18
**
con's avatar
con committed
19
** In addition, as a special exception, Nokia gives you certain additional
hjk's avatar
hjk committed
20
** rights. These rights are described in the Nokia Qt LGPL Exception
con's avatar
con committed
21
22
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
23
24
25
26
27
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
con's avatar
con committed
28
** If you have questions regarding the use of this file, please contact
Tobias Hunger's avatar
Tobias Hunger committed
29
** Nokia at info@qt.nokia.com.
30
31
32
**
**************************************************************************/

33
34
35
36
37
38
39
40
41

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

Roberto Raggi's avatar
Roberto Raggi committed
42
#include "AST.h"
43
44
45
46
#include "ASTMatcher.h"

using namespace CPlusPlus;

Roberto Raggi's avatar
Roberto Raggi committed
47
ASTMatcher::ASTMatcher()
Roberto Raggi's avatar
Roberto Raggi committed
48
49
50
51
52
{ }

ASTMatcher::~ASTMatcher()
{ }

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
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
78
bool ASTMatcher::match(SimpleSpecifierAST *node, SimpleSpecifierAST *pattern)
79
{
80
81
82
83
84
    (void) node;
    (void) pattern;

    pattern->specifier_token = node->specifier_token;

85
86
87
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
88
bool ASTMatcher::match(AttributeSpecifierAST *node, AttributeSpecifierAST *pattern)
89
{
90
91
92
93
94
95
96
97
98
99
100
101
    (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
102
        return false;
103
104
105
106
107

    pattern->first_rparen_token = node->first_rparen_token;

    pattern->second_rparen_token = node->second_rparen_token;

108
109
110
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
111
bool ASTMatcher::match(AttributeAST *node, AttributeAST *pattern)
112
{
113
114
115
116
117
118
119
120
121
122
123
124
    (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
125
        return false;
126
127
128

    pattern->rparen_token = node->rparen_token;

129
130
131
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
132
bool ASTMatcher::match(TypeofSpecifierAST *node, TypeofSpecifierAST *pattern)
133
{
134
135
136
137
138
139
140
141
142
143
    (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
144
        return false;
145
146
147

    pattern->rparen_token = node->rparen_token;

148
149
150
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
151
bool ASTMatcher::match(DeclaratorAST *node, DeclaratorAST *pattern)
152
{
153
154
155
156
157
158
    (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
159
        return false;
160
161
162
163

    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
164
        return false;
165
166
167
168

    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
169
        return false;
170
171
172
173

    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
174
        return false;
175
176
177
178

    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
179
        return false;
180

181
    pattern->equal_token = node->equal_token;
182
183
184
185

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

188
189
190
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
191
bool ASTMatcher::match(SimpleDeclarationAST *node, SimpleDeclarationAST *pattern)
192
{
193
194
195
196
197
198
199
200
    (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
201
        return false;
202
203
204
205

    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
206
        return false;
207
208
209

    pattern->semicolon_token = node->semicolon_token;

210
211
212
    return true;
}

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

    pattern->semicolon_token = node->semicolon_token;

220
221
222
    return true;
}

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

    pattern->access_specifier_token = node->access_specifier_token;

    pattern->slots_token = node->slots_token;

    pattern->colon_token = node->colon_token;

234
235
236
    return true;
}

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

    pattern->q_object_token = node->q_object_token;

    return true;
}

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

    pattern->q_private_slot_token = node->q_private_slot_token;

    pattern->lparen_token = node->lparen_token;

    pattern->dptr_token = node->dptr_token;

    pattern->dptr_lparen_token = node->dptr_lparen_token;

    pattern->dptr_rparen_token = node->dptr_rparen_token;

    pattern->comma_token = node->comma_token;

Roberto Raggi's avatar
Roberto Raggi committed
264
265
266
    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))
267
268
269
270
271
272
273
274
275
276
277
278
        return false;

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

    pattern->rparen_token = node->rparen_token;

    return true;
}

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

284
    pattern->item_name_token = node->item_name_token;
285

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

291
292
    return true;
}
293

294
295
296
297
bool ASTMatcher::match(QtPropertyDeclarationAST *node, QtPropertyDeclarationAST *pattern)
{
    (void) node;
    (void) pattern;
298

299
    pattern->property_specifier_token = node->property_specifier_token;
300

301
    pattern->lparen_token = node->lparen_token;
302

303
304
305
306
307
308
309
    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
        return false;

    pattern->comma_token = node->comma_token;

310
311
312
    if (! pattern->type_id)
        pattern->type_id = node->type_id;
    else if (! AST::match(node->type_id, pattern->type_id, this))
313
314
        return false;

315
316
317
    if (! pattern->property_name)
        pattern->property_name = node->property_name;
    else if (! AST::match(node->property_name, pattern->property_name, this))
318
319
        return false;

Roberto Raggi's avatar
Roberto Raggi committed
320
321
322
    if (! pattern->property_declaration_item_list)
        pattern->property_declaration_item_list = node->property_declaration_item_list;
    else if (! AST::match(node->property_declaration_item_list, pattern->property_declaration_item_list, this))
323
324
        return false;

325
326
    pattern->rparen_token = node->rparen_token;

327
328
329
    return true;
}

330
bool ASTMatcher::match(QtEnumDeclarationAST *node, QtEnumDeclarationAST *pattern)
331
332
333
334
335
336
{
    (void) node;
    (void) pattern;

    pattern->enum_specifier_token = node->enum_specifier_token;

337
338
    pattern->lparen_token = node->lparen_token;

339
340
341
342
343
    if (! pattern->enumerator_list)
        pattern->enumerator_list = node->enumerator_list;
    else if (! AST::match(node->enumerator_list, pattern->enumerator_list, this))
        return false;

344
345
    pattern->rparen_token = node->rparen_token;

346
347
348
    return true;
}

349
bool ASTMatcher::match(QtFlagsDeclarationAST *node, QtFlagsDeclarationAST *pattern)
350
351
352
353
354
355
{
    (void) node;
    (void) pattern;

    pattern->flags_specifier_token = node->flags_specifier_token;

356
357
    pattern->lparen_token = node->lparen_token;

358
359
360
    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))
361
362
        return false;

363
364
    pattern->rparen_token = node->rparen_token;

365
366
367
    return true;
}

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
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
405
bool ASTMatcher::match(AsmDefinitionAST *node, AsmDefinitionAST *pattern)
406
{
407
408
409
410
411
412
413
414
415
416
417
418
419
    (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;

420
421
422
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
423
bool ASTMatcher::match(BaseSpecifierAST *node, BaseSpecifierAST *pattern)
424
{
425
426
427
428
429
430
431
432
433
434
    (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
435
        return false;
436

437
438
439
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
440
441
442
443
444
445
446
447
448
449
450
451
452
bool ASTMatcher::match(IdExpressionAST *node, IdExpressionAST *pattern)
{
    (void) node;
    (void) pattern;

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

    return true;
}

453
454
455
456
457
458
459
bool ASTMatcher::match(CompoundExpressionAST *node, CompoundExpressionAST *pattern)
{
    (void) node;
    (void) pattern;

    pattern->lparen_token = node->lparen_token;

460
461
462
    if (! pattern->statement)
        pattern->statement = node->statement;
    else if (! AST::match(node->statement, pattern->statement, this))
463
464
465
466
467
468
469
        return false;

    pattern->rparen_token = node->rparen_token;

    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
470
bool ASTMatcher::match(CompoundLiteralAST *node, CompoundLiteralAST *pattern)
471
{
472
473
474
475
476
477
478
479
    (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
480
        return false;
481
482
483
484
485
486

    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
487
        return false;
488

489
490
491
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
492
bool ASTMatcher::match(QtMethodAST *node, QtMethodAST *pattern)
493
{
494
495
496
497
498
499
500
501
502
503
    (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
504
        return false;
505

506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
    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;

525
526
    pattern->rparen_token = node->rparen_token;

527
528
529
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
530
bool ASTMatcher::match(BinaryExpressionAST *node, BinaryExpressionAST *pattern)
531
{
532
533
534
535
536
537
    (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
538
        return false;
539
540
541
542
543
544

    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
545
        return false;
546

547
548
549
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
550
bool ASTMatcher::match(CastExpressionAST *node, CastExpressionAST *pattern)
551
{
552
553
554
555
556
557
558
559
    (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
560
        return false;
561
562
563
564
565
566

    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
567
        return false;
568

569
570
571
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
572
bool ASTMatcher::match(ClassSpecifierAST *node, ClassSpecifierAST *pattern)
573
{
574
575
576
577
578
579
580
581
    (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
582
        return false;
583
584
585
586

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

    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
594
        return false;
595

596
597
    pattern->dot_dot_dot_token = node->dot_dot_dot_token;

598
599
600
601
602
    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
603
        return false;
604
605
606

    pattern->rbrace_token = node->rbrace_token;

607
608
609
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
610
bool ASTMatcher::match(CaseStatementAST *node, CaseStatementAST *pattern)
611
{
612
613
614
615
616
617
618
619
    (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
620
        return false;
621
622
623
624
625
626

    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
627
        return false;
628

629
630
631
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
632
bool ASTMatcher::match(CompoundStatementAST *node, CompoundStatementAST *pattern)
633
{
634
635
636
637
638
639
640
641
    (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
642
        return false;
643
644
645

    pattern->rbrace_token = node->rbrace_token;

646
647
648
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
649
bool ASTMatcher::match(ConditionAST *node, ConditionAST *pattern)
650
{
651
652
653
654
655
656
    (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
657
        return false;
658
659
660
661

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

664
665
666
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
667
bool ASTMatcher::match(ConditionalExpressionAST *node, ConditionalExpressionAST *pattern)
668
{
669
670
671
672
673
674
    (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
675
        return false;
676
677
678
679
680
681

    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
682
        return false;
683
684
685
686
687
688

    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
689
        return false;
690

691
692
693
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
694
bool ASTMatcher::match(CppCastExpressionAST *node, CppCastExpressionAST *pattern)
695
{
696
697
698
699
700
701
702
703
704
705
    (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
706
        return false;
707
708
709
710
711
712
713
714

    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
715
        return false;
716
717
718

    pattern->rparen_token = node->rparen_token;

719
720
721
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
722
bool ASTMatcher::match(CtorInitializerAST *node, CtorInitializerAST *pattern)
723
{
724
725
726
727
728
729
730
731
    (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
732
        return false;
733

734
735
    pattern->dot_dot_dot_token = node->dot_dot_dot_token;

736
737
738
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
739
bool ASTMatcher::match(DeclarationStatementAST *node, DeclarationStatementAST *pattern)
740
{
741
742
743
744
745
746
    (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
747
        return false;
748

749
750
751
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
752
bool ASTMatcher::match(DeclaratorIdAST *node, DeclaratorIdAST *pattern)
753
{
754
755
756
    (void) node;
    (void) pattern;

757
758
    pattern->dot_dot_dot_token = node->dot_dot_dot_token;

759
760
761
    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
762
        return false;
763

764
765
766
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
767
bool ASTMatcher::match(NestedDeclaratorAST *node, NestedDeclaratorAST *pattern)
768
{
769
770
771
772
773
774
775
776
    (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
777
        return false;
778
779
780

    pattern->rparen_token = node->rparen_token;

781
782
783
    return true;
}

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

    pattern->lparen_token = node->lparen_token;

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

    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
801
        return false;
802
803
804
805

    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
806
        return false;
807

Roberto Raggi's avatar
Roberto Raggi committed
808
809
810
811
812
    if (! pattern->trailing_return_type)
        pattern->trailing_return_type = node->trailing_return_type;
    else if (! AST::match(node->trailing_return_type, pattern->trailing_return_type, this))
        return false;

813
814
815
    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
816
        return false;
817

818
819
820
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
821
bool ASTMatcher::match(ArrayDeclaratorAST *node, ArrayDeclaratorAST *pattern)
822
{
823
824
825
826
827
828
829
830
    (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
831
        return false;
832
833
834

    pattern->rbracket_token = node->rbracket_token;

835
836
837
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
838
bool ASTMatcher::match(DeleteExpressionAST *node, DeleteExpressionAST *pattern)
839
{
840
841
842
843
844
845
846
847
848
849
850
851
852
853
    (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
854
        return false;
855

856
857
858
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
859
bool ASTMatcher::match(DoStatementAST *node, DoStatementAST *pattern)
860
{
861
862
863
864
865
866
867
868
    (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
869
        return false;
870
871
872
873
874
875
876
877

    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
878
        return false;
879
880
881
882
883

    pattern->rparen_token = node->rparen_token;

    pattern->semicolon_token = node->semicolon_token;

884
885
886
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
887
bool ASTMatcher::match(NamedTypeSpecifierAST *node, NamedTypeSpecifierAST *pattern)
888
{
889
890
891
892
893
894
    (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
895
        return false;
896

897
898
899
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
900
bool ASTMatcher::match(ElaboratedTypeSpecifierAST *node, ElaboratedTypeSpecifierAST *pattern)
901
{
902
903
904
905
906
    (void) node;
    (void) pattern;

    pattern->classkey_token = node->classkey_token;

907
908
909
910
911
    if (! pattern->attribute_list)
        pattern->attribute_list = node->attribute_list;
    else if (! AST::match(node->attribute_list, pattern->attribute_list, this))
        return false;

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

917
918
919
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
920
bool ASTMatcher::match(EnumSpecifierAST *node, EnumSpecifierAST *pattern)
921
{
922
923
924
925
926
927
928
929
    (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
930
        return false;
931
932
933
934
935
936

    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
937
        return false;
938

939
940
    pattern->stray_comma_token = node->stray_comma_token;

941
942
    pattern->rbrace_token = node->rbrace_token;

943
944
945
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
946
bool ASTMatcher::match(EnumeratorAST *node, EnumeratorAST *pattern)
947
{
948
949
950
951
952
953
954
955
956
957
    (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
958
        return false;
959

960
961
962
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
963
bool ASTMatcher::match(ExceptionDeclarationAST *node, ExceptionDeclarationAST *pattern)
964
{
965
966
967
968
969
970
    (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
971
        return false;
972
973
974
975

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

    pattern->dot_dot_dot_token = node->dot_dot_dot_token;

980
981
982
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
983
bool ASTMatcher::match(ExceptionSpecificationAST *node, ExceptionSpecificationAST *pattern)
984
{
985
986
987
988
989
990
991
992
993
994
995
996
    (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
997
        return false;
998
999
1000

    pattern->rparen_token = node->rparen_token;

1001
1002
1003
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1004
bool ASTMatcher::match(ExpressionOrDeclarationStatementAST *node, ExpressionOrDeclarationStatementAST *pattern)
1005
{
1006
1007
1008
1009
1010
1011
    (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
1012
        return false;
1013
1014
1015
1016

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

1019
1020
1021
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1022
bool ASTMatcher::match(ExpressionStatementAST *node, ExpressionStatementAST *pattern)
1023
{
1024
1025
1026
1027
1028
1029
    (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
1030
        return false;
1031
1032
1033

    pattern->semicolon_token = node->semicolon_token;

1034
1035
1036
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1037
bool ASTMatcher::match(FunctionDefinitionAST *node, FunctionDefinitionAST *pattern)
1038
{
1039
1040
1041
1042
1043
1044
1045
1046
    (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
1047
        return false;
1048
1049
1050
1051

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
1052
        return false;
1053
1054
1055
1056

    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
1057
        return false;
1058
1059
1060
1061

    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
1062
        return false;
1063

1064
1065
1066
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1067
bool ASTMatcher::match(ForeachStatementAST *node, ForeachStatementAST *pattern)
1068
{
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
    (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
1079
        return false;
1080
1081
1082
1083

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
1084
        return false;
1085
1086
1087
1088

    if (! pattern->initializer)
        pattern->initializer = node->initializer;
    else if (! AST::match(node->initializer, pattern->initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
1089
        return false;
1090
1091
1092
1093
1094
1095

    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
1096
        return false;
1097
1098
1099
1100
1101
1102

    pattern->rparen_token = node->rparen_token;

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

1105
1106
1107
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1108
bool ASTMatcher::match(ForStatementAST *node, ForStatementAST *pattern)
1109
{
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
    (void) node;
    (void) pattern;

    pattern->for_token = node->for_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->initializer)
        pattern->initializer = node->initializer;
    else if (! AST::match(node->initializer, pattern->initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
1120
        return false;
1121
1122
1123
1124

    if (! pattern->condition)
        pattern->condition = node->condition;
    else if (! AST::match(node->condition, pattern->condition, this))
Roberto Raggi's avatar
Roberto Raggi committed
1125
        return false;
1126
1127
1128
1129
1130
1131

    pattern->semicolon_token = node->semicolon_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
1132
        return false;
1133
1134
1135
1136
1137
1138

    pattern->rparen_token = node->rparen_token;

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

1141
1142
1143
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1144
bool ASTMatcher::match(IfStatementAST *node, IfStatementAST *pattern)
1145
{
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
    (void) node;
    (void) pattern;

    pattern->if_token = node->if_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->condition)
        pattern->condition = node->condition;
    else if (! AST::match(node->condition, pattern->condition, this))
Roberto Raggi's avatar
Roberto Raggi committed
1156
        return false;
1157
1158
1159
1160
1161
1162

    pattern->rparen_token = node->rparen_token;

    if (! pattern->statement)
        pattern->statement = node->statement;
    else if (! AST::match(node->statement, pattern->statement, this))
Roberto Raggi's avatar
Roberto Raggi committed
1163
        return false;
1164
1165
1166
1167
1168
1169

    pattern->else_token = node->else_token;

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

1172
1173
1174
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1175
bool ASTMatcher::match(ArrayInitializerAST *node, ArrayInitializerAST *pattern)