-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReader.hpp
32 lines (26 loc) · 885 Bytes
/
Reader.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
#ifndef __Reader_hpp
#define __Reader_hpp
#include<fstream>
#include<string>
#include "Token.hpp"
class Reader
{
public:
Reader( const char *fileToReadFrom );
Reader( const std::string fileToReadFrom );
Token getToken();
~Reader();
private:
void initialize(const char *fName);
std::string readCommandLine();
int isBlankOrComment(std::string &inputLine);
void readNextNonBlankAndCommentLine(std::string ¤tInputLine);
std::size_t idxOfFirstNonSpaceChar(std::string &line, std::size_t startIdx);
std::size_t idxOfFirstNonNameChar(std::string &line, std::size_t startIdx) ;
bool _inputBufferEmpty, _readingCommandLine, _readingDependencyLine;
const char *_fileToReadFrom;
std::string _currentInputLine;
std::size_t _inputIdx; // index of the first unused character in currentInputLine.
std::fstream _ins;
};
#endif