1 //===-- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ---*- 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 #ifndef LLVM_MC_MCASMPARSER_H
11 #define LLVM_MC_MCASMPARSER_H
13 #include "llvm/System/DataTypes.h"
25 /// MCAsmParser - Generic assembler parser interface, for use by target specific
28 MCAsmParser(const MCAsmParser &); // DO NOT IMPLEMENT
29 void operator=(const MCAsmParser &); // DO NOT IMPLEMENT
30 protected: // Can only create subclasses.
34 virtual ~MCAsmParser();
36 virtual MCAsmLexer &getLexer() = 0;
38 virtual MCContext &getContext() = 0;
40 /// getSteamer - Return the output streamer for the assembler.
41 virtual MCStreamer &getStreamer() = 0;
43 /// Warning - Emit a warning at the location \arg L, with the message \arg
45 virtual void Warning(SMLoc L, const Twine &Msg) = 0;
47 /// Warning - Emit an error at the location \arg L, with the message \arg
50 /// \return The return value is always true, as an idiomatic convenience to
52 virtual bool Error(SMLoc L, const Twine &Msg) = 0;
54 /// Lex - Get the next AsmToken in the stream, possibly handling file
56 virtual const AsmToken &Lex() = 0;
58 /// ParseExpression - Parse an arbitrary expression.
60 /// @param Res - The value of the expression. The result is undefined
62 /// @result - False on success.
63 virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
64 bool ParseExpression(const MCExpr *&Res);
66 /// ParseParenExpression - Parse an arbitrary expression, assuming that an
67 /// initial '(' has already been consumed.
69 /// @param Res - The value of the expression. The result is undefined
71 /// @result - False on success.
72 virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
74 /// ParseAbsoluteExpression - Parse an expression which must evaluate to an
77 /// @param Res - The value of the absolute expression. The result is undefined
79 /// @result - False on success.
80 virtual bool ParseAbsoluteExpression(int64_t &Res) = 0;
83 } // End llvm namespace