From 9ba42085dac878f3ae6fc15345c43796d5122d00 Mon Sep 17 00:00:00 2001 From: David Greene Date: Wed, 19 Oct 2011 13:03:35 +0000 Subject: 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 --- llvm/lib/TableGen/TGLexer.h | 1 + 1 file changed, 1 insertion(+) (limited to 'llvm/lib/TableGen/TGLexer.h') diff --git a/llvm/lib/TableGen/TGLexer.h b/llvm/lib/TableGen/TGLexer.h index 84d328b12d9..24f8ea4ce5a 100644 --- a/llvm/lib/TableGen/TGLexer.h +++ b/llvm/lib/TableGen/TGLexer.h @@ -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(); -- cgit v1.2.3