cpython/Modules/_sre/sre_lib.h

/*
 * Secret Labs' Regular Expression Engine
 *
 * regular expression matching engine
 *
 * Copyright (c) 1997-2001 by Secret Labs AB.  All rights reserved.
 *
 * See the sre.c file for information on usage and redistribution.
 */

/* String matching engine */

/* This file is included three times, with different character settings */

LOCAL(int)
SRE(at)(SRE_STATE* state, const SRE_CHAR* ptr, SRE_CODE at)
{}

LOCAL(int)
SRE(charset)(SRE_STATE* state, const SRE_CODE* set, SRE_CODE ch)
{}

LOCAL(int)
SRE(charset_loc_ignore)(SRE_STATE* state, const SRE_CODE* set, SRE_CODE ch)
{}

LOCAL(Py_ssize_t) SRE(match)(SRE_STATE* state, const SRE_CODE* pattern, int toplevel);

LOCAL(Py_ssize_t)
SRE(count)(SRE_STATE* state, const SRE_CODE* pattern, Py_ssize_t maxcount)
{}

/* The macros below should be used to protect recursive SRE(match)()
 * calls that *failed* and do *not* return immediately (IOW, those
 * that will backtrack). Explaining:
 *
 * - Recursive SRE(match)() returned true: that's usually a success
 *   (besides atypical cases like ASSERT_NOT), therefore there's no
 *   reason to restore lastmark;
 *
 * - Recursive SRE(match)() returned false but the current SRE(match)()
 *   is returning to the caller: If the current SRE(match)() is the
 *   top function of the recursion, returning false will be a matching
 *   failure, and it doesn't matter where lastmark is pointing to.
 *   If it's *not* the top function, it will be a recursive SRE(match)()
 *   failure by itself, and the calling SRE(match)() will have to deal
 *   with the failure by the same rules explained here (it will restore
 *   lastmark by itself if necessary);
 *
 * - Recursive SRE(match)() returned false, and will continue the
 *   outside 'for' loop: must be protected when breaking, since the next
 *   OP could potentially depend on lastmark;
 *
 * - Recursive SRE(match)() returned false, and will be called again
 *   inside a local for/while loop: must be protected between each
 *   loop iteration, since the recursive SRE(match)() could do anything,
 *   and could potentially depend on lastmark.
 *
 * For more information, check the discussion at SF patch #712900.
 */
#define LASTMARK_SAVE()
#define LASTMARK_RESTORE()

#define LAST_PTR_PUSH()
#define LAST_PTR_POP()

#define RETURN_ERROR(i)
#define RETURN_FAILURE
#define RETURN_SUCCESS

#define RETURN_ON_ERROR(i)
#define RETURN_ON_SUCCESS(i)
#define RETURN_ON_FAILURE(i)

#define DATA_STACK_ALLOC(state, type, ptr)

#define DATA_STACK_LOOKUP_AT(state, type, ptr, pos)

#define DATA_STACK_PUSH(state, data, size)

/* We add an explicit cast to memcpy here because MSVC has a bug when
   compiling C code where it believes that `const void**` cannot be
   safely casted to `void*`, see bpo-39943 for details. */
#define DATA_STACK_POP(state, data, size, discard)

#define DATA_STACK_POP_DISCARD(state, size)

#define DATA_PUSH(x)
#define DATA_POP(x)
#define DATA_POP_DISCARD(x)
#define DATA_ALLOC(t,p)
#define DATA_LOOKUP_AT(t,p,pos)

#define PTR_TO_INDEX(ptr)

#if VERBOSE
#define MARK_TRACE
#else
#define MARK_TRACE(label, lastmark)
#endif
#define MARK_PUSH(lastmark)
#define MARK_POP(lastmark)
#define MARK_POP_KEEP(lastmark)
#define MARK_POP_DISCARD(lastmark)

#define JUMP_NONE
#define JUMP_MAX_UNTIL_1
#define JUMP_MAX_UNTIL_2
#define JUMP_MAX_UNTIL_3
#define JUMP_MIN_UNTIL_1
#define JUMP_MIN_UNTIL_2
#define JUMP_MIN_UNTIL_3
#define JUMP_REPEAT
#define JUMP_REPEAT_ONE_1
#define JUMP_REPEAT_ONE_2
#define JUMP_MIN_REPEAT_ONE
#define JUMP_BRANCH
#define JUMP_ASSERT
#define JUMP_ASSERT_NOT
#define JUMP_POSS_REPEAT_1
#define JUMP_POSS_REPEAT_2
#define JUMP_ATOMIC_GROUP

#define DO_JUMPX(jumpvalue, jumplabel, nextpattern, toplevel_)

#define DO_JUMP(jumpvalue, jumplabel, nextpattern)

#define DO_JUMP0(jumpvalue, jumplabel, nextpattern)

sre_ucs1_match_context;

#define _MAYBE_CHECK_SIGNALS

#ifdef Py_DEBUG
#define MAYBE_CHECK_SIGNALS
#else
#define MAYBE_CHECK_SIGNALS
#endif /* Py_DEBUG */

#ifdef HAVE_COMPUTED_GOTOS
    #ifndef USE_COMPUTED_GOTOS
    #define USE_COMPUTED_GOTOS
    #endif
#elif defined(USE_COMPUTED_GOTOS) && USE_COMPUTED_GOTOS
    #error "Computed gotos are not supported on this compiler."
#else
    #undef USE_COMPUTED_GOTOS
    #define USE_COMPUTED_GOTOS
#endif

#if USE_COMPUTED_GOTOS
    #define TARGET(OP)
    #define DISPATCH
#else
    #define TARGET
    #define DISPATCH
#endif

/* check if string matches the given pattern.  returns <0 for
   error, 0 for failure, and 1 for success */
LOCAL(Py_ssize_t)
SRE(match)(SRE_STATE* state, const SRE_CODE* pattern, int toplevel)
{}

/* need to reset capturing groups between two SRE(match) callings in loops */
#define RESET_CAPTURE_GROUP()

LOCAL(Py_ssize_t)
SRE(search)(SRE_STATE* state, SRE_CODE* pattern)
{}

#undef SRE_CHAR
#undef SIZEOF_SRE_CHAR
#undef SRE

/* vim:ts=4:sw=4:et
*/