aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/regex
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:23 +0300
commit706b83ed7de5a473436620367af31fc0ceecde07 (patch)
tree103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/regex
parent918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff)
downloadydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/regex')
-rw-r--r--library/cpp/regex/hyperscan/hyperscan.cpp4
-rw-r--r--library/cpp/regex/hyperscan/hyperscan.h6
-rw-r--r--library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp4
-rw-r--r--library/cpp/regex/pcre/regexp.cpp26
-rw-r--r--library/cpp/regex/pcre/regexp.h12
-rw-r--r--library/cpp/regex/pcre/regexp_ut.cpp8
-rw-r--r--library/cpp/regex/pire/pcre2pire.cpp2
-rw-r--r--library/cpp/regex/pire/pcre2pire.h4
-rw-r--r--library/cpp/regex/pire/regexp.h26
-rw-r--r--library/cpp/regex/pire/ut/ya.make2
10 files changed, 47 insertions, 47 deletions
diff --git a/library/cpp/regex/hyperscan/hyperscan.cpp b/library/cpp/regex/hyperscan/hyperscan.cpp
index ba321f9c29..98e402962d 100644
--- a/library/cpp/regex/hyperscan/hyperscan.cpp
+++ b/library/cpp/regex/hyperscan/hyperscan.cpp
@@ -249,7 +249,7 @@ namespace NHyperscan {
return NPrivate::Matches(db, scratch, text, *Singleton<NPrivate::TImpl>());
}
- TString Serialize(const TDatabase& db) {
+ TString Serialize(const TDatabase& db) {
char* databaseBytes = nullptr;
size_t databaseLength;
hs_error_t status = Singleton<NPrivate::TImpl>()->SerializeDatabase(
@@ -260,7 +260,7 @@ namespace NHyperscan {
if (status != HS_SUCCESS) {
ythrow yexception() << "Failed to serialize hyperscan database";
}
- return TString(serialization.Get(), databaseLength);
+ return TString(serialization.Get(), databaseLength);
}
TDatabase Deserialize(const TStringBuf& serialization) {
diff --git a/library/cpp/regex/hyperscan/hyperscan.h b/library/cpp/regex/hyperscan/hyperscan.h
index 1c8f404389..b615abea1d 100644
--- a/library/cpp/regex/hyperscan/hyperscan.h
+++ b/library/cpp/regex/hyperscan/hyperscan.h
@@ -121,8 +121,8 @@ namespace NHyperscan {
TDatabase Compile(const TStringBuf& regex, unsigned int flags, TCPUFeatures cpuFeatures);
TDatabase CompileMulti(
- const TVector<const char*>& regexs,
- const TVector<unsigned int>& flags,
+ const TVector<const char*>& regexs,
+ const TVector<unsigned int>& flags,
const TVector<unsigned int>& ids,
const TVector<const hs_expr_ext_t*>* extendedParameters = nullptr);
@@ -154,7 +154,7 @@ namespace NHyperscan {
const TScratch& scratch,
const TStringBuf& text);
- TString Serialize(const TDatabase& db);
+ TString Serialize(const TDatabase& db);
TDatabase Deserialize(const TStringBuf& serialization);
}
diff --git a/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp b/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp
index 9caa53f2e7..30b4024b33 100644
--- a/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp
+++ b/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp
@@ -57,7 +57,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) {
UNIT_ASSERT(NHyperscan::Matches(db, scratch, "BAR"));
UNIT_ASSERT(!NHyperscan::Matches(db, scratch, "FOO"));
- TSet<unsigned int> foundIds;
+ TSet<unsigned int> foundIds;
auto callback = [&](unsigned int id, unsigned long long /* from */, unsigned long long /* to */) {
foundIds.insert(id);
};
@@ -89,7 +89,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) {
NHyperscan::TDatabase db = NHyperscan::Compile(
"foo",
HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH);
- TString serialization = Serialize(db);
+ TString serialization = Serialize(db);
db.Reset();
TDatabase db2 = Deserialize(serialization);
NHyperscan::TScratch scratch = NHyperscan::MakeScratch(db2);
diff --git a/library/cpp/regex/pcre/regexp.cpp b/library/cpp/regex/pcre/regexp.cpp
index 575c09cee4..335c27f2eb 100644
--- a/library/cpp/regex/pcre/regexp.cpp
+++ b/library/cpp/regex/pcre/regexp.cpp
@@ -1,6 +1,6 @@
#include "regexp.h"
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/string/ascii.h>
#include <util/system/defaults.h>
@@ -135,7 +135,7 @@ class TRegExBaseImpl: public TAtomicRefCount<TRegExBaseImpl> {
protected:
int CompileOptions;
- TString RegExpr;
+ TString RegExpr;
regex_t Preg;
public:
@@ -145,7 +145,7 @@ public:
memset(&Preg, 0, sizeof(Preg));
}
- TRegExBaseImpl(const TString& re, int cflags)
+ TRegExBaseImpl(const TString& re, int cflags)
: CompileOptions(cflags)
, RegExpr(re)
{
@@ -188,7 +188,7 @@ public:
}
private:
- TString Error;
+ TString Error;
};
bool TRegExBase::IsCompiled() const {
@@ -201,14 +201,14 @@ TRegExBase::TRegExBase(const char* re, int cflags) {
}
}
-TRegExBase::TRegExBase(const TString& re, int cflags) {
+TRegExBase::TRegExBase(const TString& re, int cflags) {
Compile(re, cflags);
}
TRegExBase::~TRegExBase() {
}
-void TRegExBase::Compile(const TString& re, int cflags) {
+void TRegExBase::Compile(const TString& re, int cflags) {
Impl = new TRegExBaseImpl(re, cflags);
}
@@ -224,7 +224,7 @@ int TRegExBase::GetCompileOptions() const {
return Impl->CompileOptions;
}
-TString TRegExBase::GetRegExpr() const {
+TString TRegExBase::GetRegExpr() const {
if (!Impl)
ythrow yexception() << "!Regular expression is not compiled";
return Impl->RegExpr;
@@ -235,7 +235,7 @@ TRegExMatch::TRegExMatch(const char* re, int cflags)
{
}
-TRegExMatch::TRegExMatch(const TString& re, int cflags)
+TRegExMatch::TRegExMatch(const TString& re, int cflags)
: TRegExBase(re, cflags)
{
}
@@ -251,17 +251,17 @@ TRegExSubst::TRegExSubst(const char* re, int cflags)
memset(Brfs, 0, sizeof(TBackReferences) * NMATCHES);
}
-TString TRegExSubst::Replace(const char* str, int eflags) {
- TString s;
+TString TRegExSubst::Replace(const char* str, int eflags) {
+ TString s;
if (BrfsCount) {
if (Exec(str, PMatch, eflags) == 0) {
int i;
for (i = 0; i < BrfsCount; i++) {
- s += TString(Replacement, Brfs[i].Beg, Brfs[i].End - Brfs[i].Beg);
+ s += TString(Replacement, Brfs[i].Beg, Brfs[i].End - Brfs[i].Beg);
if (Brfs[i].Refer >= 0 && Brfs[i].Refer < NMATCHES)
- s += TString(str, PMatch[Brfs[i].Refer].rm_so, int(PMatch[Brfs[i].Refer].rm_eo - PMatch[Brfs[i].Refer].rm_so));
+ s += TString(str, PMatch[Brfs[i].Refer].rm_so, int(PMatch[Brfs[i].Refer].rm_eo - PMatch[Brfs[i].Refer].rm_so));
}
- s += TString(Replacement, Brfs[i].Beg, Brfs[i].End - Brfs[i].Beg);
+ s += TString(Replacement, Brfs[i].Beg, Brfs[i].End - Brfs[i].Beg);
}
} else {
s = Replacement;
diff --git a/library/cpp/regex/pcre/regexp.h b/library/cpp/regex/pcre/regexp.h
index bc610bd2f3..742fa20dac 100644
--- a/library/cpp/regex/pcre/regexp.h
+++ b/library/cpp/regex/pcre/regexp.h
@@ -3,7 +3,7 @@
#include <sys/types.h>
#include <util/system/defaults.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/yexception.h>
#include <contrib/libs/pcre/pcre.h>
@@ -22,21 +22,21 @@ protected:
public:
TRegExBase(const char* regExpr = nullptr, int cflags = REG_EXTENDED);
- TRegExBase(const TString& regExpr, int cflags = REG_EXTENDED);
+ TRegExBase(const TString& regExpr, int cflags = REG_EXTENDED);
virtual ~TRegExBase();
int Exec(const char* str, regmatch_t pmatch[], int eflags, int nmatches = NMATCHES) const;
- void Compile(const TString& regExpr, int cflags = REG_EXTENDED);
+ void Compile(const TString& regExpr, int cflags = REG_EXTENDED);
bool IsCompiled() const;
int GetCompileOptions() const;
- TString GetRegExpr() const;
+ TString GetRegExpr() const;
};
class TRegExMatch: public TRegExBase {
public:
TRegExMatch(const char* regExpr = nullptr, int cflags = REG_NOSUB | REG_EXTENDED);
- TRegExMatch(const TString& regExpr, int cflags = REG_NOSUB | REG_EXTENDED);
+ TRegExMatch(const TString& regExpr, int cflags = REG_NOSUB | REG_EXTENDED);
bool Match(const char* str) const;
};
@@ -58,6 +58,6 @@ private:
public:
TRegExSubst(const char* regExpr = nullptr, int cflags = REG_EXTENDED);
- TString Replace(const char* str, int eflags = 0);
+ TString Replace(const char* str, int eflags = 0);
int ParseReplacement(const char* replacement);
};
diff --git a/library/cpp/regex/pcre/regexp_ut.cpp b/library/cpp/regex/pcre/regexp_ut.cpp
index 5184e801cc..4047ebffbd 100644
--- a/library/cpp/regex/pcre/regexp_ut.cpp
+++ b/library/cpp/regex/pcre/regexp_ut.cpp
@@ -56,7 +56,7 @@ private:
inline void TestRe() {
for (const auto& regTest : REGTEST_DATA) {
memset(Matches, 0, sizeof(Matches));
- TString result;
+ TString result;
TRegExBase re(regTest.Regexp, regTest.CompileOptions);
if (re.Exec(regTest.Data, Matches, regTest.RunOptions) == 0) {
@@ -78,13 +78,13 @@ private:
for (const auto& substTest : SUBSTTEST_DATA) {
TRegExSubst subst(substTest.Regexp, substTest.CompileOptions);
subst.ParseReplacement(substTest.Replacement);
- TString result = subst.Replace(substTest.Data, substTest.RunOptions);
+ TString result = subst.Replace(substTest.Data, substTest.RunOptions);
UNIT_ASSERT_VALUES_EQUAL(result, substTest.Result);
TRegExSubst substCopy = subst;
subst.ParseReplacement(substTest.Replacement2);
- TString newResult = subst.Replace(substTest.Data, substTest.RunOptions);
+ TString newResult = subst.Replace(substTest.Data, substTest.RunOptions);
UNIT_ASSERT_VALUES_UNEQUAL(newResult.c_str(), result.c_str());
- TString copyResult = substCopy.Replace(substTest.Data, substTest.RunOptions);
+ TString copyResult = substCopy.Replace(substTest.Data, substTest.RunOptions);
UNIT_ASSERT_VALUES_EQUAL(copyResult, result);
substCopy = subst;
copyResult = substCopy.Replace(substTest.Data, substTest.RunOptions);
diff --git a/library/cpp/regex/pire/pcre2pire.cpp b/library/cpp/regex/pire/pcre2pire.cpp
index f788beb85f..d989656e1c 100644
--- a/library/cpp/regex/pire/pcre2pire.cpp
+++ b/library/cpp/regex/pire/pcre2pire.cpp
@@ -3,7 +3,7 @@
#include <util/generic/yexception.h>
TString Pcre2Pire(const TString& src) {
- TVector<char> result;
+ TVector<char> result;
result.reserve(src.size() + 1);
enum EState {
diff --git a/library/cpp/regex/pire/pcre2pire.h b/library/cpp/regex/pire/pcre2pire.h
index 46e45b9193..054fea6f01 100644
--- a/library/cpp/regex/pire/pcre2pire.h
+++ b/library/cpp/regex/pire/pcre2pire.h
@@ -2,7 +2,7 @@
// Author: smikler@yandex-team.ru
-#include <util/generic/string.h>
+#include <util/generic/string.h>
/* Converts pcre regular expression to pire compatible format:
* - replaces "\\#" with "#"
@@ -16,4 +16,4 @@
* NOTE:
* - Not fully tested!
*/
-TString Pcre2Pire(const TString& src);
+TString Pcre2Pire(const TString& src);
diff --git a/library/cpp/regex/pire/regexp.h b/library/cpp/regex/pire/regexp.h
index 94bba4064b..f3b98bc91c 100644
--- a/library/cpp/regex/pire/regexp.h
+++ b/library/cpp/regex/pire/regexp.h
@@ -6,7 +6,7 @@
#include <library/cpp/charset/recyr.hh>
#include <util/generic/maybe.h>
#include <util/generic/strbuf.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <util/generic/yexception.h>
@@ -15,22 +15,22 @@ namespace NRegExp {
struct TFsmBase {
struct TOptions {
- inline TOptions& SetCaseInsensitive(bool v) noexcept {
+ inline TOptions& SetCaseInsensitive(bool v) noexcept {
CaseInsensitive = v;
return *this;
}
- inline TOptions& SetSurround(bool v) noexcept {
+ inline TOptions& SetSurround(bool v) noexcept {
Surround = v;
return *this;
}
- inline TOptions& SetCapture(size_t pos) noexcept {
+ inline TOptions& SetCapture(size_t pos) noexcept {
CapturePos = pos;
return *this;
}
- inline TOptions& SetCharset(ECharset charset) noexcept {
+ inline TOptions& SetCharset(ECharset charset) noexcept {
Charset = charset;
return *this;
}
@@ -118,7 +118,7 @@ namespace NRegExp {
{
}
- inline const TScanner& GetScanner() const noexcept {
+ inline const TScanner& GetScanner() const noexcept {
return Scanner;
}
@@ -202,7 +202,7 @@ namespace NRegExp {
Fsm.GetScanner().Initialize(State);
}
- inline bool Final() const noexcept {
+ inline bool Final() const noexcept {
return GetScanner().Final(GetState());
}
@@ -217,11 +217,11 @@ namespace NRegExp {
}
}
- inline const typename TFsm::TScanner& GetScanner() const noexcept {
+ inline const typename TFsm::TScanner& GetScanner() const noexcept {
return Fsm.GetScanner();
}
- inline const TState& GetState() const noexcept {
+ inline const TState& GetState() const noexcept {
return State;
}
@@ -245,13 +245,13 @@ namespace NRegExp {
return Match(s.data(), s.size(), addBegin, addEnd);
}
- inline const char* Find(const char* b, const char* e) noexcept {
+ inline const char* Find(const char* b, const char* e) noexcept {
return NPire::ShortestPrefix(GetScanner(), b, e);
}
typedef std::pair<const size_t*, const size_t*> TMatchedRegexps;
- inline TMatchedRegexps MatchedRegexps() const noexcept {
+ inline TMatchedRegexps MatchedRegexps() const noexcept {
return GetScanner().AcceptedRegexps(GetState());
}
};
@@ -263,7 +263,7 @@ namespace NRegExp {
{
}
- inline bool Captured() const noexcept {
+ inline bool Captured() const noexcept {
return GetState().Captured();
}
@@ -277,7 +277,7 @@ namespace NRegExp {
return Search(s.data(), s.size());
}
- inline TStringBuf GetCaptured() const noexcept {
+ inline TStringBuf GetCaptured() const noexcept {
return TStringBuf(Data.data() + GetState().Begin() - 1,
Data.data() + GetState().End() - 1);
}
diff --git a/library/cpp/regex/pire/ut/ya.make b/library/cpp/regex/pire/ut/ya.make
index 8776695f40..117ef9694f 100644
--- a/library/cpp/regex/pire/ut/ya.make
+++ b/library/cpp/regex/pire/ut/ya.make
@@ -1,4 +1,4 @@
-# this test in not linked into build tree with ReCURSE and is built by unittest/library
+# this test in not linked into build tree with ReCURSE and is built by unittest/library
UNITTEST()