1 //===-- llvm/assembly/Parser.h - Parser for VM assembly files ----*- C++ -*--=//
3 // These classes are implemented by the lib/AssemblyParser library.
5 //===----------------------------------------------------------------------===//
7 #ifndef LLVM_ASSEMBLY_PARSER_H
8 #define LLVM_ASSEMBLY_PARSER_H
16 // The useful interface defined by this file... Parse an ascii file, and return
17 // the internal representation in a nice slice'n'dice'able representation.
19 Module *ParseAssemblyFile(const string &Filename) throw (ParseException);
21 //===------------------------------------------------------------------------===
23 //===------------------------------------------------------------------------===
25 // ParseException - For when an exceptional event is generated by the parser.
26 // This class lets you print out the exception message
28 class ParseException {
30 ParseException(const string &filename, const string &message,
31 int LineNo = -1, int ColNo = -1);
33 ParseException(const ParseException &E);
35 // getMessage - Return the message passed in at construction time plus extra
36 // information extracted from the options used to parse with...
38 const string getMessage() const;
40 inline const string getRawMessage() const { // Just the raw message...
44 inline const string &getFilename() const {
48 // getErrorLocation - Return the line and column number of the error in the
49 // input source file. The source filename can be derived from the
50 // ParserOptions in effect. If positional information is not applicable,
51 // these will return a value of -1.
53 inline const void getErrorLocation(int &Line, int &Column) const {
54 Line = LineNo; Column = ColumnNo;
60 int LineNo, ColumnNo; // -1 if not relevant
62 ParseException &operator=(const ParseException &E); // objects by reference