diff options
author | Chris Lattner <sabre@nondot.org> | 2008-10-12 04:05:48 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-10-12 04:05:48 +0000 |
commit | d88dc48e33d71732708960170e57a3d1bdc8f847 (patch) | |
tree | f9b755c065acd7a8cac2b629d79d55f7e354f45a /lib/AST/TypeSerialization.cpp | |
parent | aea3ad073793f7764aa914bd9e551f858a0b5739 (diff) |
Add a new mode to the lexer which enables it to return all characters,
even whitespace, as tokens from the file. This is enabled with
L->SetKeepWhitespaceMode(true) on a raw lexer. In this mode, you too
can use clang as a really complex version of 'cat' with code like this:
Lexer RawLex(SourceLocation::getFileLoc(SM.getMainFileID(), 0),
PP.getLangOptions(), File.first, File.second);
RawLex.SetKeepWhitespaceMode(true);
Token RawTok;
RawLex.LexFromRawLexer(RawTok);
while (RawTok.isNot(tok::eof)) {
std::cout << PP.getSpelling(RawTok);
RawLex.LexFromRawLexer(RawTok);
}
This will emit exactly the input file, with no canonicalization or other
translation. Realistic clients actually do something with the tokens of
course :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57401 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/TypeSerialization.cpp')
0 files changed, 0 insertions, 0 deletions