Tokenizing input

This commit is contained in:
Rafał Grodziński
2025-05-27 22:38:44 +09:00
parent 838dbbeb03
commit 69bf54a62d
8 changed files with 225 additions and 24 deletions

18
Lexer.h
View File

@@ -2,16 +2,28 @@
#define LEXER_H
#include <vector>
class Token;
#include "Token.h"
class Lexer {
private:
std::string source;
int currentIndex = 0;
int currentLine = 0;
Token nextToken();
Token matchEnd();
Token matchNewLine();
Token matchInvalid();
Token matchSymbol(char symbol, Token::Kind kind);
Token matchInteger();
bool isWhiteSpace(int index);
bool isNewLine(int index);
bool isDigit(int index);
public:
Lexer(std::string source);
std::vector<Token> tokens();
std::vector<Token> getTokens();
};
#endif