From 64c34a42ce96c8368b8dc0636e8a452def6f8ea5 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Fri, 18 Nov 2011 21:29:51 +0100 Subject: Inital commit --- parser.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 parser.h (limited to 'parser.h') diff --git a/parser.h b/parser.h new file mode 100644 index 0000000..e4299dc --- /dev/null +++ b/parser.h @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include + +#include "tree.h" + +struct ParserResult +{ + double result; + string tree; +}; + +class Parser +{ + public: + ParserResult calculate(string, bool); + + private: + int getPriority(char); + vector* lexer(string); + Node* buildTree(Tree**, string); +}; + +class parenthese_exception: public exception +{ + virtual const char* what() const throw() + { + return "Invalid parenthesized expression - check your input term."; + } +}; + +class operator_exception: public exception +{ + virtual const char* what() const throw() + { + return "Unexpected operator placement - check your input term."; + } +}; -- cgit v1.2.3