mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
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
This commit is contained in:
@@ -439,6 +439,28 @@ StringRef AsmLexer::LexUntilEndOfLine() {
|
||||
return StringRef(TokStart, CurPtr-TokStart);
|
||||
}
|
||||
|
||||
const AsmToken AsmLexer::peekTok(bool ShouldSkipSpace) {
|
||||
const char *SavedTokStart = TokStart;
|
||||
const char *SavedCurPtr = CurPtr;
|
||||
bool SavedAtStartOfLine = isAtStartOfLine;
|
||||
bool SavedSkipSpace = SkipSpace;
|
||||
|
||||
std::string SavedErr = getErr();
|
||||
SMLoc SavedErrLoc = getErrLoc();
|
||||
|
||||
SkipSpace = ShouldSkipSpace;
|
||||
AsmToken Token = LexToken();
|
||||
|
||||
SetError(SavedErrLoc, SavedErr);
|
||||
|
||||
SkipSpace = SavedSkipSpace;
|
||||
isAtStartOfLine = SavedAtStartOfLine;
|
||||
CurPtr = SavedCurPtr;
|
||||
TokStart = SavedTokStart;
|
||||
|
||||
return Token;
|
||||
}
|
||||
|
||||
bool AsmLexer::isAtStartOfComment(char Char) {
|
||||
// FIXME: This won't work for multi-character comment indicators like "//".
|
||||
return Char == *MAI.getCommentString();
|
||||
|
Reference in New Issue
Block a user