Initial commit, adds very basic Lexing
This commit is contained in:
37
src/Parser/Token.hpp
Normal file
37
src/Parser/Token.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef PORYGONLANG_TOKEN_HPP
|
||||
#define PORYGONLANG_TOKEN_HPP
|
||||
|
||||
#include "TokenKind.hpp"
|
||||
|
||||
class IToken{
|
||||
public:
|
||||
virtual TokenKind GetKind() = 0;
|
||||
};
|
||||
|
||||
class SimpleToken : public IToken{
|
||||
public:
|
||||
TokenKind Kind;
|
||||
|
||||
explicit SimpleToken(TokenKind type){
|
||||
Kind = type;
|
||||
}
|
||||
|
||||
TokenKind GetKind() override{
|
||||
return Kind;
|
||||
}
|
||||
};
|
||||
|
||||
class IntegerToken : public IToken{
|
||||
public:
|
||||
long Value;
|
||||
|
||||
explicit IntegerToken(long value){
|
||||
Value = value;
|
||||
}
|
||||
|
||||
TokenKind GetKind() override{
|
||||
return TokenKind::Integer;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //PORYGONLANG_TOKEN_HPP
|
||||
Reference in New Issue
Block a user