ASTMatcher.cpp 51.8 KB
Newer Older
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
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** 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.
**
**************************************************************************/

Roberto Raggi's avatar
Roberto Raggi committed
30
#include "AST.h"
31
32
33
34
35
36
#include "ASTMatcher.h"
#include "Control.h"
#include "TranslationUnit.h"

using namespace CPlusPlus;

Roberto Raggi's avatar
Roberto Raggi committed
37
38
39
40
41
42
43
ASTMatcher::ASTMatcher(Control *control)
    : _control(control)
{ }

ASTMatcher::~ASTMatcher()
{ }

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
Control *ASTMatcher::control() const
{ return _control; }

TranslationUnit *ASTMatcher::translationUnit() const
{ return _control->translationUnit(); }

unsigned ASTMatcher::tokenCount() const
{ return translationUnit()->tokenCount(); }

const Token &ASTMatcher::tokenAt(unsigned index) const
{ return translationUnit()->tokenAt(index); }

int ASTMatcher::tokenKind(unsigned index) const
{ return translationUnit()->tokenKind(index); }

const char *ASTMatcher::spell(unsigned index) const
{ return translationUnit()->spell(index); }

Identifier *ASTMatcher::identifier(unsigned index) const
{ return translationUnit()->identifier(index); }

Literal *ASTMatcher::literal(unsigned index) const
{ return translationUnit()->literal(index); }

NumericLiteral *ASTMatcher::numericLiteral(unsigned index) const
{ return translationUnit()->numericLiteral(index); }

StringLiteral *ASTMatcher::stringLiteral(unsigned index) const
{ return translationUnit()->stringLiteral(index); }

void ASTMatcher::getPosition(unsigned offset,
                             unsigned *line,
                             unsigned *column,
                             StringLiteral **fileName) const
{ translationUnit()->getPosition(offset, line, column, fileName); }

void ASTMatcher::getTokenPosition(unsigned index,
                                  unsigned *line,
                                  unsigned *column,
                                  StringLiteral **fileName) const
{ translationUnit()->getTokenPosition(index, line, column, fileName); }

void ASTMatcher::getTokenStartPosition(unsigned index, unsigned *line, unsigned *column) const
{ getPosition(tokenAt(index).begin(), line, column); }

void ASTMatcher::getTokenEndPosition(unsigned index, unsigned *line, unsigned *column) const
{ getPosition(tokenAt(index).end(), line, column); }


Roberto Raggi's avatar
Roberto Raggi committed
93
94

