Back to module index
Go to module by name
sre_parse
Internal support module for sre
Classes
State
checkgroup(self, gid)
checklookbehindgroup(self, gid, source)
closegroup(self, gid, p)
opengroup(self, name=None)
groups = <property object at 0x7f92bfb23ae0>
SubPattern
append(self, code)
dump(self, level=0)
getwidth(self)
insert(self, index, code)
Tokenizer
error(self, msg, offset=0)
get(self)
getuntil(self, terminator, name)
getwhile(self, n, charset)
match(self, char)
seek(self, index)
tell(self)
pos = <property object at 0x7f92bfb23b80>
Verbose
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
error
Exception raised for invalid regular expressions.
Attributes:
msg: The unformatted error message
pattern: The regular expression pattern
pos: The index in the pattern where compilation failed (may be None)
lineno: The line corresponding to pos (may be None)
colno: The column corresponding to pos (may be None)
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Functions
expand_template
expand_template(template, match)
fix_flags
fix_flags(src, flags)
parse
parse(str, flags=0, state=None)
parse_template
parse_template(source, state)
Other members
ANY = ANY
ANY_ALL = ANY_ALL
ASCIILETTERS = frozenset({'h', 'c', 'F', 'T', 'V', 'H', 'x', 'S', 'o', 'W', 'B', 'Q', 'C', 'G', 'r', 'z', 'E', 'U', 'O', 'R', 'a', 'm', 'p', 't', 'v', 'e', 'l', 'P', 'Y', 'X', 'N', 'j', 'q', 'f', 'K', 'L', 's', 'D', 'n', 'y', 'b', 'd', 'k', 'A', 'I', 'Z', 'M', 'w', 'J', 'u', 'i', 'g'})
ASSERT = ASSERT
ASSERT_NOT = ASSERT_NOT
AT = AT
ATCODES = [AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY, AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING, AT_LOC_BOUNDARY, AT_LOC_NON_BOUNDARY, AT_UNI_BOUNDARY, AT_UNI_NON_BOUNDARY]
AT_BEGINNING = AT_BEGINNING
AT_BEGINNING_LINE = AT_BEGINNING_LINE
AT_BEGINNING_STRING = AT_BEGINNING_STRING
AT_BOUNDARY = AT_BOUNDARY
AT_END = AT_END
AT_END_LINE = AT_END_LINE
AT_END_STRING = AT_END_STRING
AT_LOCALE = {AT_BOUNDARY: AT_LOC_BOUNDARY, AT_NON_BOUNDARY: AT_LOC_NON_BOUNDARY}
AT_LOC_BOUNDARY = AT_LOC_BOUNDARY
AT_LOC_NON_BOUNDARY = AT_LOC_NON_BOUNDARY
AT_MULTILINE = {AT_BEGINNING: AT_BEGINNING_LINE, AT_END: AT_END_LINE}
AT_NON_BOUNDARY = AT_NON_BOUNDARY
AT_UNICODE = {AT_BOUNDARY: AT_UNI_BOUNDARY, AT_NON_BOUNDARY: AT_UNI_NON_BOUNDARY}
AT_UNI_BOUNDARY = AT_UNI_BOUNDARY
AT_UNI_NON_BOUNDARY = AT_UNI_NON_BOUNDARY
BIGCHARSET = BIGCHARSET
BRANCH = BRANCH
CALL = CALL
CATEGORIES = {'\\A': (AT, AT_BEGINNING_STRING), '\\b': (AT, AT_BOUNDARY), '\\B': (AT, AT_NON_BOUNDARY), '\\d': (IN, [(CATEGORY, CATEGORY_DIGIT)]), '\\D': (IN, [(CATEGORY, CATEGORY_NOT_DIGIT)]), '\\s': (IN, [(CATEGORY, CATEGORY_SPACE)]), '\\S': (IN, [(CATEGORY, CATEGORY_NOT_SPACE)]), '\\w': (IN, [(CATEGORY, CATEGORY_WORD)]), '\\W': (IN, [(CATEGORY, CATEGORY_NOT_WORD)]), '\\Z': (AT, AT_END_STRING)}
CATEGORY = CATEGORY
CATEGORY_DIGIT = CATEGORY_DIGIT
CATEGORY_LINEBREAK = CATEGORY_LINEBREAK
CATEGORY_LOC_NOT_WORD = CATEGORY_LOC_NOT_WORD
CATEGORY_LOC_WORD = CATEGORY_LOC_WORD
CATEGORY_NOT_DIGIT = CATEGORY_NOT_DIGIT
CATEGORY_NOT_LINEBREAK = CATEGORY_NOT_LINEBREAK
CATEGORY_NOT_SPACE = CATEGORY_NOT_SPACE
CATEGORY_NOT_WORD = CATEGORY_NOT_WORD
CATEGORY_SPACE = CATEGORY_SPACE
CATEGORY_UNI_DIGIT = CATEGORY_UNI_DIGIT
CATEGORY_UNI_LINEBREAK = CATEGORY_UNI_LINEBREAK
CATEGORY_UNI_NOT_DIGIT = CATEGORY_UNI_NOT_DIGIT
CATEGORY_UNI_NOT_LINEBREAK = CATEGORY_UNI_NOT_LINEBREAK
CATEGORY_UNI_NOT_SPACE = CATEGORY_UNI_NOT_SPACE
CATEGORY_UNI_NOT_WORD = CATEGORY_UNI_NOT_WORD
CATEGORY_UNI_SPACE = CATEGORY_UNI_SPACE
CATEGORY_UNI_WORD = CATEGORY_UNI_WORD
CATEGORY_WORD = CATEGORY_WORD
CHARSET = CHARSET
CHCODES = [CATEGORY_DIGIT, CATEGORY_NOT_DIGIT, CATEGORY_SPACE, CATEGORY_NOT_SPACE, CATEGORY_WORD, CATEGORY_NOT_WORD, CATEGORY_LINEBREAK, CATEGORY_NOT_LINEBREAK, CATEGORY_LOC_WORD, CATEGORY_LOC_NOT_WORD, CATEGORY_UNI_DIGIT, CATEGORY_UNI_NOT_DIGIT, CATEGORY_UNI_SPACE, CATEGORY_UNI_NOT_SPACE, CATEGORY_UNI_WORD, CATEGORY_UNI_NOT_WORD, CATEGORY_UNI_LINEBREAK, CATEGORY_UNI_NOT_LINEBREAK]
CH_LOCALE = {CATEGORY_DIGIT: CATEGORY_DIGIT, CATEGORY_NOT_DIGIT: CATEGORY_NOT_DIGIT, CATEGORY_SPACE: CATEGORY_SPACE, CATEGORY_NOT_SPACE: CATEGORY_NOT_SPACE, CATEGORY_WORD: CATEGORY_LOC_WORD, CATEGORY_NOT_WORD: CATEGORY_LOC_NOT_WORD, CATEGORY_LINEBREAK: CATEGORY_LINEBREAK, CATEGORY_NOT_LINEBREAK: CATEGORY_NOT_LINEBREAK}
CH_UNICODE = {CATEGORY_DIGIT: CATEGORY_UNI_DIGIT, CATEGORY_NOT_DIGIT: CATEGORY_UNI_NOT_DIGIT, CATEGORY_SPACE: CATEGORY_UNI_SPACE, CATEGORY_NOT_SPACE: CATEGORY_UNI_NOT_SPACE, CATEGORY_WORD: CATEGORY_UNI_WORD, CATEGORY_NOT_WORD: CATEGORY_UNI_NOT_WORD, CATEGORY_LINEBREAK: CATEGORY_UNI_LINEBREAK, CATEGORY_NOT_LINEBREAK: CATEGORY_UNI_NOT_LINEBREAK}
DIGITS = frozenset({'6', '3', '8', '7', '5', '1', '4', '2', '0', '9'})
ESCAPES = {'\\a': (LITERAL, 7), '\\b': (LITERAL, 8), '\\f': (LITERAL, 12), '\\n': (LITERAL, 10), '\\r': (LITERAL, 13), '\\t': (LITERAL, 9), '\\v': (LITERAL, 11), '\\\\': (LITERAL, 92)}
FAILURE = FAILURE
FLAGS = {'i': 2, 'L': 4, 'm': 8, 's': 16, 'x': 64, 'a': 256, 't': 1, 'u': 32}
GLOBAL_FLAGS = 129
GROUPREF = GROUPREF
GROUPREF_EXISTS = GROUPREF_EXISTS
GROUPREF_IGNORE = GROUPREF_IGNORE
GROUPREF_LOC_IGNORE = GROUPREF_LOC_IGNORE
GROUPREF_UNI_IGNORE = GROUPREF_UNI_IGNORE
HEXDIGITS = frozenset({'c', '3', 'F', 'B', 'C', '6', 'E', '4', '9', 'a', 'e', '5', '2', 'f', '0', 'D', 'A', 'b', 'd', '8', '1', '7'})
IN = IN
INFO = INFO
IN_IGNORE = IN_IGNORE
IN_LOC_IGNORE = IN_LOC_IGNORE
IN_UNI_IGNORE = IN_UNI_IGNORE
JUMP = JUMP
LITERAL = LITERAL
LITERAL_IGNORE = LITERAL_IGNORE
LITERAL_LOC_IGNORE = LITERAL_LOC_IGNORE
LITERAL_UNI_IGNORE = LITERAL_UNI_IGNORE
MAGIC = 20171005
MARK = MARK
MAXGROUPS = 2147483647
MAXREPEAT = MAXREPEAT
MAX_REPEAT = MAX_REPEAT
MAX_UNTIL = MAX_UNTIL
MIN_REPEAT = MIN_REPEAT
MIN_REPEAT_ONE = MIN_REPEAT_ONE
MIN_UNTIL = MIN_UNTIL
NEGATE = NEGATE
NOT_LITERAL = NOT_LITERAL
NOT_LITERAL_IGNORE = NOT_LITERAL_IGNORE
NOT_LITERAL_LOC_IGNORE = NOT_LITERAL_LOC_IGNORE
NOT_LITERAL_UNI_IGNORE = NOT_LITERAL_UNI_IGNORE
OCTDIGITS = frozenset({'6', '3', '7', '5', '1', '4', '2', '0'})
OPCODES = [FAILURE, SUCCESS, ANY, ANY_ALL, ASSERT, ASSERT_NOT, AT, BRANCH, CALL, CATEGORY, CHARSET, BIGCHARSET, GROUPREF, GROUPREF_EXISTS, IN, INFO, JUMP, LITERAL, MARK, MAX_UNTIL, MIN_UNTIL, NOT_LITERAL, NEGATE, RANGE, REPEAT, REPEAT_ONE, SUBPATTERN, MIN_REPEAT_ONE, GROUPREF_IGNORE, IN_IGNORE, LITERAL_IGNORE, NOT_LITERAL_IGNORE, GROUPREF_LOC_IGNORE, IN_LOC_IGNORE, LITERAL_LOC_IGNORE, NOT_LITERAL_LOC_IGNORE, GROUPREF_UNI_IGNORE, IN_UNI_IGNORE, LITERAL_UNI_IGNORE, NOT_LITERAL_UNI_IGNORE, RANGE_UNI_IGNORE]
OP_IGNORE = {LITERAL: LITERAL_IGNORE, NOT_LITERAL: NOT_LITERAL_IGNORE}
OP_LOCALE_IGNORE = {LITERAL: LITERAL_LOC_IGNORE, NOT_LITERAL: NOT_LITERAL_LOC_IGNORE}
OP_UNICODE_IGNORE = {LITERAL: LITERAL_UNI_IGNORE, NOT_LITERAL: NOT_LITERAL_UNI_IGNORE}
RANGE = RANGE
RANGE_UNI_IGNORE = RANGE_UNI_IGNORE
REPEAT = REPEAT
REPEAT_CHARS = '*+?{'
REPEAT_ONE = REPEAT_ONE
SPECIAL_CHARS = '.\\[{()*+?^$|'
SRE_FLAG_ASCII = 256
SRE_FLAG_DEBUG = 128
SRE_FLAG_DOTALL = 16
SRE_FLAG_IGNORECASE = 2
SRE_FLAG_LOCALE = 4
SRE_FLAG_MULTILINE = 8
SRE_FLAG_TEMPLATE = 1
SRE_FLAG_UNICODE = 32
SRE_FLAG_VERBOSE = 64
SRE_INFO_CHARSET = 4
SRE_INFO_LITERAL = 2
SRE_INFO_PREFIX = 1
SUBPATTERN = SUBPATTERN
SUCCESS = SUCCESS
TYPE_FLAGS = 292
WHITESPACE = frozenset({'\x0c', '\t', '\x0b', ' ', '\n', '\r'})