some baby steps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73848 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 74e419c..8364298 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 @@
// 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;
}