Skip to content

Commit

Permalink
Fix #285 (Warnings due to -Woverloaded-virtual)
Browse files Browse the repository at this point in the history
  • Loading branch information
yhirose committed Nov 20, 2023
1 parent 6c1089b commit bd0e43e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions peglib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,8 @@ struct Ope::Visitor {
};

struct TraceOpeName : public Ope::Visitor {
using Ope::Visitor::visit;

void visit(Sequence &) override { name_ = "Sequence"; }
void visit(PrioritizedChoice &) override { name_ = "PrioritizedChoice"; }
void visit(Repetition &) override { name_ = "Repetition"; }
Expand Down Expand Up @@ -1723,6 +1725,8 @@ struct TraceOpeName : public Ope::Visitor {
};

struct AssignIDToDefinition : public Ope::Visitor {
using Ope::Visitor::visit;

void visit(Sequence &ope) override {
for (auto op : ope.opes_) {
op->accept(*this);
Expand Down Expand Up @@ -1751,6 +1755,8 @@ struct AssignIDToDefinition : public Ope::Visitor {
};

struct IsLiteralToken : public Ope::Visitor {
using Ope::Visitor::visit;

void visit(PrioritizedChoice &ope) override {
for (auto op : ope.opes_) {
if (!IsLiteralToken::check(*op)) { return; }
Expand All @@ -1772,6 +1778,8 @@ struct IsLiteralToken : public Ope::Visitor {
};

struct TokenChecker : public Ope::Visitor {
using Ope::Visitor::visit;

void visit(Sequence &ope) override {
for (auto op : ope.opes_) {
op->accept(*this);
Expand Down Expand Up @@ -1808,6 +1816,8 @@ struct TokenChecker : public Ope::Visitor {
};

struct FindLiteralToken : public Ope::Visitor {
using Ope::Visitor::visit;

void visit(LiteralString &ope) override { token_ = ope.lit_.data(); }
void visit(TokenBoundary &ope) override { ope.ope_->accept(*this); }
void visit(Ignore &ope) override { ope.ope_->accept(*this); }
Expand All @@ -1825,6 +1835,8 @@ struct FindLiteralToken : public Ope::Visitor {
};

struct DetectLeftRecursion : public Ope::Visitor {
using Ope::Visitor::visit;

DetectLeftRecursion(const std::string &name) : name_(name) {}

void visit(Sequence &ope) override {
Expand Down Expand Up @@ -1887,6 +1899,8 @@ struct DetectLeftRecursion : public Ope::Visitor {
};

struct HasEmptyElement : public Ope::Visitor {
using Ope::Visitor::visit;

HasEmptyElement(std::vector<std::pair<const char *, std::string>> &refs,
std::unordered_map<std::string, bool> &has_error_cache)
: refs_(refs), has_error_cache_(has_error_cache) {}
Expand Down Expand Up @@ -1935,6 +1949,8 @@ struct HasEmptyElement : public Ope::Visitor {
};

struct DetectInfiniteLoop : public Ope::Visitor {
using Ope::Visitor::visit;

DetectInfiniteLoop(const char *s, const std::string &name,
std::vector<std::pair<const char *, std::string>> &refs,
std::unordered_map<std::string, bool> &has_error_cache)
Expand Down Expand Up @@ -1994,6 +2010,8 @@ struct DetectInfiniteLoop : public Ope::Visitor {
};

struct ReferenceChecker : public Ope::Visitor {
using Ope::Visitor::visit;

ReferenceChecker(const Grammar &grammar,
const std::vector<std::string> &params)
: grammar_(grammar), params_(params) {}
Expand Down Expand Up @@ -2032,6 +2050,8 @@ struct ReferenceChecker : public Ope::Visitor {
};

struct LinkReferences : public Ope::Visitor {
using Ope::Visitor::visit;

LinkReferences(Grammar &grammar, const std::vector<std::string> &params)
: grammar_(grammar), params_(params) {}

Expand Down Expand Up @@ -2065,6 +2085,8 @@ struct LinkReferences : public Ope::Visitor {
};

struct FindReference : public Ope::Visitor {
using Ope::Visitor::visit;

FindReference(const std::vector<std::shared_ptr<Ope>> &args,
const std::vector<std::string> &params)
: args_(args), params_(params) {}
Expand Down

0 comments on commit bd0e43e

Please sign in to comment.