-
Notifications
You must be signed in to change notification settings - Fork 48
/
mc_driver.hpp
55 lines (43 loc) · 1.19 KB
/
mc_driver.hpp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef __MCDRIVER_HPP__
#define __MCDRIVER_HPP__ 1
#include <string>
#include <cstddef>
#include <istream>
#include "mc_scanner.hpp"
#include "mc_parser.tab.hh"
namespace MC{
class MC_Driver{
public:
MC_Driver() = default;
virtual ~MC_Driver();
/**
* parse - parse from a file
* @param filename - valid string with input file
*/
void parse( const char * const filename );
/**
* parse - parse from a c++ input stream
* @param is - std::istream&, valid input stream
*/
void parse( std::istream &iss );
void add_upper();
void add_lower();
void add_word( const std::string &word );
void add_newline();
void add_char();
std::ostream& print(std::ostream &stream);
private:
void parse_helper( std::istream &stream );
std::size_t chars = 0;
std::size_t words = 0;
std::size_t lines = 0;
std::size_t uppercase = 0;
std::size_t lowercase = 0;
MC::MC_Parser *parser = nullptr;
MC::MC_Scanner *scanner = nullptr;
const std::string red = "\033[1;31m";
const std::string blue = "\033[1;36m";
const std::string norm = "\033[0m";
};
} /* end namespace MC */
#endif /* END __MCDRIVER_HPP__ */