aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/RESearch.h
diff options
context:
space:
mode:
authornyamatongwe <unknown>2001-04-04 12:52:44 +0000
committernyamatongwe <unknown>2001-04-04 12:52:44 +0000
commit93b871d1d8fbb076510e2c410ba57a0980a22ec8 (patch)
tree56576fc17d8737f5fbb591a89fd1e9fab4bd1a59 /src/RESearch.h
parentb338ed2a95f184263c1e1c7782ba3706fa05858c (diff)
downloadscintilla-mirror-93b871d1d8fbb076510e2c410ba57a0980a22ec8.tar.gz
Moved to public domain regular expresion implementation.
Diffstat (limited to 'src/RESearch.h')
-rw-r--r--src/RESearch.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/RESearch.h b/src/RESearch.h
new file mode 100644
index 000000000..f9cf7fdc5
--- /dev/null
+++ b/src/RESearch.h
@@ -0,0 +1,54 @@
+// Scintilla source code edit control
+/** @file RESearch.h
+ ** Interface to the regular expression search library.
+ **/
+// Written by Neil Hodgson <neilh@scintilla.org>
+// Based on the work of Ozan S. Yigit.
+// This file is in the public domain.
+
+#ifndef RESEARCH_H
+#define RESEARCH_H
+
+/*
+ * The following defines are not meant to be changeable.
+ * They are for readability only.
+ */
+#define MAXCHR 128
+#define CHRBIT 8
+#define BITBLK MAXCHR/CHRBIT
+
+class CharacterIndexer {
+public:
+ virtual char CharAt(int index)=0;
+};
+
+class RESearch {
+
+public:
+ RESearch();
+ void ChSet(char c);
+ const char *Compile(char *pat);
+ int Execute(CharacterIndexer &ci, int lp);
+ void ModifyWord(char *s);
+ int Substitute(CharacterIndexer &ci, char *src, char *dst);
+
+ enum {MAXTAG=10};
+ enum {MAXNFA=1024};
+ enum {NOTFOUND=-1};
+
+ int bopat[MAXTAG];
+ int eopat[MAXTAG];
+
+private:
+ int PMatch(CharacterIndexer &ci, int lp, char *ap);
+
+ int bol;
+ int tagstk[MAXTAG]; /* subpat tag stack..*/
+ char nfa[MAXNFA]; /* automaton.. */
+ int sta;
+ char bittab[BITBLK]; /* bit table for CCL */
+ /* pre-set bits... */
+ int failure;
+};
+
+#endif