NouVeL/NVL/Parser.h

40 lines
716 B
C
Raw Normal View History

2021-05-14 11:47:54 -04:00
#pragma once
2021-12-17 01:05:38 -05:00
#include <vector>
#include <variant>
2021-05-14 11:47:54 -04:00
#include <string>
2021-12-17 01:05:38 -05:00
#include "Common.h"
2021-05-14 16:51:04 -04:00
2021-12-17 01:05:38 -05:00
namespace NVL::Parse {
enum class Type { Symbol, Number, String, Array, Subexpression };
class Object {
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);
2021-12-13 14:04:12 -05:00
}