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"
24 /// MCAsmParser - Generic assembler parser interface, for use by target specific
27 MCAsmParser(const MCAsmParser &); // DO NOT IMPLEMENT
28 void operator=(const MCAsmParser &); // DO NOT IMPLEMENT
29 protected: // Can only create subclasses.
33 virtual ~MCAsmParser();
35 virtual MCAsmLexer &getLexer() = 0;
37 virtual MCContext &getContext() = 0;
39 /// getSteamer - Return the output streamer for the assembler.
40 virtual MCStreamer &getStreamer() = 0;
42 /// Warning - Emit a warning at the location \arg L, with the message \arg
44 virtual void Warning(SMLoc L, const Twine &Msg) = 0;
46 /// Error - Emit an error at the location \arg L, with the message \arg
49 /// \return The return value is always true, as an idiomatic convenience to
51 virtual bool Error(SMLoc L, const Twine &Msg) = 0;
53 /// Lex - Get the next AsmToken in the stream, possibly handling file
55 virtual const AsmToken &Lex() = 0;
57 /// getTok - Get the current AsmToken from the stream.
58 const AsmToken &getTok();
60 /// \brief Report an error at the current lexer location.
61 bool TokError(const char *Msg);
63 /// ParseExpression - Parse an arbitrary expression.
65 /// @param Res - The value of the expression. The result is undefined
67 /// @result - False on success.
68 virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
69 bool ParseExpression(const MCExpr *&Res);
71 /// ParseParenExpression - Parse an arbitrary expression, assuming that an
72 /// initial '(' has already been consumed.
74 /// @param Res - The value of the expression. The result is undefined
76 /// @result - False on success.
77 virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
79 /// ParseAbsoluteExpression - Parse an expression which must evaluate to an
82 /// @param Res - The value of the absolute expression. The result is undefined
84 /// @result - False on success.
85 virtual bool ParseAbsoluteExpression(int64_t &Res) = 0;
88 } // End llvm namespace