2020-08-09 00:31:18 -07:00
|
|
|
#ifndef POLSERVER_COMPILEDSCRIPT_H
|
|
|
|
|
#define POLSERVER_COMPILEDSCRIPT_H
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2021-02-25 16:53:22 +01:00
|
|
|
#include "bscript/compiler/representation/DebugStore.h"
|
2020-09-12 14:26:58 -07:00
|
|
|
|
2020-08-10 03:20:29 -07:00
|
|
|
namespace Pol::Bscript
|
2020-08-09 00:31:18 -07:00
|
|
|
{
|
|
|
|
|
class StoredToken;
|
2020-08-10 03:20:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Pol::Bscript::Compiler
|
2020-08-09 00:31:18 -07:00
|
|
|
{
|
|
|
|
|
class ExportedFunction;
|
2024-08-06 20:29:02 +02:00
|
|
|
class FunctionReferenceDescriptor;
|
2020-08-09 00:31:18 -07:00
|
|
|
class SourceFileIdentifier;
|
|
|
|
|
class ModuleDescriptor;
|
2024-08-19 19:57:31 +02:00
|
|
|
class ClassDescriptor;
|
2020-08-09 00:31:18 -07:00
|
|
|
|
|
|
|
|
using CodeSection = std::vector<StoredToken>;
|
2020-08-11 01:46:35 -07:00
|
|
|
using DataSection = std::vector<std::byte>;
|
2020-08-09 00:31:18 -07:00
|
|
|
using ExportedFunctions = std::vector<ExportedFunction>;
|
2024-08-06 20:29:02 +02:00
|
|
|
using FunctionReferences = std::vector<FunctionReferenceDescriptor>;
|
2020-08-09 00:31:18 -07:00
|
|
|
using ModuleDescriptors = std::vector<ModuleDescriptor>;
|
2024-08-19 19:57:31 +02:00
|
|
|
using ClassDescriptors = std::vector<ClassDescriptor>;
|
2020-08-09 00:31:18 -07:00
|
|
|
using SourceFileIdentifiers = std::vector<std::unique_ptr<SourceFileIdentifier>>;
|
|
|
|
|
|
|
|
|
|
class CompiledScript
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct ProgramInfo
|
|
|
|
|
{
|
|
|
|
|
const unsigned parameter_count;
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-06 20:29:02 +02:00
|
|
|
CompiledScript( CodeSection code_section, DataSection data_section, DebugStore debug,
|
2020-08-09 00:31:18 -07:00
|
|
|
ExportedFunctions exported_functions,
|
2024-08-06 20:29:02 +02:00
|
|
|
std::vector<std::string> global_variable_names, ModuleDescriptors modules,
|
2024-08-19 19:57:31 +02:00
|
|
|
FunctionReferences function_references, ClassDescriptors class_descriptors,
|
2025-07-23 23:00:34 +02:00
|
|
|
std::unique_ptr<ProgramInfo>, SourceFileIdentifiers, std::string tree );
|
2020-08-09 00:31:18 -07:00
|
|
|
~CompiledScript();
|
|
|
|
|
CompiledScript( const CompiledScript& ) = delete;
|
|
|
|
|
CompiledScript& operator=( const CompiledScript& ) = delete;
|
|
|
|
|
|
|
|
|
|
const CodeSection code;
|
|
|
|
|
const DataSection data;
|
2020-09-12 14:26:58 -07:00
|
|
|
const DebugStore debug;
|
2020-08-09 00:31:18 -07:00
|
|
|
const ExportedFunctions exported_functions;
|
|
|
|
|
const std::vector<std::string> global_variable_names;
|
|
|
|
|
const ModuleDescriptors module_descriptors;
|
2024-08-06 20:29:02 +02:00
|
|
|
const FunctionReferences function_references;
|
2024-08-19 19:57:31 +02:00
|
|
|
const ClassDescriptors class_descriptors;
|
2020-08-09 00:31:18 -07:00
|
|
|
const std::unique_ptr<ProgramInfo> program_info;
|
|
|
|
|
const SourceFileIdentifiers source_file_identifiers;
|
2025-07-23 23:00:34 +02:00
|
|
|
const std::string tree;
|
2020-08-09 00:31:18 -07:00
|
|
|
};
|
|
|
|
|
|
2020-08-10 03:20:29 -07:00
|
|
|
} // namespace Pol::Bscript::Compiler
|
2020-08-09 00:31:18 -07:00
|
|
|
|
|
|
|
|
#endif // POLSERVER_COMPILEDSCRIPT_H
|