Major string_view refactor. Added namespace sv
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
#include "eng-malloc.hpp"
|
||||
#include "luastack.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
|
||||
#include "eng-malloc.hpp"
|
||||
#include "luastack.hpp"
|
||||
#include "luaconsole.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
@@ -53,7 +52,7 @@ void LuaConsole::simplify(const StringVec &words) {
|
||||
words_ = words;
|
||||
if (words.size() == 0) {
|
||||
return;
|
||||
} else if (util::valid_int64(words[0])) {
|
||||
} else if (sv::valid_int64(words[0])) {
|
||||
if (words.size() == 1) {
|
||||
words_.clear();
|
||||
words_.push_back("choose");
|
||||
@@ -62,7 +61,7 @@ void LuaConsole::simplify(const StringVec &words) {
|
||||
synerr("/choose command takes no arguments");
|
||||
}
|
||||
} else if (words[0] == "choose") {
|
||||
if ((words.size() == 2)&&(util::valid_int64(words[1]))) {
|
||||
if ((words.size() == 2)&&(sv::valid_int64(words[1]))) {
|
||||
// OK
|
||||
} else {
|
||||
synerr("/choose [menu-line-number]");
|
||||
@@ -74,7 +73,7 @@ void LuaConsole::simplify(const StringVec &words) {
|
||||
} else if (words[0] == "menu") {
|
||||
if (words.size() == 1) {
|
||||
words_.push_back("-");
|
||||
} else if ((words.size() == 2)&&(util::valid_int64(words[1]))) {
|
||||
} else if ((words.size() == 2)&&(sv::valid_int64(words[1]))) {
|
||||
// OK
|
||||
} else {
|
||||
synerr("/menu [optional-tangible-id]");
|
||||
@@ -126,13 +125,13 @@ void LuaConsole::add(eng::string line) {
|
||||
// Translate lua expression, deal with initial prefix.
|
||||
eng::string partial;
|
||||
eng::string lua_mode;
|
||||
if (util::has_prefix(raw_input_, "?=")) {
|
||||
if (sv::has_prefix(raw_input_, "?=")) {
|
||||
lua_mode = "luaprobe";
|
||||
partial = eng::string("return ") + raw_input_.substr(2);
|
||||
} else if (util::has_prefix(raw_input_, "?")) {
|
||||
} else if (sv::has_prefix(raw_input_, "?")) {
|
||||
lua_mode = "luaprobe";
|
||||
partial = raw_input_.substr(1);
|
||||
} else if (util::has_prefix(raw_input_, "=")) {
|
||||
} else if (sv::has_prefix(raw_input_, "=")) {
|
||||
lua_mode = "luainvoke";
|
||||
partial = eng::string("return ") + raw_input_.substr(1);
|
||||
} else {
|
||||
@@ -157,7 +156,7 @@ void LuaConsole::add(eng::string line) {
|
||||
}
|
||||
} else {
|
||||
words_.push_back(lua_mode);
|
||||
words_.push_back(util::rtrim(partial));
|
||||
words_.emplace_back(sv::rtrim(partial));
|
||||
clear_raw_input();
|
||||
}
|
||||
lua_settop(lua_state_, top);
|
||||
|
||||
Reference in New Issue
Block a user