|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 // Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com> |
|
42 // |
|
43 // Permission is hereby granted, free of charge, to any person obtaining a copy |
|
44 // of this software and associated documentation files (the "Software"), to deal |
|
45 // in the Software without restriction, including without limitation the rights |
|
46 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
47 // copies of the Software, and to permit persons to whom the Software is |
|
48 // furnished to do so, subject to the following conditions: |
|
49 // |
|
50 // The above copyright notice and this permission notice shall be included in |
|
51 // all copies or substantial portions of the Software. |
|
52 // |
|
53 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
54 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
55 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
56 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
57 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
58 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
59 // THE SOFTWARE. |
|
60 |
|
61 #include "AST.h" |
|
62 #include "ASTVisitor.h" |
|
63 #include "ASTMatcher.h" |
|
64 #include "MemoryPool.h" |
|
65 |
|
66 #include <cassert> |
|
67 #include <algorithm> |
|
68 |
|
69 using namespace CPlusPlus; |
|
70 |
|
71 AST::AST() |
|
72 { } |
|
73 |
|
74 AST::~AST() |
|
75 { assert(0); } |
|
76 |
|
77 void AST::accept(ASTVisitor *visitor) |
|
78 { |
|
79 if (visitor->preVisit(this)) |
|
80 accept0(visitor); |
|
81 visitor->postVisit(this); |
|
82 } |
|
83 |
|
84 bool AST::match(AST *ast, AST *pattern, ASTMatcher *matcher) |
|
85 { |
|
86 if (ast == pattern) |
|
87 return true; |
|
88 |
|
89 else if (! ast || ! pattern) |
|
90 return false; |
|
91 |
|
92 return ast->match(pattern, matcher); |
|
93 } |
|
94 |
|
95 bool AST::match(AST *pattern, ASTMatcher *matcher) |
|
96 { |
|
97 return match0(pattern, matcher); |
|
98 } |
|
99 |
|
100 unsigned AttributeSpecifierAST::firstToken() const |
|
101 { |
|
102 return attribute_token; |
|
103 } |
|
104 |
|
105 unsigned AttributeSpecifierAST::lastToken() const |
|
106 { |
|
107 if (second_rparen_token) |
|
108 return second_rparen_token + 1; |
|
109 else if (first_rparen_token) |
|
110 return first_rparen_token + 1; |
|
111 else if (attribute_list) |
|
112 return attribute_list->lastToken(); |
|
113 else if (second_lparen_token) |
|
114 return second_lparen_token + 1; |
|
115 else if (first_lparen_token) |
|
116 return first_lparen_token + 1; |
|
117 return attribute_token + 1; |
|
118 } |
|
119 |
|
120 |
|
121 unsigned AttributeAST::firstToken() const |
|
122 { |
|
123 return identifier_token; |
|
124 } |
|
125 |
|
126 unsigned AttributeAST::lastToken() const |
|
127 { |
|
128 if (rparen_token) |
|
129 return rparen_token + 1; |
|
130 |
|
131 else if (expression_list) |
|
132 return expression_list->lastToken(); |
|
133 |
|
134 else if (tag_token) |
|
135 return tag_token + 1; |
|
136 |
|
137 else if (lparen_token) |
|
138 return lparen_token + 1; |
|
139 |
|
140 return identifier_token + 1; |
|
141 } |
|
142 |
|
143 |
|
144 |
|
145 unsigned AccessDeclarationAST::firstToken() const |
|
146 { |
|
147 return access_specifier_token; |
|
148 } |
|
149 |
|
150 unsigned AccessDeclarationAST::lastToken() const |
|
151 { |
|
152 if (colon_token) |
|
153 return colon_token + 1; |
|
154 else if (slots_token) |
|
155 return slots_token + 1; |
|
156 return access_specifier_token + 1; |
|
157 } |
|
158 |
|
159 #ifdef ICHECK_BUILD |
|
160 unsigned QPropertyDeclarationAST::firstToken() const |
|
161 { |
|
162 return property_specifier_token; |
|
163 } |
|
164 |
|
165 unsigned QPropertyDeclarationAST::lastToken() const |
|
166 { |
|
167 return rparen_token; |
|
168 } |
|
169 |
|
170 unsigned QEnumDeclarationAST::firstToken() const |
|
171 { |
|
172 return enum_specifier_token; |
|
173 } |
|
174 |
|
175 unsigned QEnumDeclarationAST::lastToken() const |
|
176 { |
|
177 return rparen_token; |
|
178 } |
|
179 |
|
180 unsigned QFlagsDeclarationAST::firstToken() const |
|
181 { |
|
182 return this->flags_specifier_token; |
|
183 } |
|
184 |
|
185 unsigned QFlagsDeclarationAST::lastToken() const |
|
186 { |
|
187 return rparen_token; |
|
188 } |
|
189 |
|
190 unsigned QDeclareFlagsDeclarationAST::firstToken() const |
|
191 { |
|
192 return declareflags_specifier_token; |
|
193 } |
|
194 |
|
195 unsigned QDeclareFlagsDeclarationAST::lastToken() const |
|
196 { |
|
197 return rparen_token; |
|
198 } |
|
199 #endif |
|
200 |
|
201 unsigned ArrayAccessAST::firstToken() const |
|
202 { |
|
203 return lbracket_token; |
|
204 } |
|
205 |
|
206 unsigned ArrayAccessAST::lastToken() const |
|
207 { |
|
208 if (rbracket_token) |
|
209 return rbracket_token + 1; |
|
210 else if (expression) |
|
211 return expression->lastToken(); |
|
212 return lbracket_token + 1; |
|
213 } |
|
214 |
|
215 |
|
216 unsigned ArrayDeclaratorAST::firstToken() const |
|
217 { |
|
218 return lbracket_token; |
|
219 } |
|
220 |
|
221 unsigned ArrayDeclaratorAST::lastToken() const |
|
222 { |
|
223 if (rbracket_token) |
|
224 return rbracket_token + 1; |
|
225 else if (expression) |
|
226 return expression->lastToken(); |
|
227 return lbracket_token + 1; |
|
228 } |
|
229 |
|
230 |
|
231 unsigned ArrayInitializerAST::firstToken() const |
|
232 { |
|
233 return lbrace_token; |
|
234 } |
|
235 |
|
236 unsigned ArrayInitializerAST::lastToken() const |
|
237 { |
|
238 if (rbrace_token) |
|
239 return rbrace_token + 1; |
|
240 |
|
241 else if (expression_list) |
|
242 return expression_list->lastToken(); |
|
243 |
|
244 return lbrace_token + 1; |
|
245 } |
|
246 |
|
247 |
|
248 unsigned AsmDefinitionAST::firstToken() const |
|
249 { |
|
250 return asm_token; |
|
251 } |
|
252 |
|
253 unsigned AsmDefinitionAST::lastToken() const |
|
254 { |
|
255 if (semicolon_token) |
|
256 return semicolon_token + 1; |
|
257 else if (rparen_token) |
|
258 return rparen_token + 1; |
|
259 else if (lparen_token) |
|
260 return lparen_token + 1; |
|
261 else if (volatile_token) |
|
262 return volatile_token + 1; |
|
263 return asm_token + 1; |
|
264 } |
|
265 |
|
266 |
|
267 unsigned BaseSpecifierAST::firstToken() const |
|
268 { |
|
269 if (virtual_token && access_specifier_token) |
|
270 return std::min(virtual_token, access_specifier_token); |
|
271 return name->firstToken(); |
|
272 } |
|
273 |
|
274 unsigned BaseSpecifierAST::lastToken() const |
|
275 { |
|
276 if (name) |
|
277 return name->lastToken(); |
|
278 else if (virtual_token && access_specifier_token) |
|
279 return std::min(virtual_token, access_specifier_token) + 1; |
|
280 else if (virtual_token) |
|
281 return virtual_token + 1; |
|
282 else if (access_specifier_token) |
|
283 return access_specifier_token + 1; |
|
284 // assert? |
|
285 return 0; |
|
286 } |
|
287 |
|
288 unsigned QtMethodAST::firstToken() const |
|
289 { return method_token; } |
|
290 |
|
291 unsigned QtMethodAST::lastToken() const |
|
292 { |
|
293 if (rparen_token) |
|
294 return rparen_token + 1; |
|
295 else if (declarator) |
|
296 return declarator->lastToken(); |
|
297 else if (lparen_token) |
|
298 return lparen_token + 1; |
|
299 return method_token + 1; |
|
300 } |
|
301 |
|
302 unsigned QtMemberDeclarationAST::firstToken() const |
|
303 { |
|
304 return q_token; |
|
305 } |
|
306 |
|
307 unsigned QtMemberDeclarationAST::lastToken() const |
|
308 { |
|
309 if (rparen_token) |
|
310 return rparen_token + 1; |
|
311 else if (type_id) |
|
312 return type_id->lastToken(); |
|
313 else if (lparen_token) |
|
314 return lparen_token + 1; |
|
315 return q_token + 1; |
|
316 } |
|
317 |
|
318 unsigned BinaryExpressionAST::firstToken() const |
|
319 { |
|
320 return left_expression->firstToken(); |
|
321 } |
|
322 |
|
323 unsigned BinaryExpressionAST::lastToken() const |
|
324 { |
|
325 if (right_expression) |
|
326 return right_expression->lastToken(); |
|
327 else if (binary_op_token) |
|
328 return binary_op_token + 1; |
|
329 return left_expression->lastToken(); |
|
330 } |
|
331 |
|
332 |
|
333 unsigned BoolLiteralAST::firstToken() const |
|
334 { |
|
335 return literal_token; |
|
336 } |
|
337 |
|
338 unsigned BoolLiteralAST::lastToken() const |
|
339 { |
|
340 return literal_token + 1; |
|
341 } |
|
342 |
|
343 |
|
344 unsigned CompoundLiteralAST::firstToken() const |
|
345 { |
|
346 return lparen_token; |
|
347 } |
|
348 |
|
349 unsigned CompoundLiteralAST::lastToken() const |
|
350 { |
|
351 if (initializer) |
|
352 return initializer->lastToken(); |
|
353 else if (rparen_token) |
|
354 return rparen_token + 1; |
|
355 else if (type_id) |
|
356 return type_id->lastToken(); |
|
357 return lparen_token + 1; |
|
358 } |
|
359 |
|
360 |
|
361 unsigned BreakStatementAST::firstToken() const |
|
362 { |
|
363 return break_token; |
|
364 } |
|
365 |
|
366 unsigned BreakStatementAST::lastToken() const |
|
367 { |
|
368 if (semicolon_token) |
|
369 return semicolon_token + 1; |
|
370 return break_token + 1; |
|
371 } |
|
372 |
|
373 |
|
374 unsigned CallAST::firstToken() const |
|
375 { |
|
376 return lparen_token; |
|
377 } |
|
378 |
|
379 unsigned CallAST::lastToken() const |
|
380 { |
|
381 if (rparen_token) |
|
382 return rparen_token + 1; |
|
383 |
|
384 else if (expression_list) |
|
385 return expression_list->lastToken(); |
|
386 |
|
387 return lparen_token + 1; |
|
388 } |
|
389 |
|
390 |
|
391 unsigned CaseStatementAST::firstToken() const |
|
392 { |
|
393 return case_token; |
|
394 } |
|
395 |
|
396 unsigned CaseStatementAST::lastToken() const |
|
397 { |
|
398 if (statement) |
|
399 return statement->lastToken(); |
|
400 else if (colon_token) |
|
401 return colon_token + 1; |
|
402 else if (expression) |
|
403 return expression->lastToken(); |
|
404 return case_token + 1; |
|
405 } |
|
406 |
|
407 |
|
408 unsigned CastExpressionAST::firstToken() const |
|
409 { |
|
410 return lparen_token; |
|
411 } |
|
412 |
|
413 unsigned CastExpressionAST::lastToken() const |
|
414 { |
|
415 if (expression) |
|
416 return expression->lastToken(); |
|
417 else if (rparen_token) |
|
418 return rparen_token + 1; |
|
419 else if (type_id) |
|
420 return type_id->lastToken(); |
|
421 return lparen_token + 1; |
|
422 } |
|
423 |
|
424 |
|
425 unsigned CatchClauseAST::firstToken() const |
|
426 { |
|
427 return catch_token; |
|
428 } |
|
429 |
|
430 unsigned CatchClauseAST::lastToken() const |
|
431 { |
|
432 if (statement) |
|
433 return statement->lastToken(); |
|
434 else if (rparen_token) |
|
435 return rparen_token + 1; |
|
436 if (exception_declaration) |
|
437 return exception_declaration->lastToken(); |
|
438 if (lparen_token) |
|
439 return lparen_token + 1; |
|
440 |
|
441 return catch_token + 1; |
|
442 } |
|
443 |
|
444 |
|
445 unsigned ClassSpecifierAST::firstToken() const |
|
446 { |
|
447 return classkey_token; |
|
448 } |
|
449 |
|
450 unsigned ClassSpecifierAST::lastToken() const |
|
451 { |
|
452 if (rbrace_token) |
|
453 return rbrace_token + 1; |
|
454 |
|
455 else if (member_specifier_list) |
|
456 return member_specifier_list->lastToken(); |
|
457 |
|
458 else if (lbrace_token) |
|
459 return lbrace_token + 1; |
|
460 |
|
461 else if (base_clause_list) |
|
462 return base_clause_list->lastToken(); |
|
463 |
|
464 else if (colon_token) |
|
465 return colon_token + 1; |
|
466 |
|
467 else if (name) |
|
468 return name->lastToken(); |
|
469 |
|
470 else if (attribute_list) |
|
471 return attribute_list->lastToken(); |
|
472 |
|
473 return classkey_token + 1; |
|
474 } |
|
475 |
|
476 unsigned CompoundStatementAST::firstToken() const |
|
477 { |
|
478 return lbrace_token; |
|
479 } |
|
480 |
|
481 unsigned CompoundStatementAST::lastToken() const |
|
482 { |
|
483 if (rbrace_token) |
|
484 return rbrace_token + 1; |
|
485 |
|
486 else if (statement_list) |
|
487 return statement_list->lastToken(); |
|
488 |
|
489 return lbrace_token + 1; |
|
490 } |
|
491 |
|
492 |
|
493 unsigned ConditionAST::firstToken() const |
|
494 { |
|
495 if (type_specifier_list) |
|
496 return type_specifier_list->firstToken(); |
|
497 |
|
498 return declarator->firstToken(); |
|
499 } |
|
500 |
|
501 unsigned ConditionAST::lastToken() const |
|
502 { |
|
503 if (declarator) |
|
504 return declarator->lastToken(); |
|
505 |
|
506 else if (type_specifier_list) |
|
507 return type_specifier_list->lastToken(); |
|
508 |
|
509 // ### assert? |
|
510 return 0; |
|
511 } |
|
512 |
|
513 |
|
514 unsigned ConditionalExpressionAST::firstToken() const |
|
515 { |
|
516 return condition->firstToken(); |
|
517 } |
|
518 |
|
519 unsigned ConditionalExpressionAST::lastToken() const |
|
520 { |
|
521 if (right_expression) |
|
522 return right_expression->lastToken(); |
|
523 else if (colon_token) |
|
524 return colon_token + 1; |
|
525 else if (left_expression) |
|
526 return left_expression->lastToken(); |
|
527 else if (question_token) |
|
528 return question_token + 1; |
|
529 else if (condition) |
|
530 return condition->lastToken(); |
|
531 // ### assert? |
|
532 return 0; |
|
533 } |
|
534 |
|
535 |
|
536 unsigned ContinueStatementAST::firstToken() const |
|
537 { |
|
538 return continue_token; |
|
539 } |
|
540 |
|
541 unsigned ContinueStatementAST::lastToken() const |
|
542 { |
|
543 if (semicolon_token) |
|
544 return semicolon_token + 1; |
|
545 return continue_token + 1; |
|
546 } |
|
547 |
|
548 |
|
549 unsigned ConversionFunctionIdAST::firstToken() const |
|
550 { |
|
551 return operator_token; |
|
552 } |
|
553 |
|
554 unsigned ConversionFunctionIdAST::lastToken() const |
|
555 { |
|
556 if (ptr_operator_list) |
|
557 return ptr_operator_list->lastToken(); |
|
558 |
|
559 else if (type_specifier_list) |
|
560 return type_specifier_list->lastToken(); |
|
561 |
|
562 return operator_token + 1; |
|
563 } |
|
564 |
|
565 |
|
566 unsigned CppCastExpressionAST::firstToken() const |
|
567 { |
|
568 return cast_token; |
|
569 } |
|
570 |
|
571 unsigned CppCastExpressionAST::lastToken() const |
|
572 { |
|
573 if (rparen_token) |
|
574 return rparen_token + 1; |
|
575 else if (expression) |
|
576 return expression->lastToken(); |
|
577 else if (lparen_token) |
|
578 return lparen_token + 1; |
|
579 else if (greater_token) |
|
580 return greater_token + 1; |
|
581 else if (type_id) |
|
582 return type_id->lastToken(); |
|
583 else if (less_token) |
|
584 return less_token + 1; |
|
585 return cast_token + 1; |
|
586 } |
|
587 |
|
588 |
|
589 unsigned CtorInitializerAST::firstToken() const |
|
590 { |
|
591 return colon_token; |
|
592 } |
|
593 |
|
594 unsigned CtorInitializerAST::lastToken() const |
|
595 { |
|
596 if (member_initializer_list) |
|
597 return member_initializer_list->lastToken(); |
|
598 return colon_token + 1; |
|
599 } |
|
600 |
|
601 unsigned DeclaratorAST::firstToken() const |
|
602 { |
|
603 if (attribute_list) |
|
604 return attribute_list->firstToken(); |
|
605 if (ptr_operator_list) |
|
606 return ptr_operator_list->firstToken(); |
|
607 else if (core_declarator) |
|
608 return core_declarator->firstToken(); |
|
609 else if (postfix_declarator_list) |
|
610 return postfix_declarator_list->firstToken(); |
|
611 else if (attribute_list) |
|
612 return attribute_list->firstToken(); |
|
613 else if (initializer) |
|
614 return initializer->firstToken(); |
|
615 // ### assert? |
|
616 return 0; |
|
617 } |
|
618 |
|
619 unsigned DeclaratorAST::lastToken() const |
|
620 { |
|
621 if (initializer) |
|
622 return initializer->lastToken(); |
|
623 |
|
624 else if (post_attribute_list) |
|
625 return post_attribute_list->lastToken(); |
|
626 |
|
627 else if (postfix_declarator_list) |
|
628 return postfix_declarator_list->lastToken(); |
|
629 |
|
630 else if (core_declarator) |
|
631 return core_declarator->lastToken(); |
|
632 |
|
633 else if (ptr_operator_list) |
|
634 return ptr_operator_list->lastToken(); |
|
635 |
|
636 else if (attribute_list) |
|
637 return attribute_list->lastToken(); |
|
638 |
|
639 // ### assert? |
|
640 return 0; |
|
641 } |
|
642 |
|
643 |
|
644 unsigned DeclarationStatementAST::firstToken() const |
|
645 { |
|
646 return declaration->firstToken(); |
|
647 } |
|
648 |
|
649 unsigned DeclarationStatementAST::lastToken() const |
|
650 { |
|
651 return declaration->lastToken(); |
|
652 } |
|
653 |
|
654 |
|
655 unsigned DeclaratorIdAST::firstToken() const |
|
656 { |
|
657 return name->firstToken(); |
|
658 } |
|
659 |
|
660 unsigned DeclaratorIdAST::lastToken() const |
|
661 { |
|
662 return name->lastToken(); |
|
663 } |
|
664 |
|
665 unsigned DeleteExpressionAST::firstToken() const |
|
666 { |
|
667 if (scope_token) |
|
668 return scope_token; |
|
669 return delete_token; |
|
670 } |
|
671 |
|
672 unsigned DeleteExpressionAST::lastToken() const |
|
673 { |
|
674 if (expression) |
|
675 return expression->lastToken(); |
|
676 else if (rbracket_token) |
|
677 return rbracket_token + 1; |
|
678 else if (lbracket_token) |
|
679 return lbracket_token + 1; |
|
680 else if (delete_token) |
|
681 return delete_token + 1; |
|
682 return scope_token + 1; |
|
683 } |
|
684 |
|
685 |
|
686 unsigned DestructorNameAST::firstToken() const |
|
687 { |
|
688 return tilde_token; |
|
689 } |
|
690 |
|
691 unsigned DestructorNameAST::lastToken() const |
|
692 { |
|
693 if (identifier_token) |
|
694 return identifier_token + 1; |
|
695 return tilde_token + 1; |
|
696 } |
|
697 |
|
698 |
|
699 unsigned DoStatementAST::firstToken() const |
|
700 { |
|
701 return do_token; |
|
702 } |
|
703 |
|
704 unsigned DoStatementAST::lastToken() const |
|
705 { |
|
706 if (semicolon_token) |
|
707 return semicolon_token + 1; |
|
708 else if (rparen_token) |
|
709 return rparen_token + 1; |
|
710 else if (expression) |
|
711 return expression->lastToken(); |
|
712 else if (lparen_token) |
|
713 return lparen_token + 1; |
|
714 else if (while_token) |
|
715 return while_token + 1; |
|
716 else if (statement) |
|
717 return statement->lastToken(); |
|
718 return do_token + 1; |
|
719 } |
|
720 |
|
721 |
|
722 unsigned ElaboratedTypeSpecifierAST::firstToken() const |
|
723 { |
|
724 return classkey_token; |
|
725 } |
|
726 |
|
727 unsigned ElaboratedTypeSpecifierAST::lastToken() const |
|
728 { |
|
729 if (name) |
|
730 return name->lastToken(); |
|
731 return classkey_token + 1; |
|
732 } |
|
733 |
|
734 |
|
735 unsigned EmptyDeclarationAST::firstToken() const |
|
736 { |
|
737 return semicolon_token; |
|
738 } |
|
739 |
|
740 unsigned EmptyDeclarationAST::lastToken() const |
|
741 { |
|
742 return semicolon_token + 1; |
|
743 } |
|
744 |
|
745 |
|
746 unsigned EnumSpecifierAST::firstToken() const |
|
747 { |
|
748 return enum_token; |
|
749 } |
|
750 |
|
751 unsigned EnumSpecifierAST::lastToken() const |
|
752 { |
|
753 if (rbrace_token) |
|
754 return rbrace_token + 1; |
|
755 |
|
756 if (enumerator_list) |
|
757 return enumerator_list->lastToken(); |
|
758 |
|
759 if (lbrace_token) |
|
760 return lbrace_token + 1; |
|
761 if (name) |
|
762 return name->lastToken(); |
|
763 |
|
764 return enum_token + 1; |
|
765 } |
|
766 |
|
767 |
|
768 unsigned EnumeratorAST::firstToken() const |
|
769 { |
|
770 return identifier_token; |
|
771 } |
|
772 |
|
773 unsigned EnumeratorAST::lastToken() const |
|
774 { |
|
775 if (expression) |
|
776 return expression->lastToken(); |
|
777 else if (equal_token) |
|
778 return equal_token + 1; |
|
779 return identifier_token + 1; |
|
780 } |
|
781 |
|
782 |
|
783 unsigned ExceptionDeclarationAST::firstToken() const |
|
784 { |
|
785 if (type_specifier_list) |
|
786 return type_specifier_list->firstToken(); |
|
787 if (declarator) |
|
788 return declarator->firstToken(); |
|
789 return dot_dot_dot_token; |
|
790 } |
|
791 |
|
792 unsigned ExceptionDeclarationAST::lastToken() const |
|
793 { |
|
794 if (dot_dot_dot_token) |
|
795 return dot_dot_dot_token + 1; |
|
796 |
|
797 else if (declarator) |
|
798 return declarator->lastToken(); |
|
799 |
|
800 else if (type_specifier_list) |
|
801 return type_specifier_list->lastToken(); |
|
802 |
|
803 return 0; |
|
804 } |
|
805 |
|
806 |
|
807 unsigned ExceptionSpecificationAST::firstToken() const |
|
808 { |
|
809 return throw_token; |
|
810 } |
|
811 |
|
812 unsigned ExceptionSpecificationAST::lastToken() const |
|
813 { |
|
814 if (rparen_token) |
|
815 return rparen_token + 1; |
|
816 |
|
817 else if (type_id_list) |
|
818 return type_id_list->lastToken(); |
|
819 |
|
820 else if (dot_dot_dot_token) |
|
821 return dot_dot_dot_token + 1; |
|
822 |
|
823 else if (lparen_token) |
|
824 return lparen_token + 1; |
|
825 |
|
826 return throw_token + 1; |
|
827 } |
|
828 |
|
829 unsigned ExpressionOrDeclarationStatementAST::firstToken() const |
|
830 { |
|
831 return declaration->firstToken(); |
|
832 } |
|
833 |
|
834 unsigned ExpressionOrDeclarationStatementAST::lastToken() const |
|
835 { |
|
836 return declaration->lastToken(); |
|
837 } |
|
838 |
|
839 |
|
840 unsigned ExpressionStatementAST::firstToken() const |
|
841 { |
|
842 if (expression) |
|
843 return expression->firstToken(); |
|
844 return semicolon_token; |
|
845 } |
|
846 |
|
847 unsigned ExpressionStatementAST::lastToken() const |
|
848 { |
|
849 if (semicolon_token) |
|
850 return semicolon_token + 1; |
|
851 else if (expression) |
|
852 return expression->lastToken(); |
|
853 // ### assert? |
|
854 return 0; |
|
855 } |
|
856 |
|
857 unsigned ForeachStatementAST::firstToken() const |
|
858 { |
|
859 return foreach_token; |
|
860 } |
|
861 |
|
862 unsigned ForeachStatementAST::lastToken() const |
|
863 { |
|
864 if (statement) |
|
865 return statement->lastToken(); |
|
866 else if (rparen_token) |
|
867 return rparen_token + 1; |
|
868 else if (expression) |
|
869 return expression->lastToken(); |
|
870 else if (comma_token) |
|
871 return comma_token + 1; |
|
872 |
|
873 return foreach_token + 1; |
|
874 } |
|
875 |
|
876 unsigned ForStatementAST::firstToken() const |
|
877 { |
|
878 return for_token; |
|
879 } |
|
880 |
|
881 unsigned ForStatementAST::lastToken() const |
|
882 { |
|
883 if (statement) |
|
884 return statement->lastToken(); |
|
885 else if (rparen_token) |
|
886 return rparen_token + 1; |
|
887 else if (expression) |
|
888 return expression->lastToken(); |
|
889 else if (semicolon_token) |
|
890 return semicolon_token + 1; |
|
891 else if (condition) |
|
892 return condition->lastToken(); |
|
893 else if (initializer) |
|
894 return initializer->lastToken(); |
|
895 else if (lparen_token) |
|
896 return lparen_token + 1; |
|
897 |
|
898 return for_token + 1; |
|
899 } |
|
900 |
|
901 |
|
902 unsigned FunctionDeclaratorAST::firstToken() const |
|
903 { |
|
904 return lparen_token; |
|
905 } |
|
906 |
|
907 unsigned FunctionDeclaratorAST::lastToken() const |
|
908 { |
|
909 if (exception_specification) |
|
910 return exception_specification->lastToken(); |
|
911 |
|
912 else if (cv_qualifier_list) |
|
913 return cv_qualifier_list->lastToken(); |
|
914 |
|
915 else if (rparen_token) |
|
916 return rparen_token + 1; |
|
917 |
|
918 else if (parameters) |
|
919 return parameters->lastToken(); |
|
920 |
|
921 return lparen_token + 1; |
|
922 } |
|
923 |
|
924 |
|
925 unsigned FunctionDefinitionAST::firstToken() const |
|
926 { |
|
927 if (decl_specifier_list) |
|
928 return decl_specifier_list->firstToken(); |
|
929 else if (declarator) |
|
930 return declarator->firstToken(); |
|
931 else if (ctor_initializer) |
|
932 return ctor_initializer->firstToken(); |
|
933 return function_body->firstToken(); |
|
934 } |
|
935 |
|
936 unsigned FunctionDefinitionAST::lastToken() const |
|
937 { |
|
938 if (function_body) |
|
939 return function_body->lastToken(); |
|
940 |
|
941 else if (ctor_initializer) |
|
942 return ctor_initializer->lastToken(); |
|
943 |
|
944 else if (declarator) |
|
945 return declarator->lastToken(); |
|
946 |
|
947 else if (decl_specifier_list) |
|
948 return decl_specifier_list->lastToken(); |
|
949 |
|
950 // ### assert |
|
951 return 0; |
|
952 } |
|
953 |
|
954 |
|
955 unsigned GotoStatementAST::firstToken() const |
|
956 { |
|
957 return goto_token; |
|
958 } |
|
959 |
|
960 unsigned GotoStatementAST::lastToken() const |
|
961 { |
|
962 if (semicolon_token) |
|
963 return semicolon_token + 1; |
|
964 else if (identifier_token) |
|
965 return identifier_token + 1; |
|
966 else if (goto_token) |
|
967 return goto_token + 1; |
|
968 return 0; |
|
969 } |
|
970 |
|
971 |
|
972 unsigned IfStatementAST::firstToken() const |
|
973 { |
|
974 return if_token; |
|
975 } |
|
976 |
|
977 unsigned IfStatementAST::lastToken() const |
|
978 { |
|
979 if (else_statement) |
|
980 return else_statement->lastToken(); |
|
981 else if (else_token) |
|
982 return else_token + 1; |
|
983 else if (statement) |
|
984 return statement->lastToken(); |
|
985 else if (rparen_token) |
|
986 return rparen_token + 1; |
|
987 else if (condition) |
|
988 return condition->lastToken(); |
|
989 else if (lparen_token) |
|
990 return lparen_token + 1; |
|
991 return if_token + 1; |
|
992 } |
|
993 |
|
994 |
|
995 unsigned LabeledStatementAST::firstToken() const |
|
996 { |
|
997 return label_token; |
|
998 } |
|
999 |
|
1000 unsigned LabeledStatementAST::lastToken() const |
|
1001 { |
|
1002 if (statement) |
|
1003 return statement->lastToken(); |
|
1004 else if (colon_token) |
|
1005 return colon_token + 1; |
|
1006 return label_token + 1; |
|
1007 } |
|
1008 |
|
1009 |
|
1010 unsigned LinkageBodyAST::firstToken() const |
|
1011 { |
|
1012 return lbrace_token; |
|
1013 } |
|
1014 |
|
1015 unsigned LinkageBodyAST::lastToken() const |
|
1016 { |
|
1017 if (rbrace_token) |
|
1018 return rbrace_token + 1; |
|
1019 |
|
1020 else if (declaration_list) |
|
1021 return declaration_list->lastToken(); |
|
1022 |
|
1023 return lbrace_token + 1; |
|
1024 } |
|
1025 |
|
1026 |
|
1027 unsigned LinkageSpecificationAST::firstToken() const |
|
1028 { |
|
1029 return extern_token; |
|
1030 } |
|
1031 |
|
1032 unsigned LinkageSpecificationAST::lastToken() const |
|
1033 { |
|
1034 if (declaration) |
|
1035 return declaration->lastToken(); |
|
1036 else if (extern_type_token) |
|
1037 return extern_type_token + 1; |
|
1038 |
|
1039 return extern_token + 1; |
|
1040 } |
|
1041 |
|
1042 |
|
1043 unsigned MemInitializerAST::firstToken() const |
|
1044 { |
|
1045 return name->firstToken(); |
|
1046 } |
|
1047 |
|
1048 unsigned MemInitializerAST::lastToken() const |
|
1049 { |
|
1050 if (rparen_token) |
|
1051 return rparen_token + 1; |
|
1052 else if (expression_list) |
|
1053 return expression_list->lastToken(); |
|
1054 else if (lparen_token) |
|
1055 return lparen_token + 1; |
|
1056 return name->lastToken(); |
|
1057 } |
|
1058 |
|
1059 |
|
1060 unsigned MemberAccessAST::firstToken() const |
|
1061 { |
|
1062 return access_token; |
|
1063 } |
|
1064 |
|
1065 unsigned MemberAccessAST::lastToken() const |
|
1066 { |
|
1067 if (member_name) |
|
1068 return member_name->lastToken(); |
|
1069 else if (template_token) |
|
1070 return template_token + 1; |
|
1071 return access_token + 1; |
|
1072 } |
|
1073 |
|
1074 |
|
1075 unsigned NamedTypeSpecifierAST::firstToken() const |
|
1076 { |
|
1077 return name->firstToken(); |
|
1078 } |
|
1079 |
|
1080 unsigned NamedTypeSpecifierAST::lastToken() const |
|
1081 { |
|
1082 return name->lastToken(); |
|
1083 } |
|
1084 |
|
1085 |
|
1086 unsigned NamespaceAST::firstToken() const |
|
1087 { |
|
1088 return namespace_token; |
|
1089 } |
|
1090 |
|
1091 unsigned NamespaceAST::lastToken() const |
|
1092 { |
|
1093 if (linkage_body) |
|
1094 return linkage_body->lastToken(); |
|
1095 |
|
1096 else if (attribute_list) |
|
1097 return attribute_list->lastToken(); |
|
1098 |
|
1099 else if (identifier_token) |
|
1100 return identifier_token + 1; |
|
1101 |
|
1102 return namespace_token + 1; |
|
1103 } |
|
1104 |
|
1105 |
|
1106 unsigned NamespaceAliasDefinitionAST::firstToken() const |
|
1107 { |
|
1108 return namespace_token; |
|
1109 } |
|
1110 |
|
1111 unsigned NamespaceAliasDefinitionAST::lastToken() const |
|
1112 { |
|
1113 if (semicolon_token) |
|
1114 return semicolon_token + 1; |
|
1115 else if (name) |
|
1116 return name->lastToken(); |
|
1117 else if (equal_token) |
|
1118 return equal_token + 1; |
|
1119 else if (namespace_name_token) |
|
1120 return namespace_name_token + 1; |
|
1121 return namespace_token + 1; |
|
1122 } |
|
1123 |
|
1124 |
|
1125 unsigned NestedDeclaratorAST::firstToken() const |
|
1126 { |
|
1127 return lparen_token; |
|
1128 } |
|
1129 |
|
1130 unsigned NestedDeclaratorAST::lastToken() const |
|
1131 { |
|
1132 if (rparen_token) |
|
1133 return rparen_token + 1; |
|
1134 else if (declarator) |
|
1135 return declarator->lastToken(); |
|
1136 return lparen_token + 1; |
|
1137 } |
|
1138 |
|
1139 |
|
1140 unsigned NestedExpressionAST::firstToken() const |
|
1141 { |
|
1142 return lparen_token; |
|
1143 } |
|
1144 |
|
1145 unsigned NestedExpressionAST::lastToken() const |
|
1146 { |
|
1147 if (rparen_token) |
|
1148 return rparen_token + 1; |
|
1149 else if (expression) |
|
1150 return expression->lastToken(); |
|
1151 return lparen_token + 1; |
|
1152 } |
|
1153 |
|
1154 |
|
1155 unsigned NestedNameSpecifierAST::firstToken() const |
|
1156 { |
|
1157 return class_or_namespace_name->firstToken(); |
|
1158 } |
|
1159 |
|
1160 unsigned NestedNameSpecifierAST::lastToken() const |
|
1161 { |
|
1162 if (scope_token) |
|
1163 return scope_token + 1; |
|
1164 return class_or_namespace_name->lastToken(); |
|
1165 } |
|
1166 |
|
1167 |
|
1168 unsigned NewPlacementAST::firstToken() const |
|
1169 { |
|
1170 return lparen_token; |
|
1171 } |
|
1172 |
|
1173 unsigned NewPlacementAST::lastToken() const |
|
1174 { |
|
1175 return rparen_token + 1; |
|
1176 } |
|
1177 |
|
1178 |
|
1179 unsigned NewArrayDeclaratorAST::firstToken() const |
|
1180 { |
|
1181 return lbracket_token; |
|
1182 } |
|
1183 |
|
1184 unsigned NewArrayDeclaratorAST::lastToken() const |
|
1185 { |
|
1186 return rbracket_token + 1; |
|
1187 } |
|
1188 |
|
1189 |
|
1190 unsigned NewExpressionAST::firstToken() const |
|
1191 { |
|
1192 if (scope_token) |
|
1193 return scope_token; |
|
1194 return new_token; |
|
1195 } |
|
1196 |
|
1197 unsigned NewExpressionAST::lastToken() const |
|
1198 { |
|
1199 // ### FIXME |
|
1200 if (new_token) |
|
1201 return new_token + 1; |
|
1202 else if (scope_token) |
|
1203 return scope_token + 1; |
|
1204 // ### assert? |
|
1205 return 0; |
|
1206 } |
|
1207 |
|
1208 |
|
1209 unsigned NewInitializerAST::firstToken() const |
|
1210 { |
|
1211 return lparen_token; |
|
1212 } |
|
1213 |
|
1214 unsigned NewInitializerAST::lastToken() const |
|
1215 { |
|
1216 if (rparen_token) |
|
1217 return rparen_token + 1; |
|
1218 else if (expression) |
|
1219 return expression->lastToken(); |
|
1220 return lparen_token + 1; |
|
1221 } |
|
1222 |
|
1223 |
|
1224 unsigned NewTypeIdAST::firstToken() const |
|
1225 { |
|
1226 return type_specifier_list->firstToken(); |
|
1227 } |
|
1228 |
|
1229 unsigned NewTypeIdAST::lastToken() const |
|
1230 { |
|
1231 if (new_array_declarator_list) |
|
1232 return new_array_declarator_list->lastToken(); |
|
1233 |
|
1234 else if (ptr_operator_list) |
|
1235 return ptr_operator_list->lastToken(); |
|
1236 |
|
1237 else if (type_specifier_list) |
|
1238 return type_specifier_list->lastToken(); |
|
1239 |
|
1240 // ### assert? |
|
1241 return 0; |
|
1242 } |
|
1243 |
|
1244 |
|
1245 unsigned NumericLiteralAST::firstToken() const |
|
1246 { |
|
1247 return literal_token; |
|
1248 } |
|
1249 |
|
1250 unsigned NumericLiteralAST::lastToken() const |
|
1251 { |
|
1252 return literal_token + 1; |
|
1253 } |
|
1254 |
|
1255 |
|
1256 unsigned OperatorAST::firstToken() const |
|
1257 { |
|
1258 return op_token; |
|
1259 } |
|
1260 |
|
1261 unsigned OperatorAST::lastToken() const |
|
1262 { |
|
1263 if (close_token) |
|
1264 return close_token + 1; |
|
1265 else if (open_token) |
|
1266 return open_token + 1; |
|
1267 return op_token + 1; |
|
1268 } |
|
1269 |
|
1270 |
|
1271 unsigned OperatorFunctionIdAST::firstToken() const |
|
1272 { |
|
1273 return operator_token; |
|
1274 } |
|
1275 |
|
1276 unsigned OperatorFunctionIdAST::lastToken() const |
|
1277 { |
|
1278 if (op) |
|
1279 return op->lastToken(); |
|
1280 return operator_token + 1; |
|
1281 } |
|
1282 |
|
1283 |
|
1284 unsigned ParameterDeclarationAST::firstToken() const |
|
1285 { |
|
1286 return type_specifier_list->firstToken(); |
|
1287 } |
|
1288 |
|
1289 unsigned ParameterDeclarationAST::lastToken() const |
|
1290 { |
|
1291 if (expression) |
|
1292 return expression->lastToken(); |
|
1293 |
|
1294 else if (equal_token) |
|
1295 return equal_token + 1; |
|
1296 |
|
1297 else if (declarator) |
|
1298 return declarator->lastToken(); |
|
1299 |
|
1300 else if (type_specifier_list) |
|
1301 return type_specifier_list->lastToken(); |
|
1302 |
|
1303 // ### assert? |
|
1304 return 0; |
|
1305 } |
|
1306 |
|
1307 |
|
1308 unsigned ParameterDeclarationClauseAST::firstToken() const |
|
1309 { |
|
1310 if (parameter_declaration_list) |
|
1311 return parameter_declaration_list->firstToken(); |
|
1312 return dot_dot_dot_token; |
|
1313 } |
|
1314 |
|
1315 unsigned ParameterDeclarationClauseAST::lastToken() const |
|
1316 { |
|
1317 if (dot_dot_dot_token) |
|
1318 return dot_dot_dot_token + 1; |
|
1319 return parameter_declaration_list->lastToken(); |
|
1320 } |
|
1321 |
|
1322 |
|
1323 unsigned PointerAST::firstToken() const |
|
1324 { |
|
1325 return star_token; |
|
1326 } |
|
1327 |
|
1328 unsigned PointerAST::lastToken() const |
|
1329 { |
|
1330 if (cv_qualifier_list) |
|
1331 return cv_qualifier_list->lastToken(); |
|
1332 |
|
1333 return star_token + 1; |
|
1334 } |
|
1335 |
|
1336 |
|
1337 unsigned PointerToMemberAST::firstToken() const |
|
1338 { |
|
1339 if (global_scope_token) |
|
1340 return global_scope_token; |
|
1341 else if (nested_name_specifier_list) |
|
1342 return nested_name_specifier_list->firstToken(); |
|
1343 return star_token; |
|
1344 } |
|
1345 |
|
1346 unsigned PointerToMemberAST::lastToken() const |
|
1347 { |
|
1348 if (cv_qualifier_list) |
|
1349 return cv_qualifier_list->lastToken(); |
|
1350 |
|
1351 else if (star_token) |
|
1352 return star_token + 1; |
|
1353 |
|
1354 else if (nested_name_specifier_list) |
|
1355 return nested_name_specifier_list->lastToken(); |
|
1356 |
|
1357 else if (global_scope_token) |
|
1358 return global_scope_token + 1; |
|
1359 |
|
1360 // ### assert(0); |
|
1361 return 0; |
|
1362 } |
|
1363 |
|
1364 |
|
1365 unsigned PostIncrDecrAST::firstToken() const |
|
1366 { |
|
1367 return incr_decr_token; |
|
1368 } |
|
1369 |
|
1370 unsigned PostIncrDecrAST::lastToken() const |
|
1371 { |
|
1372 return incr_decr_token + 1; |
|
1373 } |
|
1374 |
|
1375 |
|
1376 unsigned PostfixExpressionAST::firstToken() const |
|
1377 { |
|
1378 return base_expression->firstToken(); |
|
1379 } |
|
1380 |
|
1381 unsigned PostfixExpressionAST::lastToken() const |
|
1382 { |
|
1383 if (postfix_expression_list) |
|
1384 return postfix_expression_list->lastToken(); |
|
1385 return base_expression->lastToken(); |
|
1386 } |
|
1387 |
|
1388 |
|
1389 unsigned QualifiedNameAST::firstToken() const |
|
1390 { |
|
1391 if (global_scope_token) |
|
1392 return global_scope_token; |
|
1393 else if (nested_name_specifier_list) |
|
1394 return nested_name_specifier_list->firstToken(); |
|
1395 return unqualified_name->firstToken(); |
|
1396 } |
|
1397 |
|
1398 unsigned QualifiedNameAST::lastToken() const |
|
1399 { |
|
1400 if (unqualified_name) |
|
1401 return unqualified_name->lastToken(); |
|
1402 |
|
1403 if (nested_name_specifier_list) |
|
1404 return nested_name_specifier_list->lastToken(); |
|
1405 |
|
1406 if (global_scope_token) |
|
1407 return global_scope_token + 1; |
|
1408 |
|
1409 return 0; |
|
1410 } |
|
1411 |
|
1412 |
|
1413 unsigned ReferenceAST::firstToken() const |
|
1414 { |
|
1415 return amp_token; |
|
1416 } |
|
1417 |
|
1418 unsigned ReferenceAST::lastToken() const |
|
1419 { |
|
1420 return amp_token + 1; |
|
1421 } |
|
1422 |
|
1423 |
|
1424 unsigned ReturnStatementAST::firstToken() const |
|
1425 { |
|
1426 return return_token; |
|
1427 } |
|
1428 |
|
1429 unsigned ReturnStatementAST::lastToken() const |
|
1430 { |
|
1431 if (semicolon_token) |
|
1432 return semicolon_token + 1; |
|
1433 else if (expression) |
|
1434 return expression->lastToken(); |
|
1435 return return_token + 1; |
|
1436 } |
|
1437 |
|
1438 |
|
1439 unsigned SimpleDeclarationAST::firstToken() const |
|
1440 { |
|
1441 if (decl_specifier_list) |
|
1442 return decl_specifier_list->firstToken(); |
|
1443 else if (declarator_list) |
|
1444 return declarator_list->firstToken(); |
|
1445 return semicolon_token; |
|
1446 } |
|
1447 |
|
1448 unsigned SimpleDeclarationAST::lastToken() const |
|
1449 { |
|
1450 if (semicolon_token) |
|
1451 return semicolon_token + 1; |
|
1452 |
|
1453 else if (declarator_list) |
|
1454 return declarator_list->lastToken(); |
|
1455 |
|
1456 else if (decl_specifier_list) |
|
1457 return decl_specifier_list->lastToken(); |
|
1458 |
|
1459 // ### assert(0); |
|
1460 return 0; |
|
1461 } |
|
1462 |
|
1463 unsigned SimpleNameAST::firstToken() const |
|
1464 { |
|
1465 return identifier_token; |
|
1466 } |
|
1467 |
|
1468 unsigned SimpleNameAST::lastToken() const |
|
1469 { |
|
1470 return identifier_token + 1; |
|
1471 } |
|
1472 |
|
1473 |
|
1474 unsigned SimpleSpecifierAST::firstToken() const |
|
1475 { |
|
1476 return specifier_token; |
|
1477 } |
|
1478 |
|
1479 unsigned SimpleSpecifierAST::lastToken() const |
|
1480 { |
|
1481 return specifier_token + 1; |
|
1482 } |
|
1483 |
|
1484 |
|
1485 unsigned TypeofSpecifierAST::firstToken() const |
|
1486 { |
|
1487 return typeof_token; |
|
1488 } |
|
1489 |
|
1490 unsigned TypeofSpecifierAST::lastToken() const |
|
1491 { |
|
1492 if (expression) |
|
1493 return expression->lastToken(); |
|
1494 return typeof_token + 1; |
|
1495 } |
|
1496 |
|
1497 |
|
1498 unsigned SizeofExpressionAST::firstToken() const |
|
1499 { |
|
1500 return sizeof_token; |
|
1501 } |
|
1502 |
|
1503 unsigned SizeofExpressionAST::lastToken() const |
|
1504 { |
|
1505 if (expression) |
|
1506 return expression->lastToken(); |
|
1507 return sizeof_token + 1; |
|
1508 } |
|
1509 |
|
1510 |
|
1511 unsigned StringLiteralAST::firstToken() const |
|
1512 { |
|
1513 return literal_token; |
|
1514 } |
|
1515 |
|
1516 unsigned StringLiteralAST::lastToken() const |
|
1517 { |
|
1518 if (next) |
|
1519 return next->lastToken(); |
|
1520 return literal_token + 1; |
|
1521 } |
|
1522 |
|
1523 |
|
1524 unsigned SwitchStatementAST::firstToken() const |
|
1525 { |
|
1526 return switch_token; |
|
1527 } |
|
1528 |
|
1529 unsigned SwitchStatementAST::lastToken() const |
|
1530 { |
|
1531 if (statement) |
|
1532 return statement->lastToken(); |
|
1533 |
|
1534 else if (rparen_token) |
|
1535 return rparen_token + 1; |
|
1536 |
|
1537 else if (condition) |
|
1538 return condition->lastToken(); |
|
1539 |
|
1540 else if (lparen_token) |
|
1541 return lparen_token + 1; |
|
1542 |
|
1543 return switch_token + 1; |
|
1544 } |
|
1545 |
|
1546 unsigned TemplateDeclarationAST::firstToken() const |
|
1547 { |
|
1548 if (export_token) |
|
1549 return export_token; |
|
1550 |
|
1551 return template_token; |
|
1552 } |
|
1553 |
|
1554 unsigned TemplateDeclarationAST::lastToken() const |
|
1555 { |
|
1556 if (declaration) |
|
1557 return declaration->lastToken(); |
|
1558 |
|
1559 else if (greater_token) |
|
1560 return greater_token + 1; |
|
1561 |
|
1562 else if (template_parameter_list) |
|
1563 return template_parameter_list->lastToken(); |
|
1564 |
|
1565 else if (less_token) |
|
1566 return less_token + 1; |
|
1567 |
|
1568 else if (template_token) |
|
1569 return template_token + 1; |
|
1570 |
|
1571 else if (export_token) |
|
1572 return export_token + 1; |
|
1573 |
|
1574 // ### assert(0); |
|
1575 return 0; |
|
1576 } |
|
1577 |
|
1578 |
|
1579 unsigned TemplateIdAST::firstToken() const |
|
1580 { |
|
1581 return identifier_token; |
|
1582 } |
|
1583 |
|
1584 unsigned TemplateIdAST::lastToken() const |
|
1585 { |
|
1586 if (greater_token) |
|
1587 return greater_token + 1; |
|
1588 |
|
1589 else if (template_argument_list) |
|
1590 return template_argument_list->lastToken(); |
|
1591 |
|
1592 else if (less_token) |
|
1593 return less_token + 1; |
|
1594 |
|
1595 return identifier_token + 1; |
|
1596 } |
|
1597 |
|
1598 |
|
1599 unsigned TemplateTypeParameterAST::firstToken() const |
|
1600 { |
|
1601 return template_token; |
|
1602 } |
|
1603 |
|
1604 unsigned TemplateTypeParameterAST::lastToken() const |
|
1605 { |
|
1606 if (type_id) |
|
1607 return type_id->lastToken(); |
|
1608 |
|
1609 else if (equal_token) |
|
1610 return equal_token + 1; |
|
1611 |
|
1612 else if (name) |
|
1613 return name->lastToken(); |
|
1614 |
|
1615 else if (class_token) |
|
1616 return class_token + 1; |
|
1617 |
|
1618 else if (greater_token) |
|
1619 return greater_token + 1; |
|
1620 |
|
1621 else if (template_parameter_list) |
|
1622 return template_parameter_list->lastToken(); |
|
1623 |
|
1624 else if (less_token) |
|
1625 return less_token + 1; |
|
1626 |
|
1627 return template_token + 1; |
|
1628 } |
|
1629 |
|
1630 |
|
1631 unsigned ThisExpressionAST::firstToken() const |
|
1632 { |
|
1633 return this_token; |
|
1634 } |
|
1635 |
|
1636 unsigned ThisExpressionAST::lastToken() const |
|
1637 { |
|
1638 return this_token + 1; |
|
1639 } |
|
1640 |
|
1641 |
|
1642 unsigned ThrowExpressionAST::firstToken() const |
|
1643 { |
|
1644 return throw_token; |
|
1645 } |
|
1646 |
|
1647 unsigned ThrowExpressionAST::lastToken() const |
|
1648 { |
|
1649 if (expression) |
|
1650 return expression->lastToken(); |
|
1651 return throw_token + 1; |
|
1652 } |
|
1653 |
|
1654 unsigned TranslationUnitAST::firstToken() const |
|
1655 { |
|
1656 if(declaration_list) |
|
1657 return declaration_list->firstToken(); |
|
1658 return 0; |
|
1659 } |
|
1660 |
|
1661 unsigned TranslationUnitAST::lastToken() const |
|
1662 { |
|
1663 if (declaration_list) |
|
1664 return declaration_list->lastToken(); |
|
1665 |
|
1666 // ### assert(0); |
|
1667 return 0; |
|
1668 } |
|
1669 |
|
1670 unsigned TryBlockStatementAST::firstToken() const |
|
1671 { |
|
1672 return try_token; |
|
1673 } |
|
1674 |
|
1675 unsigned TryBlockStatementAST::lastToken() const |
|
1676 { |
|
1677 if (catch_clause_list) |
|
1678 return catch_clause_list->lastToken(); |
|
1679 |
|
1680 else if (statement) |
|
1681 return statement->lastToken(); |
|
1682 |
|
1683 return try_token + 1; |
|
1684 } |
|
1685 |
|
1686 |
|
1687 unsigned TypeConstructorCallAST::firstToken() const |
|
1688 { |
|
1689 return type_specifier_list->firstToken(); |
|
1690 } |
|
1691 |
|
1692 unsigned TypeConstructorCallAST::lastToken() const |
|
1693 { |
|
1694 if (rparen_token) |
|
1695 return rparen_token + 1; |
|
1696 |
|
1697 else if (expression_list) |
|
1698 return expression_list->lastToken(); |
|
1699 |
|
1700 else if (lparen_token) |
|
1701 return lparen_token + 1; |
|
1702 |
|
1703 else if (type_specifier_list) |
|
1704 return type_specifier_list->lastToken(); |
|
1705 |
|
1706 // ### assert(0); |
|
1707 return 0; |
|
1708 } |
|
1709 |
|
1710 |
|
1711 unsigned TypeIdAST::firstToken() const |
|
1712 { |
|
1713 return type_specifier_list->firstToken(); |
|
1714 } |
|
1715 |
|
1716 unsigned TypeIdAST::lastToken() const |
|
1717 { |
|
1718 if (declarator) |
|
1719 return declarator->lastToken(); |
|
1720 |
|
1721 else if (type_specifier_list) |
|
1722 return type_specifier_list->lastToken(); |
|
1723 |
|
1724 // ### assert(0); |
|
1725 return 0; |
|
1726 } |
|
1727 |
|
1728 |
|
1729 unsigned TypeidExpressionAST::firstToken() const |
|
1730 { |
|
1731 return typeid_token; |
|
1732 } |
|
1733 |
|
1734 unsigned TypeidExpressionAST::lastToken() const |
|
1735 { |
|
1736 if (rparen_token) |
|
1737 return rparen_token + 1; |
|
1738 else if (expression) |
|
1739 return expression->lastToken(); |
|
1740 else if (lparen_token) |
|
1741 return lparen_token + 1; |
|
1742 |
|
1743 return typeid_token + 1; |
|
1744 } |
|
1745 |
|
1746 |
|
1747 unsigned TypenameCallExpressionAST::firstToken() const |
|
1748 { |
|
1749 return typename_token; |
|
1750 } |
|
1751 |
|
1752 unsigned TypenameCallExpressionAST::lastToken() const |
|
1753 { |
|
1754 if (rparen_token) |
|
1755 return rparen_token + 1; |
|
1756 |
|
1757 else if (expression_list) |
|
1758 return expression_list->lastToken(); |
|
1759 |
|
1760 else if (lparen_token) |
|
1761 return lparen_token + 1; |
|
1762 |
|
1763 else if (name) |
|
1764 return name->lastToken(); |
|
1765 |
|
1766 return typename_token + 1; |
|
1767 } |
|
1768 |
|
1769 |
|
1770 unsigned TypenameTypeParameterAST::firstToken() const |
|
1771 { |
|
1772 return classkey_token; |
|
1773 } |
|
1774 |
|
1775 unsigned TypenameTypeParameterAST::lastToken() const |
|
1776 { |
|
1777 if (type_id) |
|
1778 return type_id->lastToken(); |
|
1779 else if (equal_token) |
|
1780 return equal_token + 1; |
|
1781 else if (name) |
|
1782 return name->lastToken(); |
|
1783 return classkey_token + 1; |
|
1784 } |
|
1785 |
|
1786 |
|
1787 unsigned UnaryExpressionAST::firstToken() const |
|
1788 { |
|
1789 return unary_op_token; |
|
1790 } |
|
1791 |
|
1792 unsigned UnaryExpressionAST::lastToken() const |
|
1793 { |
|
1794 if (expression) |
|
1795 return expression->lastToken(); |
|
1796 return unary_op_token + 1; |
|
1797 } |
|
1798 |
|
1799 |
|
1800 unsigned UsingAST::firstToken() const |
|
1801 { |
|
1802 return using_token; |
|
1803 } |
|
1804 |
|
1805 unsigned UsingAST::lastToken() const |
|
1806 { |
|
1807 if (semicolon_token) |
|
1808 return semicolon_token + 1; |
|
1809 else if (name) |
|
1810 return name->lastToken(); |
|
1811 else if (typename_token) |
|
1812 return typename_token + 1; |
|
1813 return using_token + 1; |
|
1814 } |
|
1815 |
|
1816 |
|
1817 unsigned UsingDirectiveAST::firstToken() const |
|
1818 { |
|
1819 return using_token; |
|
1820 } |
|
1821 |
|
1822 unsigned UsingDirectiveAST::lastToken() const |
|
1823 { |
|
1824 if (semicolon_token) |
|
1825 return semicolon_token + 1; |
|
1826 else if (name) |
|
1827 return name->lastToken(); |
|
1828 else if (namespace_token) |
|
1829 return namespace_token + 1; |
|
1830 return using_token + 1; |
|
1831 } |
|
1832 |
|
1833 |
|
1834 unsigned WhileStatementAST::firstToken() const |
|
1835 { |
|
1836 return while_token; |
|
1837 } |
|
1838 |
|
1839 unsigned WhileStatementAST::lastToken() const |
|
1840 { |
|
1841 if (statement) |
|
1842 return statement->lastToken(); |
|
1843 |
|
1844 else if (rparen_token) |
|
1845 return rparen_token + 1; |
|
1846 |
|
1847 else if (condition) |
|
1848 return condition->lastToken(); |
|
1849 |
|
1850 else if (lparen_token) |
|
1851 return lparen_token + 1; |
|
1852 |
|
1853 return while_token + 1; |
|
1854 } |
|
1855 |
|
1856 // ObjC++ |
|
1857 unsigned ObjCClassForwardDeclarationAST::firstToken() const |
|
1858 { |
|
1859 if (attribute_list) |
|
1860 return attribute_list->firstToken(); |
|
1861 |
|
1862 return class_token; |
|
1863 } |
|
1864 |
|
1865 unsigned ObjCClassForwardDeclarationAST::lastToken() const |
|
1866 { |
|
1867 if (semicolon_token) |
|
1868 return semicolon_token + 1; |
|
1869 |
|
1870 else if (identifier_list) |
|
1871 return identifier_list->lastToken(); |
|
1872 |
|
1873 return class_token + 1; |
|
1874 } |
|
1875 |
|
1876 unsigned ObjCProtocolForwardDeclarationAST::firstToken() const |
|
1877 { |
|
1878 if (attribute_list) |
|
1879 return attribute_list->firstToken(); |
|
1880 |
|
1881 return protocol_token; |
|
1882 } |
|
1883 |
|
1884 unsigned ObjCProtocolForwardDeclarationAST::lastToken() const |
|
1885 { |
|
1886 if (semicolon_token) |
|
1887 return semicolon_token + 1; |
|
1888 |
|
1889 else if (identifier_list) |
|
1890 return identifier_list->lastToken(); |
|
1891 |
|
1892 return protocol_token + 1; |
|
1893 } |
|
1894 |
|
1895 unsigned ObjCClassDeclarationAST::firstToken() const |
|
1896 { |
|
1897 if (attribute_list) |
|
1898 return attribute_list->firstToken(); |
|
1899 |
|
1900 if (interface_token) |
|
1901 return interface_token; |
|
1902 else |
|
1903 return implementation_token; |
|
1904 } |
|
1905 |
|
1906 unsigned ObjCClassDeclarationAST::lastToken() const |
|
1907 { |
|
1908 if (end_token) return end_token + 1; |
|
1909 if (member_declaration_list) return member_declaration_list->lastToken(); |
|
1910 if (inst_vars_decl) return inst_vars_decl->lastToken(); |
|
1911 if (protocol_refs) |
|
1912 return protocol_refs->lastToken(); |
|
1913 if (superclass) |
|
1914 return superclass->lastToken(); |
|
1915 if (colon_token) return colon_token + 1; |
|
1916 if (rparen_token) |
|
1917 return rparen_token + 1; |
|
1918 if (category_name) |
|
1919 return category_name->lastToken(); |
|
1920 if (lparen_token) |
|
1921 return lparen_token + 1; |
|
1922 if (class_name) return class_name->lastToken(); |
|
1923 |
|
1924 if (interface_token) |
|
1925 return interface_token + 1; |
|
1926 else |
|
1927 return implementation_token + 1; |
|
1928 } |
|
1929 |
|
1930 unsigned ObjCProtocolDeclarationAST::firstToken() const |
|
1931 { |
|
1932 if (attribute_list) |
|
1933 return attribute_list->firstToken(); |
|
1934 return protocol_token; |
|
1935 } |
|
1936 |
|
1937 unsigned ObjCProtocolDeclarationAST::lastToken() const |
|
1938 { |
|
1939 if (end_token) |
|
1940 return end_token + 1; |
|
1941 |
|
1942 else if (member_declaration_list) |
|
1943 return member_declaration_list->lastToken(); |
|
1944 |
|
1945 else if (protocol_refs) |
|
1946 return protocol_refs->lastToken(); |
|
1947 |
|
1948 else if (name) |
|
1949 return name->lastToken(); |
|
1950 |
|
1951 else if (attribute_list) |
|
1952 return attribute_list->lastToken(); |
|
1953 |
|
1954 return protocol_token + 1; |
|
1955 } |
|
1956 |
|
1957 unsigned ObjCProtocolRefsAST::firstToken() const |
|
1958 { |
|
1959 return less_token; |
|
1960 } |
|
1961 |
|
1962 unsigned ObjCProtocolRefsAST::lastToken() const |
|
1963 { |
|
1964 if (greater_token) |
|
1965 return greater_token + 1; |
|
1966 |
|
1967 else if (identifier_list) |
|
1968 return identifier_list->lastToken(); |
|
1969 |
|
1970 return less_token + 1; |
|
1971 } |
|
1972 |
|
1973 unsigned ObjCMessageExpressionAST::firstToken() const |
|
1974 { |
|
1975 return lbracket_token; |
|
1976 } |
|
1977 |
|
1978 unsigned ObjCMessageExpressionAST::lastToken() const |
|
1979 { |
|
1980 if (rbracket_token) |
|
1981 return rbracket_token + 1; |
|
1982 |
|
1983 if (receiver_expression) |
|
1984 return receiver_expression->lastToken(); |
|
1985 |
|
1986 if (selector) |
|
1987 return selector->lastToken(); |
|
1988 |
|
1989 if (argument_list) |
|
1990 return argument_list->lastToken(); |
|
1991 |
|
1992 return lbracket_token + 1; |
|
1993 } |
|
1994 |
|
1995 unsigned ObjCMessageArgumentAST::firstToken() const |
|
1996 { |
|
1997 if (parameter_value_expression) |
|
1998 return parameter_value_expression->firstToken(); |
|
1999 |
|
2000 // ### assert? |
|
2001 return 0; |
|
2002 } |
|
2003 |
|
2004 unsigned ObjCMessageArgumentAST::lastToken() const |
|
2005 { |
|
2006 if (parameter_value_expression) |
|
2007 return parameter_value_expression->lastToken(); |
|
2008 |
|
2009 // ### assert? |
|
2010 return 0; |
|
2011 } |
|
2012 |
|
2013 unsigned ObjCProtocolExpressionAST::firstToken() const |
|
2014 { |
|
2015 return protocol_token; |
|
2016 } |
|
2017 |
|
2018 unsigned ObjCProtocolExpressionAST::lastToken() const |
|
2019 { |
|
2020 if (rparen_token) |
|
2021 return rparen_token + 1; |
|
2022 |
|
2023 if (identifier_token) |
|
2024 return identifier_token + 1; |
|
2025 |
|
2026 if (lparen_token) |
|
2027 return lparen_token + 1; |
|
2028 |
|
2029 return protocol_token + 1; |
|
2030 } |
|
2031 |
|
2032 unsigned ObjCTypeNameAST::firstToken() const |
|
2033 { |
|
2034 return lparen_token; |
|
2035 } |
|
2036 |
|
2037 unsigned ObjCTypeNameAST::lastToken() const |
|
2038 { |
|
2039 if (rparen_token) |
|
2040 return rparen_token + 1; |
|
2041 |
|
2042 if (type_id) |
|
2043 return type_id->lastToken(); |
|
2044 |
|
2045 if (type_qualifier_token) |
|
2046 return type_qualifier_token + 1; |
|
2047 |
|
2048 return lparen_token + 1; |
|
2049 } |
|
2050 |
|
2051 unsigned ObjCEncodeExpressionAST::firstToken() const |
|
2052 { |
|
2053 return encode_token; |
|
2054 } |
|
2055 |
|
2056 unsigned ObjCEncodeExpressionAST::lastToken() const |
|
2057 { |
|
2058 if (type_name) |
|
2059 return type_name->lastToken(); |
|
2060 |
|
2061 return encode_token + 1; |
|
2062 } |
|
2063 |
|
2064 unsigned ObjCSelectorWithoutArgumentsAST::firstToken() const |
|
2065 { |
|
2066 return name_token; |
|
2067 } |
|
2068 |
|
2069 unsigned ObjCSelectorWithoutArgumentsAST::lastToken() const |
|
2070 { |
|
2071 return name_token + 1; |
|
2072 } |
|
2073 |
|
2074 unsigned ObjCSelectorArgumentAST::firstToken() const |
|
2075 { |
|
2076 return name_token; |
|
2077 } |
|
2078 |
|
2079 unsigned ObjCSelectorArgumentAST::lastToken() const |
|
2080 { |
|
2081 if (colon_token) |
|
2082 return colon_token + 1; |
|
2083 else |
|
2084 return name_token + 1; |
|
2085 } |
|
2086 |
|
2087 unsigned ObjCSelectorWithArgumentsAST::firstToken() const |
|
2088 { |
|
2089 return selector_argument_list->firstToken(); |
|
2090 } |
|
2091 |
|
2092 unsigned ObjCSelectorWithArgumentsAST::lastToken() const |
|
2093 { |
|
2094 return selector_argument_list->lastToken(); |
|
2095 } |
|
2096 |
|
2097 unsigned ObjCSelectorExpressionAST::firstToken() const |
|
2098 { |
|
2099 return selector_token; |
|
2100 } |
|
2101 |
|
2102 unsigned ObjCSelectorExpressionAST::lastToken() const |
|
2103 { |
|
2104 if (rparen_token) |
|
2105 return rparen_token + 1; |
|
2106 if (selector) |
|
2107 return selector->lastToken(); |
|
2108 if (lparen_token) |
|
2109 return rparen_token + 1; |
|
2110 return selector_token + 1; |
|
2111 } |
|
2112 |
|
2113 unsigned ObjCInstanceVariablesDeclarationAST::firstToken() const |
|
2114 { |
|
2115 return lbrace_token; |
|
2116 } |
|
2117 |
|
2118 unsigned ObjCInstanceVariablesDeclarationAST::lastToken() const |
|
2119 { |
|
2120 if (rbrace_token) |
|
2121 return rbrace_token + 1; |
|
2122 |
|
2123 if (instance_variable_list) |
|
2124 return instance_variable_list->lastToken(); |
|
2125 |
|
2126 return lbrace_token + 1; |
|
2127 } |
|
2128 |
|
2129 unsigned ObjCVisibilityDeclarationAST::firstToken() const |
|
2130 { |
|
2131 return visibility_token; |
|
2132 } |
|
2133 |
|
2134 unsigned ObjCVisibilityDeclarationAST::lastToken() const |
|
2135 { |
|
2136 return visibility_token + 1; |
|
2137 } |
|
2138 |
|
2139 unsigned ObjCPropertyAttributeAST::firstToken() const |
|
2140 { |
|
2141 return attribute_identifier_token; |
|
2142 } |
|
2143 |
|
2144 unsigned ObjCPropertyAttributeAST::lastToken() const |
|
2145 { |
|
2146 if (method_selector) |
|
2147 return method_selector->lastToken(); |
|
2148 if (equals_token) |
|
2149 return equals_token + 1; |
|
2150 |
|
2151 return attribute_identifier_token + 1; |
|
2152 } |
|
2153 |
|
2154 unsigned ObjCPropertyDeclarationAST::firstToken() const |
|
2155 { |
|
2156 if (attribute_list) |
|
2157 return attribute_list->firstToken(); |
|
2158 |
|
2159 return property_token; |
|
2160 } |
|
2161 |
|
2162 unsigned ObjCPropertyDeclarationAST::lastToken() const |
|
2163 { |
|
2164 if (simple_declaration) |
|
2165 return simple_declaration->lastToken(); |
|
2166 else if (rparen_token) |
|
2167 return rparen_token + 1; |
|
2168 else if (property_attribute_list) |
|
2169 return property_attribute_list->lastToken(); |
|
2170 else if (lparen_token) |
|
2171 return lparen_token + 1; |
|
2172 |
|
2173 return property_token + 1; |
|
2174 } |
|
2175 |
|
2176 unsigned ObjCMessageArgumentDeclarationAST::firstToken() const |
|
2177 { |
|
2178 if (type_name) |
|
2179 return type_name->firstToken(); |
|
2180 else |
|
2181 return param_name_token; |
|
2182 } |
|
2183 |
|
2184 unsigned ObjCMessageArgumentDeclarationAST::lastToken() const |
|
2185 { |
|
2186 if (param_name_token) |
|
2187 return param_name_token + 1; |
|
2188 else if (type_name) |
|
2189 return type_name->lastToken(); |
|
2190 |
|
2191 // ### assert? |
|
2192 return 0; |
|
2193 } |
|
2194 |
|
2195 unsigned ObjCMethodPrototypeAST::firstToken() const |
|
2196 { |
|
2197 return method_type_token; |
|
2198 } |
|
2199 |
|
2200 unsigned ObjCMethodPrototypeAST::lastToken() const |
|
2201 { |
|
2202 if (attribute_list) |
|
2203 return attribute_list->lastToken(); |
|
2204 else if (dot_dot_dot_token) |
|
2205 return dot_dot_dot_token + 1; |
|
2206 else if (argument_list) |
|
2207 return argument_list->lastToken(); |
|
2208 else if (type_name) |
|
2209 return type_name->lastToken(); |
|
2210 return method_type_token + 1; |
|
2211 } |
|
2212 |
|
2213 unsigned ObjCMethodDeclarationAST::firstToken() const |
|
2214 { |
|
2215 return method_prototype->firstToken(); |
|
2216 } |
|
2217 |
|
2218 unsigned ObjCMethodDeclarationAST::lastToken() const |
|
2219 { |
|
2220 if (semicolon_token) |
|
2221 return semicolon_token + 1; |
|
2222 if (function_body) |
|
2223 return function_body->lastToken(); |
|
2224 return method_prototype->lastToken(); |
|
2225 } |
|
2226 |
|
2227 unsigned ObjCSynthesizedPropertyAST::firstToken() const |
|
2228 { |
|
2229 if (property_identifier_token) |
|
2230 return property_identifier_token; |
|
2231 else if (equals_token) |
|
2232 return equals_token; |
|
2233 else |
|
2234 return alias_identifier_token; |
|
2235 } |
|
2236 |
|
2237 unsigned ObjCSynthesizedPropertyAST::lastToken() const |
|
2238 { |
|
2239 if (alias_identifier_token) |
|
2240 return alias_identifier_token + 1; |
|
2241 else if (equals_token) |
|
2242 return equals_token + 1; |
|
2243 else |
|
2244 return property_identifier_token + 1; |
|
2245 } |
|
2246 |
|
2247 unsigned ObjCSynthesizedPropertiesDeclarationAST::firstToken() const |
|
2248 { |
|
2249 return synthesized_token; |
|
2250 } |
|
2251 |
|
2252 unsigned ObjCSynthesizedPropertiesDeclarationAST::lastToken() const |
|
2253 { |
|
2254 if (semicolon_token) |
|
2255 return semicolon_token + 1; |
|
2256 else if (property_identifier_list) |
|
2257 return property_identifier_list->lastToken(); |
|
2258 else |
|
2259 return synthesized_token + 1; |
|
2260 } |
|
2261 |
|
2262 unsigned ObjCDynamicPropertiesDeclarationAST::firstToken() const |
|
2263 { |
|
2264 return dynamic_token; |
|
2265 } |
|
2266 |
|
2267 unsigned ObjCDynamicPropertiesDeclarationAST::lastToken() const |
|
2268 { |
|
2269 if (semicolon_token) |
|
2270 return semicolon_token + 1; |
|
2271 else if (property_identifier_list) |
|
2272 return property_identifier_list->lastToken(); |
|
2273 else |
|
2274 return dynamic_token + 1; |
|
2275 } |
|
2276 |
|
2277 unsigned ObjCFastEnumerationAST::firstToken() const |
|
2278 { |
|
2279 return for_token; |
|
2280 } |
|
2281 |
|
2282 unsigned ObjCFastEnumerationAST::lastToken() const |
|
2283 { |
|
2284 if (statement) |
|
2285 return statement->lastToken(); |
|
2286 else if (rparen_token) |
|
2287 return rparen_token + 1; |
|
2288 else if (fast_enumeratable_expression) |
|
2289 return fast_enumeratable_expression->lastToken(); |
|
2290 else if (in_token) |
|
2291 return in_token + 1; |
|
2292 else if (initializer) |
|
2293 return initializer->lastToken(); |
|
2294 else if (declarator) |
|
2295 return declarator->lastToken(); |
|
2296 else if (type_specifier_list) |
|
2297 return type_specifier_list->lastToken(); |
|
2298 else if (lparen_token) |
|
2299 return lparen_token + 1; |
|
2300 else |
|
2301 return for_token + 1; |
|
2302 } |
|
2303 |
|
2304 unsigned ObjCSynchronizedStatementAST::firstToken() const |
|
2305 { |
|
2306 return synchronized_token; |
|
2307 } |
|
2308 |
|
2309 unsigned ObjCSynchronizedStatementAST::lastToken() const |
|
2310 { |
|
2311 if (statement) return statement->lastToken(); |
|
2312 if (rparen_token) return rparen_token + 1; |
|
2313 if (synchronized_object) return synchronized_object->lastToken(); |
|
2314 if (lparen_token) return lparen_token + 1; |
|
2315 return synchronized_token + 1; |
|
2316 } |
|
2317 |
|
2318 |