diff --git a/example/calc.cc b/example/calc.cc index a8d9a23..6de3dd0 100644 --- a/example/calc.cc +++ b/example/calc.cc @@ -16,7 +16,7 @@ int main(void) { %whitespace <- [ \t]* )"); - assert((bool)parser == true); + assert(static_cast(parser) == true); // (3) Setup actions parser["Additive"] = [](const SemanticValues& sv) { diff --git a/lint/peglint.cc b/lint/peglint.cc index 9b0fa46..14423cc 100644 --- a/lint/peglint.cc +++ b/lint/peglint.cc @@ -11,7 +11,7 @@ using namespace std; -bool read_file(const char* path, vector& buff) +inline bool read_file(const char* path, vector& buff) { ifstream ifs(path, ios::in | ios::binary); if (ifs.fail()) { @@ -128,13 +128,13 @@ int main(int argc, const char** argv) const peg::any& /*dt*/, size_t len) { auto pos = static_cast(s - c.s); - if (len != -1) { + if (len != static_cast(-1)) { pos += len; } string indent; auto level = c.trace_ids.size() - 1; while (level--) { indent += "│"; } - auto ret = len != -1 ? "└o " : "└x "; + auto ret = len != static_cast(-1) ? "└o " : "└x "; std::stringstream choice; if (sv.choice_count() > 0) { choice << " " << sv.choice() << "/" << sv.choice_count(); diff --git a/peglib.h b/peglib.h index 22fef39..cae4d6d 100644 --- a/peglib.h +++ b/peglib.h @@ -3143,7 +3143,6 @@ private: }; g["Loop"] = [&](const SemanticValues &sv) { - std::pair dummy; switch (sv.choice()) { case 0: // Option return Loop{Loop::Type::opt, std::pair()}; diff --git a/test/test3.cc b/test/test3.cc index 529e96e..377864e 100644 --- a/test/test3.cc +++ b/test/test3.cc @@ -3,13 +3,13 @@ using namespace peg; -bool exact(Grammar& g, const char* d, const char* s) { +inline bool exact(Grammar& g, const char* d, const char* s) { auto n = strlen(s); auto r = g[d].parse(s, n); return r.ret && r.len == n; } -Grammar& make_peg_grammar() { +inline Grammar& make_peg_grammar() { return ParserGenerator::grammar(); }