This commit is contained in:
yhirose 2019-07-09 21:49:15 -04:00
parent ac8c93f415
commit 2d276c8cd9
2 changed files with 14 additions and 0 deletions

View File

@ -2374,6 +2374,9 @@ inline void DetectLeftRecursion::visit(Reference& ope) {
refs_.insert(ope.name_); refs_.insert(ope.name_);
if (ope.rule_) { if (ope.rule_) {
ope.rule_->accept(*this); ope.rule_->accept(*this);
if (done_ == false) {
return;
}
} }
} }
done_ = true; done_ = true;

View File

@ -1032,6 +1032,17 @@ TEST_CASE("Left recursive with zom test", "[left recursive]")
REQUIRE(!parser); REQUIRE(!parser);
} }
TEST_CASE("Left recursive with a ZOM content rule", "[left recursive]")
{
parser parser(R"(
A <- B
B <- _ A
_ <- ' '* # Zero or more
)");
REQUIRE(!parser);
}
TEST_CASE("Left recursive with empty string test", "[left recursive]") TEST_CASE("Left recursive with empty string test", "[left recursive]")
{ {
parser parser( parser parser(