-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumber.cpp
More file actions
28 lines (20 loc) · 705 Bytes
/
Copy pathNumber.cpp
File metadata and controls
28 lines (20 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "Number.hpp"
#include "BinaryOperationExpression.hpp"
Number::Number(long double val) : val(val) {
}
std::shared_ptr<Expression> Number::add(std::shared_ptr<ASTNode> toAdd) {
return ASTBuilder::getSelf()->createBinaryOperationExpression(shared_from_this(), std::static_pointer_cast<Operation>(toAdd),
nullptr);
}
long double Number::resolve(std::map<std::string, long double> vars) const {
return val;
}
std::shared_ptr<Expression> Number::simplify() {
return shared_from_this();
}
bool Number::openForInput() const {
return false;
}
std::string Number::toString() const {
return std::to_string(val);
}