No one should be using the method directly. Assert if they do.
[oota-llvm.git] / utils / TableGen / TGLexer.h
index 59e9fa0ef5ffd8f949f999e0089c254bb4b69f77..84d328b12d9764d894cc8b626e49d60e36db32c0 100644 (file)
 #define TGLEXER_H
 
 #include "llvm/Support/DataTypes.h"
-#include <vector>
 #include <string>
-#include <iosfwd>
+#include <vector>
 #include <cassert>
 
 namespace llvm {
 class MemoryBuffer;
-class TGSourceMgr;
-  
+class SourceMgr;
+class SMLoc;
+class Twine;
+
 namespace tgtok {
   enum TokKind {
     // Markers
@@ -35,7 +36,7 @@ namespace tgtok {
     l_brace, r_brace,   // { }
     l_paren, r_paren,   // ( )
     less, greater,      // < >
-    colon, semi,        // ; :
+    colon, semi,        // : ;
     comma, period,      // , .
     equal, question,    // = ?
     
@@ -44,8 +45,9 @@ namespace tgtok {
     MultiClass, String,
     
     // !keywords.
-    XConcat, XSRA, XSRL, XSHL, XStrConcat,
-    
+    XConcat, XSRA, XSRL, XSHL, XStrConcat, XCast, XSubst,
+    XForEach, XHead, XTail, XEmpty, XIf, XEq,
+
     // Integer value.
     IntVal,
     
@@ -56,7 +58,7 @@ namespace tgtok {
 
 /// TGLexer - TableGen Lexer class.
 class TGLexer {
-  TGSourceMgr &SrcMgr;
+  SourceMgr &SrcMgr;
   
   const char *CurPtr;
   const MemoryBuffer *CurBuf;
@@ -70,21 +72,20 @@ class TGLexer {
   /// CurBuffer - This is the current buffer index we're lexing from as managed
   /// by the SourceMgr object.
   int CurBuffer;
+  /// Dependencies - This is the list of all included files.
+  std::vector<std::string> Dependencies;
   
-  // IncludeDirectories - This is the list of directories we should search for
-  // include files in.
-  std::vector<std::string> IncludeDirectories;
 public:
-  TGLexer(TGSourceMgr &SrcMgr);
+  TGLexer(SourceMgr &SrcMgr);
   ~TGLexer() {}
   
-  void setIncludeDirs(const std::vector<std::string> &Dirs) {
-    IncludeDirectories = Dirs;
-  }
-  
   tgtok::TokKind Lex() {
     return CurCode = LexToken();
   }
+
+  const std::vector<std::string> &getDependencies() const {
+    return Dependencies;
+  }
   
   tgtok::TokKind getCode() const { return CurCode; }
 
@@ -99,16 +100,13 @@ public:
     return CurIntVal;
   }
 
-  typedef const char* LocTy;
-  LocTy getLoc() const { return TokStart; }
-
-  void PrintError(LocTy Loc, const std::string &Msg) const;
+  SMLoc getLoc() const;
   
 private:
   /// LexToken - Read the next token and return its code.
   tgtok::TokKind LexToken();
   
-  tgtok::TokKind ReturnError(const char *Loc, const std::string &Msg);
+  tgtok::TokKind ReturnError(const char *Loc, const Twine &Msg);
   
   int getNextChar();
   void SkipBCPLComment();