71 lines
1.1 KiB
C++
71 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <regex>
|
|
#include <variant>
|
|
|
|
|
|
namespace NVL
|
|
{
|
|
struct Token
|
|
{
|
|
std::string Identifier;
|
|
|
|
void Print();
|
|
};
|
|
|
|
struct Object
|
|
{
|
|
std::variant<
|
|
Token,
|
|
float,
|
|
std::string,
|
|
bool,
|
|
std::vector<Object> // Implies Object can be an array of other Object
|
|
> Value;
|
|
|
|
void Print(int indent);
|
|
|
|
};
|
|
|
|
struct Call
|
|
{
|
|
std::vector<Object> Objects;
|
|
void Print(int indent);
|
|
};
|
|
|
|
struct Sequence
|
|
{
|
|
std::string Name;
|
|
std::vector<Call> Calls;
|
|
|
|
Sequence(std::string n) : Name(n)
|
|
{}
|
|
|
|
void Print(int indent);
|
|
};
|
|
|
|
struct Tree
|
|
{
|
|
std::vector<Sequence> Sequences;
|
|
void Print(int indent);
|
|
};
|
|
|
|
struct Context {
|
|
std::vector<std::variant<
|
|
std::shared_ptr<Tree>,
|
|
std::shared_ptr<Sequence>,
|
|
std::shared_ptr<Call>,
|
|
std::shared_ptr<Object>
|
|
>> Scope_Hierarchy;
|
|
};
|
|
|
|
void parse_NVL(Tree& root, std::string path);
|
|
|
|
void parse_Sequence(Context context, std::ifstream& nvl);
|
|
|
|
void parse_Call(Context context, std::ifstream& nvl, std::streampos end_pos);
|
|
}
|