39 lines
788 B
C++
39 lines
788 B
C++
#pragma once
|
|
#include <vector>
|
|
#include <variant>
|
|
#include <string>
|
|
#include "Common.h"
|
|
|
|
namespace NVL::Parse {
|
|
enum class Type { Symbol, Number, String, Array, Subexpression };
|
|
|
|
class Object { // TODO make constructors to prevent possibility of type/value mismatch
|
|
public:
|
|
Type type;
|
|
std::variant<
|
|
Number,
|
|
std::string,
|
|
std::vector<Object>
|
|
> value;
|
|
};
|
|
|
|
using Command = std::vector<Object>;
|
|
|
|
class Scene {
|
|
std::string name;
|
|
std::vector<Command> commands{};
|
|
public:
|
|
Scene(const std::string& name) : name(name) {}
|
|
void append(const Command& c) {
|
|
commands.push_back(c);
|
|
}
|
|
void append(Command&& c) {
|
|
commands.push_back(std::move(c));
|
|
}
|
|
const auto& get() const {
|
|
return commands;
|
|
}
|
|
};
|
|
|
|
std::vector<Scene> ParseFile(const std::string& path);
|
|
}
|