]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.10/Modules/sre.h
2 * Secret Labs' Regular Expression Engine
4 * regular expression matching engine
6 * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
8 * See the _sre.c file for information on usage and redistribution.
14 #include "sre_constants.h"
16 /* size of a code word (must be unsigned short or larger, and
17 large enough to hold a UCS4 character) */
18 #ifdef Py_USING_UNICODE
19 # define SRE_CODE Py_UCS4
20 # if SIZEOF_SIZE_T > 4
21 # define SRE_MAXREPEAT (~(SRE_CODE)0)
23 # define SRE_MAXREPEAT ((SRE_CODE)PY_SSIZE_T_MAX)
26 # define SRE_CODE unsigned int
27 # if SIZEOF_SIZE_T > SIZEOF_INT
28 # define SRE_MAXREPEAT (~(SRE_CODE)0)
30 # define SRE_MAXREPEAT ((SRE_CODE)PY_SSIZE_T_MAX)
36 Py_ssize_t groups
; /* must be first! */
40 PyObject
* pattern
; /* pattern source (or None) */
41 int flags
; /* flags used when compiling pattern source */
42 PyObject
*weakreflist
; /* List of weak references */
48 #define PatternObject_GetCode(o) (((PatternObject*)(o))->code)
52 PyObject
* string
; /* link to the target string (must be first) */
53 PyObject
* regs
; /* cached list of matching spans */
54 PatternObject
* pattern
; /* link to the regex (pattern) object */
55 Py_ssize_t pos
, endpos
; /* current target slice */
56 Py_ssize_t lastindex
; /* last index marker seen by the engine (-1 if none) */
57 Py_ssize_t groups
; /* number of groups (start/end marks) */
61 typedef unsigned int (*SRE_TOLOWER_HOOK
)(unsigned int ch
);
63 /* FIXME: <fl> shouldn't be a constant, really... */
64 #define SRE_MARK_SIZE 200
66 typedef struct SRE_REPEAT_T
{
68 SRE_CODE
* pattern
; /* points to REPEAT operator arguments */
69 void* last_ptr
; /* helper to check for infinite loops */
70 struct SRE_REPEAT_T
*prev
; /* points to previous repeat context */
75 void* ptr
; /* current position (also end of current slice) */
76 void* beginning
; /* start of original string */
77 void* start
; /* start of current slice */
78 void* end
; /* end of original string */
79 /* attributes for the match object */
81 Py_ssize_t pos
, endpos
;
87 void* mark
[SRE_MARK_SIZE
];
88 /* dynamically allocated stuff */
90 size_t data_stack_size
;
91 size_t data_stack_base
;
92 /* current repeat context */
95 SRE_TOLOWER_HOOK lower
;