Initial commit
This commit is contained in:
26
include/ast/ast_token.hpp
Normal file
26
include/ast/ast_token.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
#include "ast/ast_base.hpp"
|
||||
#include "util/text.hpp"
|
||||
|
||||
|
||||
namespace fsh {
|
||||
|
||||
template<Lexer::TokenType T>
|
||||
class TokenNode : public AstNode {
|
||||
public:
|
||||
using shared = std::shared_ptr<TokenNode>;
|
||||
Lexer::TokenType gtoken_type() {return T;}
|
||||
std::string& gvalue() {return value;};
|
||||
static std::shared_ptr<TokenNode> build(std::list<Token>::iterator& it);
|
||||
|
||||
protected:
|
||||
TokenNode(std::string value)
|
||||
: AstNode(NodeType::TOKEN, util::tokens[T]), value(value) {}
|
||||
|
||||
private:
|
||||
std::string value;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user