2016-04-22 21:46:31 +02:00
|
|
|
#ifndef LEXER_HPP
|
|
|
|
#define LEXER_HPP
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <regex>
|
|
|
|
|
|
|
|
#include "Token.hpp"
|
|
|
|
#include "TokenList.hpp"
|
|
|
|
|
|
|
|
namespace Blang{
|
|
|
|
|
2016-08-11 15:11:45 +02:00
|
|
|
class Buffer{
|
|
|
|
public:
|
|
|
|
Buffer(const std::string& text);
|
2016-04-22 21:46:31 +02:00
|
|
|
|
2016-08-11 15:11:45 +02:00
|
|
|
char nextChar();
|
|
|
|
std::string nextChars(int n);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string _text;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Lexer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TokenList tokenize(const std::string& text);
|
|
|
|
TokenList tokenizeFile(const std::string& filename);
|
|
|
|
|
|
|
|
};
|
2016-04-22 21:46:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|