aboutsummaryrefslogtreecommitdiffstats
path: root/value.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'value.cpp')
-rw-r--r--value.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/value.cpp b/value.cpp
index acf80ce..90b689b 100644
--- a/value.cpp
+++ b/value.cpp
@@ -1,14 +1,13 @@
#include "value.h"
#include <string>
-Value::Value(std::string& lexeme) {
- if (lexeme.find_first_not_of("0123456789")) {
+Value::Value(Token& token) {
+ if (!token.isString())
m_type = Value::Type::Integer;
- m_intData = std::stoi(lexeme, nullptr, 10);
- }
- else {
+ m_intData = std::stoi(token.getLexeme(), nullptr, 10);
+ } else {
m_type = Value::Type::String;
- m_strData = lexeme;
+ m_strData = token.getLexeme();
}
}