2010-06-28 14:48:19 +00:00
|
|
|
#ifndef COMPILER_LITERALS_H_INCLUDED
|
|
|
|
#define COMPILER_LITERALS_H_INCLUDED
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <components/interpreter/types.hpp>
|
|
|
|
|
|
|
|
namespace Compiler
|
|
|
|
{
|
|
|
|
/// \brief Literal values.
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
class Literals
|
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
std::vector<Interpreter::Type_Integer> mIntegers;
|
|
|
|
std::vector<Interpreter::Type_Float> mFloats;
|
|
|
|
std::vector<std::string> mStrings;
|
|
|
|
|
|
|
|
public:
|
2023-01-10 03:10:18 +00:00
|
|
|
const std::vector<Interpreter::Type_Integer>& getIntegers() const { return mIntegers; }
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2023-01-10 03:10:18 +00:00
|
|
|
const std::vector<Interpreter::Type_Float>& getFloats() const { return mFloats; }
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2023-01-10 03:10:18 +00:00
|
|
|
const std::vector<std::string>& getStrings() const { return mStrings; }
|
2022-09-22 18:26:05 +00:00
|
|
|
|
|
|
|
int addInteger(Interpreter::Type_Integer value);
|
|
|
|
///< add integer liternal and return index.
|
|
|
|
|
|
|
|
int addFloat(Interpreter::Type_Float value);
|
|
|
|
///< add float literal and return value.
|
|
|
|
|
|
|
|
int addString(const std::string& value);
|
|
|
|
///< add string literal and return value.
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
///< remove all literals.
|
2010-06-28 14:48:19 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|