24 lines
630 B
C++
24 lines
630 B
C++
#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;
|
|
};
|
|
|
|
} |