2020-08-10 00:42:37 -07:00
|
|
|
#ifndef POLSERVER_COMPILERWORKSPACE_H
|
|
|
|
|
#define POLSERVER_COMPILERWORKSPACE_H
|
|
|
|
|
|
2020-09-11 00:16:20 -07:00
|
|
|
#include <map>
|
2020-08-10 00:42:37 -07:00
|
|
|
#include <memory>
|
2020-08-11 00:08:48 -07:00
|
|
|
#include <string>
|
2020-08-10 00:42:37 -07:00
|
|
|
#include <vector>
|
|
|
|
|
|
2020-09-11 00:16:20 -07:00
|
|
|
#include "clib/maputil.h"
|
2021-02-25 16:53:22 +01:00
|
|
|
#include "bscript/compiler/analyzer/Constants.h"
|
|
|
|
|
#include "bscript/compiler/ast/Node.h"
|
2020-09-01 00:54:24 -07:00
|
|
|
|
2020-08-10 03:20:29 -07:00
|
|
|
namespace Pol::Bscript::Compiler
|
2020-08-10 00:42:37 -07:00
|
|
|
{
|
2020-08-23 15:01:39 -07:00
|
|
|
class Block;
|
2020-09-01 00:54:24 -07:00
|
|
|
class ConstDeclaration;
|
2020-08-23 15:01:39 -07:00
|
|
|
class ModuleFunctionDeclaration;
|
2020-08-28 22:45:07 -07:00
|
|
|
class Program;
|
2020-09-01 00:54:24 -07:00
|
|
|
class Report;
|
2020-08-14 13:54:20 -07:00
|
|
|
class SourceFile;
|
2020-08-10 00:42:37 -07:00
|
|
|
class SourceFileIdentifier;
|
2020-08-17 22:53:03 -07:00
|
|
|
class TopLevelStatements;
|
2020-08-31 18:46:27 -07:00
|
|
|
class UserFunction;
|
2020-08-10 00:42:37 -07:00
|
|
|
|
|
|
|
|
class CompilerWorkspace
|
|
|
|
|
{
|
|
|
|
|
public:
|
2020-09-01 00:54:24 -07:00
|
|
|
explicit CompilerWorkspace( Report& );
|
2020-08-10 00:42:37 -07:00
|
|
|
~CompilerWorkspace();
|
|
|
|
|
|
2020-09-01 00:54:24 -07:00
|
|
|
void accept( NodeVisitor& );
|
|
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<ConstDeclaration>> const_declarations;
|
|
|
|
|
Constants constants;
|
|
|
|
|
|
2020-08-17 22:53:03 -07:00
|
|
|
std::unique_ptr<TopLevelStatements> top_level_statements;
|
2020-08-23 15:01:39 -07:00
|
|
|
std::vector<std::unique_ptr<ModuleFunctionDeclaration>> module_function_declarations;
|
2020-08-31 18:46:27 -07:00
|
|
|
std::vector<std::unique_ptr<UserFunction>> user_functions;
|
2020-08-28 22:45:07 -07:00
|
|
|
std::unique_ptr<Program> program;
|
2020-08-17 22:53:03 -07:00
|
|
|
|
2020-08-24 01:47:38 -07:00
|
|
|
// These reference ModuleFunctionDeclaration objects that are in module_functions
|
|
|
|
|
std::vector<ModuleFunctionDeclaration*> referenced_module_function_declarations;
|
|
|
|
|
|
2020-08-10 00:42:37 -07:00
|
|
|
std::vector<std::unique_ptr<SourceFileIdentifier>> referenced_source_file_identifiers;
|
2020-08-11 00:08:48 -07:00
|
|
|
|
2020-09-11 00:16:20 -07:00
|
|
|
std::map<std::string, SourceLocation, Clib::ci_cmp_pred> all_function_locations;
|
|
|
|
|
|
2020-08-11 00:08:48 -07:00
|
|
|
std::vector<std::string> global_variable_names;
|
2020-08-10 00:42:37 -07:00
|
|
|
};
|
|
|
|
|
|
2020-08-10 03:20:29 -07:00
|
|
|
} // namespace Pol::Bscript::Compiler
|
2020-08-10 00:42:37 -07:00
|
|
|
|
|
|
|
|
#endif // POLSERVER_COMPILERWORKSPACE_H
|