Fix indenting a snippet when there is whitespace after the
[geany-mirror.git] / scintilla / RESearch.h
blobef8c3e11b2ddac9afbc8bc5f2f1d68f2ee77e62e
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 RESearch(CharClassify *charClassTable);
35 ~RESearch();
36 bool 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);
39 int Substitute(CharacterIndexer &ci, char *src, char *dst);
41 enum { MAXTAG=10 };
42 enum { MAXNFA=2048 };
43 enum { NOTFOUND=-1 };
45 int bopat[MAXTAG];
46 int eopat[MAXTAG];
47 char *pat[MAXTAG];
49 private:
50 void Init();
51 void Clear();
52 void ChSet(unsigned char c);
53 void ChSetWithCase(unsigned char c, bool caseSensitive);
54 int GetBackslashExpression(const char *pattern, int &incr);
56 int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
58 int bol;
59 int tagstk[MAXTAG]; /* subpat tag stack */
60 char nfa[MAXNFA]; /* automaton */
61 int sta;
62 unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */
63 int failure;
64 CharClassify *charClass;
65 bool iswordc(unsigned char x) {
66 return charClass->IsWord(x);
70 #ifdef SCI_NAMESPACE
72 #endif
74 #endif