aboutsummaryrefslogtreecommitdiffstats
path: root/value.cpp
blob: 90b689bffa319cba13815a9edb92fc325f85ce7b (plain)
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
#include "value.h"
#include <string>

Value::Value(Token& token) {
    if (!token.isString())
        m_type = Value::Type::Integer;
        m_intData = std::stoi(token.getLexeme(), nullptr, 10);
    } else {
        m_type = Value::Type::String;
        m_strData = token.getLexeme();
    }
}


const Value::Type Value::getType() const {
    return m_type;
}

const int Value::getIntData() const {
    return m_intData;
}

const std::string& Value::getStrData() const {
    return m_strData;
}