2012-11-02 23:07:00 +00:00
|
|
|
#ifndef LEXER_H
|
|
|
|
#define LEXER_H
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
|
|
|
#include <cctype>
|
|
|
|
#include <iostream>
|
|
|
|
#include "Token.h"
|
|
|
|
|
|
|
|
using namespace std;
|
2012-11-08 20:16:00 +00:00
|
|
|
|
2012-11-02 23:07:00 +00:00
|
|
|
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);
|
|
|
|
|
2012-11-04 12:18:26 +00:00
|
|
|
bool is_keyword(string value);
|
|
|
|
bool is_punctuation(char c);
|
|
|
|
bool is_operator(string value );
|
|
|
|
|
2012-11-02 23:07:00 +00:00
|
|
|
protected:
|
|
|
|
private:
|
|
|
|
|
|
|
|
vector<string> keywords;
|
|
|
|
vector<char> punctuation;
|
|
|
|
vector<string> operators;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LEXER_H
|