From 537dca94b35e651248b57db03c9fece4c40bd5f9 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 9 Feb 2014 23:29:24 +0000 Subject: MCParser: add a single token lookahead Some of the more complex directive and macro handling for GAS compatibility requires lookahead. Add a single token lookahead in the MCAsmLexer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201058 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/AsmLexer.h | 2 ++ include/llvm/MC/MCParser/MCAsmLexer.h | 3 +++ 2 files changed, 5 insertions(+) (limited to 'include/llvm') diff --git a/include/llvm/MC/MCParser/AsmLexer.h b/include/llvm/MC/MCParser/AsmLexer.h index 1b3ab57751..89677a91cd 100644 --- a/include/llvm/MC/MCParser/AsmLexer.h +++ b/include/llvm/MC/MCParser/AsmLexer.h @@ -47,6 +47,8 @@ public: virtual StringRef LexUntilEndOfStatement(); StringRef LexUntilEndOfLine(); + virtual const AsmToken peekTok(bool ShouldSkipSpace = true); + bool isAtStartOfComment(char Char); bool isAtStatementSeparator(const char *Ptr); diff --git a/include/llvm/MC/MCParser/MCAsmLexer.h b/include/llvm/MC/MCParser/MCAsmLexer.h index ceba3f05e1..e3d4181e08 100644 --- a/include/llvm/MC/MCParser/MCAsmLexer.h +++ b/include/llvm/MC/MCParser/MCAsmLexer.h @@ -160,6 +160,9 @@ public: return CurTok; } + /// peekTok - Look ahead at the next token to be lexed. + virtual const AsmToken peekTok(bool ShouldSkipSpace = true) = 0; + /// getErrLoc - Get the current error location const SMLoc &getErrLoc() { return ErrLoc; -- cgit v1.2.3