summaryrefslogtreecommitdiff
path: root/lib/AsmParser/LLLexer.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-18 08:46:26 +0000
committerChris Lattner <sabre@nondot.org>2007-11-18 08:46:26 +0000
commit8e3a8e0452695643d04c21e15c94b802aef81bae (patch)
tree9884e80bdb01fa3acb2b692d471f42b06c510032 /lib/AsmParser/LLLexer.h
parentc1819188b6c971b91c680a9a3c077b84a110e5fd (diff)
downloadllvm-8e3a8e0452695643d04c21e15c94b802aef81bae.tar.gz
llvm-8e3a8e0452695643d04c21e15c94b802aef81bae.tar.bz2
llvm-8e3a8e0452695643d04c21e15c94b802aef81bae.tar.xz
Replace the original flex lexer with a hand writen one. This
drops a dependency on flex and lets us make future progress more easily. Yay for 2 fewer .cvs files to make silly conflicts with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/LLLexer.h')
-rw-r--r--lib/AsmParser/LLLexer.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/AsmParser/LLLexer.h b/lib/AsmParser/LLLexer.h
new file mode 100644
index 0000000000..eaf32203bb
--- /dev/null
+++ b/lib/AsmParser/LLLexer.h
@@ -0,0 +1,57 @@
+//===- LLLexer.h - Lexer for LLVM Assembly Files ----------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by Chris Lattner and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This class represents the Lexer for .ll files.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LIB_ASMPARSER_LLLEXER_H
+#define LIB_ASMPARSER_LLLEXER_H
+
+#include <vector>
+#include <string>
+#include <iosfwd>
+
+namespace llvm {
+ class MemoryBuffer;
+
+ class LLLexer {
+ const char *CurPtr;
+ unsigned CurLineNo;
+ MemoryBuffer *CurBuf;
+
+ const char *TokStart;
+
+ std::string TheError;
+ public:
+ LLLexer(MemoryBuffer *StartBuf);
+ ~LLLexer() {}
+
+ const char *getTokStart() const { return TokStart; }
+ unsigned getTokLength() const { return CurPtr-TokStart; }
+ unsigned getLineNo() const { return CurLineNo; }
+ std::string getFilename() const;
+ int LexToken();
+
+ const std::string getError() const { return TheError; }
+
+ private:
+ int getNextChar();
+ void SkipLineComment();
+ int LexIdentifier();
+ int LexDigitOrNegative();
+ int LexPositive();
+ int LexAt();
+ int LexPercent();
+ int LexQuote();
+ int Lex0x();
+ };
+} // end namespace llvm
+
+#endif