bool ASTMatcher::match(SimpleSpecifierAST *node, SimpleSpecifierAST *pattern)
95
{
Roberto Raggi's avatar
Roberto Raggi committed
96
97
    if (node->specifier_token != pattern->specifier_token)
        return false;
98
99
100
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
101
bool ASTMatcher::match(AttributeSpecifierAST *node, AttributeSpecifierAST *pattern)
102
{
Roberto Raggi's avatar
Roberto Raggi committed
103
104
105
106
107
108
109
110
111
112
113
114
    if (node->attribute_token != pattern->attribute_token)
        return false;
    if (node->first_lparen_token != pattern->first_lparen_token)
        return false;
    if (node->second_lparen_token != pattern->second_lparen_token)
        return false;
    if (! AST::match(node->attribute_list, pattern->attribute_list, this))
        return false;
    if (node->first_rparen_token != pattern->first_rparen_token)
        return false;
    if (node->second_rparen_token != pattern->second_rparen_token)
        return false;
115
116
117
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
118
bool ASTMatcher::match(AttributeAST *node, AttributeAST *pattern)
119
{
Roberto Raggi's avatar
Roberto Raggi committed
120
121
122
123
124
125
126
127
128
129
    if (node->identifier_token != pattern->identifier_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (node->tag_token != pattern->tag_token)
        return false;
    if (! AST::match(node->expression_list, pattern->expression_list, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
130
131
132
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
133
bool ASTMatcher::match(TypeofSpecifierAST *node, TypeofSpecifierAST *pattern)
134
{
Roberto Raggi's avatar
Roberto Raggi committed
135
136
137
138
139
140
141
142
    if (node->typeof_token != pattern->typeof_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
143
144
145
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
146
bool ASTMatcher::match(DeclaratorAST *node, DeclaratorAST *pattern)
147
{
Roberto Raggi's avatar
Roberto Raggi committed
148
149
150
151
152
153
154
155
156
157
158
159
160
161
    if (! AST::match(node->attribute_list, pattern->attribute_list, this))
        return false;
    if (! AST::match(node->ptr_operator_list, pattern->ptr_operator_list, this))
        return false;
    if (! AST::match(node->core_declarator, pattern->core_declarator, this))
        return false;
    if (! AST::match(node->postfix_declarator_list, pattern->postfix_declarator_list, this))
        return false;
    if (! AST::match(node->post_attribute_list, pattern->post_attribute_list, this))
        return false;
    if (node->equals_token != pattern->equals_token)
        return false;
    if (! AST::match(node->initializer, pattern->initializer, this))
        return false;
162
163
164
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
165
bool ASTMatcher::match(SimpleDeclarationAST *node, SimpleDeclarationAST *pattern)
166
{
Roberto Raggi's avatar
Roberto Raggi committed
167
168
169
170
171
172
173
174
    if (node->qt_invokable_token != pattern->qt_invokable_token)
        return false;
    if (! AST::match(node->decl_specifier_list, pattern->decl_specifier_list, this))
        return false;
    if (! AST::match(node->declarator_list, pattern->declarator_list, this))
        return false;
    if (node->semicolon_token != pattern->semicolon_token)
        return false;
175
176
177
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
178
bool ASTMatcher::match(EmptyDeclarationAST *node, EmptyDeclarationAST *pattern)
179
{
Roberto Raggi's avatar
Roberto Raggi committed
180
181
    if (node->semicolon_token != pattern->semicolon_token)
        return false;
182
183
184
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
185
bool ASTMatcher::match(AccessDeclarationAST *node, AccessDeclarationAST *pattern)
186
{
Roberto Raggi's avatar
Roberto Raggi committed
187
188
189
190
191
192
    if (node->access_specifier_token != pattern->access_specifier_token)
        return false;
    if (node->slots_token != pattern->slots_token)
        return false;
    if (node->colon_token != pattern->colon_token)
        return false;
193
194
195
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
196
bool ASTMatcher::match(AsmDefinitionAST *node, AsmDefinitionAST *pattern)
197
{
Roberto Raggi's avatar
Roberto Raggi committed
198
199
200
201
202
203
204
205
206
207
    if (node->asm_token != pattern->asm_token)
        return false;
    if (node->volatile_token != pattern->volatile_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
    if (node->semicolon_token != pattern->semicolon_token)
        return false;
208
209
210
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
211
bool ASTMatcher::match(BaseSpecifierAST *node, BaseSpecifierAST *pattern)
212
{
Roberto Raggi's avatar
Roberto Raggi committed
213
214
215
216
217
218
    if (node->virtual_token != pattern->virtual_token)
        return false;
    if (node->access_specifier_token != pattern->access_specifier_token)
        return false;
    if (! AST::match(node->name, pattern->name, this))
        return false;
219
220
221
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
222
bool ASTMatcher::match(CompoundLiteralAST *node, CompoundLiteralAST *pattern)
223
{
Roberto Raggi's avatar
Roberto Raggi committed
224
225
226
227
228
229
230
231
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->type_id, pattern->type_id, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
    if (! AST::match(node->initializer, pattern->initializer, this))
        return false;
232
233
234
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
235
bool ASTMatcher::match(QtMethodAST *node, QtMethodAST *pattern)
236
{
Roberto Raggi's avatar
Roberto Raggi committed
237
238
239
240
241
242
243
244
    if (node->method_token != pattern->method_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->declarator, pattern->declarator, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
245
246
247
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
248
bool ASTMatcher::match(BinaryExpressionAST *node, BinaryExpressionAST *pattern)
249
{
Roberto Raggi's avatar
Roberto Raggi committed
250
251
252
253
254
255
    if (! AST::match(node->left_expression, pattern->left_expression, this))
        return false;
    if (node->binary_op_token != pattern->binary_op_token)
        return false;
    if (! AST::match(node->right_expression, pattern->right_expression, this))
        return false;
256
257
258
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
259
bool ASTMatcher::match(CastExpressionAST *node, CastExpressionAST *pattern)
260
{
Roberto Raggi's avatar
Roberto Raggi committed
261
262
263
264
265
266
267
268
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->type_id, pattern->type_id, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
269
270
271
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
272
bool ASTMatcher::match(ClassSpecifierAST *node, ClassSpecifierAST *pattern)
273
{
Roberto Raggi's avatar
Roberto Raggi committed
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
    if (node->classkey_token != pattern->classkey_token)
        return false;
    if (! AST::match(node->attribute_list, pattern->attribute_list, this))
        return false;
    if (! AST::match(node->name, pattern->name, this))
        return false;
    if (node->colon_token != pattern->colon_token)
        return false;
    if (! AST::match(node->base_clause_list, pattern->base_clause_list, this))
        return false;
    if (node->lbrace_token != pattern->lbrace_token)
        return false;
    if (! AST::match(node->member_specifier_list, pattern->member_specifier_list, this))
        return false;
    if (node->rbrace_token != pattern->rbrace_token)
        return false;
290
291
292
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
293
bool ASTMatcher::match(CaseStatementAST *node, CaseStatementAST *pattern)
294
{
Roberto Raggi's avatar
Roberto Raggi committed
295
296
297
298
299
300
301
302
    if (node->case_token != pattern->case_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->colon_token != pattern->colon_token)
        return false;
    if (! AST::match(node->statement, pattern->statement, this))
        return false;
303
304
305
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
306
bool ASTMatcher::match(CompoundStatementAST *node, CompoundStatementAST *pattern)
307
{
Roberto Raggi's avatar
Roberto Raggi committed
308
309
310
311
312
313
    if (node->lbrace_token != pattern->lbrace_token)
        return false;
    if (! AST::match(node->statement_list, pattern->statement_list, this))
        return false;
    if (node->rbrace_token != pattern->rbrace_token)
        return false;
314
315
316
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
317
bool ASTMatcher::match(ConditionAST *node, ConditionAST *pattern)
318
{
Roberto Raggi's avatar
Roberto Raggi committed
319
320
321
322
    if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
        return false;
    if (! AST::match(node->declarator, pattern->declarator, this))
        return false;
323
324
325
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
326
bool ASTMatcher::match(ConditionalExpressionAST *node, ConditionalExpressionAST *pattern)
327
{
Roberto Raggi's avatar
Roberto Raggi committed
328
329
330
331
332
333
334
335
336
337
    if (! AST::match(node->condition, pattern->condition, this))
        return false;
    if (node->question_token != pattern->question_token)
        return false;
    if (! AST::match(node->left_expression, pattern->left_expression, this))
        return false;
    if (node->colon_token != pattern->colon_token)
        return false;
    if (! AST::match(node->right_expression, pattern->right_expression, this))
        return false;
338
339
340
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
341
bool ASTMatcher::match(CppCastExpressionAST *node, CppCastExpressionAST *pattern)
342
{
Roberto Raggi's avatar
Roberto Raggi committed
343
344
345
346
347
348
349
350
351
352
353
354
355
356
    if (node->cast_token != pattern->cast_token)
        return false;
    if (node->less_token != pattern->less_token)
        return false;
    if (! AST::match(node->type_id, pattern->type_id, this))
        return false;
    if (node->greater_token != pattern->greater_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
357
358
359
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
360
bool ASTMatcher::match(CtorInitializerAST *node, CtorInitializerAST *pattern)
361
{
Roberto Raggi's avatar
Roberto Raggi committed
362
363
364
365
    if (node->colon_token != pattern->colon_token)
        return false;
    if (! AST::match(node->member_initializer_list, pattern->member_initializer_list, this))
        return false;
366
367
368
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
369
bool ASTMatcher::match(DeclarationStatementAST *node, DeclarationStatementAST *pattern)
370
{
Roberto Raggi's avatar
Roberto Raggi committed
371
372
    if (! AST::match(node->declaration, pattern->declaration, this))
        return false;
373
374
375
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
376
bool ASTMatcher::match(DeclaratorIdAST *node, DeclaratorIdAST *pattern)
377
{
Roberto Raggi's avatar
Roberto Raggi committed
378
379
    if (! AST::match(node->name, pattern->name, this))
        return false;
380
381
382
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
383
bool ASTMatcher::match(NestedDeclaratorAST *node, NestedDeclaratorAST *pattern)
384
{
Roberto Raggi's avatar
Roberto Raggi committed
385
386
387
388
389
390
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->declarator, pattern->declarator, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
391
392
393
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
394
bool ASTMatcher::match(FunctionDeclaratorAST *node, FunctionDeclaratorAST *pattern)
395
{
Roberto Raggi's avatar
Roberto Raggi committed
396
397
398
399
400
401
402
403
404
405
406
407
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->parameters, pattern->parameters, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
    if (! AST::match(node->cv_qualifier_list, pattern->cv_qualifier_list, this))
        return false;
    if (! AST::match(node->exception_specification, pattern->exception_specification, this))
        return false;
    if (! AST::match(node->as_cpp_initializer, pattern->as_cpp_initializer, this))
        return false;
408
409
410
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
411
bool ASTMatcher::match(ArrayDeclaratorAST *node, ArrayDeclaratorAST *pattern)
412
{
Roberto Raggi's avatar
Roberto Raggi committed
413
414
415
416
417
418
    if (node->lbracket_token != pattern->lbracket_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rbracket_token != pattern->rbracket_token)
        return false;
419
420
421
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
422
bool ASTMatcher::match(DeleteExpressionAST *node, DeleteExpressionAST *pattern)
423
{
Roberto Raggi's avatar
Roberto Raggi committed
424
425
426
427
428
429
430
431
432
433
    if (node->scope_token != pattern->scope_token)
        return false;
    if (node->delete_token != pattern->delete_token)
        return false;
    if (node->lbracket_token != pattern->lbracket_token)
        return false;
    if (node->rbracket_token != pattern->rbracket_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
434
435
436
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
437
bool ASTMatcher::match(DoStatementAST *node, DoStatementAST *pattern)
438
{
Roberto Raggi's avatar
Roberto Raggi committed
439
440
441
442
443
444
445
446
447
448
449
450
451
452
    if (node->do_token != pattern->do_token)
        return false;
    if (! AST::match(node->statement, pattern->statement, this))
        return false;
    if (node->while_token != pattern->while_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
    if (node->semicolon_token != pattern->semicolon_token)
        return false;
453
454
455
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
456
bool ASTMatcher::match(NamedTypeSpecifierAST *node, NamedTypeSpecifierAST *pattern)
457
{
Roberto Raggi's avatar
Roberto Raggi committed
458
459
    if (! AST::match(node->name, pattern->name, this))
        return false;
460
461
462
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
463
bool ASTMatcher::match(ElaboratedTypeSpecifierAST *node, ElaboratedTypeSpecifierAST *pattern)
464
{
Roberto Raggi's avatar
Roberto Raggi committed
465
466
467
468
    if (node->classkey_token != pattern->classkey_token)
        return false;
    if (! AST::match(node->name, pattern->name, this))
        return false;
469
470
471
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
472
bool ASTMatcher::match(EnumSpecifierAST *node, EnumSpecifierAST *pattern)
473
{
Roberto Raggi's avatar
Roberto Raggi committed
474
475
476
477
478
479
480
481
482
483
    if (node->enum_token != pattern->enum_token)
        return false;
    if (! AST::match(node->name, pattern->name, this))
        return false;
    if (node->lbrace_token != pattern->lbrace_token)
        return false;
    if (! AST::match(node->enumerator_list, pattern->enumerator_list, this))
        return false;
    if (node->rbrace_token != pattern->rbrace_token)
        return false;
484
485
486
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
487
bool ASTMatcher::match(EnumeratorAST *node, EnumeratorAST *pattern)
488
{
Roberto Raggi's avatar
Roberto Raggi committed
489
490
491
492
493
494
    if (node->identifier_token != pattern->identifier_token)
        return false;
    if (node->equal_token != pattern->equal_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
495
496
497
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
498
bool ASTMatcher::match(ExceptionDeclarationAST *node, ExceptionDeclarationAST *pattern)
499
{
Roberto Raggi's avatar
Roberto Raggi committed
500
501
502
503
504
505
    if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
        return false;
    if (! AST::match(node->declarator, pattern->declarator, this))
        return false;
    if (node->dot_dot_dot_token != pattern->dot_dot_dot_token)
        return false;
506
507
508
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
509
bool ASTMatcher::match(ExceptionSpecificationAST *node, ExceptionSpecificationAST *pattern)
510
{
Roberto Raggi's avatar
Roberto Raggi committed
511
512
513
514
515
516
517
518
519
520
    if (node->throw_token != pattern->throw_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (node->dot_dot_dot_token != pattern->dot_dot_dot_token)
        return false;
    if (! AST::match(node->type_id_list, pattern->type_id_list, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
521
522
523
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
524
bool ASTMatcher::match(ExpressionOrDeclarationStatementAST *node, ExpressionOrDeclarationStatementAST *pattern)
525
{
Roberto Raggi's avatar
Roberto Raggi committed
526
527
528
529
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (! AST::match(node->declaration, pattern->declaration, this))
        return false;
530
531
532
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
533
bool ASTMatcher::match(ExpressionStatementAST *node, ExpressionStatementAST *pattern)
534
{
Roberto Raggi's avatar
Roberto Raggi committed
535
536
537
538
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->semicolon_token != pattern->semicolon_token)
        return false;
539
540
541
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
542
bool ASTMatcher::match(FunctionDefinitionAST *node, FunctionDefinitionAST *pattern)
543
{
Roberto Raggi's avatar
Roberto Raggi committed
544
545
546
547
548
549
550
551
552
553
    if (node->qt_invokable_token != pattern->qt_invokable_token)
        return false;
    if (! AST::match(node->decl_specifier_list, pattern->decl_specifier_list, this))
        return false;
    if (! AST::match(node->declarator, pattern->declarator, this))
        return false;
    if (! AST::match(node->ctor_initializer, pattern->ctor_initializer, this))
        return false;
    if (! AST::match(node->function_body, pattern->function_body, this))
        return false;
554
555
556
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
557
bool ASTMatcher::match(ForeachStatementAST *node, ForeachStatementAST *pattern)
558
{
Roberto Raggi's avatar
Roberto Raggi committed
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
    if (node->foreach_token != pattern->foreach_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
        return false;
    if (! AST::match(node->declarator, pattern->declarator, this))
        return false;
    if (! AST::match(node->initializer, pattern->initializer, this))
        return false;
    if (node->comma_token != pattern->comma_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
    if (! AST::match(node->statement, pattern->statement, this))
        return false;
577
578
579
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
580
bool ASTMatcher::match(ForStatementAST *node, ForStatementAST *pattern)
581
{
Roberto Raggi's avatar
Roberto Raggi committed
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
    if (node->for_token != pattern->for_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->initializer, pattern->initializer, this))
        return false;
    if (! AST::match(node->condition, pattern->condition, this))
        return false;
    if (node->semicolon_token != pattern->semicolon_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
    if (! AST::match(node->statement, pattern->statement, this))
        return false;
598
599
600
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
601
bool ASTMatcher::match(IfStatementAST *node, IfStatementAST *pattern)
602
{
Roberto Raggi's avatar
Roberto Raggi committed
603
604
605
606
607
608
609
610
611
612
613
614
615
616
    if (node->if_token != pattern->if_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->condition, pattern->condition, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
    if (! AST::match(node->statement, pattern->statement, this))
        return false;
    if (node->else_token != pattern->else_token)
        return false;
    if (! AST::match(node->else_statement, pattern->else_statement, this))
        return false;
617
618
619
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
620
bool ASTMatcher::match(ArrayInitializerAST *node, ArrayInitializerAST *pattern)
621
{
Roberto Raggi's avatar
Roberto Raggi committed
622
623
624
625
626
627
    if (node->lbrace_token != pattern->lbrace_token)
        return false;
    if (! AST::match(node->expression_list, pattern->expression_list, this))
        return false;
    if (node->rbrace_token != pattern->rbrace_token)
        return false;
628
629
630
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
631
bool ASTMatcher::match(LabeledStatementAST *node, LabeledStatementAST *pattern)
632
{
Roberto Raggi's avatar
Roberto Raggi committed
633
634
635
636
637
638
    if (node->label_token != pattern->label_token)
        return false;
    if (node->colon_token != pattern->colon_token)
        return false;
    if (! AST::match(node->statement, pattern->statement, this))
        return false;
639
640
641
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
642
bool ASTMatcher::match(LinkageBodyAST *node, LinkageBodyAST *pattern)
643
{
Roberto Raggi's avatar
Roberto Raggi committed
644
645
646
647
648
649
    if (node->lbrace_token != pattern->lbrace_token)
        return false;
    if (! AST::match(node->declaration_list, pattern->declaration_list, this))
        return false;
    if (node->rbrace_token != pattern->rbrace_token)
        return false;
650
651
652
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
653
bool ASTMatcher::match(LinkageSpecificationAST *node, LinkageSpecificationAST *pattern)
654
{
Roberto Raggi's avatar
Roberto Raggi committed
655
656
657
658
659
660
    if (node->extern_token != pattern->extern_token)
        return false;
    if (node->extern_type_token != pattern->extern_type_token)
        return false;
    if (! AST::match(node->declaration, pattern->declaration, this))
        return false;
661
662
663
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
664
bool ASTMatcher::match(MemInitializerAST *node, MemInitializerAST *pattern)
665
{
Roberto Raggi's avatar
Roberto Raggi committed
666
667
668
669
670
671
672
673
    if (! AST::match(node->name, pattern->name, this))
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
674
675
676
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
677
bool ASTMatcher::match(NestedNameSpecifierAST *node, NestedNameSpecifierAST *pattern)
678
{
Roberto Raggi's avatar
Roberto Raggi committed
679
680
681
682
    if (! AST::match(node->class_or_namespace_name, pattern->class_or_namespace_name, this))
        return false;
    if (node->scope_token != pattern->scope_token)
        return false;
683
684
685
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
686
bool ASTMatcher::match(QualifiedNameAST *node, QualifiedNameAST *pattern)
687
{
Roberto Raggi's avatar
Roberto Raggi committed
688
689
690
691
692
693
    if (node->global_scope_token != pattern->global_scope_token)
        return false;
    if (! AST::match(node->nested_name_specifier_list, pattern->nested_name_specifier_list, this))
        return false;
    if (! AST::match(node->unqualified_name, pattern->unqualified_name, this))
        return false;
694
695
696
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
697
bool ASTMatcher::match(OperatorFunctionIdAST *node, OperatorFunctionIdAST *pattern)
698
{
Roberto Raggi's avatar
Roberto Raggi committed
699
700
701
702
    if (node->operator_token != pattern->operator_token)
        return false;
    if (! AST::match(node->op, pattern->op, this))
        return false;
703
704
705
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
706
bool ASTMatcher::match(ConversionFunctionIdAST *node, ConversionFunctionIdAST *pattern)
707
{
Roberto Raggi's avatar
Roberto Raggi committed
708
709
710
711
712
713
    if (node->operator_token != pattern->operator_token)
        return false;
    if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
        return false;
    if (! AST::match(node->ptr_operator_list, pattern->ptr_operator_list, this))
        return false;
714
715
716
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
717
bool ASTMatcher::match(SimpleNameAST *node, SimpleNameAST *pattern)
718
{
Roberto Raggi's avatar
Roberto Raggi committed
719
720
    if (node->identifier_token != pattern->identifier_token)
        return false;
721
722
723
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
724
bool ASTMatcher::match(DestructorNameAST *node, DestructorNameAST *pattern)
725
{
Roberto Raggi's avatar
Roberto Raggi committed
726
727
728
729
    if (node->tilde_token != pattern->tilde_token)
        return false;
    if (node->identifier_token != pattern->identifier_token)
        return false;
730
731
732
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
733
bool ASTMatcher::match(TemplateIdAST *node, TemplateIdAST *pattern)
734
{
Roberto Raggi's avatar
Roberto Raggi committed
735
736
737
738
739
740
741
742
    if (node->identifier_token != pattern->identifier_token)
        return false;
    if (node->less_token != pattern->less_token)
        return false;
    if (! AST::match(node->template_argument_list, pattern->template_argument_list, this))
        return false;
    if (node->greater_token != pattern->greater_token)
        return false;
743
744
745
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
746
bool ASTMatcher::match(NamespaceAST *node, NamespaceAST *pattern)
747
{
Roberto Raggi's avatar
Roberto Raggi committed
748
749
750
751
752
753
754
755
    if (node->namespace_token != pattern->namespace_token)
        return false;
    if (node->identifier_token != pattern->identifier_token)
        return false;
    if (! AST::match(node->attribute_list, pattern->attribute_list, this))
        return false;
    if (! AST::match(node->linkage_body, pattern->linkage_body, this))
        return false;
756
757
758
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
759
bool ASTMatcher::match(NamespaceAliasDefinitionAST *node, NamespaceAliasDefinitionAST *pattern)
760
{
Roberto Raggi's avatar
Roberto Raggi committed
761
762
763
764
765
766
767
768
769
770
    if (node->namespace_token != pattern->namespace_token)
        return false;
    if (node->namespace_name_token != pattern->namespace_name_token)
        return false;
    if (node->equal_token != pattern->equal_token)
        return false;
    if (! AST::match(node->name, pattern->name, this))
        return false;
    if (node->semicolon_token != pattern->semicolon_token)
        return false;
771
772
773
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
774
bool ASTMatcher::match(NewPlacementAST *node, NewPlacementAST *pattern)
775
{
Roberto Raggi's avatar
Roberto Raggi committed
776
777
778
779
780
781
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression_list, pattern->expression_list, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
782
783
784
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
785
bool ASTMatcher::match(NewArrayDeclaratorAST *node, NewArrayDeclaratorAST *pattern)
786
{
Roberto Raggi's avatar
Roberto Raggi committed
787
788
789
790
791
792
    if (node->lbracket_token != pattern->lbracket_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rbracket_token != pattern->rbracket_token)
        return false;
793
794
795
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
796
bool ASTMatcher::match(NewExpressionAST *node, NewExpressionAST *pattern)
797
{
Roberto Raggi's avatar
Roberto Raggi committed
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
    if (node->scope_token != pattern->scope_token)
        return false;
    if (node->new_token != pattern->new_token)
        return false;
    if (! AST::match(node->new_placement, pattern->new_placement, this))
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->type_id, pattern->type_id, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
    if (! AST::match(node->new_type_id, pattern->new_type_id, this))
        return false;
    if (! AST::match(node->new_initializer, pattern->new_initializer, this))
        return false;
814
815
816
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
817
bool ASTMatcher::match(NewInitializerAST *node, NewInitializerAST *pattern)
818
{
Roberto Raggi's avatar
Roberto Raggi committed
819
820
821
822
823
824
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
825
826
827
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
828
bool ASTMatcher::match(NewTypeIdAST *node, NewTypeIdAST *pattern)
829
{
Roberto Raggi's avatar
Roberto Raggi committed
830
831
832
833
834
835
    if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
        return false;
    if (! AST::match(node->ptr_operator_list, pattern->ptr_operator_list, this))
        return false;
    if (! AST::match(node->new_array_declarator_list, pattern->new_array_declarator_list, this))
        return false;
836
837
838
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
839
bool ASTMatcher::match(OperatorAST *node, OperatorAST *pattern)
840
{
Roberto Raggi's avatar
Roberto Raggi committed
841
842
843
844
845
846
    if (node->op_token != pattern->op_token)
        return false;
    if (node->open_token != pattern->open_token)
        return false;
    if (node->close_token != pattern->close_token)
        return false;
847
848
849
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
850
bool ASTMatcher::match(ParameterDeclarationAST *node, ParameterDeclarationAST *pattern)
851
{
Roberto Raggi's avatar
Roberto Raggi committed
852
853
854
855
856
857
858
859
    if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
        return false;
    if (! AST::match(node->declarator, pattern->declarator, this))
        return false;
    if (node->equal_token != pattern->equal_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
860
861
862
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
863
bool ASTMatcher::match(ParameterDeclarationClauseAST *node, ParameterDeclarationClauseAST *pattern)
864
{
Roberto Raggi's avatar
Roberto Raggi committed
865
866
867
868
    if (! AST::match(node->parameter_declaration_list, pattern->parameter_declaration_list, this))
        return false;
    if (node->dot_dot_dot_token != pattern->dot_dot_dot_token)
        return false;
869
870
871
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
872
bool ASTMatcher::match(CallAST *node, CallAST *pattern)
873
{
Roberto Raggi's avatar
Roberto Raggi committed
874
875
876
877
878
879
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression_list, pattern->expression_list, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
880
881
882
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
883
bool ASTMatcher::match(ArrayAccessAST *node, ArrayAccessAST *pattern)
884
{
Roberto Raggi's avatar
Roberto Raggi committed
885
886
887
888
889
890
    if (node->lbracket_token != pattern->lbracket_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rbracket_token != pattern->rbracket_token)
        return false;
891
892
893
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
894
bool ASTMatcher::match(PostIncrDecrAST *node, PostIncrDecrAST *pattern)
895
{
Roberto Raggi's avatar
Roberto Raggi committed
896
897
    if (node->incr_decr_token != pattern->incr_decr_token)
        return false;
898
899
900
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
901
bool ASTMatcher::match(MemberAccessAST *node, MemberAccessAST *pattern)
902
{
Roberto Raggi's avatar
Roberto Raggi committed
903
904
905
906
907
908
    if (node->access_token != pattern->access_token)
        return false;
    if (node->template_token != pattern->template_token)
        return false;
    if (! AST::match(node->member_name, pattern->member_name, this))
        return false;
909
910
911
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
912
bool ASTMatcher::match(TypeidExpressionAST *node, TypeidExpressionAST *pattern)
913
{
Roberto Raggi's avatar
Roberto Raggi committed
914
915
916
917
918
919
920
921
    if (node->typeid_token != pattern->typeid_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
922
923
924
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
925
bool ASTMatcher::match(TypenameCallExpressionAST *node, TypenameCallExpressionAST *pattern)
926
{
Roberto Raggi's avatar
Roberto Raggi committed
927
928
929
930
931
932
933
934
935
936
    if (node->typename_token != pattern->typename_token)
        return false;
    if (! AST::match(node->name, pattern->name, this))
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression_list, pattern->expression_list, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
937
938
939
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
940
bool ASTMatcher::match(TypeConstructorCallAST *node, TypeConstructorCallAST *pattern)
941
{
Roberto Raggi's avatar
Roberto Raggi committed
942
943
944
945
946
947
948
949
    if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression_list, pattern->expression_list, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
950
951
952
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
953
bool ASTMatcher::match(PostfixExpressionAST *node, PostfixExpressionAST *pattern)
954
{
Roberto Raggi's avatar
Roberto Raggi committed
955
956
957
958
    if (! AST::match(node->base_expression, pattern->base_expression, this))
        return false;
    if (! AST::match(node->postfix_expression_list, pattern->postfix_expression_list, this))
        return false;
959
960
961
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
962
bool ASTMatcher::match(PointerToMemberAST *node, PointerToMemberAST *pattern)
963
{
Roberto Raggi's avatar
Roberto Raggi committed
964
965
966
967
968
969
970
971
    if (node->global_scope_token != pattern->global_scope_token)
        return false;
    if (! AST::match(node->nested_name_specifier_list, pattern->nested_name_specifier_list, this))
        return false;
    if (node->star_token != pattern->star_token)
        return false;
    if (! AST::match(node->cv_qualifier_list, pattern->cv_qualifier_list, this))
        return false;
972
973
974
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
975
bool ASTMatcher::match(PointerAST *node, PointerAST *pattern)
976
{
Roberto Raggi's avatar
Roberto Raggi committed
977
978
979
980
    if (node->star_token != pattern->star_token)
        return false;
    if (! AST::match(node->cv_qualifier_list, pattern->cv_qualifier_list, this))
        return false;
981
982
983
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
984
bool ASTMatcher::match(ReferenceAST *node, ReferenceAST *pattern)
985
{
Roberto Raggi's avatar
Roberto Raggi committed
986
987
    if (node->amp_token != pattern->amp_token)
        return false;
988
989
990
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
991
bool ASTMatcher::match(BreakStatementAST *node, BreakStatementAST *pattern)
992
{
Roberto Raggi's avatar
Roberto Raggi committed
993
994
995
996
    if (node->break_token != pattern->break_token)
        return false;
    if (node->semicolon_token != pattern->semicolon_token)
        return false;
997
998
999
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1000
bool ASTMatcher::match(ContinueStatementAST *node, ContinueStatementAST *pattern)
1001
{
Roberto Raggi's avatar
Roberto Raggi committed
1002
1003
1004
1005
    if (node->continue_token != pattern->continue_token)
        return false;
    if (node->semicolon_token != pattern->semicolon_token)
        return false;
1006
1007
1008
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1009
bool ASTMatcher::match(GotoStatementAST *node, GotoStatementAST *pattern)
1010
{
Roberto Raggi's avatar
Roberto Raggi committed
1011
1012
1013
1014
1015
1016
    if (node->goto_token != pattern->goto_token)
        return false;
    if (node->identifier_token != pattern->identifier_token)
        return false;
    if (node->semicolon_token != pattern->semicolon_token)
        return false;
1017
1018
1019
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1020
bool ASTMatcher::match(ReturnStatementAST *node, ReturnStatementAST *pattern)
1021
{
Roberto Raggi's avatar
Roberto Raggi committed
1022
1023
1024
1025
1026
1027
    if (node->return_token != pattern->return_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->semicolon_token != pattern->semicolon_token)
        return false;
1028
1029
1030
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1031
bool ASTMatcher::match(SizeofExpressionAST *node, SizeofExpressionAST *pattern)
1032
{
Roberto Raggi's avatar
Roberto Raggi committed
1033
1034
1035
1036
1037
1038
1039
1040
    if (node->sizeof_token != pattern->sizeof_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
1041
1042
1043
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1044
bool ASTMatcher::match(NumericLiteralAST *node, NumericLiteralAST *pattern)
1045
{
Roberto Raggi's avatar
Roberto Raggi committed
1046
1047
    if (node->literal_token != pattern->literal_token)
        return false;
1048
1049
1050
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1051
bool ASTMatcher::match(BoolLiteralAST *node, BoolLiteralAST *pattern)
1052
{
Roberto Raggi's avatar
Roberto Raggi committed
1053
1054
    if (node->literal_token != pattern->literal_token)
        return false;
1055
1056
1057
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1058
bool ASTMatcher::match(ThisExpressionAST *node, ThisExpressionAST *pattern)
1059
{
Roberto Raggi's avatar
Roberto Raggi committed
1060
1061
    if (node->this_token != pattern->this_token)
        return false;
1062
1063
1064
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1065
bool ASTMatcher::match(NestedExpressionAST *node, NestedExpressionAST *pattern)
1066
{
Roberto Raggi's avatar
Roberto Raggi committed
1067
1068
1069
1070
1071
1072
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->expression, pattern->expression, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
1073
1074
1075
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1076
bool ASTMatcher::match(StringLiteralAST *node, StringLiteralAST *pattern)
1077
{
Roberto Raggi's avatar
Roberto Raggi committed
1078
1079
1080
1081
    if (node->literal_token != pattern->literal_token)
        return false;
    if (! AST::match(node->next, pattern->next, this))
        return false;
1082
1083
1084
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1085
bool ASTMatcher::match(SwitchStatementAST *node, SwitchStatementAST *pattern)
1086
{
Roberto Raggi's avatar
Roberto Raggi committed
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
    if (node->switch_token != pattern->switch_token)
        return false;
    if (node->lparen_token != pattern->lparen_token)
        return false;
    if (! AST::match(node->condition, pattern->condition, this))
        return false;
    if (node->rparen_token != pattern->rparen_token)
        return false;
    if (! AST::match(node->statement, pattern->statement, this))
        return false;
1097
1098
1099
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1100
bool ASTMatcher::match(TemplateDeclarationAST *node, TemplateDeclarationAST *pattern)
1101
{
Roberto Raggi's avatar
Roberto Raggi committed
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
    if (node->export_token != pattern->export_token)
        return false;
    if (node->template_token != pattern->template_token)
        return false;
    if (node->less_token != pattern->less_token)
        return false;
    if (! AST::match(node->template_parameter_list, pattern->template_parameter_list, this))
        return false;
    if (node->greater_token != pattern->greater_token)
        return false;
    if (! AST::match