Code cleanup.

pull/3/head
yhirose 9 years ago
parent 682417b410
commit 7583711c63
  1. 22
      peglib.h

@ -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()) {

Loading…
Cancel
Save