19 #include <unordered_map>
21 #include <torquescript/interpreterconfiguration.hpp>
22 #include <torquescript/function.hpp>
23 #include <torquescript/consoleobject.hpp>
24 #include <torquescript/storedvalue.hpp>
25 #include <torquescript/stringhelpers.hpp>
26 #include <torquescript/stringtable.hpp>
27 #include <torquescript/functionregistry.hpp>
28 #include <torquescript/storedvaluestack.hpp>
29 #include <torquescript/consoleobjectregistry.hpp>
31 #define NAMESPACE_EMPTY ""
32 #define PACKAGE_EMPTY ""
67 void setGlobal(
const std::size_t name,
StoredValue value);
68 void setGlobal(
const std::string& name,
StoredValue value);
97 void evaluate(
const std::string& input, std::shared_ptr<ExecutionState> state =
nullptr);
98 void execute(
const std::string& path, std::shared_ptr<ExecutionState> state =
nullptr);
110 std::shared_ptr<Function> getFunction(
const std::string& space,
const std::string& name);
111 std::shared_ptr<Function> getFunctionParent(
Function*
function);
114 void addFunctionRegistry(
const std::string& packageName);
115 void activateFunctionRegistry(
const std::string& packageName);
116 void deactivateFunctionRegistry(
const std::string& packageName);
117 void removeFunctionRegistry(
const std::string& packageName);
120 std::shared_ptr<ExecutionState> getExecutionState();
142 template <
typename classType>
143 void registerConsoleObjectType()
154 std::vector<FunctionRegistry> mFunctionRegistries;
157 std::unordered_map<std::size_t, StoredValue> mGlobalVariables;
A CodeBlock defines a piece of executable code generated from a single input (Ie. a file)....
Definition: codeblock.hpp:37
Primary compiler class. This class is an AST visitor that walks the AST tree generated by a AST::ASTB...
Definition: compiler.hpp:35
Definition: consoleobjectregistry.hpp:38
A function is callable subroutine from anywhere in the language, defined by a script....
Definition: function.hpp:40
The interpreter class represents a high level instance of the TorqueScript interpreter....
Definition: interpreter.hpp:46
std::shared_ptr< ConsoleObject > initializeConsoleObjectTree(ObjectInstantiationDescriptor &descriptor)
Initializes the tree of objects described by the provided descriptor.
const InterpreterConfiguration mConfig
The interpreter configuration.
Definition: interpreter.hpp:129
ConsoleObjectRegistry mConsoleObjectRegistry
The ConsoleObjectRegistry associated with this interpreter. It is used to store all ConsoleObject ins...
Definition: interpreter.hpp:123
StoredValue * getGlobal(const std::string &name)
Retrieves a global variable by string.
StoredValue * getGlobal(const std::size_t name)
Retrieves a global variable by string ID.
CodeBlock * compile(const std::string &input)
Ask the interpreter to compile the input string and return the resulting CodeBlock.
StringTable mStringTable
The string table associated with this interpreter.
Definition: interpreter.hpp:126
void addFunction(std::shared_ptr< Function > function)
Registers a new function to the interpreter.
Interpreter(const InterpreterConfiguration &config)
Constructs a new interpreter with the specified configuration.
Storage class used to keep variable values in-memory of arbitrary data types. The data types supporte...
Definition: storedvalue.hpp:80
A string table maintains a mapping of numeric identifiers to their raw string values....
Definition: stringtable.hpp:32
A FunctionRegistry is used to keep track of registered functions in memory by the packages they are a...
Definition: functionregistry.hpp:33
A structure representing overall interpreter runtime configuration. Some settings can be changed at r...
Definition: interpreterconfiguration.hpp:26
Struct describing a tree of console object initializations.
Definition: executionscope.hpp:48