Update Scintilla to version 3.4.4
[TortoiseGit.git] / ext / scintilla / src / RESearch.h
blobb3dae1a726b7b70246e7384ef4af6cbffc711e27
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 #ifdef SCI_NAMESPACE
13 namespace Scintilla {
14 #endif
17 * The following defines are not meant to be changeable.
18 * They are for readability only.
20 #define MAXCHR 256
21 #define CHRBIT 8
22 #define BITBLK MAXCHR/CHRBIT
24 class CharacterIndexer {
25 public:
26 virtual char CharAt(int index)=0;
27 virtual ~CharacterIndexer() {
31 class RESearch {
33 public:
34 explicit RESearch(CharClassify *charClassTable);
35 ~RESearch();
36 void GrabMatches(CharacterIndexer &ci);
37 const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix);
38 int Execute(CharacterIndexer &ci, int lp, int endp);
40 enum { MAXTAG=10 };
41 enum { MAXNFA=2048 };
42 enum { NOTFOUND=-1 };
44 int bopat[MAXTAG];
45 int eopat[MAXTAG];
46 std::string pat[MAXTAG];
48 private:
49 void Init();
50 void Clear();
51 void ChSet(unsigned char c);
52 void ChSetWithCase(unsigned char c, bool caseSensitive);
53 int GetBackslashExpression(const char *pattern, int &incr);
55 int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
57 int bol;
58 int tagstk[MAXTAG]; /* subpat tag stack */
59 char nfa[MAXNFA]; /* automaton */
60 int sta;
61 unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */
62 int failure;
63 CharClassify *charClass;
64 bool iswordc(unsigned char x) const {
65 return charClass->IsWord(x);
69 #ifdef SCI_NAMESPACE
71 #endif
73 #endif