2010-06-28 14:48:19 +00:00
|
|
|
#include "literals.hpp"
|
|
|
|
|
|
|
|
#include <algorithm>
|
2023-01-10 03:10:18 +00:00
|
|
|
#include <cstring>
|
2010-06-28 14:48:19 +00:00
|
|
|
|
|
|
|
namespace Compiler
|
|
|
|
{
|
|
|
|
int Literals::addInteger(Interpreter::Type_Integer value)
|
|
|
|
{
|
|
|
|
int index = static_cast<int>(mIntegers.size());
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
mIntegers.push_back(value);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Literals::addFloat(Interpreter::Type_Float value)
|
|
|
|
{
|
|
|
|
int index = static_cast<int>(mFloats.size());
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
mFloats.push_back(value);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Literals::addString(const std::string& value)
|
|
|
|
{
|
|
|
|
int index = static_cast<int>(mStrings.size());
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
mStrings.push_back(value);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Literals::clear()
|
|
|
|
{
|
|
|
|
mIntegers.clear();
|
|
|
|
mFloats.clear();
|
|
|
|
mStrings.clear();
|
|
|
|
}
|
|
|
|
}
|