summaryrefslogtreecommitdiffstats
path: root/scintilla/src/RESearch.h
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2010-10-31 17:17:15 +0000
committerXhmikosR <xhmikosr@users.sourceforge.net>2010-10-31 17:17:15 +0000
commit88a9de8737ca5a2ba239d49e072660fc9c89ab25 (patch)
treeb64f81588eafd28926ffc632c01f6b3c246e218d /scintilla/src/RESearch.h
parente5eb2fe35699c79bef11a870fd4c111c040fc22c (diff)
downloadnotepad2-mod-88a9de8737ca5a2ba239d49e072660fc9c89ab25.zip
notepad2-mod-88a9de8737ca5a2ba239d49e072660fc9c89ab25.tar.gz
notepad2-mod-88a9de8737ca5a2ba239d49e072660fc9c89ab25.tar.bz2
add scintilla v2.12 in the svn
git-svn-id: https://notepad2-mod.googlecode.com/svn/trunk@3 28bd50df-7adb-d945-0439-6e466c6a13cc
Diffstat (limited to 'scintilla/src/RESearch.h')
-rw-r--r--scintilla/src/RESearch.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/scintilla/src/RESearch.h b/scintilla/src/RESearch.h
new file mode 100644
index 0000000..e2f8d50
--- /dev/null
+++ b/scintilla/src/RESearch.h
@@ -0,0 +1,75 @@
+// 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
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+/*
+ * The following defines are not meant to be changeable.
+ * They are for readability only.
+ */
+#define MAXCHR 256
+#define CHRBIT 8
+#define BITBLK MAXCHR/CHRBIT
+
+class CharacterIndexer {
+public:
+ virtual char CharAt(int index)=0;
+ virtual ~CharacterIndexer() {
+ }
+};
+
+class RESearch {
+
+public:
+ RESearch(CharClassify *charClassTable);
+ ~RESearch();
+ bool GrabMatches(CharacterIndexer &ci);
+ const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix);
+ int Execute(CharacterIndexer &ci, int lp, int endp);
+ int Substitute(CharacterIndexer &ci, char *src, char *dst);
+
+ enum { MAXTAG=10 };
+ enum { MAXNFA=2048 };
+ enum { NOTFOUND=-1 };
+
+ int bopat[MAXTAG];
+ int eopat[MAXTAG];
+ char *pat[MAXTAG];
+
+private:
+ void Init();
+ void Clear();
+ void ChSet(unsigned char c);
+ void ChSetWithCase(unsigned char c, bool caseSensitive);
+ int GetBackslashExpression(const char *pattern, int &incr);
+
+ int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
+
+ int bol;
+ int tagstk[MAXTAG]; /* subpat tag stack */
+ char nfa[MAXNFA]; /* automaton */
+ int sta;
+ unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */
+ int failure;
+ CharClassify *charClass;
+ bool iswordc(unsigned char x) {
+ return charClass->IsWord(x);
+ }
+};
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
+