summaryrefslogtreecommitdiffstats
path: root/maildrop/reeval.h
diff options
context:
space:
mode:
Diffstat (limited to 'maildrop/reeval.h')
-rw-r--r--maildrop/reeval.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/maildrop/reeval.h b/maildrop/reeval.h
new file mode 100644
index 0000000..37d59a8
--- /dev/null
+++ b/maildrop/reeval.h
@@ -0,0 +1,32 @@
+#ifndef reeval_h
+#define reeval_h
+
+
+#include "regexpnode.h"
+
+///////////////////////////////////////////////////////////////////////////
+//
+// For matching a regular expression, we keep track of the set of all the
+// current nodes we're currently on. For speed, there are two ReEval
+// objects - current one, and the next one, and we switch between the two
+// on each step.
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+class ReEval {
+public:
+ RegExpNode **nodes;
+ unsigned numnodes;
+ unsigned *nodenums; // For speed - lookup array of nodes
+ // that are already in this set.
+ ReEval() : nodes(0), numnodes(0), nodenums(0), arysize(0) {}
+ ~ReEval() { if (nodes) delete[] nodes;
+ if (nodenums) delete[] nodenums;
+ }
+ void init(unsigned maxsize);
+private:
+ unsigned arysize;
+} ;
+
+#endif