Remove trailing whitespace
[oota-llvm.git] / include / llvm / Assembly / Parser.h
1 //===-- llvm/Assembly/Parser.h - Parser for VM assembly files ---*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  These classes are implemented by the lib/AsmParser library.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_ASSEMBLY_PARSER_H
15 #define LLVM_ASSEMBLY_PARSER_H
16
17 #include <string>
18
19 namespace llvm {
20
21 class Module;
22 class ParseException;
23
24
25 // The useful interface defined by this file... Parse an ascii file, and return
26 // the internal representation in a nice slice'n'dice'able representation.  Note
27 // that this does not verify that the generated LLVM is valid, so you should run
28 // the verifier after parsing the file to check that it's ok.
29 //
30 Module *ParseAssemblyFile(const std::string &Filename);// throw (ParseException)
31
32 //===------------------------------------------------------------------------===
33 //                              Helper Classes
34 //===------------------------------------------------------------------------===
35
36 // ParseException - For when an exceptional event is generated by the parser.
37 // This class lets you print out the exception message
38 //
39 class ParseException {
40 public:
41   ParseException(const std::string &filename, const std::string &message,
42                  int LineNo = -1, int ColNo = -1);
43
44   ParseException(const ParseException &E);
45
46   // getMessage - Return the message passed in at construction time plus extra
47   // information extracted from the options used to parse with...
48   //
49   const std::string getMessage() const;
50
51   inline const std::string &getRawMessage() const {   // Just the raw message...
52     return Message;
53   }
54
55   inline const std::string &getFilename() const {
56     return Filename;
57   }
58
59   // getErrorLocation - Return the line and column number of the error in the
60   // input source file.  The source filename can be derived from the
61   // ParserOptions in effect.  If positional information is not applicable,
62   // these will return a value of -1.
63   //
64   inline const void getErrorLocation(int &Line, int &Column) const {
65     Line = LineNo; Column = ColumnNo;
66   }
67
68 private :
69   std::string Filename;
70   std::string Message;
71   int LineNo, ColumnNo;                               // -1 if not relevant
72
73   ParseException &operator=(const ParseException &E); // objects by reference
74 };
75
76 } // End llvm namespace
77
78 #endif