]> git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/RESearch.h
a558b371d2542ad64f2f9abf840a5af43721d1cb
[wxWidgets.git] / src / stc / scintilla / src / RESearch.h
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.
8
9 #ifndef RESEARCH_H
10 #define RESEARCH_H
11
12 /*
13 * The following defines are not meant to be changeable.
14 * They are for readability only.
15 */
16 #define MAXCHR 256
17 #define CHRBIT 8
18 #define BITBLK MAXCHR/CHRBIT
19
20 class CharacterIndexer {
21 public:
22 virtual char CharAt(int index)=0;
23 virtual ~CharacterIndexer() {
24 }
25 };
26
27 class RESearch {
28
29 public:
30 RESearch();
31 ~RESearch();
32 void Init();
33 void Clear();
34 bool GrabMatches(CharacterIndexer &ci);
35 void ChSet(char c);
36 void ChSetWithCase(char c, bool caseSensitive);
37 const char *Compile(const char *pat, int length, bool caseSensitive, bool posix);
38 int Execute(CharacterIndexer &ci, int lp, int endp);
39 void ModifyWord(char *s);
40 int Substitute(CharacterIndexer &ci, char *src, char *dst);
41
42 enum {MAXTAG=10};
43 enum {MAXNFA=2048};
44 enum {NOTFOUND=-1};
45
46 int bopat[MAXTAG];
47 int eopat[MAXTAG];
48 char *pat[MAXTAG];
49
50 private:
51 int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
52
53 int bol;
54 int tagstk[MAXTAG]; /* subpat tag stack..*/
55 char nfa[MAXNFA]; /* automaton.. */
56 int sta;
57 char bittab[BITBLK]; /* bit table for CCL */
58 /* pre-set bits... */
59 int failure;
60 };
61
62 #endif