/* Generated by Cython 0.14.1rc2 on Mon Jan 24 21:41:45 2011 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif

#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif

#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif

#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)

#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif

#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE_API__acora___nfa2dfa

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || defined(__INTEL_COMPILER)
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x)   __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "nfa2dfa.py",
};

/* Type declarations */

/* "acora/nfa2dfa.py":58
 * # NFA to DFA transformation
 * 
 * def nfa2dfa(tree, ignore_case):             # <<<<<<<<<<<<<<
 *     """Transform a keyword tree into a DFA using powerset construction.
 *     """
 */

struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa {
  PyObject_HEAD
  PyObject *__pyx_v_visit_all;
};

#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif

#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
  end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
  }
  #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
#else
  #define __Pyx_RefNannySetupContext(name)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name, PyObject* kw_name); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/

static PyObject* __Pyx_PyEval_CallObjectWithKeywords(PyObject*, PyObject*, PyObject*); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; }
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}

#if PY_VERSION_HEX < 0x02050000
#ifndef PyAnySet_CheckExact

#define PyAnySet_CheckExact(ob) \
    ((ob)->ob_type == &PySet_Type || \
     (ob)->ob_type == &PyFrozenSet_Type)

#define PySet_New(iterable) \
    PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL)

#define Pyx_PyFrozenSet_New(iterable) \
    PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL)

#define PySet_Size(anyset) \
    PyObject_Size((anyset))

#define PySet_Contains(anyset, key) \
    PySequence_Contains((anyset), (key))

#define PySet_Pop(set) \
    PyObject_CallMethod(set, (char *)"pop", NULL)

static CYTHON_INLINE int PySet_Clear(PyObject *set) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

#endif /* PyAnySet_CheckExact (<= Py2.4) */

#if PY_VERSION_HEX < 0x02040000
#ifndef Py_SETOBJECT_H
#define Py_SETOBJECT_H

static PyTypeObject *__Pyx_PySet_Type = NULL;
static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL;

#define PySet_Type (*__Pyx_PySet_Type)
#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type)

#define PyAnySet_Check(ob) \
    (PyAnySet_CheckExact(ob) || \
     PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \
     PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))

#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)

static int __Pyx_Py23SetsImport(void) {
    PyObject *sets=0, *Set=0, *ImmutableSet=0;

    sets = PyImport_ImportModule((char *)"sets");
    if (!sets) goto bad;
    Set = PyObject_GetAttrString(sets, (char *)"Set");
    if (!Set) goto bad;
    ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet");
    if (!ImmutableSet) goto bad;
    Py_DECREF(sets);

    __Pyx_PySet_Type       = (PyTypeObject*) Set;
    __Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet;

    return 0;

 bad:
    Py_XDECREF(sets);
    Py_XDECREF(Set);
    Py_XDECREF(ImmutableSet);
    return -1;
}

#else
static int __Pyx_Py23SetsImport(void) { return 0; }
#endif /* !Py_SETOBJECT_H */
#endif /* < Py2.4  */
#endif /* < Py2.5  */


static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
    PyObject *r;
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
        r = PySequence_GetItem(o, i);
    }
    else {
        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
    }
    return r;
}

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname); /*proto*/

#define __pyx_binding_PyCFunctionType_USED 1

typedef struct {
    PyCFunctionObject func;
} __pyx_binding_PyCFunctionType_object;

static PyTypeObject __pyx_binding_PyCFunctionType_type;
static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;

static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */
#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL)

static int __pyx_binding_PyCFunctionType_init(void); /* proto */

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static void __Pyx_AddTraceback(const char *funcname); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from acora._nfa2dfa */

static PyTypeObject *__pyx_ptype_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa = 0;
#define __Pyx_MODULE_NAME "acora._nfa2dfa"
static int __pyx_module_is_main_acora___nfa2dfa = 0;

/* Implementation of acora._nfa2dfa */
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin_len;
static char __pyx_k_2[] = "cannot search for the empty string";
static char __pyx_k_4[] = "acora._nfa2dfa";
static char __pyx_k_5[] = "NFA state for the untransformed automaton.\n    ";
static char __pyx_k__id[] = "id";
static char __pyx_k__add[] = "add";
static char __pyx_k__cls[] = "cls";
static char __pyx_k__key[] = "key";
static char __pyx_k__len[] = "len";
static char __pyx_k__memo[] = "memo";
static char __pyx_k__self[] = "self";
static char __pyx_k__sort[] = "sort";
static char __pyx_k__tree[] = "tree";
static char __pyx_k__items[] = "items";
static char __pyx_k__lower[] = "lower";
static char __pyx_k__other[] = "other";
static char __pyx_k__upper[] = "upper";
static char __pyx_k____eq__[] = "__eq__";
static char __pyx_k____lt__[] = "__lt__";
static char __pyx_k__append[] = "append";
static char __pyx_k__extend[] = "extend";
static char __pyx_k__sorted[] = "sorted";
static char __pyx_k__update[] = "update";
static char __pyx_k__values[] = "values";
static char __pyx_k____new__[] = "__new__";
static char __pyx_k____str__[] = "__str__";
static char __pyx_k__keyword[] = "keyword";
static char __pyx_k__matches[] = "matches";
static char __pyx_k__nfa2dfa[] = "nfa2dfa";
static char __pyx_k__reverse[] = "reverse";
static char __pyx_k__visitor[] = "visitor";
static char __pyx_k__NfaState[] = "NfaState";
static char __pyx_k____copy__[] = "__copy__";
static char __pyx_k____hash__[] = "__hash__";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____repr__[] = "__repr__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__state_id[] = "state_id";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k__ignore_case[] = "ignore_case";
static char __pyx_k____deepcopy__[] = "__deepcopy__";
static char __pyx_k__insert_keyword[] = "insert_keyword";
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_n_s_4;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_n_s__NfaState;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____copy__;
static PyObject *__pyx_n_s____deepcopy__;
static PyObject *__pyx_n_s____eq__;
static PyObject *__pyx_n_s____hash__;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____lt__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____new__;
static PyObject *__pyx_n_s____repr__;
static PyObject *__pyx_n_s____str__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__add;
static PyObject *__pyx_n_s__append;
static PyObject *__pyx_n_s__cls;
static PyObject *__pyx_n_s__extend;
static PyObject *__pyx_n_s__id;
static PyObject *__pyx_n_s__ignore_case;
static PyObject *__pyx_n_s__insert_keyword;
static PyObject *__pyx_n_s__items;
static PyObject *__pyx_n_s__key;
static PyObject *__pyx_n_s__keyword;
static PyObject *__pyx_n_s__len;
static PyObject *__pyx_n_s__lower;
static PyObject *__pyx_n_s__matches;
static PyObject *__pyx_n_s__memo;
static PyObject *__pyx_n_s__nfa2dfa;
static PyObject *__pyx_n_s__other;
static PyObject *__pyx_n_s__reverse;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__sort;
static PyObject *__pyx_n_s__sorted;
static PyObject *__pyx_n_s__state_id;
static PyObject *__pyx_n_s__tree;
static PyObject *__pyx_n_s__update;
static PyObject *__pyx_n_s__upper;
static PyObject *__pyx_n_s__values;
static PyObject *__pyx_n_s__visitor;
static PyObject *__pyx_int_1;
static PyObject *__pyx_k_tuple_1;
static PyObject *__pyx_k_tuple_3;

/* "acora/nfa2dfa.py":7
 *     """NFA state for the untransformed automaton.
 *     """
 *     def __new__(cls, state_id, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         state = dict.__new__(cls, *args, **kwargs)
 *         state.id = state_id
 */

