40 lines
747 B
C
40 lines
747 B
C
|
#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);
|
||
|
|
||
|
vector<Token> parse_line(string line);
|
||
|
pair<string, Token> parse_token(string line);
|
||
|
type_of_token guess_type(string value);
|
||
|
|
||
|
protected:
|
||
|
private:
|
||
|
|
||
|
bool is_keyword(string value);
|
||
|
bool is_punctuation(char c);
|
||
|
bool is_operator(string value );
|
||
|
|
||
|
vector<string> keywords;
|
||
|
vector<char> punctuation;
|
||
|
vector<string> operators;
|
||
|
};
|
||
|
|
||
|
#endif // LEXER_H
|