@@ -321,10 +321,10 @@ class Parser {
321
321
void restoreParserPosition (ParserPosition PP) {
322
322
L->restoreState (PP.LS );
323
323
324
- // We might be at tok::eof now, so ensure that consumeToken ()
324
+ // We might be at tok::eof now, so ensure that consumeLoc ()
325
325
// does not assert about lexing past eof.
326
326
Tok = syntax::Token::unknown ();
327
- consumeToken ();
327
+ consumeLoc ();
328
328
329
329
PreviousLoc = PP.PreviousLoc ;
330
330
}
@@ -334,10 +334,10 @@ class Parser {
334
334
335
335
L->backtrackToState (PP.LS );
336
336
337
- // We might be at tok::eof now, so ensure that consumeToken ()
337
+ // We might be at tok::eof now, so ensure that consumeLoc ()
338
338
// does not assert about lexing past eof.
339
339
Tok = syntax::Token::unknown ();
340
- consumeToken ();
340
+ consumeLoc ();
341
341
342
342
PreviousLoc = PP.PreviousLoc ;
343
343
}
@@ -386,21 +386,22 @@ class Parser {
386
386
// ===--------------------------------------------------------------------===//
387
387
// Utilities
388
388
389
- // / \brief Return the next token that will be installed by \c consumeToken .
389
+ // / \brief Return the next token that will be installed by \c consumeLoc .
390
390
const syntax::Token &peekToken ();
391
391
392
- SourceLoc consumeToken ();
393
- SourceLoc consumeToken (tok K) {
392
+ syntax::Token consumeToken ();
393
+ SourceLoc consumeLoc ();
394
+ SourceLoc consumeLoc (tok K) {
394
395
assert (Tok.is (K) && " Consuming wrong token kind" );
395
- return consumeToken ();
396
+ return consumeLoc ();
396
397
}
397
398
398
399
SourceLoc consumeIdentifier (Identifier *Result = nullptr ) {
399
400
assert (Tok.isAny (tok::identifier, tok::kw_self,
400
401
tok::kw_Self, tok::kw_throws));
401
402
if (Result)
402
403
*Result = Context.getIdentifier (Tok.getText ().str ());
403
- return consumeToken ();
404
+ return consumeLoc ();
404
405
}
405
406
406
407
// / \brief Retrieve the location just past the end of the previous
@@ -411,15 +412,15 @@ class Parser {
411
412
// / return true. Otherwise, return false without consuming it.
412
413
bool consumeIf (tok K) {
413
414
if (Tok.isNot (K)) return false ;
414
- consumeToken (K);
415
+ consumeLoc (K);
415
416
return true ;
416
417
}
417
418
418
419
// / \brief If the current token is the specified kind, consume it and
419
420
// / return true. Otherwise, return false without consuming it.
420
421
bool consumeIf (tok K, SourceLoc &consumedLoc) {
421
422
if (Tok.isNot (K)) return false ;
422
- consumedLoc = consumeToken (K);
423
+ consumedLoc = consumeLoc (K);
423
424
return true ;
424
425
}
425
426
0 commit comments