static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState___new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5acora_8_nfa2dfa_8NfaState___new__ = {__Pyx_NAMESTR("__new__"), (PyCFunction)__pyx_pf_5acora_8_nfa2dfa_8NfaState___new__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState___new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_state_id = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_v_state;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__cls,&__pyx_n_s__state_id,0};
  __Pyx_RefNannySetupContext("__new__");
  __pyx_self = __pyx_self;
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_args);

    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs);
      return NULL;
    }
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      default:
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cls);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__state_id);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 2) ? PyTuple_GET_SIZE(__pyx_args) : 2;
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__new__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_cls = values[0];
    __pyx_v_state_id = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_cls = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_state_id = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__new__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_state = Py_None; __Pyx_INCREF(Py_None);

  /* "acora/nfa2dfa.py":8
 *     """
 *     def __new__(cls, state_id, *args, **kwargs):
 *         state = dict.__new__(cls, *args, **kwargs)             # <<<<<<<<<<<<<<
 *         state.id = state_id
 *         state.matches = []
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_n_s____new__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_cls);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_cls);
  __Pyx_GIVEREF(__pyx_v_cls);
  __pyx_t_3 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_v_state);
  __pyx_v_state = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "acora/nfa2dfa.py":9
 *     def __new__(cls, state_id, *args, **kwargs):
 *         state = dict.__new__(cls, *args, **kwargs)
 *         state.id = state_id             # <<<<<<<<<<<<<<
 *         state.matches = []
 *         return state
 */
  if (PyObject_SetAttr(__pyx_v_state, __pyx_n_s__id, __pyx_v_state_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "acora/nfa2dfa.py":10
 *         state = dict.__new__(cls, *args, **kwargs)
 *         state.id = state_id
 *         state.matches = []             # <<<<<<<<<<<<<<
 *         return state
 * 
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyObject_SetAttr(__pyx_v_state, __pyx_n_s__matches, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "acora/nfa2dfa.py":11
 *         state.id = state_id
 *         state.matches = []
 *         return state             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, state_id, *args, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_state);
  __pyx_r = __pyx_v_state;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__new__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_DECREF(__pyx_v_state);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/nfa2dfa.py":13
 *         return state
 * 
 *     def __init__(self, state_id, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         dict.__init__(self, *args, **kwargs)
 * 
 */

static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5acora_8_nfa2dfa_8NfaState_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_5acora_8_nfa2dfa_8NfaState_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_state_id = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__state_id,0};
  __Pyx_RefNannySetupContext("__init__");
  __pyx_self = __pyx_self;
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_args);

    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs);
      return NULL;
    }
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      default:
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__state_id);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 2) ? PyTuple_GET_SIZE(__pyx_args) : 2;
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_state_id = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_state_id = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__init__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "acora/nfa2dfa.py":14
 * 
 *     def __init__(self, state_id, *args, **kwargs):
 *         dict.__init__(self, *args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def __lt__(self, other):
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__init__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/nfa2dfa.py":16
 *         dict.__init__(self, *args, **kwargs)
 * 
 *     def __lt__(self, other):             # <<<<<<<<<<<<<<
 *         return self.id < other.id
 * 
 */

static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_2__lt__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5acora_8_nfa2dfa_8NfaState_2__lt__ = {__Pyx_NAMESTR("__lt__"), (PyCFunction)__pyx_pf_5acora_8_nfa2dfa_8NfaState_2__lt__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_2__lt__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
  __Pyx_RefNannySetupContext("__lt__");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__lt__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__lt__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_other = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_other = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__lt__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__lt__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "acora/nfa2dfa.py":17
 * 
 *     def __lt__(self, other):
 *         return self.id < other.id             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__lt__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/nfa2dfa.py":19
 *         return self.id < other.id
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         return self.id == other.id
 * 
 */

static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_3__eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5acora_8_nfa2dfa_8NfaState_3__eq__ = {__Pyx_NAMESTR("__eq__"), (PyCFunction)__pyx_pf_5acora_8_nfa2dfa_8NfaState_3__eq__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_3__eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
  __Pyx_RefNannySetupContext("__eq__");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__eq__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_other = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_other = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__eq__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "acora/nfa2dfa.py":20
 * 
 *     def __eq__(self, other):
 *         return self.id == other.id             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__eq__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/nfa2dfa.py":22
 *         return self.id == other.id
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return self.id
 * 
 */

static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_4__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5acora_8_nfa2dfa_8NfaState_4__hash__ = {__Pyx_NAMESTR("__hash__"), (PyCFunction)__pyx_pf_5acora_8_nfa2dfa_8NfaState_4__hash__, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_4__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__hash__");
  __pyx_self = __pyx_self;

  /* "acora/nfa2dfa.py":23
 * 
 *     def __hash__(self):
 *         return self.id             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__hash__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/nfa2dfa.py":25
 *         return self.id
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return str(self.id)
 *     __repr__ = __str__
 */

static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_5__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5acora_8_nfa2dfa_8NfaState_5__str__ = {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_5acora_8_nfa2dfa_8NfaState_5__str__, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_5__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__str__");
  __pyx_self = __pyx_self;

  /* "acora/nfa2dfa.py":26
 * 
 *     def __str__(self):
 *         return str(self.id)             # <<<<<<<<<<<<<<
 *     __repr__ = __str__
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__str__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/nfa2dfa.py":29
 *     __repr__ = __str__
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         state = NfaState(self.id, **self)
 *         state.matches[:] = self.matches
 */

static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_6__copy__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5acora_8_nfa2dfa_8NfaState_6__copy__ = {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_5acora_8_nfa2dfa_8NfaState_6__copy__, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_6__copy__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_state;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__copy__");
  __pyx_self = __pyx_self;
  __pyx_v_state = Py_None; __Pyx_INCREF(Py_None);

  /* "acora/nfa2dfa.py":30
 * 
 *     def __copy__(self):
 *         state = NfaState(self.id, **self)             # <<<<<<<<<<<<<<
 *         state.matches[:] = self.matches
 *         return state
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__NfaState); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), __pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_state);
  __pyx_v_state = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":31
 *     def __copy__(self):
 *         state = NfaState(self.id, **self)
 *         state.matches[:] = self.matches             # <<<<<<<<<<<<<<
 *         return state
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__matches); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_state, __pyx_n_s__matches); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_PySequence_SetSlice(__pyx_t_3, 0, PY_SSIZE_T_MAX, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":32
 *         state = NfaState(self.id, **self)
 *         state.matches[:] = self.matches
 *         return state             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_state);
  __pyx_r = __pyx_v_state;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__copy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_state);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/nfa2dfa.py":34
 *         return state
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         state = NfaState(
 *             self.id,
 */

static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_7__deepcopy__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5acora_8_nfa2dfa_8NfaState_7__deepcopy__ = {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pf_5acora_8_nfa2dfa_8NfaState_7__deepcopy__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5acora_8_nfa2dfa_8NfaState_7__deepcopy__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_memo = 0;
  PyObject *__pyx_v_state;
  PyObject *__pyx_v_char;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__memo,0};
  __Pyx_RefNannySetupContext("__deepcopy__");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__memo);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__deepcopy__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_memo = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_memo = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__deepcopy__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_state = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_char = Py_None; __Pyx_INCREF(Py_None);

  /* "acora/nfa2dfa.py":35
 * 
 *     def __deepcopy__(self, memo):
 *         state = NfaState(             # <<<<<<<<<<<<<<
 *             self.id,
 *             [ (char, state.__deepcopy__(None))
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__NfaState); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "acora/nfa2dfa.py":36
 *     def __deepcopy__(self, memo):
 *         state = NfaState(
 *             self.id,             # <<<<<<<<<<<<<<
 *             [ (char, state.__deepcopy__(None))
 *               for char, state in self.items() ])
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "acora/nfa2dfa.py":37
 *         state = NfaState(
 *             self.id,
 *             [ (char, state.__deepcopy__(None))             # <<<<<<<<<<<<<<
 *               for char, state in self.items() ])
 *         state.matches[:] = self.matches
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));

  /* "acora/nfa2dfa.py":38
 *             self.id,
 *             [ (char, state.__deepcopy__(None))
 *               for char, state in self.items() ])             # <<<<<<<<<<<<<<
 *         state.matches[:] = self.matches
 *         return state
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__items); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
    __pyx_t_4 = 0; __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5);
  } else {
    __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_5))) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break;
      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
    } else {
      __pyx_t_6 = PyIter_Next(__pyx_t_5);
      if (!__pyx_t_6) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) {
      PyObject* tuple = __pyx_t_6;
      __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_char);
      __pyx_v_char = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_state);
      __pyx_v_state = __pyx_t_8;
      __pyx_t_8 = 0;
    } else {
      __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_v_char);
      __pyx_v_char = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_state);
      __pyx_v_state = __pyx_t_8;
      __pyx_t_8 = 0;
    }

    /* "acora/nfa2dfa.py":37
 *         state = NfaState(
 *             self.id,
 *             [ (char, state.__deepcopy__(None))             # <<<<<<<<<<<<<<
 *               for char, state in self.items() ])
 *         state.matches[:] = self.matches
 */
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_state, __pyx_n_s____deepcopy__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(__pyx_v_char);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_char);
    __Pyx_GIVEREF(__pyx_v_char);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_8 = 0;
    if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_v_state);
  __pyx_v_state = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "acora/nfa2dfa.py":39
 *             [ (char, state.__deepcopy__(None))
 *               for char, state in self.items() ])
 *         state.matches[:] = self.matches             # <<<<<<<<<<<<<<
 *         return state
 * 
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__matches); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_state, __pyx_n_s__matches); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_PySequence_SetSlice(__pyx_t_5, 0, PY_SSIZE_T_MAX, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "acora/nfa2dfa.py":40
 *               for char, state in self.items() ])
 *         state.matches[:] = self.matches
 *         return state             # <<<<<<<<<<<<<<
 * 
 * def insert_keyword(tree, keyword, state_id):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_state);
  __pyx_r = __pyx_v_state;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("acora._nfa2dfa.NfaState.__deepcopy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_state);
  __Pyx_DECREF(__pyx_v_char);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/nfa2dfa.py":42
 *         return state
 * 
 * def insert_keyword(tree, keyword, state_id):             # <<<<<<<<<<<<<<
 *     if not keyword:
 *         raise ValueError("cannot search for the empty string")
 */

static PyObject *__pyx_pf_5acora_8_nfa2dfa_insert_keyword(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5acora_8_nfa2dfa_insert_keyword = {__Pyx_NAMESTR("insert_keyword"), (PyCFunction)__pyx_pf_5acora_8_nfa2dfa_insert_keyword, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5acora_8_nfa2dfa_insert_keyword(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree = 0;
  PyObject *__pyx_v_keyword = 0;
  PyObject *__pyx_v_state_id = 0;
  PyObject *__pyx_v_char;
  PyObject *__pyx_v_next_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree,&__pyx_n_s__keyword,&__pyx_n_s__state_id,0};
  __Pyx_RefNannySetupContext("insert_keyword");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__keyword);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("insert_keyword", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__state_id);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("insert_keyword", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "insert_keyword") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tree = values[0];
    __pyx_v_keyword = values[1];
    __pyx_v_state_id = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_tree = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_keyword = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_state_id = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insert_keyword", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._nfa2dfa.insert_keyword");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_tree);
  __Pyx_INCREF(__pyx_v_state_id);
  __pyx_v_char = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_next_node = Py_None; __Pyx_INCREF(Py_None);

  /* "acora/nfa2dfa.py":43
 * 
 * def insert_keyword(tree, keyword, state_id):
 *     if not keyword:             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot search for the empty string")
 *     for char in keyword:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_keyword); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "acora/nfa2dfa.py":44
 * def insert_keyword(tree, keyword, state_id):
 *     if not keyword:
 *         raise ValueError("cannot search for the empty string")             # <<<<<<<<<<<<<<
 *     for char in keyword:
 *         if char in tree:
 */
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "acora/nfa2dfa.py":45
 *     if not keyword:
 *         raise ValueError("cannot search for the empty string")
 *     for char in keyword:             # <<<<<<<<<<<<<<
 *         if char in tree:
 *             tree = tree[char]
 */
  if (PyList_CheckExact(__pyx_v_keyword) || PyTuple_CheckExact(__pyx_v_keyword)) {
    __pyx_t_4 = 0; __pyx_t_3 = __pyx_v_keyword; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_keyword); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++;
    } else {
      __pyx_t_5 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_5) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_v_char);
    __pyx_v_char = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "acora/nfa2dfa.py":46
 *         raise ValueError("cannot search for the empty string")
 *     for char in keyword:
 *         if char in tree:             # <<<<<<<<<<<<<<
 *             tree = tree[char]
 *         else:
 */
    __pyx_t_2 = ((PySequence_Contains(__pyx_v_tree, __pyx_v_char))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "acora/nfa2dfa.py":47
 *     for char in keyword:
 *         if char in tree:
 *             tree = tree[char]             # <<<<<<<<<<<<<<
 *         else:
 *             next_node = NfaState(state_id)
 */
      __pyx_t_5 = PyObject_GetItem(__pyx_v_tree, __pyx_v_char); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_tree);
      __pyx_v_tree = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "acora/nfa2dfa.py":49
 *             tree = tree[char]
 *         else:
 *             next_node = NfaState(state_id)             # <<<<<<<<<<<<<<
 *             state_id += 1
 *             tree[char] = next_node
 */
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__NfaState); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(__pyx_v_state_id);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_state_id);
      __Pyx_GIVEREF(__pyx_v_state_id);
      __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_next_node);
      __pyx_v_next_node = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "acora/nfa2dfa.py":50
 *         else:
 *             next_node = NfaState(state_id)
 *             state_id += 1             # <<<<<<<<<<<<<<
 *             tree[char] = next_node
 *             tree = next_node
 */
      __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_state_id, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_v_state_id);
      __pyx_v_state_id = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "acora/nfa2dfa.py":51
 *             next_node = NfaState(state_id)
 *             state_id += 1
 *             tree[char] = next_node             # <<<<<<<<<<<<<<
 *             tree = next_node
 *     tree.matches = [keyword]
 */
      if (PyObject_SetItem(__pyx_v_tree, __pyx_v_char, __pyx_v_next_node) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "acora/nfa2dfa.py":52
 *             state_id += 1
 *             tree[char] = next_node
 *             tree = next_node             # <<<<<<<<<<<<<<
 *     tree.matches = [keyword]
 *     return state_id
 */
      __Pyx_INCREF(__pyx_v_next_node);
      __Pyx_DECREF(__pyx_v_tree);
      __pyx_v_tree = __pyx_v_next_node;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "acora/nfa2dfa.py":53
 *             tree[char] = next_node
 *             tree = next_node
 *     tree.matches = [keyword]             # <<<<<<<<<<<<<<
 *     return state_id
 * 
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_keyword);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_keyword);
  __Pyx_GIVEREF(__pyx_v_keyword);
  if (PyObject_SetAttr(__pyx_v_tree, __pyx_n_s__matches, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "acora/nfa2dfa.py":54
 *             tree = next_node
 *     tree.matches = [keyword]
 *     return state_id             # <<<<<<<<<<<<<<
 * 
 * # NFA to DFA transformation
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_state_id);
  __pyx_r = __pyx_v_state_id;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("acora._nfa2dfa.insert_keyword");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_char);
  __Pyx_DECREF(__pyx_v_next_node);
  __Pyx_DECREF(__pyx_v_tree);
  __Pyx_DECREF(__pyx_v_state_id);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/nfa2dfa.py":61
 *     """Transform a keyword tree into a DFA using powerset construction.
 *     """
 *     def visit_all(tree, visitor):             # <<<<<<<<<<<<<<
 *         visitor(tree)
 *         for node in tree.values():
 */

