forked from JonathanMeans/EvilC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlexer.h
42 lines (34 loc) · 730 Bytes
/
lexer.h
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
#ifndef LEXER_H
#define LEXER_H
#include "ErrorReporter.h"
#include "token.h"
#include <istream>
#include <stdexcept>
#include <string>
class EnvironmentalLimitsException : public std::runtime_error
{
public:
EnvironmentalLimitsException(const char* msg);
};
class Lexer
{
public:
struct Options
{
bool rot13 = false;
};
explicit Lexer(std::istream& source,
ErrorReporter& errors,
const Options& options = Options());
bool hasNext() const;
Token next();
private:
char getNextChar();
void skipWhitespace();
bool mHasNext;
std::istream& mSource;
ErrorReporter& mErrors;
Options mOptions;
FileLocation mLocation;
};
#endif