blob: cd3db82f9dd694168bcef725966426c9a44df823 (
plain)
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
|
#ifndef LEXER_H
#define LEXER_H
#include <vector>
#include <string>
#include <utility>
#include <cctype>
#include <iostream>
#include "Token.h"
using namespace std;
class Lexer
{
public:
Lexer();
virtual ~Lexer();
void add_keyword(string word);
void add_punctuation_char(char c);
void add_operator(string oper);
string unescape_string(string text);
vector<Token> parse_line(string line);
pair<string, Token> parse_token(string line);
type_of_token guess_type(string value);
bool is_keyword(string value);
bool is_punctuation(char c);
bool is_operator(string value );
protected:
private:
vector<string> keywords;
vector<char> punctuation;
vector<string> operators;
};
#endif // LEXER_H
|