#ifndef LEXER_H
#define LEXER_H
#include <vector>
#include <string>
#include <utility>
#include <cctype>
#include <iostream>
#include "Token.h"

using namespace std;

/**
 * Lexer is a class which gets some text, analyzes it and returns a vector of tokens.
 */
class Lexer
{
public:
	Lexer();
	virtual ~Lexer();
	/**
	 * parse_line(line) analyzes input and returns vector of tokens.
	 */
	vector<Token> parse_line(string line);
	pair<string, Token> parse_token(string line);

	//helper function to evaluate type of token
	bool is_keyword(string value);
	bool is_punctuation(char c);
	bool is_operator(string value );

private:
	void add_keyword(string word);
	void add_punctuation_char(char c);
	void add_operator(string oper);
	string unescape_string(string text);

	/**
	 * Tokens have type and value. Type is evaluated in function guess_type(value).
	 */
	type_of_token guess_type(string value);

	vector<string> keywords;
	vector<char> punctuation;
	vector<string> operators;
};

#endif // LEXER_H
