nw::script::Nss

struct Nss

Public Functions

explicit Nss(const std::filesystem::path &filename, Context *ctx, bool command_script = false)
explicit Nss(StringView script, Context *ctx, bool command_script = false)
explicit Nss(ResourceData data, Context *ctx, bool command_script = false)
void add_diagnostic(Diagnostic diagnostic)

Add diagnostic to script.

Ast &ast()

Gets parsed AST.

const Ast &ast() const

Gets parsed ast.

void complete(const String &needle, CompletionContext &out, bool no_filter = false) const

Generates a list of potential completions (excluding dependencies)

void complete_at(const String &needle, size_t line, size_t character, CompletionContext &out, bool no_filter = false)

Get all completions (including dependencies)

void complete_dot(const String &needle, size_t line, size_t character, Vector<Symbol> &out, bool no_filter = false)

Get all completions (including dependencies)

Context *ctx() const

Script context.

Symbol declaration_to_symbol(const Declaration *decl) const

Converts declaration to symbol

Note

Declaration must be in script

Vector<String> dependencies() const

Returns all transitive dependencies in ‘preprocessed’ order, i.e. dependencies()[n] was include before dependencies()[n+1]

const Vector<Diagnostic> &diagnostics() const noexcept

Gets script diagnostics.

inline size_t errors() const noexcept

Returns how many errors were found during parsing.

inline immer::map<String, Export> exports() const noexcept

Table of symbols exported from script.

inline size_t export_count() const noexcept

Count of symbols exported from script.

inline void increment_errors() noexcept

Increments error count.

inline void increment_warnings() noexcept

Increments warning count.

Vector<InlayHint> inlay_hints(SourceRange range)
inline bool is_command_script() const noexcept

Is script a command script.

Symbol locate_export(const String &symbol, bool is_type, bool search_dependencies = false) const

Locate export, i.e. a top level symbols.

Symbol locate_symbol(const String &symbol, size_t line, size_t character)

Locate symbol in source file.

StringView name() const noexcept

Script name.

void parse()

Parses script file.

void process_includes(Nss *parent = nullptr)

Process includes recursively.

void resolve()

Resolves and type checks the Ast.

void set_name(const String &new_name)

Sets a scripts name.

SignatureHelp signature_help(size_t line, size_t character)
StringView text() const noexcept

Gets text of script.

StringView view_from_range(SourceRange range) const noexcept

Gets a view of source file in specified range.

inline size_t warnings() const noexcept

Returns how many warnings were found during parsing.