Fix issues with constructing name generators from Lua

This commit is contained in:
Celtic Minstrel 2016-07-12 10:43:10 -04:00
parent c39af95a44
commit 7e04c7f8e9
3 changed files with 3 additions and 2 deletions

View file

@ -191,7 +191,7 @@ static int intf_name_generator(lua_State *L)
if(lua_istable(L, 2)) {
input = lua_check<std::vector<std::string>>(L, 2);
} else {
input = utils::parenthetical_split(luaL_checkstring(L, 2));
input = utils::parenthetical_split(luaL_checkstring(L, 2), ',');
}
int chain_sz = luaL_optinteger(L, 3, 2);
int max_len = luaL_optinteger(L, 4, 12);

View file

@ -243,6 +243,7 @@ namespace lua_check_impl
{
lua_rawgeti(L, n, i);
res.push_back(lua_check_impl::lua_check<typename remove_constref<typename T::reference>::type>(L, -1));
lua_pop(L, 1);
}
return res;
}

View file

@ -97,10 +97,10 @@ context_free_grammar_generator::context_free_grammar_generator(const std::map<st
for(auto rule : source) {
std::string key = rule.first; // Need to do this because utils::strip is mutating
key = utils::strip(key);
std::string buf;
for(std::string str : rule.second) {
nonterminals_[key].possibilities_.emplace_back();
std::vector<std::string>* filled = &nonterminals_[key].possibilities_.back();
std::string buf;
// A little code duplication here...
for(char c : str) {
if (c == '{') {