Code cleanup.

This commit is contained in:
yhirose 2015-06-05 08:56:16 -04:00
parent 682417b410
commit 7583711c63

View File

@ -164,7 +164,7 @@ struct SemanticValue {
const T& get() const { const T& get() const {
return val.get<T>(); return val.get<T>();
} }
std::string str() const { std::string str() const {
return std::string(s, n); return std::string(s, n);
} }
@ -1563,10 +1563,10 @@ private:
const auto& name = sv[baseId].val.get<std::string>(); const auto& name = sv[baseId].val.get<std::string>();
auto ope = sv[baseId + 2].val.get<std::shared_ptr<Ope>>(); auto ope = sv[baseId + 2].val.get<std::shared_ptr<Ope>>();
auto& def = (*data.grammar)[name]; auto& rule = (*data.grammar)[name];
def <= ope; rule <= ope;
def.name = name; rule.name = name;
def.ignoreSemanticValue = ignore; rule.ignoreSemanticValue = ignore;
if (data.start.empty()) { if (data.start.empty()) {
data.start = name; data.start = name;
@ -1719,10 +1719,10 @@ private:
} }
if (!name.empty()) { if (!name.empty()) {
auto& def = grammar[name]; auto& rule = grammar[name];
def <= x.second; rule <= x.second;
def.name = name; rule.name = name;
def.ignoreSemanticValue = ignore; rule.ignoreSemanticValue = ignore;
} }
} }
@ -2076,8 +2076,8 @@ private:
void ast_end() { void ast_end() {
for (auto& x: *grammar_) { for (auto& x: *grammar_) {
const auto& name = x.first; const auto& name = x.first;
auto& def = x.second; auto& rule = x.second;
auto& action = def.actions.front(); auto& action = rule.actions.front();
if (!action) { if (!action) {
action = [name](const SemanticValues& sv) { action = [name](const SemanticValues& sv) {
if (sv.is_token()) { if (sv.is_token()) {