Merge pull request #826 from kugel-/doxygen-fixes2
[geany-mirror.git] / scintilla / src / RESearch.h
blob3a7f0e4d61e87f911d4d085503f6b1abce4f87f1
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 Clear();
37 void GrabMatches(CharacterIndexer &ci);
38 const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix);
39 int Execute(CharacterIndexer &ci, int lp, int endp);
41 enum { MAXTAG=10 };
42 enum { MAXNFA=2048 };
43 enum { NOTFOUND=-1 };
45 int bopat[MAXTAG];
46 int eopat[MAXTAG];
47 std::string pat[MAXTAG];
49 private:
50 void ChSet(unsigned char c);
51 void ChSetWithCase(unsigned char c, bool caseSensitive);
52 int GetBackslashExpression(const char *pattern, int &incr);
54 int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
56 int bol;
57 int tagstk[MAXTAG]; /* subpat tag stack */
58 char nfa[MAXNFA]; /* automaton */
59 int sta;
60 unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */
61 int failure;
62 CharClassify *charClass;
63 bool iswordc(unsigned char x) const {
64 return charClass->IsWord(x);
68 #ifdef SCI_NAMESPACE
70 #endif
72 #endif