aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/regex/pcre
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:25 +0300
commit344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/regex/pcre
parent706b83ed7de5a473436620367af31fc0ceecde07 (diff)
downloadydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/regex/pcre')
-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
3 files changed, 23 insertions, 23 deletions
diff --git a/library/cpp/regex/pcre/regexp.cpp b/library/cpp/regex/pcre/regexp.cpp
index 335c27f2eb..575c09cee4 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 742fa20dac..bc610bd2f3 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 4047ebffbd..5184e801cc 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);