can now parse identifiers and integer literals
This commit is contained in:
15
src/ast/expressions/integer.cpp
Normal file
15
src/ast/expressions/integer.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "integer.hpp"
|
||||
|
||||
namespace ast {
|
||||
integer_literal::integer_literal(token::token token, int value)
|
||||
: token(std::move(token)),
|
||||
value(value) {}
|
||||
|
||||
std::string integer_literal::token_literal() const {
|
||||
return token.literal;
|
||||
};
|
||||
|
||||
std::string integer_literal::str() const {
|
||||
return token.literal;
|
||||
};
|
||||
} // namespace ast
|
15
src/ast/expressions/integer.hpp
Normal file
15
src/ast/expressions/integer.hpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "ast/ast.hpp"
|
||||
#include "token/token.hpp"
|
||||
|
||||
namespace ast {
|
||||
struct integer_literal : expression {
|
||||
integer_literal(token::token token, int value);
|
||||
token::token token;
|
||||
int value;
|
||||
|
||||
std::string token_literal() const override;
|
||||
std::string str() const override;
|
||||
};
|
||||
} // namespace ast
|
Reference in New Issue
Block a user