aboutsummaryrefslogtreecommitdiffstats
path: root/value.cpp
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2016-08-31 20:05:10 +0000
committerJan Tuomi <jans.tuomi@gmail.com>2016-08-31 20:05:10 +0000
commitc4cae690deddcb8a7fc6a537816e832525ca0e86 (patch)
tree42a78dedb03d776e3945c1729a2e4b1d264ef2ed /value.cpp
parent1ba5c17a68f13633d6a20785c722b22032ba45c4 (diff)
Develop runtime
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();
}
}