Calculator Step 1

- Main Page
- Classes
- Files

- File List
- File Members

parse.hpp
Go to the documentation of this file.
1 #ifndef PARSE_HPP_
2 #define PARSE_HPP_
3
4 #include <istream>
5 #include <locale>
6 #include <ostream>
7 #include <stdexcept>
8 #include <string>
9
11 class parse_error : public std::runtime_error {
12 public:
13 parse_error(std::string const& msg) : runtime_error{msg} {}
14 };
15
17 class parser
18 {
19 public:
23 parser(std::istream& input);
24
30 bool get_expr(double& result);
31
32 private:
37 std::string charify(char c);
42 bool get_number(double& result);
48 bool get_primary(double& result);
53 bool get_mult_expr(double& result);
54
55 std::istream& input_;
56 std::ctype<char> const& ctype_;
57 };
58
64 void parse_loop(std::istream& input, std::ostream& output);
65
66 #endif
parser::get_primary
bool get_primary(double &result)
Definition: parse.cpp:162
parse_loop
void parse_loop(std::istream &input, std::ostream &output)
Definition: parse.cpp:183
parser::parser
parser(std::istream &input)
Definition: parse.cpp:6
parse_error::parse_error
parse_error(std::string const &msg)
Definition: parse.hpp:13
parser::charify
std::string charify(char c)
Definition: parse.cpp:11
parser::get_number
bool get_number(double &result)
Definition: parse.cpp:38
parser
Definition: parse.hpp:17
parser::get_expr
bool get_expr(double &result)
Definition: parse.cpp:110
parse_error
Definition: parse.hpp:11
parser::input_
std::istream & input_
Definition: parse.hpp:55
parser::ctype_
std::ctype< char > const & ctype_
Definition: parse.hpp:56
parser::get_mult_expr
bool get_mult_expr(double &result)
Definition: parse.cpp:135