Initial commit

This commit is contained in:
2024-12-02 06:30:40 +00:00
commit fd62fb822d
33 changed files with 1972 additions and 0 deletions

26
include/ast/ast_token.hpp Normal file
View 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;
};
}