Files
highground-fork/src/lexer.h

29 lines
535 B
C
Raw Normal View History

2025-12-25 22:37:40 +11:00
#ifndef LEXER_H
#define LEXER_H
2025-12-21 12:06:55 +11:00
#include <string>
#include <optional>
#include <vector>
namespace Solstice {
2025-12-25 22:37:40 +11:00
struct Token {
std::string value;
int line;
std::string lineContent;
};
2025-12-21 12:06:55 +11:00
class Lexer {
std::string input;
2025-12-25 22:37:40 +11:00
std::vector<std::string> lines;
2025-12-21 12:06:55 +11:00
size_t size;
size_t current;
std::optional<char> peek(int ahead = 1);
std::optional<char> consume();
public:
Lexer(std::string in);
2025-12-25 22:37:40 +11:00
std::vector<Token> lex();
2025-12-21 12:06:55 +11:00
};
}
2025-12-25 22:37:40 +11:00
#endif