Skip to content

Commit

Permalink
Remove whitespace problem with commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Borja Lorente committed Apr 12, 2017
1 parent 417be91 commit 681f66b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion interpreter/src/frontends/ConsoleFrontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

#include "ConsoleFrontend.h"
#include <regex>

namespace naylang {
void ConsoleFrontend::runCommand(std::string line) {
Expand All @@ -12,7 +13,7 @@ void ConsoleFrontend::runCommand(std::string line) {

void ConsoleFrontend::setCommand(std::string line) {
auto commandName = line.substr(0, line.find(" "));
auto code = line.substr(line.find(" ") + 1);
auto code = std::regex_replace(line.substr(line.find(" ")), std::regex("^ +"), "");
if (commandName == "exec" || commandName == "e") {
_command = std::make_unique<ExecCommand>(code);
} else if (commandName == "load" || commandName == "l") {
Expand Down

0 comments on commit 681f66b

Please sign in to comment.