update version, code style

This commit is contained in:
pantor
2020-04-10 15:58:05 +02:00
parent c2c95a4871
commit 8f2fac5d4d
5 changed files with 25 additions and 9 deletions
+10 -3
View File
@@ -55,7 +55,9 @@ class FunctionStorage {
FunctionData& get_or_new(nonstd::string_view name, unsigned int num_args) {
auto &vec = m_map[static_cast<std::string>(name)];
for (auto &i: vec) {
if (i.num_args == num_args) return i;
if (i.num_args == num_args) {
return i;
}
}
vec.emplace_back();
vec.back().num_args = num_args;
@@ -64,9 +66,14 @@ class FunctionStorage {
const FunctionData* get(nonstd::string_view name, unsigned int num_args) const {
auto it = m_map.find(static_cast<std::string>(name));
if (it == m_map.end()) return nullptr;
if (it == m_map.end()) {
return nullptr;
}
for (auto &&i: it->second) {
if (i.num_args == num_args) return &i;
if (i.num_args == num_args) {
return &i;
}
}
return nullptr;
}
+4 -1
View File
@@ -182,7 +182,10 @@ class Lexer {
}
m_pos = m_tok_start + 1;
if (std::isalpha(ch)) return scan_id();
if (std::isalpha(ch)) {
return scan_id();
}
switch (ch) {
case ',':
return make_token(Token::Kind::Comma);