nw::script::Context

struct Context

Public Functions

Context(Vector<String> include_paths = {}, String command_script = "nwscript")
virtual ~Context() = default
void add_include_path(const std::filesystem::path &path)

Adds include path to internal resman.

Nss *get(Resref resref, bool command_script = false)

Gets a script from internal resman.

inline const Nss *command_script() const noexcept

Gets command script.

virtual void register_default_types()
virtual void register_engine_types()
size_t type_id(StringView type_name, bool define = false)
size_t type_id(Type type_name, bool define = false)
StringView type_name(size_t type_id)
virtual size_t type_check_binary_op(NssToken op, size_t lhs, size_t rhs)
virtual bool is_type_convertible(size_t lhs, size_t rhs)
virtual void lexical_diagnostic(Nss *script, StringView msg, bool is_warning, SourceRange range)
virtual void parse_diagnostic(Nss *script, StringView msg, bool is_warning, SourceRange range)
virtual void semantic_diagnostic(Nss *script, StringView msg, bool is_warning, SourceRange range)

Public Members

MemoryArena arena
MemoryScope scope
Vector<String> include_paths_
absl::flat_hash_map<Resource, std::unique_ptr<Nss>> dependencies_
Vector<IncludeStackEntry> include_stack_
Vector<IncludeStackEntry> preprocessed_
ResourceManager resman_
String command_script_name_
Nss *command_script_ = nullptr
absl::flat_hash_map<String, size_t> type_map_
Vector<String> type_array_
Vector<StructDecl*> struct_stack_