aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/regex
diff options
context:
space:
mode:
authoryazevnul <yazevnul@yandex-team.ru>2022-02-10 16:46:46 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:46 +0300
commit8cbc307de0221f84c80c42dcbe07d40727537e2c (patch)
tree625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/regex
parent30d1ef3941e0dc835be7609de5ebee66958f215a (diff)
downloadydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/regex')
-rw-r--r--library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp16
-rw-r--r--library/cpp/regex/pcre/regexp_ut.cpp12
-rw-r--r--library/cpp/regex/pire/regexp.h4
-rw-r--r--library/cpp/regex/pire/ut/regexp_ut.cpp30
4 files changed, 31 insertions, 31 deletions
diff --git a/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp b/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp
index 9caa53f2e7..b12985579c 100644
--- a/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp
+++ b/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp
@@ -7,11 +7,11 @@
#include <array>
#include <algorithm>
-Y_UNIT_TEST_SUITE(HyperscanWrappers) {
+Y_UNIT_TEST_SUITE(HyperscanWrappers) {
using namespace NHyperscan;
using namespace NHyperscan::NPrivate;
- Y_UNIT_TEST(CompileAndScan) {
+ Y_UNIT_TEST(CompileAndScan) {
TDatabase db = Compile("a.c", HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH);
TScratch scratch = MakeScratch(db);
@@ -27,7 +27,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) {
UNIT_ASSERT_EQUAL(foundId, 0);
}
- Y_UNIT_TEST(Matches) {
+ Y_UNIT_TEST(Matches) {
NHyperscan::TDatabase db = NHyperscan::Compile(
"a.c",
HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH);
@@ -36,7 +36,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) {
UNIT_ASSERT(!NHyperscan::Matches(db, scratch, "foo"));
}
- Y_UNIT_TEST(Multi) {
+ Y_UNIT_TEST(Multi) {
NHyperscan::TDatabase db = NHyperscan::CompileMulti(
{
"foo",
@@ -72,7 +72,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) {
}
// https://ml.yandex-team.ru/thread/2370000002965712422/
- Y_UNIT_TEST(MultiRegression) {
+ Y_UNIT_TEST(MultiRegression) {
NHyperscan::CompileMulti(
{
"aa.bb/cc.dd",
@@ -85,7 +85,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) {
});
}
- Y_UNIT_TEST(Serialize) {
+ Y_UNIT_TEST(Serialize) {
NHyperscan::TDatabase db = NHyperscan::Compile(
"foo",
HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH);
@@ -98,7 +98,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) {
UNIT_ASSERT(!NHyperscan::Matches(db2, scratch, "FOO"));
}
- Y_UNIT_TEST(GrowScratch) {
+ Y_UNIT_TEST(GrowScratch) {
NHyperscan::TDatabase db1 = NHyperscan::Compile(
"foo",
HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH);
@@ -111,7 +111,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) {
UNIT_ASSERT(NHyperscan::Matches(db2, scratch, "longerWWWpattern"));
}
- Y_UNIT_TEST(CloneScratch) {
+ Y_UNIT_TEST(CloneScratch) {
NHyperscan::TDatabase db = NHyperscan::Compile(
"foo",
HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH);
diff --git a/library/cpp/regex/pcre/regexp_ut.cpp b/library/cpp/regex/pcre/regexp_ut.cpp
index 5184e801cc..3818fe59c3 100644
--- a/library/cpp/regex/pcre/regexp_ut.cpp
+++ b/library/cpp/regex/pcre/regexp_ut.cpp
@@ -1,6 +1,6 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/string/strip.h>
+#include <util/string/strip.h>
#include <library/cpp/regex/pcre/regexp.h>
#include <util/stream/output.h>
@@ -54,17 +54,17 @@ private:
UNIT_TEST_SUITE_END();
inline void TestRe() {
- for (const auto& regTest : REGTEST_DATA) {
+ for (const auto& regTest : REGTEST_DATA) {
memset(Matches, 0, sizeof(Matches));
TString result;
TRegExBase re(regTest.Regexp, regTest.CompileOptions);
if (re.Exec(regTest.Data, Matches, regTest.RunOptions) == 0) {
- for (auto& matche : Matches) {
- if (matche.rm_so == -1) {
+ for (auto& matche : Matches) {
+ if (matche.rm_so == -1) {
break;
}
- result.append(Sprintf("%i %i ", matche.rm_so, matche.rm_eo));
+ result.append(Sprintf("%i %i ", matche.rm_so, matche.rm_eo));
}
} else {
result = "NM";
@@ -75,7 +75,7 @@ private:
}
inline void TestSubst() {
- for (const auto& substTest : SUBSTTEST_DATA) {
+ for (const auto& substTest : SUBSTTEST_DATA) {
TRegExSubst subst(substTest.Regexp, substTest.CompileOptions);
subst.ParseReplacement(substTest.Replacement);
TString result = subst.Replace(substTest.Data, substTest.RunOptions);
diff --git a/library/cpp/regex/pire/regexp.h b/library/cpp/regex/pire/regexp.h
index 94bba4064b..9321863bad 100644
--- a/library/cpp/regex/pire/regexp.h
+++ b/library/cpp/regex/pire/regexp.h
@@ -58,8 +58,8 @@ namespace NRegExp {
size_t outWritten = 0;
int recodeRes = RecodeToUnicode(opts.Charset, regexp.data(), ucs4.data(),
regexp.size(), regexp.size(), inRead, outWritten);
- Y_ASSERT(recodeRes == RECODE_OK);
- Y_ASSERT(outWritten < ucs4.size());
+ Y_ASSERT(recodeRes == RECODE_OK);
+ Y_ASSERT(outWritten < ucs4.size());
ucs4[outWritten] = 0;
lexer.Assign(ucs4.begin(),
diff --git a/library/cpp/regex/pire/ut/regexp_ut.cpp b/library/cpp/regex/pire/ut/regexp_ut.cpp
index e7206de9ad..0bb72b3fde 100644
--- a/library/cpp/regex/pire/ut/regexp_ut.cpp
+++ b/library/cpp/regex/pire/ut/regexp_ut.cpp
@@ -3,20 +3,20 @@
#include <library/cpp/regex/pire/regexp.h>
#include <library/cpp/regex/pire/pcre2pire.h>
-Y_UNIT_TEST_SUITE(TRegExp) {
+Y_UNIT_TEST_SUITE(TRegExp) {
using namespace NRegExp;
- Y_UNIT_TEST(False) {
+ Y_UNIT_TEST(False) {
UNIT_ASSERT(!TMatcher(TFsm::False()).Match("").Final());
UNIT_ASSERT(!TMatcher(TFsm::False()).Match(TStringBuf{}).Final());
}
- Y_UNIT_TEST(Surround) {
+ Y_UNIT_TEST(Surround) {
UNIT_ASSERT(TMatcher(TFsm("qw", TFsm::TOptions().SetSurround(true))).Match("aqwb").Final());
UNIT_ASSERT(!TMatcher(TFsm("qw", TFsm::TOptions().SetSurround(false))).Match("aqwb").Final());
}
- Y_UNIT_TEST(Boundaries) {
+ Y_UNIT_TEST(Boundaries) {
UNIT_ASSERT(!TMatcher(TFsm("qwb$", TFsm::TOptions().SetSurround(true))).Match("aqwb").Final());
UNIT_ASSERT(!TMatcher(TFsm("^aqw", TFsm::TOptions().SetSurround(true))).Match("aqwb").Final());
UNIT_ASSERT(TMatcher(TFsm("qwb$", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final());
@@ -32,7 +32,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {
.Final());
}
- Y_UNIT_TEST(Case) {
+ Y_UNIT_TEST(Case) {
UNIT_ASSERT(TMatcher(TFsm("qw", TFsm::TOptions().SetCaseInsensitive(true))).Match("Qw").Final());
UNIT_ASSERT(!TMatcher(TFsm("qw", TFsm::TOptions().SetCaseInsensitive(false))).Match("Qw").Final());
}
@@ -42,7 +42,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {
UNIT_ASSERT(!TMatcher(TFsm("\\x{61}\\x{62}", TFsm::TOptions().SetCaseInsensitive(false))).Match("Ab").Final());
}
- Y_UNIT_TEST(Utf) {
+ Y_UNIT_TEST(Utf) {
NRegExp::TFsmBase::TOptions opts;
opts.Charset = CODES_UTF8;
opts.Surround = true;
@@ -83,7 +83,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {
}
}
- Y_UNIT_TEST(Glue) {
+ Y_UNIT_TEST(Glue) {
TFsm glued =
TFsm("qw", TFsm::TOptions().SetCaseInsensitive(true)) |
TFsm("qw", TFsm::TOptions().SetCaseInsensitive(false)) |
@@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {
UNIT_ASSERT(!TMatcher(glued).Match("Abc").Final());
}
- Y_UNIT_TEST(Capture1) {
+ Y_UNIT_TEST(Capture1) {
TCapturingFsm fsm("here we have user_id=([a-z0-9]+);");
TSearcher searcher(fsm);
@@ -103,7 +103,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {
UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("0x0d0a"));
}
- Y_UNIT_TEST(Capture2) {
+ Y_UNIT_TEST(Capture2) {
TCapturingFsm fsm("w([abcdez]+)f");
TSearcher searcher(fsm);
@@ -112,7 +112,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {
UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("abcde"));
}
- Y_UNIT_TEST(Capture3) {
+ Y_UNIT_TEST(Capture3) {
TCapturingFsm fsm("http://vk(ontakte[.]ru|[.]com)/id(\\d+)([^0-9]|$)",
TFsm::TOptions().SetCapture(2));
@@ -122,7 +122,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {
UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("100500"));
}
- Y_UNIT_TEST(Capture4) {
+ Y_UNIT_TEST(Capture4) {
TCapturingFsm fsm("Здравствуйте, ((\\s|\\w|[()]|-)+)!",
TFsm::TOptions().SetCharset(CODES_UTF8));
@@ -132,7 +132,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {
UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("Уважаемый (-ая)"));
}
- Y_UNIT_TEST(Capture5) {
+ Y_UNIT_TEST(Capture5) {
TCapturingFsm fsm("away\\.php\\?to=http:([^\"])+\"");
TSearcher searcher(fsm);
searcher.Search("\"/away.php?to=http:some.addr\"&id=1");
@@ -140,7 +140,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {
//UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("some.addr"));
}
- Y_UNIT_TEST(Capture6) {
+ Y_UNIT_TEST(Capture6) {
TCapturingFsm fsm("(/to-match-with)");
TSearcher searcher(fsm);
searcher.Search("/some/table/path/to-match-with");
@@ -148,7 +148,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {
UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("/to-match-with"));
}
- Y_UNIT_TEST(Capture7) {
+ Y_UNIT_TEST(Capture7) {
TCapturingFsm fsm("(pref.*suff)");
TSearcher searcher(fsm);
searcher.Search("ala pref bla suff cla");
@@ -305,7 +305,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {
UNIT_ASSERT(!searcher.Captured());
}
- Y_UNIT_TEST(Pcre2PireTest) {
+ Y_UNIT_TEST(Pcre2PireTest) {
UNIT_ASSERT_VALUES_EQUAL(Pcre2Pire("(?:fake)"), "(fake)");
UNIT_ASSERT_VALUES_EQUAL(Pcre2Pire("(?:fake)??"), "(fake)?");
UNIT_ASSERT_VALUES_EQUAL(Pcre2Pire("(?:fake)*?fake"), "(fake)*fake");