/* -*- Mode: C; tab-width: 4 -*-
*
* Secret Labs' Regular Expression Engine
- * $Id$
*
* regular expression matching engine
*
#ifndef SRE_RECURSIVE
static char
-copyright[] = " SRE 0.9.1 Copyright (c) 1997-2000 by Secret Labs AB ";
+copyright[] = " SRE 0.9.2 Copyright (c) 1997-2000 by Secret Labs AB ";
#include "Python.h"
#define HAVE_UNICODE
#endif
-#if defined(WIN32) /* FIXME: <fl> don't assume Windows == MSVC */
+#if defined(_MSC_VER)
#pragma optimize("agtw", on) /* doesn't seem to make much difference... */
/* fastest possible local call under MSVC */
#define LOCAL(type) static __inline type __fastcall
int this, that;
switch (at) {
+
case SRE_AT_BEGINNING:
return ((void*) ptr == state->beginning);
+
case SRE_AT_BEGINNING_LINE:
return ((void*) ptr == state->beginning ||
SRE_IS_LINEBREAK((int) ptr[-1]));
+
case SRE_AT_END:
return ((void*) ptr == state->end);
+
case SRE_AT_END_LINE:
return ((void*) ptr == state->end ||
SRE_IS_LINEBREAK((int) ptr[0]));
+
case SRE_AT_BOUNDARY:
if (state->beginning == state->end)
return 0;
this = ((void*) ptr < state->end) ?
SRE_IS_WORD((int) ptr[0]) : 0;
return this != that;
+
case SRE_AT_NON_BOUNDARY:
if (state->beginning == state->end)
return 0;
break;
default:
- /* FIXME: internal error */
+ /* internal error -- there's not much we can do about it
+ here, so let's just pretend it didn't match... */
return 0;
}
}
SRE_CHAR* ptr = state->start;
SRE_CHAR* end = state->end;
int status = 0;
+ int prefix_len = 0;
+ SRE_CODE* prefix = NULL;
if (pattern[0] == SRE_OP_INFO) {
- /* don't look too far */
+ /* args: <skip> <min> <max> <prefix> <prefix data...> */
end -= pattern[2];
+ prefix_len = pattern[4];
+ prefix = pattern + 5;
pattern += pattern[1];
- /* FIXME: add support for fast scan */
}
+ /* if (prefix_len > 0) ... */
+
if (pattern[0] == SRE_OP_LITERAL) {
/* pattern starts with a literal */
SRE_CHAR chr = (SRE_CHAR) pattern[1];