blob: 12d745a5f4082203b8d2e3aa609d0c40771d2b13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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_
|