implement memory operand parsing.
[oota-llvm.git] / tools / llvm-mc / AsmParser.h
1 //===- AsmParser.h - Parser 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 parser for assembly files.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef ASMPARSER_H
15 #define ASMPARSER_H
16
17 #include "AsmLexer.h"
18
19 namespace llvm {
20   
21 class AsmParser {
22   AsmLexer Lexer;
23   struct X86Operand;
24   
25 public:
26   AsmParser(SourceMgr &SM) : Lexer(SM) {}
27   ~AsmParser() {}
28   
29   bool Run();
30   
31 private:
32   bool ParseStatement();
33   
34   bool Error(SMLoc L, const char *Msg);
35   bool TokError(const char *Msg);
36   
37   void EatToEndOfStatement();
38   
39   bool ParseX86Operand(X86Operand &Op);
40   bool ParseX86MemOperand(X86Operand &Op);
41   bool ParseExpression(int64_t &Res);
42 };
43
44 } // end namespace llvm
45
46 #endif