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

31
Token.h
View File

@@ -5,18 +5,39 @@
class Token {
public:
enum Kind {
integer,
real,
eof
enum Kind {
PLUS,
MINUS,
STAR,
SLASH,
PERCENT,
LEFT_PAREN,
RIGHT_PAREN,
DOT,
COMMA,
INTEGER,
NEW_LINE,
END,
INVALID
};
private:
Kind kind;
std::string lexme;
public:
Token(Kind kind);
Token(Kind kind, std::string lexme);
Kind getKind();
std::string getLexme();
bool operator==(Token const& other);
bool operator!=(Token const& other);
std::string toString();
static Token Invalid;
};
#endif