Tokenizing input
This commit is contained in:
31
Token.h
31
Token.h
@@ -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
|
||||
Reference in New Issue
Block a user