]> git.saurik.com Git - wxWidgets.git/blame - src/stc/scintilla/src/RESearch.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / src / stc / scintilla / src / RESearch.h
CommitLineData
65ec6247
RD
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
7e0c58e9
RD
12#ifdef SCI_NAMESPACE
13namespace Scintilla {
14#endif
15
65ec6247
RD
16/*
17 * The following defines are not meant to be changeable.
18 * They are for readability only.
19 */
9e730a78 20#define MAXCHR 256
65ec6247
RD
21#define CHRBIT 8
22#define BITBLK MAXCHR/CHRBIT
23
24class CharacterIndexer {
b8193d80 25public:
65ec6247 26 virtual char CharAt(int index)=0;
1e9bafca
RD
27 virtual ~CharacterIndexer() {
28 }
65ec6247
RD
29};
30
31class RESearch {
32
33public:
b8193d80 34 RESearch(CharClassify *charClassTable);
65ec6247 35 ~RESearch();
65ec6247 36 bool GrabMatches(CharacterIndexer &ci);
9e96e16f 37 const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix);
65ec6247 38 int Execute(CharacterIndexer &ci, int lp, int endp);
65ec6247
RD
39 int Substitute(CharacterIndexer &ci, char *src, char *dst);
40
7e0c58e9
RD
41 enum { MAXTAG=10 };
42 enum { MAXNFA=2048 };
43 enum { NOTFOUND=-1 };
65ec6247
RD
44
45 int bopat[MAXTAG];
46 int eopat[MAXTAG];
47 char *pat[MAXTAG];
48
49private:
b8193d80
RD
50 void Init();
51 void Clear();
7e0c58e9
RD
52 void ChSet(unsigned char c);
53 void ChSetWithCase(unsigned char c, bool caseSensitive);
9e96e16f 54 int GetBackslashExpression(const char *pattern, int &incr);
b8193d80 55
65ec6247
RD
56 int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
57
58 int bol;
7e0c58e9 59 int tagstk[MAXTAG]; /* subpat tag stack */
b8193d80 60 char nfa[MAXNFA]; /* automaton */
65ec6247 61 int sta;
7e0c58e9 62 unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */
65ec6247 63 int failure;
b8193d80
RD
64 CharClassify *charClass;
65 bool iswordc(unsigned char x) {
66 return charClass->IsWord(x);
67 }
65ec6247
RD
68};
69
7e0c58e9
RD
70#ifdef SCI_NAMESPACE
71}
65ec6247 72#endif
7e0c58e9
RD
73
74#endif
75