static PyObject *__pyx_pf_5acora_8_nfa2dfa_7nfa2dfa_visit_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5acora_8_nfa2dfa_7nfa2dfa_visit_all = {__Pyx_NAMESTR("visit_all"), (PyCFunction)__pyx_pf_5acora_8_nfa2dfa_7nfa2dfa_visit_all, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5acora_8_nfa2dfa_7nfa2dfa_visit_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *__pyx_cur_scope;
  struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *__pyx_outer_scope;
  PyObject *__pyx_v_tree = 0;
  PyObject *__pyx_v_visitor = 0;
  PyObject *__pyx_v_node;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree,&__pyx_n_s__visitor,0};
  __Pyx_RefNannySetupContext("visit_all");
  __pyx_outer_scope = (struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *)__pyx_self;
  __pyx_cur_scope = __pyx_outer_scope;
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__visitor);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("visit_all", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "visit_all") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tree = values[0];
    __pyx_v_visitor = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_tree = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_visitor = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("visit_all", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._nfa2dfa.nfa2dfa.visit_all");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_node = Py_None; __Pyx_INCREF(Py_None);

  /* "acora/nfa2dfa.py":62
 *     """
 *     def visit_all(tree, visitor):
 *         visitor(tree)             # <<<<<<<<<<<<<<
 *         for node in tree.values():
 *             visit_all(node, visitor)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_tree);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tree);
  __Pyx_GIVEREF(__pyx_v_tree);
  __pyx_t_2 = PyObject_Call(__pyx_v_visitor, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":63
 *     def visit_all(tree, visitor):
 *         visitor(tree)
 *         for node in tree.values():             # <<<<<<<<<<<<<<
 *             visit_all(node, visitor)
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_tree, __pyx_n_s__values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else {
      __pyx_t_1 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_1) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_v_node);
    __pyx_v_node = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "acora/nfa2dfa.py":64
 *         visitor(tree)
 *         for node in tree.values():
 *             visit_all(node, visitor)             # <<<<<<<<<<<<<<
 * 
 *     states = []
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_node);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_node);
    __Pyx_GIVEREF(__pyx_v_node);
    __Pyx_INCREF(__pyx_v_visitor);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_visitor);
    __Pyx_GIVEREF(__pyx_v_visitor);
    __pyx_t_4 = PyObject_Call(__pyx_cur_scope->__pyx_v_visit_all, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("acora._nfa2dfa.nfa2dfa.visit_all");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/nfa2dfa.py":58
 * # NFA to DFA transformation
 * 
 * def nfa2dfa(tree, ignore_case):             # <<<<<<<<<<<<<<
 *     """Transform a keyword tree into a DFA using powerset construction.
 *     """
 */

static PyObject *__pyx_pf_5acora_8_nfa2dfa_1nfa2dfa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5acora_8_nfa2dfa_1nfa2dfa[] = "Transform a keyword tree into a DFA using powerset construction.\n    ";
static PyMethodDef __pyx_mdef_5acora_8_nfa2dfa_1nfa2dfa = {__Pyx_NAMESTR("nfa2dfa"), (PyCFunction)__pyx_pf_5acora_8_nfa2dfa_1nfa2dfa, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5acora_8_nfa2dfa_1nfa2dfa)};
static PyObject *__pyx_pf_5acora_8_nfa2dfa_1nfa2dfa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *__pyx_cur_scope;
  PyObject *__pyx_v_tree = 0;
  PyObject *__pyx_v_ignore_case = 0;
  PyObject *__pyx_v_states;
  PyObject *__pyx_v_next_state_id;
  PyObject *__pyx_v_transitions;
  PyObject *__pyx_v_chars_by_state;
  PyObject *__pyx_v_new_eq_classes;
  PyObject *__pyx_v_state;
  PyObject *__pyx_v_chars;
  PyObject *__pyx_v_char;
  PyObject *__pyx_v_target;
  PyObject *__pyx_v_key;
  PyObject *__pyx_v_existing_eq_classes;
  PyObject *__pyx_v_eq_classes_by_state;
  PyObject *__pyx_v_eq_classes;
  PyObject *__pyx_v_eq_states;
  PyObject *__pyx_v_eq_key;
  PyObject *__pyx_v_new_state;
  PyObject *__pyx_v_matches;
  PyObject *__pyx_v_s;
  PyObject *__pyx_v_new_chars;
  PyObject *__pyx_v_targets;
  PyObject *__pyx_v_new_key;
  PyObject *__pyx_v_state_set;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree,&__pyx_n_s__ignore_case,0};
  __Pyx_RefNannySetupContext("nfa2dfa");
  __pyx_cur_scope = (struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *)__pyx_ptype_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa->tp_new(__pyx_ptype_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ignore_case);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("nfa2dfa", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "nfa2dfa") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tree = values[0];
    __pyx_v_ignore_case = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_tree = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_ignore_case = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfa2dfa", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._nfa2dfa.nfa2dfa");
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_cur_scope->__pyx_v_visit_all = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_states = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_next_state_id = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_transitions = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_chars_by_state = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_new_eq_classes = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_state = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_chars = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_char = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_target = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_existing_eq_classes = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_eq_classes_by_state = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_eq_classes = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_eq_states = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_eq_key = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_new_state = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_matches = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_new_chars = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_targets = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_new_key = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_state_set = Py_None; __Pyx_INCREF(Py_None);

  /* "acora/nfa2dfa.py":61
 *     """Transform a keyword tree into a DFA using powerset construction.
 *     """
 *     def visit_all(tree, visitor):             # <<<<<<<<<<<<<<
 *         visitor(tree)
 *         for node in tree.values():
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5acora_8_nfa2dfa_7nfa2dfa_visit_all, ((PyObject*)__pyx_cur_scope), __pyx_n_s_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_cur_scope->__pyx_v_visit_all);
  __pyx_cur_scope->__pyx_v_visit_all = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":66
 *             visit_all(node, visitor)
 * 
 *     states = []             # <<<<<<<<<<<<<<
 *     visit_all(tree, states.append)
 *     next_state_id = len(states)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_v_states);
  __pyx_v_states = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":67
 * 
 *     states = []
 *     visit_all(tree, states.append)             # <<<<<<<<<<<<<<
 *     next_state_id = len(states)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_states, __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_tree);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tree);
  __Pyx_GIVEREF(__pyx_v_tree);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_cur_scope->__pyx_v_visit_all, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":68
 *     states = []
 *     visit_all(tree, states.append)
 *     next_state_id = len(states)             # <<<<<<<<<<<<<<
 * 
 *     # run through all states and collect all transitions, including
 */
  __pyx_t_3 = PyObject_Length(__pyx_v_states); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_next_state_id);
  __pyx_v_next_state_id = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":72
 *     # run through all states and collect all transitions, including
 *     # those from the start state (in which the NFA always stays)
 *     transitions = {}             # <<<<<<<<<<<<<<
 *     chars_by_state = {}
 *     new_eq_classes = set()
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_v_transitions);
  __pyx_v_transitions = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":73
 *     # those from the start state (in which the NFA always stays)
 *     transitions = {}
 *     chars_by_state = {}             # <<<<<<<<<<<<<<
 *     new_eq_classes = set()
 *     for state in states:
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_v_chars_by_state);
  __pyx_v_chars_by_state = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":74
 *     transitions = {}
 *     chars_by_state = {}
 *     new_eq_classes = set()             # <<<<<<<<<<<<<<
 *     for state in states:
 *         chars = chars_by_state[state] = set()
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_v_new_eq_classes);
  __pyx_v_new_eq_classes = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":75
 *     chars_by_state = {}
 *     new_eq_classes = set()
 *     for state in states:             # <<<<<<<<<<<<<<
 *         chars = chars_by_state[state] = set()
 *         for char, target in state.items():
 */
  if (PyList_CheckExact(__pyx_v_states) || PyTuple_CheckExact(__pyx_v_states)) {
    __pyx_t_3 = 0; __pyx_t_1 = __pyx_v_states; __Pyx_INCREF(__pyx_t_1);
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_states); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_1))) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else {
      __pyx_t_2 = PyIter_Next(__pyx_t_1);
      if (!__pyx_t_2) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_v_state);
    __pyx_v_state = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "acora/nfa2dfa.py":76
 *     new_eq_classes = set()
 *     for state in states:
 *         chars = chars_by_state[state] = set()             # <<<<<<<<<<<<<<
 *         for char, target in state.items():
 *             if ignore_case:
 */
    __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_v_chars);
    __pyx_v_chars = ((PyObject *)__pyx_t_2);
    if (PyObject_SetItem(__pyx_v_chars_by_state, __pyx_v_state, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

    /* "acora/nfa2dfa.py":77
 *     for state in states:
 *         chars = chars_by_state[state] = set()
 *         for char, target in state.items():             # <<<<<<<<<<<<<<
 *             if ignore_case:
 *                 char = char.lower()
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_state, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_5; __Pyx_INCREF(__pyx_t_2);
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++;
      } else {
        __pyx_t_5 = PyIter_Next(__pyx_t_2);
        if (!__pyx_t_5) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) {
        PyObject* tuple = __pyx_t_5;
        __pyx_t_6 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_6);
        __pyx_t_7 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_char);
        __pyx_v_char = __pyx_t_6;
        __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_v_target);
        __pyx_v_target = __pyx_t_7;
        __pyx_t_7 = 0;
      } else {
        __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_EndUnpack(__pyx_t_8, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_v_char);
        __pyx_v_char = __pyx_t_6;
        __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_v_target);
        __pyx_v_target = __pyx_t_7;
        __pyx_t_7 = 0;
      }

      /* "acora/nfa2dfa.py":78
 *         chars = chars_by_state[state] = set()
 *         for char, target in state.items():
 *             if ignore_case:             # <<<<<<<<<<<<<<
 *                 char = char.lower()
 *             transitions[(state,char)] = set([target])
 */
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_case); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_9) {

        /* "acora/nfa2dfa.py":79
 *         for char, target in state.items():
 *             if ignore_case:
 *                 char = char.lower()             # <<<<<<<<<<<<<<
 *             transitions[(state,char)] = set([target])
 *             chars.add(char)
 */
        __pyx_t_5 = PyObject_GetAttr(__pyx_v_char, __pyx_n_s__lower); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_char);
        __pyx_v_char = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "acora/nfa2dfa.py":80
 *             if ignore_case:
 *                 char = char.lower()
 *             transitions[(state,char)] = set([target])             # <<<<<<<<<<<<<<
 *             chars.add(char)
 *         for char, target in tree.items():
 */
      __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      __Pyx_INCREF(__pyx_v_target);
      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_v_target);
      __Pyx_GIVEREF(__pyx_v_target);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_7));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
      __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_v_state);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_state);
      __Pyx_GIVEREF(__pyx_v_state);
      __Pyx_INCREF(__pyx_v_char);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_char);
      __Pyx_GIVEREF(__pyx_v_char);
      if (PyObject_SetItem(__pyx_v_transitions, ((PyObject *)__pyx_t_5), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "acora/nfa2dfa.py":81
 *                 char = char.lower()
 *             transitions[(state,char)] = set([target])
 *             chars.add(char)             # <<<<<<<<<<<<<<
 *         for char, target in tree.items():
 *             if ignore_case:
 */
      __pyx_t_7 = PyObject_GetAttr(__pyx_v_chars, __pyx_n_s__add); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_v_char);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_char);
      __Pyx_GIVEREF(__pyx_v_char);
      __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "acora/nfa2dfa.py":82
 *             transitions[(state,char)] = set([target])
 *             chars.add(char)
 *         for char, target in tree.items():             # <<<<<<<<<<<<<<
 *             if ignore_case:
 *                 char = char.lower()
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_tree, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
      __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2);
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
      } else {
        __pyx_t_6 = PyIter_Next(__pyx_t_2);
        if (!__pyx_t_6) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) {
        PyObject* tuple = __pyx_t_6;
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_7 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_v_char);
        __pyx_v_char = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_target);
        __pyx_v_target = __pyx_t_7;
        __pyx_t_7 = 0;
      } else {
        __pyx_t_8 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_EndUnpack(__pyx_t_8, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_v_char);
        __pyx_v_char = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_target);
        __pyx_v_target = __pyx_t_7;
        __pyx_t_7 = 0;
      }

      /* "acora/nfa2dfa.py":83
 *             chars.add(char)
 *         for char, target in tree.items():
 *             if ignore_case:             # <<<<<<<<<<<<<<
 *                 char = char.lower()
 *             chars.add(char)
 */
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_case); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_9) {

        /* "acora/nfa2dfa.py":84
 *         for char, target in tree.items():
 *             if ignore_case:
 *                 char = char.lower()             # <<<<<<<<<<<<<<
 *             chars.add(char)
 *             key = (state,char)
 */
        __pyx_t_6 = PyObject_GetAttr(__pyx_v_char, __pyx_n_s__lower); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_v_char);
        __pyx_v_char = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "acora/nfa2dfa.py":85
 *             if ignore_case:
 *                 char = char.lower()
 *             chars.add(char)             # <<<<<<<<<<<<<<
 *             key = (state,char)
 *             if key in transitions:
 */
      __pyx_t_7 = PyObject_GetAttr(__pyx_v_chars, __pyx_n_s__add); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(__pyx_v_char);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_char);
      __Pyx_GIVEREF(__pyx_v_char);
      __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "acora/nfa2dfa.py":86
 *                 char = char.lower()
 *             chars.add(char)
 *             key = (state,char)             # <<<<<<<<<<<<<<
 *             if key in transitions:
 *                 transitions[key].add(target)
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_v_state);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_state);
      __Pyx_GIVEREF(__pyx_v_state);
      __Pyx_INCREF(__pyx_v_char);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_char);
      __Pyx_GIVEREF(__pyx_v_char);
      __Pyx_DECREF(__pyx_v_key);
      __pyx_v_key = ((PyObject *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "acora/nfa2dfa.py":87
 *             chars.add(char)
 *             key = (state,char)
 *             if key in transitions:             # <<<<<<<<<<<<<<
 *                 transitions[key].add(target)
 *                 new_eq_classes.add(key)
 */
      __pyx_t_9 = ((PySequence_Contains(__pyx_v_transitions, __pyx_v_key))); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_9) {

        /* "acora/nfa2dfa.py":88
 *             key = (state,char)
 *             if key in transitions:
 *                 transitions[key].add(target)             # <<<<<<<<<<<<<<
 *                 new_eq_classes.add(key)
 *             else:
 */
        __pyx_t_5 = PyObject_GetItem(__pyx_v_transitions, __pyx_v_key); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__add); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __Pyx_INCREF(__pyx_v_target);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_target);
        __Pyx_GIVEREF(__pyx_v_target);
        __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "acora/nfa2dfa.py":89
 *             if key in transitions:
 *                 transitions[key].add(target)
 *                 new_eq_classes.add(key)             # <<<<<<<<<<<<<<
 *             else:
 *                 transitions[key] = set([target])
 */
        __pyx_t_7 = PyObject_GetAttr(__pyx_v_new_eq_classes, __pyx_n_s__add); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __Pyx_INCREF(__pyx_v_key);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_key);
        __Pyx_GIVEREF(__pyx_v_key);
        __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L14;
      }
      /*else*/ {

        /* "acora/nfa2dfa.py":91
 *                 new_eq_classes.add(key)
 *             else:
 *                 transitions[key] = set([target])             # <<<<<<<<<<<<<<
 * 
 *     # create new states for newly found equivalence classes
 */
        __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        __Pyx_INCREF(__pyx_v_target);
        PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_target);
        __Pyx_GIVEREF(__pyx_v_target);
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
        __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        if (PyObject_SetItem(__pyx_v_transitions, __pyx_v_key, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __pyx_L14:;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":94
 * 
 *     # create new states for newly found equivalence classes
 *     existing_eq_classes = {}             # <<<<<<<<<<<<<<
 *     eq_classes_by_state = {}
 *     while new_eq_classes:
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_v_existing_eq_classes);
  __pyx_v_existing_eq_classes = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":95
 *     # create new states for newly found equivalence classes
 *     existing_eq_classes = {}
 *     eq_classes_by_state = {}             # <<<<<<<<<<<<<<
 *     while new_eq_classes:
 *         eq_classes = new_eq_classes
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_v_eq_classes_by_state);
  __pyx_v_eq_classes_by_state = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":96
 *     existing_eq_classes = {}
 *     eq_classes_by_state = {}
 *     while new_eq_classes:             # <<<<<<<<<<<<<<
 *         eq_classes = new_eq_classes
 *         new_eq_classes = set()
 */
  while (1) {
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_new_eq_classes); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_9) break;

    /* "acora/nfa2dfa.py":97
 *     eq_classes_by_state = {}
 *     while new_eq_classes:
 *         eq_classes = new_eq_classes             # <<<<<<<<<<<<<<
 *         new_eq_classes = set()
 *         for key in eq_classes:
 */
    __Pyx_INCREF(__pyx_v_new_eq_classes);
    __Pyx_DECREF(__pyx_v_eq_classes);
    __pyx_v_eq_classes = __pyx_v_new_eq_classes;

    /* "acora/nfa2dfa.py":98
 *     while new_eq_classes:
 *         eq_classes = new_eq_classes
 *         new_eq_classes = set()             # <<<<<<<<<<<<<<
 *         for key in eq_classes:
 *             eq_states = transitions[key]
 */
    __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(__pyx_v_new_eq_classes);
    __pyx_v_new_eq_classes = ((PyObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "acora/nfa2dfa.py":99
 *         eq_classes = new_eq_classes
 *         new_eq_classes = set()
 *         for key in eq_classes:             # <<<<<<<<<<<<<<
 *             eq_states = transitions[key]
 *             if len(eq_states) < 2:
 */
    if (PyList_CheckExact(__pyx_v_eq_classes) || PyTuple_CheckExact(__pyx_v_eq_classes)) {
      __pyx_t_3 = 0; __pyx_t_1 = __pyx_v_eq_classes; __Pyx_INCREF(__pyx_t_1);
    } else {
      __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_eq_classes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    }
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
      } else {
        __pyx_t_2 = PyIter_Next(__pyx_t_1);
        if (!__pyx_t_2) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_v_key);
      __pyx_v_key = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "acora/nfa2dfa.py":100
 *         new_eq_classes = set()
 *         for key in eq_classes:
 *             eq_states = transitions[key]             # <<<<<<<<<<<<<<
 *             if len(eq_states) < 2:
 *                 continue
 */
      __pyx_t_2 = PyObject_GetItem(__pyx_v_transitions, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_eq_states);
      __pyx_v_eq_states = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "acora/nfa2dfa.py":101
 *         for key in eq_classes:
 *             eq_states = transitions[key]
 *             if len(eq_states) < 2:             # <<<<<<<<<<<<<<
 *                 continue
 *             eq_key = tuple(sorted([s.id for s in eq_states]))
 */
      __pyx_t_4 = PyObject_Length(__pyx_v_eq_states); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = (__pyx_t_4 < 2);
      if (__pyx_t_9) {

        /* "acora/nfa2dfa.py":102
 *             eq_states = transitions[key]
 *             if len(eq_states) < 2:
 *                 continue             # <<<<<<<<<<<<<<
 *             eq_key = tuple(sorted([s.id for s in eq_states]))
 *             if eq_key in existing_eq_classes:
 */
        goto __pyx_L17_continue;
        goto __pyx_L19;
      }
      __pyx_L19:;

      /* "acora/nfa2dfa.py":103
 *             if len(eq_states) < 2:
 *                 continue
 *             eq_key = tuple(sorted([s.id for s in eq_states]))             # <<<<<<<<<<<<<<
 *             if eq_key in existing_eq_classes:
 *                 transitions[key] = set([existing_eq_classes[eq_key]])
 */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      if (PyList_CheckExact(__pyx_v_eq_states) || PyTuple_CheckExact(__pyx_v_eq_states)) {
        __pyx_t_4 = 0; __pyx_t_6 = __pyx_v_eq_states; __Pyx_INCREF(__pyx_t_6);
      } else {
        __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_eq_states); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
      }
      for (;;) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_6)) break;
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++;
        } else if (likely(PyTuple_CheckExact(__pyx_t_6))) {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++;
        } else {
          __pyx_t_5 = PyIter_Next(__pyx_t_6);
          if (!__pyx_t_5) {
            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            break;
          }
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_DECREF(__pyx_v_s);
        __pyx_v_s = __pyx_t_5;
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__id); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(((PyObject *)__pyx_t_2));
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_eq_key);
      __pyx_v_eq_key = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "acora/nfa2dfa.py":104
 *                 continue
 *             eq_key = tuple(sorted([s.id for s in eq_states]))
 *             if eq_key in existing_eq_classes:             # <<<<<<<<<<<<<<
 *                 transitions[key] = set([existing_eq_classes[eq_key]])
 *                 continue
 */
      __pyx_t_9 = ((PySequence_Contains(__pyx_v_existing_eq_classes, __pyx_v_eq_key))); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_9) {

        /* "acora/nfa2dfa.py":105
 *             eq_key = tuple(sorted([s.id for s in eq_states]))
 *             if eq_key in existing_eq_classes:
 *                 transitions[key] = set([existing_eq_classes[eq_key]])             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
        __pyx_t_2 = PyObject_GetItem(__pyx_v_existing_eq_classes, __pyx_v_eq_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_6));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
        __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
        if (PyObject_SetItem(__pyx_v_transitions, __pyx_v_key, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "acora/nfa2dfa.py":106
 *             if eq_key in existing_eq_classes:
 *                 transitions[key] = set([existing_eq_classes[eq_key]])
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             # create a new joined state
 */
        goto __pyx_L17_continue;
        goto __pyx_L22;
      }
      __pyx_L22:;

      /* "acora/nfa2dfa.py":109
 * 
 *             # create a new joined state
 *             new_state = NfaState(next_state_id)             # <<<<<<<<<<<<<<
 * 
 *             matches = []
 */
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__NfaState); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_next_state_id);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_next_state_id);
      __Pyx_GIVEREF(__pyx_v_next_state_id);
      __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_new_state);
      __pyx_v_new_state = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "acora/nfa2dfa.py":111
 *             new_state = NfaState(next_state_id)
 * 
 *             matches = []             # <<<<<<<<<<<<<<
 *             for s in eq_states:
 *                 matches.extend(s.matches)
 */
      __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_DECREF(__pyx_v_matches);
      __pyx_v_matches = ((PyObject *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "acora/nfa2dfa.py":112
 * 
 *             matches = []
 *             for s in eq_states:             # <<<<<<<<<<<<<<
 *                 matches.extend(s.matches)
 *             matches.sort(key=len, reverse=True)
 */
      if (PyList_CheckExact(__pyx_v_eq_states) || PyTuple_CheckExact(__pyx_v_eq_states)) {
        __pyx_t_4 = 0; __pyx_t_5 = __pyx_v_eq_states; __Pyx_INCREF(__pyx_t_5);
      } else {
        __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_eq_states); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
      }
      for (;;) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break;
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
        } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
        } else {
          __pyx_t_2 = PyIter_Next(__pyx_t_5);
          if (!__pyx_t_2) {
            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_DECREF(__pyx_v_s);
        __pyx_v_s = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "acora/nfa2dfa.py":113
 *             matches = []
 *             for s in eq_states:
 *                 matches.extend(s.matches)             # <<<<<<<<<<<<<<
 *             matches.sort(key=len, reverse=True)
 *             new_state.matches = matches
 */
        __pyx_t_2 = PyObject_GetAttr(__pyx_v_matches, __pyx_n_s__extend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__matches); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "acora/nfa2dfa.py":114
 *             for s in eq_states:
 *                 matches.extend(s.matches)
 *             matches.sort(key=len, reverse=True)             # <<<<<<<<<<<<<<
 *             new_state.matches = matches
 * 
 */
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_matches, __pyx_n_s__sort); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__key), __pyx_builtin_len) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__reverse), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "acora/nfa2dfa.py":115
 *                 matches.extend(s.matches)
 *             matches.sort(key=len, reverse=True)
 *             new_state.matches = matches             # <<<<<<<<<<<<<<
 * 
 *             eq_classes_by_state[new_state] = eq_states
 */
      if (PyObject_SetAttr(__pyx_v_new_state, __pyx_n_s__matches, __pyx_v_matches) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "acora/nfa2dfa.py":117
 *             new_state.matches = matches
 * 
 *             eq_classes_by_state[new_state] = eq_states             # <<<<<<<<<<<<<<
 *             existing_eq_classes[eq_key] = new_state
 *             next_state_id += 1
 */
      if (PyObject_SetItem(__pyx_v_eq_classes_by_state, __pyx_v_new_state, __pyx_v_eq_states) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "acora/nfa2dfa.py":118
 * 
 *             eq_classes_by_state[new_state] = eq_states
 *             existing_eq_classes[eq_key] = new_state             # <<<<<<<<<<<<<<
 *             next_state_id += 1
 * 
 */
      if (PyObject_SetItem(__pyx_v_existing_eq_classes, __pyx_v_eq_key, __pyx_v_new_state) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "acora/nfa2dfa.py":119
 *             eq_classes_by_state[new_state] = eq_states
 *             existing_eq_classes[eq_key] = new_state
 *             next_state_id += 1             # <<<<<<<<<<<<<<
 * 
 *             # redirect the original transition to the new node
 */
      __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_next_state_id, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_v_next_state_id);
      __pyx_v_next_state_id = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "acora/nfa2dfa.py":122
 * 
 *             # redirect the original transition to the new node
 *             transitions[key] = set([new_state])             # <<<<<<<<<<<<<<
 * 
 *             # collect its transitions
 */
      __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      __Pyx_INCREF(__pyx_v_new_state);
      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_v_new_state);
      __Pyx_GIVEREF(__pyx_v_new_state);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_7));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
      __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (PyObject_SetItem(__pyx_v_transitions, __pyx_v_key, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "acora/nfa2dfa.py":125
 * 
 *             # collect its transitions
 *             new_chars = chars_by_state[new_state] = set()             # <<<<<<<<<<<<<<
 *             for state in eq_states:
 *                 chars = chars_by_state[state]
 */
      __pyx_t_7 = PySet_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      __Pyx_INCREF(((PyObject *)__pyx_t_7));
      __Pyx_DECREF(__pyx_v_new_chars);
      __pyx_v_new_chars = ((PyObject *)__pyx_t_7);
      if (PyObject_SetItem(__pyx_v_chars_by_state, __pyx_v_new_state, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

      /* "acora/nfa2dfa.py":126
 *             # collect its transitions
 *             new_chars = chars_by_state[new_state] = set()
 *             for state in eq_states:             # <<<<<<<<<<<<<<
 *                 chars = chars_by_state[state]
 *                 new_chars.update(chars)
 */
      if (PyList_CheckExact(__pyx_v_eq_states) || PyTuple_CheckExact(__pyx_v_eq_states)) {
        __pyx_t_4 = 0; __pyx_t_7 = __pyx_v_eq_states; __Pyx_INCREF(__pyx_t_7);
      } else {
        __pyx_t_4 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_eq_states); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
      }
      for (;;) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_7)) break;
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
        } else if (likely(PyTuple_CheckExact(__pyx_t_7))) {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
        } else {
          __pyx_t_6 = PyIter_Next(__pyx_t_7);
          if (!__pyx_t_6) {
            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            break;
          }
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_DECREF(__pyx_v_state);
        __pyx_v_state = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "acora/nfa2dfa.py":127
 *             new_chars = chars_by_state[new_state] = set()
 *             for state in eq_states:
 *                 chars = chars_by_state[state]             # <<<<<<<<<<<<<<
 *                 new_chars.update(chars)
 *                 for char in chars:
 */
        __pyx_t_6 = PyObject_GetItem(__pyx_v_chars_by_state, __pyx_v_state); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_v_chars);
        __pyx_v_chars = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "acora/nfa2dfa.py":128
 *             for state in eq_states:
 *                 chars = chars_by_state[state]
 *                 new_chars.update(chars)             # <<<<<<<<<<<<<<
 *                 for char in chars:
 *                     # resolve original states from equivalence class states
 */
        __pyx_t_6 = PyObject_GetAttr(__pyx_v_new_chars, __pyx_n_s__update); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __Pyx_INCREF(__pyx_v_chars);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_chars);
        __Pyx_GIVEREF(__pyx_v_chars);
        __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "acora/nfa2dfa.py":129
 *                 chars = chars_by_state[state]
 *                 new_chars.update(chars)
 *                 for char in chars:             # <<<<<<<<<<<<<<
 *                     # resolve original states from equivalence class states
 *                     targets = set()
 */
        if (PyList_CheckExact(__pyx_v_chars) || PyTuple_CheckExact(__pyx_v_chars)) {
          __pyx_t_10 = 0; __pyx_t_2 = __pyx_v_chars; __Pyx_INCREF(__pyx_t_2);
        } else {
          __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_chars); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
        }
        for (;;) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break;
            __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++;
          } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
            if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++;
          } else {
            __pyx_t_5 = PyIter_Next(__pyx_t_2);
            if (!__pyx_t_5) {
              if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              break;
            }
            __Pyx_GOTREF(__pyx_t_5);
          }
          __Pyx_DECREF(__pyx_v_char);
          __pyx_v_char = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "acora/nfa2dfa.py":131
 *                 for char in chars:
 *                     # resolve original states from equivalence class states
 *                     targets = set()             # <<<<<<<<<<<<<<
 *                     for target in transitions[(state,char)]:
 *                         if target in eq_classes_by_state:
 */
          __pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_5));
          __Pyx_DECREF(__pyx_v_targets);
          __pyx_v_targets = ((PyObject *)__pyx_t_5);
          __pyx_t_5 = 0;

          /* "acora/nfa2dfa.py":132
 *                     # resolve original states from equivalence class states
 *                     targets = set()
 *                     for target in transitions[(state,char)]:             # <<<<<<<<<<<<<<
 *                         if target in eq_classes_by_state:
 *                             targets.update(eq_classes_by_state[target])
 */
          __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_5));
          __Pyx_INCREF(__pyx_v_state);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_state);
          __Pyx_GIVEREF(__pyx_v_state);
          __Pyx_INCREF(__pyx_v_char);
          PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_char);
          __Pyx_GIVEREF(__pyx_v_char);
          __pyx_t_6 = PyObject_GetItem(__pyx_v_transitions, ((PyObject *)__pyx_t_5)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
          if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
            __pyx_t_11 = 0; __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5);
          } else {
            __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          for (;;) {
            if (likely(PyList_CheckExact(__pyx_t_5))) {
              if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break;
              __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++;
            } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
              if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
              __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++;
            } else {
              __pyx_t_6 = PyIter_Next(__pyx_t_5);
              if (!__pyx_t_6) {
                if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                break;
              }
              __Pyx_GOTREF(__pyx_t_6);
            }
            __Pyx_DECREF(__pyx_v_target);
            __pyx_v_target = __pyx_t_6;
            __pyx_t_6 = 0;

            /* "acora/nfa2dfa.py":133
 *                     targets = set()
 *                     for target in transitions[(state,char)]:
 *                         if target in eq_classes_by_state:             # <<<<<<<<<<<<<<
 *                             targets.update(eq_classes_by_state[target])
 *                         else:
 */
            __pyx_t_9 = ((PySequence_Contains(__pyx_v_eq_classes_by_state, __pyx_v_target))); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            if (__pyx_t_9) {

              /* "acora/nfa2dfa.py":134
 *                     for target in transitions[(state,char)]:
 *                         if target in eq_classes_by_state:
 *                             targets.update(eq_classes_by_state[target])             # <<<<<<<<<<<<<<
 *                         else:
 *                             targets.add(target)
 */
              __pyx_t_6 = PyObject_GetAttr(__pyx_v_targets, __pyx_n_s__update); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_6);
              __pyx_t_8 = PyObject_GetItem(__pyx_v_eq_classes_by_state, __pyx_v_target); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(((PyObject *)__pyx_t_12));
              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8);
              __Pyx_GIVEREF(__pyx_t_8);
              __pyx_t_8 = 0;
              __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              goto __pyx_L31;
            }
            /*else*/ {

              /* "acora/nfa2dfa.py":136
 *                             targets.update(eq_classes_by_state[target])
 *                         else:
 *                             targets.add(target)             # <<<<<<<<<<<<<<
 *                     new_key = (new_state,char)
 *                     if new_key in transitions:
 */
              __pyx_t_8 = PyObject_GetAttr(__pyx_v_targets, __pyx_n_s__add); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(((PyObject *)__pyx_t_12));
              __Pyx_INCREF(__pyx_v_target);
              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_target);
              __Pyx_GIVEREF(__pyx_v_target);
              __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            }
            __pyx_L31:;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "acora/nfa2dfa.py":137
 *                         else:
 *                             targets.add(target)
 *                     new_key = (new_state,char)             # <<<<<<<<<<<<<<
 *                     if new_key in transitions:
 *                         transitions[new_key].update(targets)
 */
          __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_5));
          __Pyx_INCREF(__pyx_v_new_state);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_new_state);
          __Pyx_GIVEREF(__pyx_v_new_state);
          __Pyx_INCREF(__pyx_v_char);
          PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_char);
          __Pyx_GIVEREF(__pyx_v_char);
          __Pyx_DECREF(__pyx_v_new_key);
          __pyx_v_new_key = ((PyObject *)__pyx_t_5);
          __pyx_t_5 = 0;

          /* "acora/nfa2dfa.py":138
 *                             targets.add(target)
 *                     new_key = (new_state,char)
 *                     if new_key in transitions:             # <<<<<<<<<<<<<<
 *                         transitions[new_key].update(targets)
 *                     else:
 */
          __pyx_t_9 = ((PySequence_Contains(__pyx_v_transitions, __pyx_v_new_key))); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          if (__pyx_t_9) {

            /* "acora/nfa2dfa.py":139
 *                     new_key = (new_state,char)
 *                     if new_key in transitions:
 *                         transitions[new_key].update(targets)             # <<<<<<<<<<<<<<
 *                     else:
 *                         transitions[new_key] = set(targets)
 */
            __pyx_t_5 = PyObject_GetItem(__pyx_v_transitions, __pyx_v_new_key); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__update); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(((PyObject *)__pyx_t_5));
            __Pyx_INCREF(__pyx_v_targets);
            PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_targets);
            __Pyx_GIVEREF(__pyx_v_targets);
            __pyx_t_12 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            goto __pyx_L32;
          }
          /*else*/ {

            /* "acora/nfa2dfa.py":141
 *                         transitions[new_key].update(targets)
 *                     else:
 *                         transitions[new_key] = set(targets)             # <<<<<<<<<<<<<<
 *                     new_eq_classes.add(new_key)
 * 
 */
            __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(((PyObject *)__pyx_t_12));
            __Pyx_INCREF(__pyx_v_targets);
            PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_targets);
            __Pyx_GIVEREF(__pyx_v_targets);
            __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
            if (PyObject_SetItem(__pyx_v_transitions, __pyx_v_new_key, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          }
          __pyx_L32:;

          /* "acora/nfa2dfa.py":142
 *                     else:
 *                         transitions[new_key] = set(targets)
 *                     new_eq_classes.add(new_key)             # <<<<<<<<<<<<<<
 * 
 *     # rebuild transitions dict to point to exactly one state
 */
          __pyx_t_5 = PyObject_GetAttr(__pyx_v_new_eq_classes, __pyx_n_s__add); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_12));
          __Pyx_INCREF(__pyx_v_new_key);
          PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_new_key);
          __Pyx_GIVEREF(__pyx_v_new_key);
          __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_L17_continue:;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "acora/nfa2dfa.py":145
 * 
 *     # rebuild transitions dict to point to exactly one state
 *     for key, state_set in transitions.items():             # <<<<<<<<<<<<<<
 *         assert len(state_set) == 1
 *         transitions[key] = tuple(state_set)[0]
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_transitions, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
    __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_7; __Pyx_INCREF(__pyx_t_1);
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_1))) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
    } else {
      __pyx_t_7 = PyIter_Next(__pyx_t_1);
      if (!__pyx_t_7) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    if (PyTuple_CheckExact(__pyx_t_7) && likely(PyTuple_GET_SIZE(__pyx_t_7) == 2)) {
      PyObject* tuple = __pyx_t_7;
      __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
      __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_key);
      __pyx_v_key = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_state_set);
      __pyx_v_state_set = __pyx_t_6;
      __pyx_t_6 = 0;
    } else {
      __pyx_t_12 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_EndUnpack(__pyx_t_12, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_v_key);
      __pyx_v_key = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_state_set);
      __pyx_v_state_set = __pyx_t_6;
      __pyx_t_6 = 0;
    }

    /* "acora/nfa2dfa.py":146
 *     # rebuild transitions dict to point to exactly one state
 *     for key, state_set in transitions.items():
 *         assert len(state_set) == 1             # <<<<<<<<<<<<<<
 *         transitions[key] = tuple(state_set)[0]
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    __pyx_t_4 = PyObject_Length(__pyx_v_state_set); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (unlikely(!(__pyx_t_4 == 1))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #endif

    /* "acora/nfa2dfa.py":147
 *     for key, state_set in transitions.items():
 *         assert len(state_set) == 1
 *         transitions[key] = tuple(state_set)[0]             # <<<<<<<<<<<<<<
 * 
 *     # duplicate the transitions for case insensitive parsing
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_INCREF(__pyx_v_state_set);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_state_set);
    __Pyx_GIVEREF(__pyx_v_state_set);
    __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_t_6, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyObject_SetItem(__pyx_v_transitions, __pyx_v_key, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":150
 * 
 *     # duplicate the transitions for case insensitive parsing
 *     if ignore_case:             # <<<<<<<<<<<<<<
 *         for (state,char), target in list(transitions.items()):
 *             transitions[(state,char.upper())] = target
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_case); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_9) {

    /* "acora/nfa2dfa.py":151
 *     # duplicate the transitions for case insensitive parsing
 *     if ignore_case:
 *         for (state,char), target in list(transitions.items()):             # <<<<<<<<<<<<<<
 *             transitions[(state,char.upper())] = target
 * 
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_transitions, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_7; __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
      if (PyTuple_CheckExact(__pyx_t_7) && likely(PyTuple_GET_SIZE(__pyx_t_7) == 2)) {
        PyObject* tuple = __pyx_t_7;
        __pyx_t_6 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_6);
        __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) {
          PyObject* tuple = __pyx_t_6;
          __pyx_t_12 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_12);
          __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_v_state);
          __pyx_v_state = __pyx_t_12;
          __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_v_char);
          __pyx_v_char = __pyx_t_5;
          __pyx_t_5 = 0;
        } else {
          __pyx_t_8 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_12 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          if (__Pyx_EndUnpack(__pyx_t_8, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_v_state);
          __pyx_v_state = __pyx_t_12;
          __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_v_char);
          __pyx_v_char = __pyx_t_5;
          __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_v_target);
        __pyx_v_target = __pyx_t_2;
        __pyx_t_2 = 0;
      } else {
        __pyx_t_5 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) {
          PyObject* tuple = __pyx_t_6;
          __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
          __pyx_t_12 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_v_state);
          __pyx_v_state = __pyx_t_5;
          __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_v_char);
          __pyx_v_char = __pyx_t_12;
          __pyx_t_12 = 0;
        } else {
          __pyx_t_8 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_12 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_12);
          if (__Pyx_EndUnpack(__pyx_t_8, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_v_state);
          __pyx_v_state = __pyx_t_5;
          __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_v_char);
          __pyx_v_char = __pyx_t_12;
          __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_v_target);
        __pyx_v_target = __pyx_t_2;
        __pyx_t_2 = 0;
      }

      /* "acora/nfa2dfa.py":152
 *     if ignore_case:
 *         for (state,char), target in list(transitions.items()):
 *             transitions[(state,char.upper())] = target             # <<<<<<<<<<<<<<
 * 
 *     # return start state and transitions
 */
      __pyx_t_7 = PyObject_GetAttr(__pyx_v_char, __pyx_n_s__upper); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      __Pyx_INCREF(__pyx_v_state);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_state);
      __Pyx_GIVEREF(__pyx_v_state);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      if (PyObject_SetItem(__pyx_v_transitions, ((PyObject *)__pyx_t_7), __pyx_v_target) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L35;
  }
  __pyx_L35:;

  /* "acora/nfa2dfa.py":155
 * 
 *     # return start state and transitions
 *     return tree, transitions             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_tree);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tree);
  __Pyx_GIVEREF(__pyx_v_tree);
  __Pyx_INCREF(__pyx_v_transitions);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_transitions);
  __Pyx_GIVEREF(__pyx_v_transitions);
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("acora._nfa2dfa.nfa2dfa");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_visit_all);
  __Pyx_DECREF(__pyx_v_states);
  __Pyx_DECREF(__pyx_v_next_state_id);
  __Pyx_DECREF(__pyx_v_transitions);
  __Pyx_DECREF(__pyx_v_chars_by_state);
  __Pyx_DECREF(__pyx_v_new_eq_classes);
  __Pyx_DECREF(__pyx_v_state);
  __Pyx_DECREF(__pyx_v_chars);
  __Pyx_DECREF(__pyx_v_char);
  __Pyx_DECREF(__pyx_v_target);
  __Pyx_DECREF(__pyx_v_key);
  __Pyx_DECREF(__pyx_v_existing_eq_classes);
  __Pyx_DECREF(__pyx_v_eq_classes_by_state);
  __Pyx_DECREF(__pyx_v_eq_classes);
  __Pyx_DECREF(__pyx_v_eq_states);
  __Pyx_DECREF(__pyx_v_eq_key);
  __Pyx_DECREF(__pyx_v_new_state);
  __Pyx_DECREF(__pyx_v_matches);
  __Pyx_DECREF(__pyx_v_s);
  __Pyx_DECREF(__pyx_v_new_chars);
  __Pyx_DECREF(__pyx_v_targets);
  __Pyx_DECREF(__pyx_v_new_key);
  __Pyx_DECREF(__pyx_v_state_set);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *)o);
  p->__pyx_v_visit_all = 0;
  return o;
}

static void __pyx_tp_dealloc_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa(PyObject *o) {
  struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *p = (struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *)o;
  Py_XDECREF(p->__pyx_v_visit_all);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *p = (struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *)o;
  if (p->__pyx_v_visit_all) {
    e = (*v)(p->__pyx_v_visit_all, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa(PyObject *o) {
  struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *p = (struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_visit_all);
  p->__pyx_v_visit_all = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct__nfa2dfa = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct__nfa2dfa = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct__nfa2dfa = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct__nfa2dfa = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("acora._nfa2dfa.__pyx_scope_struct__nfa2dfa"), /*tp_name*/
  sizeof(struct __pyx_obj_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number___pyx_scope_struct__nfa2dfa, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct__nfa2dfa, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct__nfa2dfa, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_scope_struct__nfa2dfa, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa, /*tp_traverse*/
  __pyx_tp_clear_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("_nfa2dfa"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_n_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 1},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_n_s__NfaState, __pyx_k__NfaState, sizeof(__pyx_k__NfaState), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s____copy__, __pyx_k____copy__, sizeof(__pyx_k____copy__), 0, 0, 1, 1},
  {&__pyx_n_s____deepcopy__, __pyx_k____deepcopy__, sizeof(__pyx_k____deepcopy__), 0, 0, 1, 1},
  {&__pyx_n_s____eq__, __pyx_k____eq__, sizeof(__pyx_k____eq__), 0, 0, 1, 1},
  {&__pyx_n_s____hash__, __pyx_k____hash__, sizeof(__pyx_k____hash__), 0, 0, 1, 1},
  {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
  {&__pyx_n_s____lt__, __pyx_k____lt__, sizeof(__pyx_k____lt__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____new__, __pyx_k____new__, sizeof(__pyx_k____new__), 0, 0, 1, 1},
  {&__pyx_n_s____repr__, __pyx_k____repr__, sizeof(__pyx_k____repr__), 0, 0, 1, 1},
  {&__pyx_n_s____str__, __pyx_k____str__, sizeof(__pyx_k____str__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s__add, __pyx_k__add, sizeof(__pyx_k__add), 0, 0, 1, 1},
  {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
  {&__pyx_n_s__cls, __pyx_k__cls, sizeof(__pyx_k__cls), 0, 0, 1, 1},
  {&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1},
  {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
  {&__pyx_n_s__ignore_case, __pyx_k__ignore_case, sizeof(__pyx_k__ignore_case), 0, 0, 1, 1},
  {&__pyx_n_s__insert_keyword, __pyx_k__insert_keyword, sizeof(__pyx_k__insert_keyword), 0, 0, 1, 1},
  {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1},
  {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
  {&__pyx_n_s__keyword, __pyx_k__keyword, sizeof(__pyx_k__keyword), 0, 0, 1, 1},
  {&__pyx_n_s__len, __pyx_k__len, sizeof(__pyx_k__len), 0, 0, 1, 1},
  {&__pyx_n_s__lower, __pyx_k__lower, sizeof(__pyx_k__lower), 0, 0, 1, 1},
  {&__pyx_n_s__matches, __pyx_k__matches, sizeof(__pyx_k__matches), 0, 0, 1, 1},
  {&__pyx_n_s__memo, __pyx_k__memo, sizeof(__pyx_k__memo), 0, 0, 1, 1},
  {&__pyx_n_s__nfa2dfa, __pyx_k__nfa2dfa, sizeof(__pyx_k__nfa2dfa), 0, 0, 1, 1},
  {&__pyx_n_s__other, __pyx_k__other, sizeof(__pyx_k__other), 0, 0, 1, 1},
  {&__pyx_n_s__reverse, __pyx_k__reverse, sizeof(__pyx_k__reverse), 0, 0, 1, 1},
  {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
  {&__pyx_n_s__sort, __pyx_k__sort, sizeof(__pyx_k__sort), 0, 0, 1, 1},
  {&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1},
  {&__pyx_n_s__state_id, __pyx_k__state_id, sizeof(__pyx_k__state_id), 0, 0, 1, 1},
  {&__pyx_n_s__tree, __pyx_k__tree, sizeof(__pyx_k__tree), 0, 0, 1, 1},
  {&__pyx_n_s__update, __pyx_k__update, sizeof(__pyx_k__update), 0, 0, 1, 1},
  {&__pyx_n_s__upper, __pyx_k__upper, sizeof(__pyx_k__upper), 0, 0, 1, 1},
  {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1},
  {&__pyx_n_s__visitor, __pyx_k__visitor, sizeof(__pyx_k__visitor), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_sorted = __Pyx_GetName(__pyx_b, __pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_len = __Pyx_GetName(__pyx_b, __pyx_n_s__len); if (!__pyx_builtin_len) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");

  /* "acora/nfa2dfa.py":37
 *         state = NfaState(
 *             self.id,
 *             [ (char, state.__deepcopy__(None))             # <<<<<<<<<<<<<<
 *               for char, state in self.items() ])
 *         state.matches[:] = self.matches
 */
  __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));

  /* "acora/nfa2dfa.py":44
 * def insert_keyword(tree, keyword, state_id):
 *     if not keyword:
 *         raise ValueError("cannot search for the empty string")             # <<<<<<<<<<<<<<
 *     for char in keyword:
 *         if char in tree:
 */
  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  #if PY_VERSION_HEX < 0x02040000
  if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_nfa2dfa(void); /*proto*/
PyMODINIT_FUNC init_nfa2dfa(void)
#else
PyMODINIT_FUNC PyInit__nfa2dfa(void); /*proto*/
PyMODINIT_FUNC PyInit__nfa2dfa(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  #if CYTHON_REFNANNY
  void* __pyx_refnanny = NULL;
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__nfa2dfa(void)", __LINE__, __FILE__);
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __pyx_binding_PyCFunctionType_USED
  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_nfa2dfa"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_acora___nfa2dfa) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa = &__pyx_type_5acora_8_nfa2dfa___pyx_scope_struct__nfa2dfa;
  /*--- Type import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "acora/nfa2dfa.py":4
 * # initial graph representation of the automaton
 * 
 * class NfaState(dict):             # <<<<<<<<<<<<<<
 *     """NFA state for the untransformed automaton.
 *     """
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "acora/nfa2dfa.py":7
 *     """NFA state for the untransformed automaton.
 *     """
 *     def __new__(cls, state_id, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         state = dict.__new__(cls, *args, **kwargs)
 *         state.id = state_id
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5acora_8_nfa2dfa_8NfaState___new__, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____new__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":13
 *         return state
 * 
 *     def __init__(self, state_id, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         dict.__init__(self, *args, **kwargs)
 * 
 */
  __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5acora_8_nfa2dfa_8NfaState_1__init__, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":16
 *         dict.__init__(self, *args, **kwargs)
 * 
 *     def __lt__(self, other):             # <<<<<<<<<<<<<<
 *         return self.id < other.id
 * 
 */
  __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5acora_8_nfa2dfa_8NfaState_2__lt__, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____lt__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":19
 *         return self.id < other.id
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         return self.id == other.id
 * 
 */
  __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5acora_8_nfa2dfa_8NfaState_3__eq__, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____eq__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":22
 *         return self.id == other.id
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return self.id
 * 
 */
  __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5acora_8_nfa2dfa_8NfaState_4__hash__, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____hash__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":25
 *         return self.id
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return str(self.id)
 *     __repr__ = __str__
 */
  __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5acora_8_nfa2dfa_8NfaState_5__str__, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____str__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":27
 *     def __str__(self):
 *         return str(self.id)
 *     __repr__ = __str__             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s____str__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____repr__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":29
 *     __repr__ = __str__
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         state = NfaState(self.id, **self)
 *         state.matches[:] = self.matches
 */
  __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5acora_8_nfa2dfa_8NfaState_6__copy__, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____copy__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":34
 *         return state
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         state = NfaState(
 *             self.id,
 */
  __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5acora_8_nfa2dfa_8NfaState_7__deepcopy__, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____deepcopy__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/nfa2dfa.py":4
 * # initial graph representation of the automaton
 * 
 * class NfaState(dict):             # <<<<<<<<<<<<<<
 *     """NFA state for the untransformed automaton.
 *     """
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyDict_Type))));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyDict_Type))));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyDict_Type))));
  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__NfaState, __pyx_n_s_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__NfaState, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":42
 *         return state
 * 
 * def insert_keyword(tree, keyword, state_id):             # <<<<<<<<<<<<<<
 *     if not keyword:
 *         raise ValueError("cannot search for the empty string")
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5acora_8_nfa2dfa_insert_keyword, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__insert_keyword, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":58
 * # NFA to DFA transformation
 * 
 * def nfa2dfa(tree, ignore_case):             # <<<<<<<<<<<<<<
 *     """Transform a keyword tree into a DFA using powerset construction.
 *     """
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5acora_8_nfa2dfa_1nfa2dfa, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__nfa2dfa, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "acora/nfa2dfa.py":2
 * 
 * # initial graph representation of the automaton             # <<<<<<<<<<<<<<
 * 
 * class NfaState(dict):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    __Pyx_AddTraceback("init acora._nfa2dfa");
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init acora._nfa2dfa");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *number, *more_or_less;

    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    number = (num_expected == 1) ? "" : "s";
    PyErr_Format(PyExc_TypeError,
        #if PY_VERSION_HEX < 0x02050000
            "%s() takes %s %d positional argument%s (%d given)",
        #else
            "%s() takes %s %zd positional argument%s (%zd given)",
        #endif
        func_name, more_or_less, num_expected, number, num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;

    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static PyObject* __Pyx_PyEval_CallObjectWithKeywords(PyObject *callable, PyObject *args, PyObject *kwargs) {
    PyObject* result;
    if (likely(PyDict_Check(kwargs))) {
        return PyEval_CallObjectWithKeywords(callable, args, kwargs);
    } else {
        PyObject* real_dict;
        real_dict = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, kwargs, NULL);
        if (unlikely(!real_dict))
            return NULL;
        result = PyEval_CallObjectWithKeywords(callable, args, real_dict);
        Py_DECREF(real_dict);
        return result; /* may be NULL */
    }
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
                 "need more than %d value%s to unpack", (int)index,
        #else
                 "need more than %zd value%s to unpack", index,
        #endif
                 (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
            "too many values to unpack (expected %d)", (int)expected);
        #else
            "too many values to unpack (expected %zd)", expected);
        #endif
}

