aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/regex
diff options
context:
space:
mode:
authorRuslan Kovalev <ruslan.a.kovalev@gmail.com>2022-02-10 16:46:44 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:44 +0300
commit59e19371de37995fcb36beb16cd6ec030af960bc (patch)
treefa68e36093ebff8b805462e9e6d331fe9d348214 /library/cpp/regex
parent89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (diff)
downloadydb-59e19371de37995fcb36beb16cd6ec030af960bc.tar.gz
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/regex')
-rw-r--r--library/cpp/regex/pcre/regexp.h2
-rw-r--r--library/cpp/regex/pire/regexp.h28
-rw-r--r--library/cpp/regex/pire/ut/regexp_ut.cpp62
3 files changed, 46 insertions, 46 deletions
diff --git a/library/cpp/regex/pcre/regexp.h b/library/cpp/regex/pcre/regexp.h
index bc610bd2f3..70ead8c494 100644
--- a/library/cpp/regex/pcre/regexp.h
+++ b/library/cpp/regex/pcre/regexp.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <sys/types.h>
diff --git a/library/cpp/regex/pire/regexp.h b/library/cpp/regex/pire/regexp.h
index 94bba4064b..7e4e3bd9ca 100644
--- a/library/cpp/regex/pire/regexp.h
+++ b/library/cpp/regex/pire/regexp.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "pire.h"
@@ -35,16 +35,16 @@ namespace NRegExp {
return *this;
}
- inline TOptions& SetAndNotSupport(bool andNotSupport) noexcept {
- AndNotSupport = andNotSupport;
- return *this;
- }
-
- bool CaseInsensitive = false;
- bool Surround = false;
+ inline TOptions& SetAndNotSupport(bool andNotSupport) noexcept {
+ AndNotSupport = andNotSupport;
+ return *this;
+ }
+
+ bool CaseInsensitive = false;
+ bool Surround = false;
TMaybe<size_t> CapturePos;
- ECharset Charset = CODES_UNKNOWN;
- bool AndNotSupport = false;
+ ECharset Charset = CODES_UNKNOWN;
+ bool AndNotSupport = false;
};
static inline NPire::TFsm Parse(const TStringBuf& regexp,
@@ -74,10 +74,10 @@ namespace NRegExp {
lexer.AddFeature(NPire::NFeatures::Capture(*opts.CapturePos));
}
- if (opts.AndNotSupport) {
- lexer.AddFeature(NPire::NFeatures::AndNotSupport());
- }
-
+ if (opts.AndNotSupport) {
+ lexer.AddFeature(NPire::NFeatures::AndNotSupport());
+ }
+
switch (opts.Charset) {
case CODES_UNKNOWN:
break;
diff --git a/library/cpp/regex/pire/ut/regexp_ut.cpp b/library/cpp/regex/pire/ut/regexp_ut.cpp
index e7206de9ad..96b92bbc38 100644
--- a/library/cpp/regex/pire/ut/regexp_ut.cpp
+++ b/library/cpp/regex/pire/ut/regexp_ut.cpp
@@ -52,37 +52,37 @@ Y_UNIT_TEST_SUITE(TRegExp) {
UNIT_ASSERT(!TMatcher(TFsm("чзн", opts)).Match("чзх").Final());
}
- Y_UNIT_TEST(AndNot) {
- NRegExp::TFsmBase::TOptions opts;
- opts.AndNotSupport = true;
- {
- NRegExp::TFsm fsm(".*&~([0-9]*)", opts);
- UNIT_ASSERT(TMatcher(fsm).Match("a2").Final());
- UNIT_ASSERT(TMatcher(fsm).Match("ab").Final());
- UNIT_ASSERT(TMatcher(fsm).Match("1a").Final());
- UNIT_ASSERT(!TMatcher(fsm).Match("12").Final());
- }
- {
- NRegExp::TFsm fsm(".*&~(.*[0-9].*)", opts);
- UNIT_ASSERT(TMatcher(fsm).Match("ab").Final());
- UNIT_ASSERT(!TMatcher(fsm).Match("a2").Final());
- UNIT_ASSERT(!TMatcher(fsm).Match("1a").Final());
- UNIT_ASSERT(!TMatcher(fsm).Match("12").Final());
- }
- {
- NRegExp::TFsm fsm(
- "((([a-z0-9_\\-]+[.])*[a-z0-9_\\-]+)"
- "&~(\\d+[.]\\d+[.]\\d+[.]\\d+))(:\\d+)?",
- TFsm::TOptions().SetCaseInsensitive(true).SetAndNotSupport(true)
- );
- UNIT_ASSERT(TMatcher(fsm).Match("yandex.ru").Final());
- UNIT_ASSERT(TMatcher(fsm).Match("yandex").Final());
- UNIT_ASSERT(TMatcher(fsm).Match("yandex:80").Final());
- UNIT_ASSERT(!TMatcher(fsm).Match("127.0.0.1").Final());
- UNIT_ASSERT(!TMatcher(fsm).Match("127.0.0.1:8080").Final());
- }
- }
-
+ Y_UNIT_TEST(AndNot) {
+ NRegExp::TFsmBase::TOptions opts;
+ opts.AndNotSupport = true;
+ {
+ NRegExp::TFsm fsm(".*&~([0-9]*)", opts);
+ UNIT_ASSERT(TMatcher(fsm).Match("a2").Final());
+ UNIT_ASSERT(TMatcher(fsm).Match("ab").Final());
+ UNIT_ASSERT(TMatcher(fsm).Match("1a").Final());
+ UNIT_ASSERT(!TMatcher(fsm).Match("12").Final());
+ }
+ {
+ NRegExp::TFsm fsm(".*&~(.*[0-9].*)", opts);
+ UNIT_ASSERT(TMatcher(fsm).Match("ab").Final());
+ UNIT_ASSERT(!TMatcher(fsm).Match("a2").Final());
+ UNIT_ASSERT(!TMatcher(fsm).Match("1a").Final());
+ UNIT_ASSERT(!TMatcher(fsm).Match("12").Final());
+ }
+ {
+ NRegExp::TFsm fsm(
+ "((([a-z0-9_\\-]+[.])*[a-z0-9_\\-]+)"
+ "&~(\\d+[.]\\d+[.]\\d+[.]\\d+))(:\\d+)?",
+ TFsm::TOptions().SetCaseInsensitive(true).SetAndNotSupport(true)
+ );
+ UNIT_ASSERT(TMatcher(fsm).Match("yandex.ru").Final());
+ UNIT_ASSERT(TMatcher(fsm).Match("yandex").Final());
+ UNIT_ASSERT(TMatcher(fsm).Match("yandex:80").Final());
+ UNIT_ASSERT(!TMatcher(fsm).Match("127.0.0.1").Final());
+ UNIT_ASSERT(!TMatcher(fsm).Match("127.0.0.1:8080").Final());
+ }
+ }
+
Y_UNIT_TEST(Glue) {
TFsm glued =
TFsm("qw", TFsm::TOptions().SetCaseInsensitive(true)) |