46 lines
927 B
C++
46 lines
927 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 {
|
|
public:
|
|
Object() = delete;
|
|
Object(const Number& v);
|
|
Object(Type t, const String& v);
|
|
Object(Type t, const std::vector<Object>& v);
|
|
Object(Number&& v);
|
|
Object(Type t, String&& v);
|
|
Object(Type t, std::vector<Object>&& v);
|
|
Type type;
|
|
std::variant<
|
|
Number,
|
|
String,
|
|
std::vector<Object>
|
|
> value;
|
|
};
|
|
|
|
using Command = std::vector<Object>;
|
|
|
|
class Scene {
|
|
String name;
|
|
std::vector<Command> commands{};
|
|
public:
|
|
Scene(const 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);
|
|
}
|