Migrate token_infos inside token_for_string and reformat

This commit is contained in:
ridiculousfish 2018-11-03 12:16:56 -07:00
parent e1c0ab8edb
commit cf01694def

View File

@ -116,8 +116,9 @@ struct token_info_t {
unsigned int flags;
};
static const std::map<wcstring, const token_info_t> token_infos =
{{L"", {test_unknown, 0}},
const token_info_t * const token_for_string(const wcstring &str) {
static const std::map<wcstring, const token_info_t> token_infos = {
{L"", {test_unknown, 0}},
{L"!", {test_bang, 0}},
{L"-b", {test_filetype_b, UNARY_PRIMARY}},
{L"-c", {test_filetype_c, UNARY_PRIMARY}},
@ -153,7 +154,6 @@ struct token_info_t {
{L"(", {test_paren_open, 0}},
{L")", {test_paren_close, 0}}};
const token_info_t * const token_for_string(const wcstring &str) {
auto t = token_infos.find(str);
if (t != token_infos.end()) return &t->second;
return &token_infos.find(L"")->second;