parser_exception.h
Go to the documentation of this file.
/********************* */
#include "cvc4parser_public.h"
#ifndef __CVC4__PARSER__PARSER_EXCEPTION_H
#define __CVC4__PARSER__PARSER_EXCEPTION_H
#include <iostream>
#include <string>
#include <sstream>
#include "util/exception.h"
namespace CVC4 {
namespace parser {
class CVC4_PUBLIC ParserException : public Exception {
public:
// Constructors
ParserException() throw() :
d_filename(),
d_line(0),
d_column(0) {
}
ParserException(const std::string& msg) throw() :
Exception(msg),
d_filename(),
d_line(0),
d_column(0) {
}
ParserException(const char* msg) throw() :
Exception(msg),
d_filename(),
d_line(0),
d_column(0) {
}
ParserException(const std::string& msg, const std::string& filename,
unsigned long line, unsigned long column) throw() :
Exception(msg),
d_filename(filename),
d_line(line),
d_column(column) {
}
// Destructor
virtual ~ParserException() throw() {}
virtual void toStream(std::ostream& os) const throw() {
if( d_line > 0 ) {
os << "Parse Error: " << d_filename << ":" << d_line << "."
<< d_column << ": " << d_msg;
} else {
os << "Parse Error: " << d_msg;
}
}
std::string getFilename() const throw() {
return d_filename;
}
int getLine() const throw() {
return d_line;
}
int getColumn() const throw() {
return d_column;
}
protected:
std::string d_filename;
unsigned long d_line;
unsigned long d_column;
};/* class ParserException */
class CVC4_PUBLIC ParserEndOfFileException : public ParserException {
public:
// Constructors same as ParserException's
ParserEndOfFileException() throw() :
ParserException() {
}
ParserEndOfFileException(const std::string& msg) throw() :
ParserException(msg) {
}
ParserEndOfFileException(const char* msg) throw() :
ParserException(msg) {
}
ParserEndOfFileException(const std::string& msg, const std::string& filename,
unsigned long line, unsigned long column) throw() :
ParserException(msg, filename, line, column) {
}
};/* class ParserEndOfFileException */
}/* CVC4::parser namespace */
}/* CVC4 namespace */
#endif /* __CVC4__PARSER__PARSER_EXCEPTION_H */
CVC4::Exception
Definition exception.h:32
CVC4::parser::ParserEndOfFileException
Definition parser_exception.h:92
CVC4::parser::ParserEndOfFileException::ParserEndOfFileException
ParserEndOfFileException()
Definition parser_exception.h:97
CVC4::parser::ParserEndOfFileException::ParserEndOfFileException
ParserEndOfFileException(const char *msg)
Definition parser_exception.h:105
CVC4::parser::ParserEndOfFileException::ParserEndOfFileException
ParserEndOfFileException(const std::string &msg, const std::string &filename, unsigned long line, unsigned long column)
Definition parser_exception.h:109
CVC4::parser::ParserEndOfFileException::ParserEndOfFileException
ParserEndOfFileException(const std::string &msg)
Definition parser_exception.h:101
CVC4::parser::ParserException
Definition parser_exception.h:31
CVC4::parser::ParserException::d_line
unsigned long d_line
Definition parser_exception.h:88
CVC4::parser::ParserException::toStream
virtual void toStream(std::ostream &os) const
Printing: feel free to redefine toStream().
Definition parser_exception.h:65
CVC4::parser::ParserException::ParserException
ParserException(const std::string &msg, const std::string &filename, unsigned long line, unsigned long column)
Definition parser_exception.h:54
CVC4::parser::ParserException::ParserException
ParserException(const std::string &msg)
Definition parser_exception.h:40
CVC4::parser::ParserException::ParserException
ParserException(const char *msg)
Definition parser_exception.h:47
CVC4::parser::ParserException::d_filename
std::string d_filename
Definition parser_exception.h:87
CVC4::parser::ParserException::getFilename
std::string getFilename() const
Definition parser_exception.h:74
CVC4::parser::ParserException::getColumn
int getColumn() const
Definition parser_exception.h:82
CVC4::parser::ParserException::getLine
int getLine() const
Definition parser_exception.h:78
CVC4::parser::ParserException::~ParserException
virtual ~ParserException()
Definition parser_exception.h:63
CVC4::parser::ParserException::d_column
unsigned long d_column
Definition parser_exception.h:89
CVC4::parser::ParserException::ParserException
ParserException()
Definition parser_exception.h:34
CVC4_PUBLIC
#define CVC4_PUBLIC
Definition cvc4_public.h:30
cvc4parser_public.h
Macros that should be defined everywhere during the building of the libraries and driver binary,...
exception.h
CVC4's exception base class and some associated utilities.
CVC4
Definition expr.h:106