From 039bd2cc84b2bbea2b83635ec04fef5b18622574 Mon Sep 17 00:00:00 2001 From: asterite Date: Thu, 3 Aug 2017 10:25:33 +0300 Subject: [PATCH] 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 --- src/parser/seclang-parser.cc | 2 +- src/parser/seclang-parser.yy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser/seclang-parser.cc b/src/parser/seclang-parser.cc index 56ddc9d6..bab3432a 100644 --- a/src/parser/seclang-parser.cc +++ b/src/parser/seclang-parser.cc @@ -1459,7 +1459,7 @@ namespace yy { case 33: #line 855 "seclang-parser.yy" // lalr1.cc:859 { - OPERATOR_CONTAINER(yylhs.value.as< std::unique_ptr > (), new operators::Rx("!" + utils::string::removeBracketsIfNeeded(yystack_[0].value.as< std::string > ()))); + OPERATOR_CONTAINER(yylhs.value.as< std::unique_ptr > (), new operators::Rx("Rx", utils::string::removeBracketsIfNeeded(yystack_[0].value.as< std::string > ()), true)); std::string error; if (yylhs.value.as< std::unique_ptr > ()->init(driver.ref.back(), &error) == false) { driver.error(yystack_[2].location, error); diff --git a/src/parser/seclang-parser.yy b/src/parser/seclang-parser.yy index 61c48e69..5eb61688 100644 --- a/src/parser/seclang-parser.yy +++ b/src/parser/seclang-parser.yy @@ -853,7 +853,7 @@ op: } | 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; if ($$->init(driver.ref.back(), &error) == false) { driver.error(@0, error);