|
|
@ -2486,18 +2486,23 @@ inline void ReferenceChecker::visit(Reference& ope) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inline void LinkReferences::visit(Reference& ope) { |
|
|
|
inline void LinkReferences::visit(Reference& ope) { |
|
|
|
if (grammar_.count(ope.name_)) { |
|
|
|
// Check if the reference is a macro parameter
|
|
|
|
auto& rule = grammar_.at(ope.name_); |
|
|
|
auto found_param = false; |
|
|
|
ope.rule_ = &rule; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
for (size_t i = 0; i < params_.size(); i++) { |
|
|
|
for (size_t i = 0; i < params_.size(); i++) { |
|
|
|
const auto& param = params_[i]; |
|
|
|
const auto& param = params_[i]; |
|
|
|
if (param == ope.name_) { |
|
|
|
if (param == ope.name_) { |
|
|
|
ope.iarg_ = i; |
|
|
|
ope.iarg_ = i; |
|
|
|
|
|
|
|
found_param = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check if the reference is a definition rule
|
|
|
|
|
|
|
|
if (!found_param && grammar_.count(ope.name_)) { |
|
|
|
|
|
|
|
auto& rule = grammar_.at(ope.name_); |
|
|
|
|
|
|
|
ope.rule_ = &rule; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (auto arg: ope.args_) { |
|
|
|
for (auto arg: ope.args_) { |
|
|
|
arg->accept(*this); |
|
|
|
arg->accept(*this); |
|
|
|
} |
|
|
|
} |
|
|
|