Update Russian translation (#3918)
[geany-mirror.git] / scintilla / src / RESearch.h
blob34c6c46f9670e63b0d5198859ac333486a28aa7a
1 // Scintilla source code edit control
2 /** @file RESearch.h
3 ** Interface to the regular expression search library.
4 **/
5 // Written by Neil Hodgson <neilh@scintilla.org>
6 // Based on the work of Ozan S. Yigit.
7 // This file is in the public domain.
9 #ifndef RESEARCH_H
10 #define RESEARCH_H
12 namespace Scintilla::Internal {
14 class CharacterIndexer {
15 public:
16 virtual char CharAt(Sci::Position index) const=0;
19 class RESearch {
21 public:
22 explicit RESearch(CharClassify *charClassTable);
23 // No dynamic allocation so default copy constructor and assignment operator are OK.
24 void Clear() noexcept;
25 void GrabMatches(const CharacterIndexer &ci);
26 const char *Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix) noexcept;
27 int Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp);
29 static constexpr int MAXTAG = 10;
30 static constexpr int NOTFOUND = -1;
32 Sci::Position bopat[MAXTAG];
33 Sci::Position eopat[MAXTAG];
34 std::string pat[MAXTAG];
36 private:
38 static constexpr int MAXNFA = 4096;
39 // The following constants are not meant to be changeable.
40 // They are for readability only.
41 static constexpr int MAXCHR = 256;
42 static constexpr int CHRBIT = 8;
43 static constexpr int BITBLK = MAXCHR / CHRBIT;
45 void ChSet(unsigned char c) noexcept;
46 void ChSetWithCase(unsigned char c, bool caseSensitive) noexcept;
47 int GetBackslashExpression(const char *pattern, int &incr) noexcept;
49 Sci::Position PMatch(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, char *ap);
51 Sci::Position bol;
52 Sci::Position tagstk[MAXTAG]; /* subpat tag stack */
53 char nfa[MAXNFA]; /* automaton */
54 int sta;
55 unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */
56 int failure;
57 CharClassify *charClass;
58 bool iswordc(unsigned char x) const noexcept {
59 return charClass->IsWord(x);
65 #endif