aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerländer2013-01-11 21:30:53 +0100
committerAdrian Kummerländer2013-01-11 21:30:53 +0100
commit5f2233fb632dc19678d0faac354857979b154f15 (patch)
treee23be2c458bd292335c6d9e2b746b0f07d1a6c92
parent4e138b38eb9c41d7ef110dd1841122f5861ab244 (diff)
downloadSimpleParser-5f2233fb632dc19678d0faac354857979b154f15.tar
SimpleParser-5f2233fb632dc19678d0faac354857979b154f15.tar.gz
SimpleParser-5f2233fb632dc19678d0faac354857979b154f15.tar.bz2
SimpleParser-5f2233fb632dc19678d0faac354857979b154f15.tar.lz
SimpleParser-5f2233fb632dc19678d0faac354857979b154f15.tar.xz
SimpleParser-5f2233fb632dc19678d0faac354857979b154f15.tar.zst
SimpleParser-5f2233fb632dc19678d0faac354857979b154f15.zip
Included previously missing exceptions header
-rw-r--r--README.md2
-rw-r--r--src/exceptions.h29
2 files changed, 30 insertions, 1 deletions
diff --git a/README.md b/README.md
index 46284c9..a2745af 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ The implementation itself does not use any external libraries and relies fully o
- Support for brackets
- Export of the expression tree as [Graphviz](http://www.graphviz.org/) dot for visualization
-## Requirements
+## Requirements:
- C++ compiler with support for new C++11 and STL features such as the auto keyword and unique_ptr (tested with GCC 4.7.2 on Linux)
- [GoogleTest](http://code.google.com/p/googletest/) for tests
diff --git a/src/exceptions.h b/src/exceptions.h
new file mode 100644
index 0000000..cd76368
--- /dev/null
+++ b/src/exceptions.h
@@ -0,0 +1,29 @@
+#ifndef PARSER_SRC_EXCEPTIONS_H_
+#define PARSER_SRC_EXCEPTIONS_H_
+
+#include <exception>
+
+namespace SimpleParser {
+
+class parenthese_exception: public std::exception {
+ virtual const char* what() const throw() {
+ return "Invalid parenthesized expression - check your input term.";
+ }
+};
+
+class operator_exception: public std::exception {
+ virtual const char* what() const throw() {
+ return "Unexpected operator placement - check your input term.";
+ }
+};
+
+class divide_exception: public std::exception {
+ virtual const char* what() const throw()
+ {
+ return "A divison through zero had to be prevented by the parser - check your input term.";
+ }
+};
+
+}
+
+#endif // PARSER_SRC_EXCEPTIONS_H_