- Main Page
- Classes
- Files

# parse.hpp

Go to the documentation of this file.

    00001 #ifndef PARSE_HPP_
    00002 #define PARSE_HPP_
    00003
    00004 #include <istream>
    00005 #include <locale>
    00006 #include <ostream>
    00007 #include <stdexcept>
    00008 #include <string>
    00009
    00011 class parse_error : public std::runtime_error {
    00012 public:
    00013   parse_error(std::string const& msg) : runtime_error(msg) {}
    00014 };
    00015
    00017 class parser
    00018 {
    00019 public:
    00023   parser(std::istream& input);
    00024
    00030   bool get_expr(double& result);
    00031
    00032 private:
    00037   std::string charify(char c);
    00042   bool get_number(double& result);
    00048   bool get_primary(double& result);
    00053   bool get_mult_expr(double& result);
    00054
    00055   std::istream& input_;
    00056   std::ctype<char> const& ctype_;
    00057 };
    00058
    00064 void parse_loop(std::istream& input, std::ostream& output);
    00065
    00066 #endif