mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-29 22:30:33 +00:00
Add Peek
Add a peek function to let the Lexer look at a character arbitrarily far ahead in the stream without consuming anything. We need this to disambiguate numbers and operands of a paste operation. For example: def foo#8i Without lookahead the lexer will treat '8' as a number rather than as part of a string to be pasted to form an identifier. llvm-svn: 142512
This commit is contained in:
parent
190378766b
commit
5b898126d2
@ -80,6 +80,10 @@ int TGLexer::getNextChar() {
|
||||
}
|
||||
}
|
||||
|
||||
int TGLexer::peekNextChar(int Index) {
|
||||
return *(CurPtr + Index);
|
||||
}
|
||||
|
||||
tgtok::TokKind TGLexer::LexToken() {
|
||||
TokStart = CurPtr;
|
||||
// This always consumes at least one character.
|
||||
|
@ -109,6 +109,7 @@ private:
|
||||
tgtok::TokKind ReturnError(const char *Loc, const Twine &Msg);
|
||||
|
||||
int getNextChar();
|
||||
int peekNextChar(int Index);
|
||||
void SkipBCPLComment();
|
||||
bool SkipCComment();
|
||||
tgtok::TokKind LexIdentifier();
|
||||
|
Loading…
Reference in New Issue
Block a user