very basic parser of let statements
This commit is contained in:
17
src/ast/statements/let.cpp
Normal file
17
src/ast/statements/let.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "let.hpp"
|
||||
|
||||
namespace ast {
|
||||
let::let(token::token token)
|
||||
: token(std::move(token)),
|
||||
name(nullptr),
|
||||
value(nullptr) {}
|
||||
|
||||
std::string let::token_literal() const {
|
||||
return token.literal;
|
||||
}
|
||||
|
||||
let::~let() {
|
||||
delete name;
|
||||
delete value;
|
||||
};
|
||||
} // namespace ast
|
19
src/ast/statements/let.hpp
Normal file
19
src/ast/statements/let.hpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "ast/ast.hpp"
|
||||
#include "ast/expressions/identifier.hpp"
|
||||
#include "token/token.hpp"
|
||||
|
||||
namespace ast {
|
||||
struct let : statement {
|
||||
let(token::token token);
|
||||
|
||||
token::token token;
|
||||
identifier* name;
|
||||
expression* value;
|
||||
|
||||
std::string token_literal() const override;
|
||||
|
||||
~let();
|
||||
};
|
||||
} // namespace ast
|
Reference in New Issue
Block a user