forked from solstice/solstice
30 lines
539 B
C++
30 lines
539 B
C++
#ifndef LEXER_H
|
|
#define LEXER_H
|
|
|
|
#include <string>
|
|
#include <optional>
|
|
#include <vector>
|
|
|
|
namespace Solstice {
|
|
struct Token {
|
|
std::string value;
|
|
size_t line;
|
|
std::string lineContent;
|
|
};
|
|
|
|
class Lexer {
|
|
std::string input;
|
|
std::vector<std::string> lines;
|
|
size_t size;
|
|
size_t current;
|
|
std::optional<char> peek(int ahead = 1);
|
|
std::optional<char> consume();
|
|
public:
|
|
Lexer(std::string in);
|
|
std::vector<Token> lex();
|
|
|
|
};
|
|
}
|
|
|
|
#endif
|