diff options
author | Chris Lattner <sabre@nondot.org> | 2009-06-21 07:19:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-06-21 07:19:10 +0000 |
commit | a59e8779964992457ada1af6a5f48068523cfd42 (patch) | |
tree | 936d4fbc4b784a3eb0fdbf0b65f91f3d1a66cdbb /tools/llvm-mc/llvm-mc.cpp | |
parent | d926e048c1409d3105e1ccd166e9369ab454a81d (diff) |
some baby steps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73848 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc/llvm-mc.cpp')
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 74e419ccfc..83642988e3 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -19,6 +19,7 @@ #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include "llvm/System/Signals.h" +#include "AsmLexer.h" using namespace llvm; static cl::opt<std::string> @@ -63,10 +64,29 @@ static int AssembleInput(const char *ProgName) { // Record the location of the include directories so that the lexer can find // it later. SrcMgr.setIncludeDirs(IncludeDirs); + + - //TGParser Parser(SrcMgr); - //return Parser.ParseFile(); + AsmLexer Lexer(SrcMgr); + asmtok::TokKind Tok = Lexer.Lex(); + while (Tok != asmtok::Eof) { + switch (Tok) { + default: outs() << "<<unknown token>>\n"; break; + case asmtok::Error: outs() << "<<error>>\n"; break; + case asmtok::Identifier: + outs() << "identifier: " << Lexer.getCurStrVal() << '\n'; + break; + case asmtok::IntVal: + outs() << "int: " << Lexer.getCurIntVal() << '\n'; + break; + case asmtok::Colon: outs() << "Colon\n"; break; + case asmtok::Plus: outs() << "Plus\n"; break; + case asmtok::Minus: outs() << "Minus\n"; break; + } + + Tok = Lexer.Lex(); + } return 1; } |