Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.8 KiB

  1. //===- AsmLexer.h - Lexer for Assembly Files --------------------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This class declares the lexer for assembly files.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_MC_MCPARSER_ASMLEXER_H
  14. #define LLVM_MC_MCPARSER_ASMLEXER_H
  15. #include "llvm/ADT/StringRef.h"
  16. #include "llvm/MC/MCParser/MCAsmLexer.h"
  17. #include "llvm/Support/DataTypes.h"
  18. #include <string>
  19. namespace llvm {
  20. class MemoryBuffer;
  21. class MCAsmInfo;
  22. /// AsmLexer - Lexer class for assembly files.
  23. class AsmLexer : public MCAsmLexer {
  24. const MCAsmInfo &MAI;
  25. const char *CurPtr;
  26. const MemoryBuffer *CurBuf;
  27. bool isAtStartOfLine;
  28. void operator=(const AsmLexer&) LLVM_DELETED_FUNCTION;
  29. AsmLexer(const AsmLexer&) LLVM_DELETED_FUNCTION;
  30. protected:
  31. /// LexToken - Read the next token and return its code.
  32. virtual AsmToken LexToken();
  33. public:
  34. AsmLexer(const MCAsmInfo &MAI);
  35. ~AsmLexer();
  36. void setBuffer(const MemoryBuffer *buf, const char *ptr = NULL);
  37. virtual StringRef LexUntilEndOfStatement();
  38. StringRef LexUntilEndOfLine();
  39. bool isAtStartOfComment(char Char);
  40. bool isAtStatementSeparator(const char *Ptr);
  41. const MCAsmInfo &getMAI() const { return MAI; }
  42. private:
  43. int getNextChar();
  44. AsmToken ReturnError(const char *Loc, const std::string &Msg);
  45. AsmToken LexIdentifier();
  46. AsmToken LexSlash();
  47. AsmToken LexLineComment();
  48. AsmToken LexDigit();
  49. AsmToken LexSingleQuote();
  50. AsmToken LexQuote();
  51. AsmToken LexFloatLiteral();
  52. };
  53. } // end namespace llvm
  54. #endif