schema_editor/comdel/parser/astnode.cpp

18 lines
505 B
C++
Raw Normal View History

2022-03-29 19:31:45 +00:00
#include "astnode.h"
AstNode::~AstNode() = default;
NumberNode::NumberNode(std::string expression) {
if(expression.size() > 2) {
if(expression.substr(0, 2) == "0x") {
this->value = std::stoll(expression, 0, 16);
} else if(expression.substr(0, 2) == "0b") {
this->value = std::stoll(expression, 0, 2);
} else {
this->value = std::stoll(expression, 0, 10);
}
} else {
this->value = std::stoll(expression, 0, 10);
}
}