1 //===- LLLexer.h - Lexer for LLVM Assembly Files ----------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This class represents the Lexer for .ll files.
12 //===----------------------------------------------------------------------===//
14 #ifndef LIB_ASMPARSER_LLLEXER_H
15 #define LIB_ASMPARSER_LLLEXER_H
18 #include "llvm/ADT/APSInt.h"
19 #include "llvm/ADT/APFloat.h"
33 ParseError &ErrorInfo;
35 // Information about the current token.
46 explicit LLLexer(MemoryBuffer *StartBuf, ParseError &);
50 return CurKind = LexToken();
53 typedef const char* LocTy;
54 LocTy getLoc() const { return TokStart; }
55 lltok::Kind getKind() const { return CurKind; }
56 const std::string getStrVal() const { return StrVal; }
57 const Type *getTyVal() const { return TyVal; }
58 unsigned getUIntVal() const { return UIntVal; }
59 const APSInt &getAPSIntVal() const { return APSIntVal; }
60 const APFloat &getAPFloatVal() const { return APFloatVal; }
63 bool Error(LocTy L, const std::string &Msg) const;
64 bool Error(const std::string &Msg) const { return Error(CurPtr, Msg); }
65 std::string getFilename() const;
68 lltok::Kind LexToken();
71 void SkipLineComment();
72 lltok::Kind LexIdentifier();
73 lltok::Kind LexDigitOrNegative();
74 lltok::Kind LexPositive();
76 lltok::Kind LexPercent();
77 lltok::Kind LexQuote();
80 uint64_t atoull(const char *Buffer, const char *End);
81 uint64_t HexIntToVal(const char *Buffer, const char *End);
82 void HexToIntPair(const char *Buffer, const char *End, uint64_t Pair[2]);
84 } // end namespace llvm