static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred()) {
            __Pyx_RaiseNeedMoreValuesError(index);
        }
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;

    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}


#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }

    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;

    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (!PyExceptionClass_Check(type)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    PyErr_SetObject(type, value);

    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }

bad:
    return;
}
#endif


static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
    PyObject *metaclass;
    /* Default metaclass */
#if PY_MAJOR_VERSION < 3
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = PyObject_GetAttrString(base, "__class__");
        if (!metaclass) {
            PyErr_Clear();
            metaclass = (PyObject*) Py_TYPE(base);
        }
    } else {
        metaclass = (PyObject *) &PyClass_Type;
    }
#else
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = (PyObject*) Py_TYPE(base);
    } else {
        metaclass = (PyObject *) &PyType_Type;
    }
#endif
    Py_INCREF(metaclass);
    return metaclass;
}

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname) {
    PyObject *result;
    PyObject *metaclass;

    if (PyDict_SetItemString(dict, "__module__", modname) < 0)
        return NULL;

    /* Python2 __metaclass__ */
    metaclass = PyDict_GetItemString(dict, "__metaclass__");
    if (metaclass) {
        Py_INCREF(metaclass);
    } else {
        metaclass = __Pyx_FindPy2Metaclass(bases);
    }
    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
    Py_DECREF(metaclass);
    return result;
}


static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
	__pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType);
    if (op == NULL)
        return NULL;
	op->func.m_ml = ml;
	Py_XINCREF(self);
	op->func.m_self = self;
	Py_XINCREF(module);
	op->func.m_module = module;
	PyObject_GC_Track(op);
	return (PyObject *)op;
}

static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) {
	PyObject_GC_UnTrack(m);
	Py_XDECREF(m->func.m_self);
	Py_XDECREF(m->func.m_module);
    PyObject_GC_Del(m);
}

static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) {
	if (obj == Py_None)
		obj = NULL;
	return PyMethod_New(func, obj, type);
}

static int __pyx_binding_PyCFunctionType_init(void) {
    __pyx_binding_PyCFunctionType_type = PyCFunction_Type;
    __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method");
    __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc;
    __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get;
    if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) {
        return -1;
    }
    __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type;
    return 0;

}

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
