1 //===- AsmLexer.h - Lexer for 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 declares the lexer for assembly files.
12 //===----------------------------------------------------------------------===//
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/MC/MCAsmLexer.h"
19 #include "llvm/MC/MCAsmInfo.h"
20 #include "llvm/System/DataTypes.h"
30 /// AsmLexer - Lexer class for assembly files.
31 class AsmLexer : public MCAsmLexer {
36 const MemoryBuffer *CurBuf;
40 /// This is the current buffer index we're lexing from as managed by the
44 void operator=(const AsmLexer&); // DO NOT IMPLEMENT
45 AsmLexer(const AsmLexer&); // DO NOT IMPLEMENT
48 /// LexToken - Read the next token and return its code.
49 virtual AsmToken LexToken();
52 AsmLexer(SourceMgr &SrcMgr, const MCAsmInfo &MAI);
57 StringRef LexUntilEndOfStatement();
59 bool isAtStartOfComment(char Char);
61 /// EnterIncludeFile - Enter the specified file. This returns true on failure.
62 bool EnterIncludeFile(const std::string &Filename);
64 void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const;
68 AsmToken ReturnError(const char *Loc, const std::string &Msg);
70 AsmToken LexIdentifier();
72 AsmToken LexLineComment();
77 } // end namespace llvm