diff options
author | Morgan Deters <mdeters@gmail.com> | 2010-04-04 23:03:52 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2010-04-04 23:03:52 +0000 |
commit | ff53861016427723a7c29e9bbca6f497b4556164 (patch) | |
tree | 4ed798e2f7dfa31283f7d14d44e70c77badf6b75 /src/parser/parser_exception.h | |
parent | 42c58baf0a2a96c1f3bd797d64834d02adfb9a59 (diff) |
* Addressed issues brought up in Chris's review of Morgan's
NodeManager (bug #65). Better documentation, etc.
* As part of this, removed NodeManager::mkVar() (which created a
variable of unknown type). This requires changes to lots of unit
tests, which were using this function.
* Performed some review of parser code (my code review #73).
+ I changed the way exceptions were caught and rethrown in
src/parser/input.cpp.
+ ParserExceptions weren't being properly constructed (d_line and
d_column weren't intiialized and could contain junk, leading to
weird error messages). Fixed.
* Fix to the current working directory used by run_regression script.
Makes exceptional output easier to match against (in expected error
output).
* (configure.ac) Ensure that CFLAGS has -fexceptions in it, in case we
compile any C code and don't use the C++ compiler.
Diffstat (limited to 'src/parser/parser_exception.h')
-rw-r--r-- | src/parser/parser_exception.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/parser/parser_exception.h b/src/parser/parser_exception.h index 7b0f8bda9..dfca01ce2 100644 --- a/src/parser/parser_exception.h +++ b/src/parser/parser_exception.h @@ -30,9 +30,26 @@ namespace parser { class CVC4_PUBLIC ParserException : public Exception { public: // Constructors - ParserException() { } - ParserException(const std::string& msg): Exception(msg) { } - ParserException(const char* msg): Exception(msg) { } + ParserException() : + d_filename(), + d_line(0), + d_column(0) { + } + + ParserException(const std::string& msg) : + Exception(msg), + d_filename(), + d_line(0), + d_column(0) { + } + + ParserException(const char* msg) : + 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) : Exception(msg), @@ -43,11 +60,12 @@ public: // Destructor virtual ~ParserException() throw() {} + virtual std::string toString() const { if( d_line > 0 ) { std::stringstream ss; - ss << "Parser Error: " << d_filename << ":" << d_line << "." - << d_column << ": " << d_msg; + ss << "Parse Error: " << d_filename << ":" << d_line << "." + << d_column << ": " << d_msg; return ss.str(); } else { return "Parse Error: " + d_msg; |