blob: baa038ea98da66dd19fb00690dc0574001bb535e [file] [log] [blame]
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +00001//===--- ParseCXXInlineMethods.cpp - C++ class inline methods parsing------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements parsing for C++ class inline methods.
11//
12//===----------------------------------------------------------------------===//
13
Chris Lattner60f36222009-01-29 05:15:15 +000014#include "clang/Parse/ParseDiagnostic.h"
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +000015#include "clang/Parse/Parser.h"
John McCall8b0666c2010-08-20 18:27:03 +000016#include "clang/Sema/DeclSpec.h"
17#include "clang/Sema/Scope.h"
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +000018using namespace clang;
19
Sebastian Redla7b98a72009-04-26 20:35:05 +000020/// ParseCXXInlineMethodDef - We parsed and verified that the specified
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +000021/// Declarator is a well formed C++ inline method definition. Now lex its body
22/// and store its tokens for parsing after the C++ class is complete.
John McCallc1465822011-02-14 07:13:47 +000023Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, ParsingDeclarator &D,
Nico Weber24b2a822011-01-28 06:07:34 +000024 const ParsedTemplateInfo &TemplateInfo,
25 const VirtSpecifiers& VS) {
Abramo Bagnara924a8f32010-12-10 16:29:40 +000026 assert(D.isFunctionDeclarator() && "This isn't a function declarator!");
Sebastian Redla7b98a72009-04-26 20:35:05 +000027 assert((Tok.is(tok::l_brace) || Tok.is(tok::colon) || Tok.is(tok::kw_try)) &&
28 "Current token not a '{', ':' or 'try'!");
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +000029
John McCallfaf5fb42010-08-26 23:41:50 +000030 MultiTemplateParamsArg TemplateParams(Actions,
Alexis Hunt1deb9722010-04-14 23:07:37 +000031 TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->data() : 0,
32 TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->size() : 0);
33
John McCall48871652010-08-21 09:40:31 +000034 Decl *FnD;
John McCall07e91c02009-08-06 02:15:43 +000035 if (D.getDeclSpec().isFriendSpecified())
Douglas Gregor3447e762009-08-20 22:52:58 +000036 // FIXME: Friend templates
Douglas Gregor0be31a22010-07-02 17:43:08 +000037 FnD = Actions.ActOnFriendFunctionDecl(getCurScope(), D, true,
Alexis Hunt1deb9722010-04-14 23:07:37 +000038 move(TemplateParams));
Nico Weber24b2a822011-01-28 06:07:34 +000039 else { // FIXME: pass template information through
40 if (VS.isOverrideSpecified())
41 Diag(VS.getOverrideLoc(), diag::ext_override_inline) << "override";
42 if (VS.isFinalSpecified())
43 Diag(VS.getFinalLoc(), diag::ext_override_inline) << "final";
44 if (VS.isNewSpecified())
45 Diag(VS.getNewLoc(), diag::ext_override_inline) << "new";
46
Douglas Gregor0be31a22010-07-02 17:43:08 +000047 FnD = Actions.ActOnCXXMemberDeclarator(getCurScope(), AS, D,
Anders Carlssondb36b802011-01-20 03:57:25 +000048 move(TemplateParams), 0,
Nico Weber24b2a822011-01-28 06:07:34 +000049 VS, 0, /*IsDefinition*/true);
50 }
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +000051
Eli Friedman3af2a772009-07-22 21:45:50 +000052 HandleMemberFunctionDefaultArgs(D, FnD);
53
John McCallc1465822011-02-14 07:13:47 +000054 D.complete(FnD);
55
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +000056 // Consume the tokens and store them for later parsing.
57
Douglas Gregorefc46952010-10-12 16:25:54 +000058 LexedMethod* LM = new LexedMethod(this, FnD);
59 getCurrentClass().LateParsedDeclarations.push_back(LM);
60 LM->TemplateScope = getCurScope()->isTemplateParamScope();
61 CachedTokens &Toks = LM->Toks;
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +000062
Sebastian Redla7b98a72009-04-26 20:35:05 +000063 tok::TokenKind kind = Tok.getKind();
64 // We may have a constructor initializer or function-try-block here.
65 if (kind == tok::colon || kind == tok::kw_try) {
Douglas Gregore8381c02008-11-05 04:29:56 +000066 // Consume everything up to (and including) the left brace.
Argyrios Kyrtzidis8d7bdba2010-04-23 21:20:12 +000067 if (!ConsumeAndStoreUntil(tok::l_brace, Toks)) {
Douglas Gregor49de5342008-11-10 16:59:40 +000068 // We didn't find the left-brace we expected after the
Mike Stump11289f42009-09-09 15:08:12 +000069 // constructor initializer.
Douglas Gregor49de5342008-11-10 16:59:40 +000070 if (Tok.is(tok::semi)) {
71 // We found a semicolon; complain, consume the semicolon, and
72 // don't try to parse this method later.
73 Diag(Tok.getLocation(), diag::err_expected_lbrace);
74 ConsumeAnyToken();
Douglas Gregorefc46952010-10-12 16:25:54 +000075 delete getCurrentClass().LateParsedDeclarations.back();
76 getCurrentClass().LateParsedDeclarations.pop_back();
Douglas Gregor49de5342008-11-10 16:59:40 +000077 return FnD;
78 }
79 }
80
Douglas Gregore8381c02008-11-05 04:29:56 +000081 } else {
Mike Stump11289f42009-09-09 15:08:12 +000082 // Begin by storing the '{' token.
Douglas Gregore8381c02008-11-05 04:29:56 +000083 Toks.push_back(Tok);
84 ConsumeBrace();
85 }
86 // Consume everything up to (and including) the matching right brace.
Argyrios Kyrtzidis8d7bdba2010-04-23 21:20:12 +000087 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +000088
Sebastian Redla7b98a72009-04-26 20:35:05 +000089 // If we're in a function-try-block, we need to store all the catch blocks.
90 if (kind == tok::kw_try) {
91 while (Tok.is(tok::kw_catch)) {
Argyrios Kyrtzidis8d7bdba2010-04-23 21:20:12 +000092 ConsumeAndStoreUntil(tok::l_brace, Toks, /*StopAtSemi=*/false);
93 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
Sebastian Redla7b98a72009-04-26 20:35:05 +000094 }
95 }
96
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +000097 return FnD;
98}
99
Douglas Gregorefc46952010-10-12 16:25:54 +0000100Parser::LateParsedDeclaration::~LateParsedDeclaration() {}
101void Parser::LateParsedDeclaration::ParseLexedMethodDeclarations() {}
102void Parser::LateParsedDeclaration::ParseLexedMethodDefs() {}
103
104Parser::LateParsedClass::LateParsedClass(Parser *P, ParsingClass *C)
105 : Self(P), Class(C) {}
106
107Parser::LateParsedClass::~LateParsedClass() {
108 Self->DeallocateParsedClasses(Class);
109}
110
111void Parser::LateParsedClass::ParseLexedMethodDeclarations() {
112 Self->ParseLexedMethodDeclarations(*Class);
113}
114
115void Parser::LateParsedClass::ParseLexedMethodDefs() {
116 Self->ParseLexedMethodDefs(*Class);
117}
118
119void Parser::LateParsedMethodDeclaration::ParseLexedMethodDeclarations() {
120 Self->ParseLexedMethodDeclaration(*this);
121}
122
123void Parser::LexedMethod::ParseLexedMethodDefs() {
124 Self->ParseLexedMethodDef(*this);
125}
126
Douglas Gregor4d87df52008-12-16 21:30:33 +0000127/// ParseLexedMethodDeclarations - We finished parsing the member
128/// specification of a top (non-nested) C++ class. Now go over the
129/// stack of method declarations with some parts for which parsing was
130/// delayed (such as default arguments) and parse them.
Douglas Gregore44a2ad2009-05-27 23:11:45 +0000131void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
132 bool HasTemplateScope = !Class.TopLevelClass && Class.TemplateScope;
Douglas Gregorefc46952010-10-12 16:25:54 +0000133 ParseScope ClassTemplateScope(this, Scope::TemplateParamScope, HasTemplateScope);
Douglas Gregore44a2ad2009-05-27 23:11:45 +0000134 if (HasTemplateScope)
Douglas Gregor0be31a22010-07-02 17:43:08 +0000135 Actions.ActOnReenterTemplateScope(getCurScope(), Class.TagOrTemplate);
Douglas Gregore44a2ad2009-05-27 23:11:45 +0000136
John McCall6df5fef2009-12-19 10:49:29 +0000137 // The current scope is still active if we're the top-level class.
138 // Otherwise we'll need to push and enter a new scope.
Douglas Gregore44a2ad2009-05-27 23:11:45 +0000139 bool HasClassScope = !Class.TopLevelClass;
Alexis Hunt1deb9722010-04-14 23:07:37 +0000140 ParseScope ClassScope(this, Scope::ClassScope|Scope::DeclScope,
141 HasClassScope);
John McCall6df5fef2009-12-19 10:49:29 +0000142 if (HasClassScope)
Douglas Gregor0be31a22010-07-02 17:43:08 +0000143 Actions.ActOnStartDelayedMemberDeclarations(getCurScope(), Class.TagOrTemplate);
Douglas Gregore44a2ad2009-05-27 23:11:45 +0000144
Douglas Gregorefc46952010-10-12 16:25:54 +0000145 for (size_t i = 0; i < Class.LateParsedDeclarations.size(); ++i) {
146 Class.LateParsedDeclarations[i]->ParseLexedMethodDeclarations();
Douglas Gregor4d87df52008-12-16 21:30:33 +0000147 }
Douglas Gregore44a2ad2009-05-27 23:11:45 +0000148
John McCall6df5fef2009-12-19 10:49:29 +0000149 if (HasClassScope)
Douglas Gregor0be31a22010-07-02 17:43:08 +0000150 Actions.ActOnFinishDelayedMemberDeclarations(getCurScope(), Class.TagOrTemplate);
Douglas Gregor4d87df52008-12-16 21:30:33 +0000151}
152
Douglas Gregorefc46952010-10-12 16:25:54 +0000153void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
154 // If this is a member template, introduce the template parameter scope.
155 ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope);
156 if (LM.TemplateScope)
157 Actions.ActOnReenterTemplateScope(getCurScope(), LM.Method);
158
159 // Start the delayed C++ method declaration
160 Actions.ActOnStartDelayedCXXMethodDeclaration(getCurScope(), LM.Method);
161
162 // Introduce the parameters into scope and parse their default
163 // arguments.
164 ParseScope PrototypeScope(this,
165 Scope::FunctionPrototypeScope|Scope::DeclScope);
166 for (unsigned I = 0, N = LM.DefaultArgs.size(); I != N; ++I) {
167 // Introduce the parameter into scope.
168 Actions.ActOnDelayedCXXMethodParameter(getCurScope(), LM.DefaultArgs[I].Param);
169
170 if (CachedTokens *Toks = LM.DefaultArgs[I].Toks) {
171 // Save the current token position.
172 SourceLocation origLoc = Tok.getLocation();
173
174 // Parse the default argument from its saved token stream.
175 Toks->push_back(Tok); // So that the current token doesn't get lost
176 PP.EnterTokenStream(&Toks->front(), Toks->size(), true, false);
177
178 // Consume the previously-pushed token.
179 ConsumeAnyToken();
180
181 // Consume the '='.
182 assert(Tok.is(tok::equal) && "Default argument not starting with '='");
183 SourceLocation EqualLoc = ConsumeToken();
184
185 // The argument isn't actually potentially evaluated unless it is
186 // used.
187 EnterExpressionEvaluationContext Eval(Actions,
188 Sema::PotentiallyEvaluatedIfUsed);
189
190 ExprResult DefArgResult(ParseAssignmentExpression());
191 if (DefArgResult.isInvalid())
192 Actions.ActOnParamDefaultArgumentError(LM.DefaultArgs[I].Param);
193 else {
194 if (Tok.is(tok::cxx_defaultarg_end))
195 ConsumeToken();
196 else
197 Diag(Tok.getLocation(), diag::err_default_arg_unparsed);
198 Actions.ActOnParamDefaultArgument(LM.DefaultArgs[I].Param, EqualLoc,
199 DefArgResult.take());
200 }
201
202 assert(!PP.getSourceManager().isBeforeInTranslationUnit(origLoc,
203 Tok.getLocation()) &&
204 "ParseAssignmentExpression went over the default arg tokens!");
205 // There could be leftover tokens (e.g. because of an error).
206 // Skip through until we reach the original token position.
207 while (Tok.getLocation() != origLoc && Tok.isNot(tok::eof))
208 ConsumeAnyToken();
209
210 delete Toks;
211 LM.DefaultArgs[I].Toks = 0;
212 }
213 }
214 PrototypeScope.Exit();
215
216 // Finish the delayed C++ method declaration.
217 Actions.ActOnFinishDelayedCXXMethodDeclaration(getCurScope(), LM.Method);
218}
219
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000220/// ParseLexedMethodDefs - We finished parsing the member specification of a top
221/// (non-nested) C++ class. Now go over the stack of lexed methods that were
222/// collected during its parsing and parse them all.
Douglas Gregore44a2ad2009-05-27 23:11:45 +0000223void Parser::ParseLexedMethodDefs(ParsingClass &Class) {
224 bool HasTemplateScope = !Class.TopLevelClass && Class.TemplateScope;
Douglas Gregorefc46952010-10-12 16:25:54 +0000225 ParseScope ClassTemplateScope(this, Scope::TemplateParamScope, HasTemplateScope);
Douglas Gregore44a2ad2009-05-27 23:11:45 +0000226 if (HasTemplateScope)
Douglas Gregor0be31a22010-07-02 17:43:08 +0000227 Actions.ActOnReenterTemplateScope(getCurScope(), Class.TagOrTemplate);
Douglas Gregore44a2ad2009-05-27 23:11:45 +0000228
229 bool HasClassScope = !Class.TopLevelClass;
230 ParseScope ClassScope(this, Scope::ClassScope|Scope::DeclScope,
231 HasClassScope);
232
Douglas Gregorefc46952010-10-12 16:25:54 +0000233 for (size_t i = 0; i < Class.LateParsedDeclarations.size(); ++i) {
234 Class.LateParsedDeclarations[i]->ParseLexedMethodDefs();
235 }
236}
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000237
Douglas Gregorefc46952010-10-12 16:25:54 +0000238void Parser::ParseLexedMethodDef(LexedMethod &LM) {
239 // If this is a member template, introduce the template parameter scope.
240 ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope);
241 if (LM.TemplateScope)
242 Actions.ActOnReenterTemplateScope(getCurScope(), LM.D);
Mike Stump11289f42009-09-09 15:08:12 +0000243
Douglas Gregorefc46952010-10-12 16:25:54 +0000244 // Save the current token position.
245 SourceLocation origLoc = Tok.getLocation();
Argyrios Kyrtzidis02041972010-03-31 00:38:09 +0000246
Douglas Gregorefc46952010-10-12 16:25:54 +0000247 assert(!LM.Toks.empty() && "Empty body!");
248 // Append the current token at the end of the new token stream so that it
249 // doesn't get lost.
250 LM.Toks.push_back(Tok);
251 PP.EnterTokenStream(LM.Toks.data(), LM.Toks.size(), true, false);
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000252
Douglas Gregorefc46952010-10-12 16:25:54 +0000253 // Consume the previously pushed token.
254 ConsumeAnyToken();
255 assert((Tok.is(tok::l_brace) || Tok.is(tok::colon) || Tok.is(tok::kw_try))
256 && "Inline method not starting with '{', ':' or 'try'");
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000257
Douglas Gregorefc46952010-10-12 16:25:54 +0000258 // Parse the method body. Function body parsing code is similar enough
259 // to be re-used for method bodies as well.
260 ParseScope FnScope(this, Scope::FnScope|Scope::DeclScope);
261 Actions.ActOnStartOfFunctionDef(getCurScope(), LM.D);
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000262
Douglas Gregorefc46952010-10-12 16:25:54 +0000263 if (Tok.is(tok::kw_try)) {
Douglas Gregora0ff0c32011-03-16 17:05:57 +0000264 ParseFunctionTryBlock(LM.D, FnScope);
Douglas Gregorefc46952010-10-12 16:25:54 +0000265 assert(!PP.getSourceManager().isBeforeInTranslationUnit(origLoc,
266 Tok.getLocation()) &&
267 "ParseFunctionTryBlock went over the cached tokens!");
268 // There could be leftover tokens (e.g. because of an error).
269 // Skip through until we reach the original token position.
270 while (Tok.getLocation() != origLoc && Tok.isNot(tok::eof))
271 ConsumeAnyToken();
272 return;
273 }
274 if (Tok.is(tok::colon)) {
275 ParseConstructorInitializer(LM.D);
276
277 // Error recovery.
278 if (!Tok.is(tok::l_brace)) {
Douglas Gregora0ff0c32011-03-16 17:05:57 +0000279 FnScope.Exit();
Douglas Gregorefc46952010-10-12 16:25:54 +0000280 Actions.ActOnFinishFunctionBody(LM.D, 0);
281 return;
282 }
283 } else
284 Actions.ActOnDefaultCtorInitializers(LM.D);
285
Douglas Gregora0ff0c32011-03-16 17:05:57 +0000286 ParseFunctionStatementBody(LM.D, FnScope);
Douglas Gregorefc46952010-10-12 16:25:54 +0000287
288 if (Tok.getLocation() != origLoc) {
289 // Due to parsing error, we either went over the cached tokens or
290 // there are still cached tokens left. If it's the latter case skip the
291 // leftover tokens.
292 // Since this is an uncommon situation that should be avoided, use the
293 // expensive isBeforeInTranslationUnit call.
294 if (PP.getSourceManager().isBeforeInTranslationUnit(Tok.getLocation(),
295 origLoc))
Argyrios Kyrtzidise1224c82010-06-19 19:58:34 +0000296 while (Tok.getLocation() != origLoc && Tok.isNot(tok::eof))
Argyrios Kyrtzidise9b76af2010-06-17 10:52:22 +0000297 ConsumeAnyToken();
John McCallbb7b6582010-04-10 07:37:23 +0000298
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000299 }
300}
301
302/// ConsumeAndStoreUntil - Consume and store the token at the passed token
Douglas Gregor4d87df52008-12-16 21:30:33 +0000303/// container until the token 'T' is reached (which gets
Mike Stump11289f42009-09-09 15:08:12 +0000304/// consumed/stored too, if ConsumeFinalToken).
Argyrios Kyrtzidis8d7bdba2010-04-23 21:20:12 +0000305/// If StopAtSemi is true, then we will stop early at a ';' character.
Douglas Gregor4d87df52008-12-16 21:30:33 +0000306/// Returns true if token 'T1' or 'T2' was found.
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000307/// NOTE: This is a specialized version of Parser::SkipUntil.
Douglas Gregor4d87df52008-12-16 21:30:33 +0000308bool Parser::ConsumeAndStoreUntil(tok::TokenKind T1, tok::TokenKind T2,
309 CachedTokens &Toks,
Argyrios Kyrtzidis8d7bdba2010-04-23 21:20:12 +0000310 bool StopAtSemi, bool ConsumeFinalToken) {
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000311 // We always want this function to consume at least one token if the first
312 // token isn't T and if not at EOF.
313 bool isFirstTokenConsumed = true;
314 while (1) {
315 // If we found one of the tokens, stop and return true.
Douglas Gregor4d87df52008-12-16 21:30:33 +0000316 if (Tok.is(T1) || Tok.is(T2)) {
317 if (ConsumeFinalToken) {
318 Toks.push_back(Tok);
319 ConsumeAnyToken();
320 }
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000321 return true;
322 }
323
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000324 switch (Tok.getKind()) {
325 case tok::eof:
326 // Ran out of tokens.
327 return false;
328
329 case tok::l_paren:
330 // Recursively consume properly-nested parens.
331 Toks.push_back(Tok);
332 ConsumeParen();
Argyrios Kyrtzidis8d7bdba2010-04-23 21:20:12 +0000333 ConsumeAndStoreUntil(tok::r_paren, Toks, /*StopAtSemi=*/false);
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000334 break;
335 case tok::l_square:
336 // Recursively consume properly-nested square brackets.
337 Toks.push_back(Tok);
338 ConsumeBracket();
Argyrios Kyrtzidis8d7bdba2010-04-23 21:20:12 +0000339 ConsumeAndStoreUntil(tok::r_square, Toks, /*StopAtSemi=*/false);
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000340 break;
341 case tok::l_brace:
342 // Recursively consume properly-nested braces.
343 Toks.push_back(Tok);
344 ConsumeBrace();
Argyrios Kyrtzidis8d7bdba2010-04-23 21:20:12 +0000345 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000346 break;
347
348 // Okay, we found a ']' or '}' or ')', which we think should be balanced.
349 // Since the user wasn't looking for this token (if they were, it would
350 // already be handled), this isn't balanced. If there is a LHS token at a
351 // higher level, we will assume that this matches the unbalanced token
352 // and return it. Otherwise, this is a spurious RHS token, which we skip.
353 case tok::r_paren:
354 if (ParenCount && !isFirstTokenConsumed)
355 return false; // Matches something.
356 Toks.push_back(Tok);
357 ConsumeParen();
358 break;
359 case tok::r_square:
360 if (BracketCount && !isFirstTokenConsumed)
361 return false; // Matches something.
362 Toks.push_back(Tok);
363 ConsumeBracket();
364 break;
365 case tok::r_brace:
366 if (BraceCount && !isFirstTokenConsumed)
367 return false; // Matches something.
368 Toks.push_back(Tok);
369 ConsumeBrace();
370 break;
371
372 case tok::string_literal:
373 case tok::wide_string_literal:
374 Toks.push_back(Tok);
375 ConsumeStringToken();
376 break;
Argyrios Kyrtzidis8d7bdba2010-04-23 21:20:12 +0000377 case tok::semi:
378 if (StopAtSemi)
379 return false;
380 // FALL THROUGH.
Argyrios Kyrtzidis7bbb20e2008-06-24 22:12:16 +0000381 default:
382 // consume this token.
383 Toks.push_back(Tok);
384 ConsumeToken();
385 break;
386 }
387 isFirstTokenConsumed = false;
388 }
389}