1 //===-- llvm/Assembly/Parser.h - Parser for VM assembly files ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // These classes are implemented by the lib/AsmParser library.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_ASSEMBLY_PARSER_H
15 #define LLVM_ASSEMBLY_PARSER_H
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.
30 Module *ParseAssemblyFile(const std::string &Filename);// throw (ParseException)
32 //===------------------------------------------------------------------------===
34 //===------------------------------------------------------------------------===
36 // ParseException - For when an exceptional event is generated by the parser.
37 // This class lets you print out the exception message
39 struct ParseException {
40 ParseException(const std::string &filename, const std::string &message,
41 int LineNo = -1, int ColNo = -1);
43 ParseException(const ParseException &E);
45 // getMessage - Return the message passed in at construction time plus extra
46 // information extracted from the options used to parse with...
48 const std::string getMessage() const;
50 inline const std::string &getRawMessage() const { // Just the raw message...
54 inline const std::string &getFilename() const {
58 // getErrorLocation - Return the line and column number of the error in the
59 // input source file. The source filename can be derived from the
60 // ParserOptions in effect. If positional information is not applicable,
61 // these will return a value of -1.
63 inline const void getErrorLocation(int &Line, int &Column) const {
64 Line = LineNo; Column = ColumnNo;
70 int LineNo, ColumnNo; // -1 if not relevant
72 ParseException &operator=(const ParseException &E); // objects by reference
75 } // End llvm namespace