a6acf4e94df6a43fcfe726cf9d4faabfd3d837bc
[oota-llvm.git] / include / llvm / MC / MCAsmParser.h
1 //===-- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ---*- 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 #ifndef LLVM_MC_MCASMPARSER_H
11 #define LLVM_MC_MCASMPARSER_H
12
13 #include "llvm/Support/DataTypes.h"
14
15 namespace llvm {
16 class MCAsmLexer;
17 class MCValue;
18 class SMLoc;
19 class Twine;
20
21 /// MCAsmParser - Generic assembler parser interface, for use by target specific
22 /// assembly parsers.
23 class MCAsmParser {
24   MCAsmParser(const MCAsmParser &);   // DO NOT IMPLEMENT
25   void operator=(const MCAsmParser &);  // DO NOT IMPLEMENT
26 protected: // Can only create subclasses.
27   MCAsmParser();
28  
29 public:
30   virtual ~MCAsmParser();
31
32   virtual MCAsmLexer &getLexer() = 0;
33
34   /// Warning - Emit a warning at the location \arg L, with the message \arg
35   /// Msg.
36   virtual void Warning(SMLoc L, const Twine &Msg) = 0;
37
38   /// Warning - Emit an error at the location \arg L, with the message \arg
39   /// Msg.
40   ///
41   /// \return The return value is always true, as an idiomatic convenience to
42   /// clients.
43   virtual bool Error(SMLoc L, const Twine &Msg) = 0;
44
45   /// ParseAbsoluteExpression - Parse an expression which must evaluate to an
46   /// absolute value.
47   ///
48   /// @param Res - The value of the absolute expression. The result is undefined
49   /// on error.
50   /// @result - False on success.
51   virtual bool ParseAbsoluteExpression(int64_t &Res) = 0;
52
53   /// ParseRelocatableExpression - Parse an expression which must be
54   /// relocatable.
55   ///
56   /// @param Res - The relocatable expression value. The result is undefined on
57   /// error.  
58   /// @result - False on success.
59   virtual bool ParseRelocatableExpression(MCValue &Res) = 0;
60
61   /// ParseParenRelocatableExpression - Parse an expression which must be
62   /// relocatable, assuming that an initial '(' has already been consumed.
63   ///
64   /// @param Res - The relocatable expression value. The result is undefined on
65   /// error.  
66   /// @result - False on success.
67   ///
68   /// @see ParseRelocatableExpression, ParseParenExpr.
69   virtual bool ParseParenRelocatableExpression(MCValue &Res) = 0;
70 };
71
72 } // End llvm namespace
73
74 #endif