mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-11-13 22:55:29 +00:00
Code cleanup.
This commit is contained in:
parent
50ea1858c1
commit
91fe3b755c
@ -369,7 +369,7 @@ auto syntax = R"(
|
||||
|
||||
Rules additional_rules = {
|
||||
{
|
||||
"NAME", usr([](const char* s, size_t n, SemanticValues& sv, any& c) -> size_t {
|
||||
"NAME", usr([](const char* s, size_t n, SemanticValues& sv, any& dt) -> size_t {
|
||||
static vector<string> names = { "PEG", "BNF" };
|
||||
for (const auto& name: names) {
|
||||
if (name.size() <= n && !name.compare(0, name.size(), s, name.size())) {
|
||||
|
12
peglib.h
12
peglib.h
@ -2058,7 +2058,7 @@ private:
|
||||
}
|
||||
|
||||
// Check duplicated definitions
|
||||
bool ret = data.duplicates.empty();;
|
||||
bool ret = data.duplicates.empty();
|
||||
|
||||
for (const auto& x: data.duplicates) {
|
||||
if (log) {
|
||||
@ -2404,7 +2404,7 @@ public:
|
||||
if (grammar_ != nullptr) {
|
||||
const auto& rule = (*grammar_)[start_];
|
||||
auto r = rule.parse(s, n, path);
|
||||
output_log(s, n, log, r);
|
||||
output_log(s, n, r);
|
||||
return r.ret && r.len == n;
|
||||
}
|
||||
return false;
|
||||
@ -2419,7 +2419,7 @@ public:
|
||||
if (grammar_ != nullptr) {
|
||||
const auto& rule = (*grammar_)[start_];
|
||||
auto r = rule.parse(s, n, dt, path);
|
||||
output_log(s, n, log, r);
|
||||
output_log(s, n, r);
|
||||
return r.ret && r.len == n;
|
||||
}
|
||||
return false;
|
||||
@ -2435,7 +2435,7 @@ public:
|
||||
if (grammar_ != nullptr) {
|
||||
const auto& rule = (*grammar_)[start_];
|
||||
auto r = rule.parse_and_get_value(s, n, val, path);
|
||||
output_log(s, n, log, r);
|
||||
output_log(s, n, r);
|
||||
return r.ret && r.len == n;
|
||||
}
|
||||
return false;
|
||||
@ -2452,7 +2452,7 @@ public:
|
||||
if (grammar_ != nullptr) {
|
||||
const auto& rule = (*grammar_)[start_];
|
||||
auto r = rule.parse_and_get_value(s, n, dt, val, path);
|
||||
output_log(s, n, log, r);
|
||||
output_log(s, n, r);
|
||||
return r.ret && r.len == n;
|
||||
}
|
||||
return false;
|
||||
@ -2538,7 +2538,7 @@ public:
|
||||
Log log;
|
||||
|
||||
private:
|
||||
void output_log(const char* s, size_t n, Log log, const Definition::Result& r) const {
|
||||
void output_log(const char* s, size_t n, const Definition::Result& r) const {
|
||||
if (log) {
|
||||
if (!r.ret) {
|
||||
if (r.message_pos) {
|
||||
|
Loading…
Reference in New Issue
Block a user