diff options
author | Adrian Kummerländer | 2013-01-05 22:04:23 +0100 |
---|---|---|
committer | Adrian Kummerländer | 2013-01-05 22:04:23 +0100 |
commit | e3081360c65eb4994e7e8042898cec72de0d560b (patch) | |
tree | 2cac723733c674381ccaf32df5a64fe23b026467 /src/parser.h | |
parent | 0ab1ad8c67ac5579e10104f53040d962a7f98f17 (diff) | |
download | SimpleParser-e3081360c65eb4994e7e8042898cec72de0d560b.tar SimpleParser-e3081360c65eb4994e7e8042898cec72de0d560b.tar.gz SimpleParser-e3081360c65eb4994e7e8042898cec72de0d560b.tar.bz2 SimpleParser-e3081360c65eb4994e7e8042898cec72de0d560b.tar.lz SimpleParser-e3081360c65eb4994e7e8042898cec72de0d560b.tar.xz SimpleParser-e3081360c65eb4994e7e8042898cec72de0d560b.tar.zst SimpleParser-e3081360c65eb4994e7e8042898cec72de0d560b.zip |
Folder structure change; Further improvements of parser code
Diffstat (limited to 'src/parser.h')
-rw-r--r-- | src/parser.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/parser.h b/src/parser.h new file mode 100644 index 0000000..12d745a --- /dev/null +++ b/src/parser.h @@ -0,0 +1,36 @@ +#ifndef PARSER_PARSER_H_ +#define PARSER_PARSER_H_ + +#include <vector> +#include <stack> +#include <exception> + +#include "tree.h" + +namespace SimpleParser { + +class Parser { + public: + double calculate(std::string); + + private: + int8_t getPriority(char); + std::vector<std::string> lexer(std::string); + Node* buildTree(Tree*, std::string); +}; + +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."; + } +}; + +} + +#endif // PARSER_PARSER_H_ |