aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/RESearch.cxx22
-rw-r--r--src/RESearch.h12
2 files changed, 17 insertions, 17 deletions
diff --git a/src/RESearch.cxx b/src/RESearch.cxx
index 5ce073a44..dd9cb75af 100644
--- a/src/RESearch.cxx
+++ b/src/RESearch.cxx
@@ -256,7 +256,7 @@ RESearch::RESearch(CharClassify *charClassTable) {
charClass = charClassTable;
sta = NOP; /* status of lastpat */
bol = 0;
- const unsigned char nul=0;
+ constexpr unsigned char nul = 0;
std::fill(bittab, std::end(bittab), nul);
std::fill(tagstk, std::end(tagstk), 0);
std::fill(nfa, std::end(nfa), '\0');
@@ -267,7 +267,7 @@ RESearch::~RESearch() {
Clear();
}
-void RESearch::Clear() {
+void RESearch::Clear() noexcept {
for (int i = 0; i < MAXTAG; i++) {
pat[i].clear();
bopat[i] = NOTFOUND;
@@ -278,7 +278,7 @@ void RESearch::Clear() {
void RESearch::GrabMatches(const CharacterIndexer &ci) {
for (unsigned int i = 0; i < MAXTAG; i++) {
if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) {
- Sci::Position len = eopat[i] - bopat[i];
+ const Sci::Position len = eopat[i] - bopat[i];
pat[i].resize(len);
for (Sci::Position j = 0; j < len; j++)
pat[i][j] = ci.CharAt(bopat[i] + j);
@@ -286,11 +286,11 @@ void RESearch::GrabMatches(const CharacterIndexer &ci) {
}
}
-void RESearch::ChSet(unsigned char c) {
+void RESearch::ChSet(unsigned char c) noexcept {
bittab[((c) & BLKIND) >> 3] |= bitarr[(c) & BITIND];
}
-void RESearch::ChSetWithCase(unsigned char c, bool caseSensitive) {
+void RESearch::ChSetWithCase(unsigned char c, bool caseSensitive) noexcept {
ChSet(c);
if (!caseSensitive) {
if ((c >= 'a') && (c <= 'z')) {
@@ -301,7 +301,7 @@ void RESearch::ChSetWithCase(unsigned char c, bool caseSensitive) {
}
}
-static unsigned char escapeValue(unsigned char ch) {
+static unsigned char escapeValue(unsigned char ch) noexcept {
switch (ch) {
case 'a': return '\a';
case 'b': return '\b';
@@ -314,7 +314,7 @@ static unsigned char escapeValue(unsigned char ch) {
return 0;
}
-static int GetHexaChar(unsigned char hd1, unsigned char hd2) {
+static int GetHexaChar(unsigned char hd1, unsigned char hd2) noexcept {
int hexValue = 0;
if (hd1 >= '0' && hd1 <= '9') {
hexValue += 16 * (hd1 - '0');
@@ -347,7 +347,7 @@ static int GetHexaChar(unsigned char hd1, unsigned char hd2) {
*/
int RESearch::GetBackslashExpression(
const char *pattern,
- int &incr) {
+ int &incr) noexcept {
// Since error reporting is primitive and messages are not used anyway,
// I choose to interpret unexpected syntax in a logical way instead
// of reporting errors. Otherwise, we can stick on, eg., PCRE behavior.
@@ -430,7 +430,7 @@ int RESearch::GetBackslashExpression(
return result;
}
-const char *RESearch::Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix) {
+const char *RESearch::Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix) noexcept {
char *mp=nfa; /* nfa pointer */
char *lp; /* saved pointer */
char *sp=nfa; /* another one */
@@ -556,7 +556,7 @@ const char *RESearch::Compile(const char *pattern, Sci::Position length, bool ca
i++;
p++;
int incr;
- int c = GetBackslashExpression(p, incr);
+ const int c = GetBackslashExpression(p, incr);
i += incr;
p += incr;
if (c >= 0) {
@@ -831,7 +831,7 @@ int RESearch::Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Positio
extern void re_fail(char *,char);
-static inline int isinset(const char *ap, unsigned char c) {
+static inline int isinset(const char *ap, unsigned char c) noexcept {
return ap[(c & BLKIND) >> 3] & bitarr[c & BITIND];
}
diff --git a/src/RESearch.h b/src/RESearch.h
index 213055dac..10ed4380d 100644
--- a/src/RESearch.h
+++ b/src/RESearch.h
@@ -24,9 +24,9 @@ public:
explicit RESearch(CharClassify *charClassTable);
// No dynamic allocation so default copy constructor and assignment operator are OK.
~RESearch();
- void Clear();
+ void Clear() noexcept;
void GrabMatches(const CharacterIndexer &ci);
- const char *Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix);
+ const char *Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix) noexcept;
int Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp);
enum { MAXTAG=10 };
@@ -45,9 +45,9 @@ private:
enum { CHRBIT = 8 };
enum { BITBLK = MAXCHR / CHRBIT };
- void ChSet(unsigned char c);
- void ChSetWithCase(unsigned char c, bool caseSensitive);
- int GetBackslashExpression(const char *pattern, int &incr);
+ void ChSet(unsigned char c) noexcept;
+ void ChSetWithCase(unsigned char c, bool caseSensitive) noexcept;
+ int GetBackslashExpression(const char *pattern, int &incr) noexcept;
Sci::Position PMatch(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, char *ap);
@@ -58,7 +58,7 @@ private:
unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */
int failure;
CharClassify *charClass;
- bool iswordc(unsigned char x) const {
+ bool iswordc(unsigned char x) const noexcept {
return charClass->IsWord(x);
}
};