Skip to content

Commit 039bd2c

Browse files
asterite3Felipe Zimmerle
authored and
Felipe Zimmerle
committed
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
1 parent ca9cbf4 commit 039bd2c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/parser/seclang-parser.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,7 @@ namespace yy {
14591459
case 33:
14601460
#line 855 "seclang-parser.yy" // lalr1.cc:859
14611461
{
1462-
OPERATOR_CONTAINER(yylhs.value.as< std::unique_ptr<Operator> > (), new operators::Rx("!" + utils::string::removeBracketsIfNeeded(yystack_[0].value.as< std::string > ())));
1462+
OPERATOR_CONTAINER(yylhs.value.as< std::unique_ptr<Operator> > (), new operators::Rx("Rx", utils::string::removeBracketsIfNeeded(yystack_[0].value.as< std::string > ()), true));
14631463
std::string error;
14641464
if (yylhs.value.as< std::unique_ptr<Operator> > ()->init(driver.ref.back(), &error) == false) {
14651465
driver.error(yystack_[2].location, error);

src/parser/seclang-parser.yy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ op:
853853
}
854854
| NOT OPERATOR_RX_CONTENT_ONLY
855855
{
856-
OPERATOR_CONTAINER($$, new operators::Rx("!" + utils::string::removeBracketsIfNeeded($2)));
856+
OPERATOR_CONTAINER($$, new operators::Rx("Rx", utils::string::removeBracketsIfNeeded($2), true));
857857
std::string error;
858858
if ($$->init(driver.ref.back(), &error) == false) {
859859
driver.error(@0, error);

0 commit comments

Comments
 (0)