fix negated implicit @rx operator

When an operator starts with '!' and no explicit operator
is specified, a negated @rx operator should be created.
Due to a bug, a regular @rx operator with regex starting
with '!' was created. This commit fixes it
This commit is contained in:
asterite
2017-08-03 10:25:33 +03:00
committed by Felipe Zimmerle
parent ca9cbf4ddc
commit 039bd2cc84
2 changed files with 2 additions and 2 deletions

View File

@@ -1459,7 +1459,7 @@ namespace yy {
case 33: case 33:
#line 855 "seclang-parser.yy" // lalr1.cc:859 #line 855 "seclang-parser.yy" // lalr1.cc:859
{ {
OPERATOR_CONTAINER(yylhs.value.as< std::unique_ptr<Operator> > (), new operators::Rx("!" + utils::string::removeBracketsIfNeeded(yystack_[0].value.as< std::string > ()))); OPERATOR_CONTAINER(yylhs.value.as< std::unique_ptr<Operator> > (), new operators::Rx("Rx", utils::string::removeBracketsIfNeeded(yystack_[0].value.as< std::string > ()), true));
std::string error; std::string error;
if (yylhs.value.as< std::unique_ptr<Operator> > ()->init(driver.ref.back(), &error) == false) { if (yylhs.value.as< std::unique_ptr<Operator> > ()->init(driver.ref.back(), &error) == false) {
driver.error(yystack_[2].location, error); driver.error(yystack_[2].location, error);

View File

@@ -853,7 +853,7 @@ op:
} }
| NOT OPERATOR_RX_CONTENT_ONLY | NOT OPERATOR_RX_CONTENT_ONLY
{ {
OPERATOR_CONTAINER($$, new operators::Rx("!" + utils::string::removeBracketsIfNeeded($2))); OPERATOR_CONTAINER($$, new operators::Rx("Rx", utils::string::removeBracketsIfNeeded($2), true));
std::string error; std::string error;
if ($$->init(driver.ref.back(), &error) == false) { if ($$->init(driver.ref.back(), &error) == false) {
driver.error(@0, error); driver.error(@0, error);