diff --git a/src/debug/console.cpp b/src/debug/command-interpreter.cpp
similarity index 80%
rename from src/debug/console.cpp
rename to src/debug/command-interpreter.cpp
index e8cce02..4060637 100644
--- a/src/debug/console.cpp
+++ b/src/debug/command-interpreter.cpp
@@ -17,7 +17,7 @@
* along with Antkeeper Source Code. If not, see .
*/
-#include "console.hpp"
+#include "command-interpreter.hpp"
#include
template<>
@@ -64,15 +64,15 @@ std::string ArgumentParser::parse(const std::string& argument)
void CommandInterpreter::set(const std::string& name, const std::string& value)
{
- variables[name] = value;
+ variableMap[name] = value;
}
void CommandInterpreter::unset(const std::string& name)
{
- auto it = variables.find(name);
- if (it != variables.end())
+ auto it = variableMap.find(name);
+ if (it != variableMap.end())
{
- variables.erase(it);
+ variableMap.erase(it);
}
}
@@ -81,6 +81,11 @@ const std::map& CommandInterpreter::help() const
return helpStrings;
}
+const std::map& CommandInterpreter::variables() const
+{
+ return variableMap;
+}
+
std::tuple, std::function> CommandInterpreter::interpret(const std::string& line)
{
// Split line into arguments
@@ -103,7 +108,7 @@ std::tuple, std::function> Command
if (!argument.empty() && argument[0] == '$')
{
std::string variableName = argument.substr(1);
- std::string variableValue = variables[variableName];
+ std::string variableValue = variableMap[variableName];
argument = variableValue;
}
}
@@ -114,21 +119,6 @@ std::tuple, std::function> Command
// Remove command name from arguments
arguments.erase(arguments.begin());
- // Check command name for member access operator '.'
- std::size_t dotOperatorPosition = commandName.find('.');
- if (dotOperatorPosition != std::string::npos)
- {
- // Get variable name and lookup value
- std::string variableName = commandName.substr(0, dotOperatorPosition);
- std::string variableValue = variables[variableName];
-
- // Insert variable value at front of the argument vector
- arguments.insert(arguments.begin(), variableValue);
-
- // Remove variable name from command name
- commandName = commandName.substr(dotOperatorPosition + 1);
- }
-
// Find command linker for this command
auto linker = linkers.find(commandName);
if (linker == linkers.end())
diff --git a/src/debug/console.hpp b/src/debug/command-interpreter.hpp
similarity index 95%
rename from src/debug/console.hpp
rename to src/debug/command-interpreter.hpp
index d13b4eb..a866e0a 100644
--- a/src/debug/console.hpp
+++ b/src/debug/command-interpreter.hpp
@@ -17,8 +17,8 @@
* along with Antkeeper Source Code. If not, see .
*/
-#ifndef CONSOLE_HPP
-#define CONSOLE_HPP
+#ifndef COMMAND_INTERPRETER_HPP
+#define COMMAND_INTERPRETER_HPP
#include
#include