Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/smanonr..../lib64/python2....
File: sre_constants.py
#
[0] Fix | Delete
# Secret Labs' Regular Expression Engine
[1] Fix | Delete
#
[2] Fix | Delete
# various symbols used by the regular expression engine.
[3] Fix | Delete
# run this script to update the _sre include files!
[4] Fix | Delete
#
[5] Fix | Delete
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
[6] Fix | Delete
#
[7] Fix | Delete
# See the sre.py file for information on usage and redistribution.
[8] Fix | Delete
#
[9] Fix | Delete
[10] Fix | Delete
"""Internal support module for sre"""
[11] Fix | Delete
[12] Fix | Delete
# update when constants are added or removed
[13] Fix | Delete
[14] Fix | Delete
MAGIC = 20031017
[15] Fix | Delete
[16] Fix | Delete
try:
[17] Fix | Delete
from _sre import MAXREPEAT
[18] Fix | Delete
except ImportError:
[19] Fix | Delete
import _sre
[20] Fix | Delete
MAXREPEAT = _sre.MAXREPEAT = 65535
[21] Fix | Delete
[22] Fix | Delete
# SRE standard exception (access as sre.error)
[23] Fix | Delete
# should this really be here?
[24] Fix | Delete
[25] Fix | Delete
class error(Exception):
[26] Fix | Delete
pass
[27] Fix | Delete
[28] Fix | Delete
# operators
[29] Fix | Delete
[30] Fix | Delete
FAILURE = "failure"
[31] Fix | Delete
SUCCESS = "success"
[32] Fix | Delete
[33] Fix | Delete
ANY = "any"
[34] Fix | Delete
ANY_ALL = "any_all"
[35] Fix | Delete
ASSERT = "assert"
[36] Fix | Delete
ASSERT_NOT = "assert_not"
[37] Fix | Delete
AT = "at"
[38] Fix | Delete
BIGCHARSET = "bigcharset"
[39] Fix | Delete
BRANCH = "branch"
[40] Fix | Delete
CALL = "call"
[41] Fix | Delete
CATEGORY = "category"
[42] Fix | Delete
CHARSET = "charset"
[43] Fix | Delete
GROUPREF = "groupref"
[44] Fix | Delete
GROUPREF_IGNORE = "groupref_ignore"
[45] Fix | Delete
GROUPREF_EXISTS = "groupref_exists"
[46] Fix | Delete
IN = "in"
[47] Fix | Delete
IN_IGNORE = "in_ignore"
[48] Fix | Delete
INFO = "info"
[49] Fix | Delete
JUMP = "jump"
[50] Fix | Delete
LITERAL = "literal"
[51] Fix | Delete
LITERAL_IGNORE = "literal_ignore"
[52] Fix | Delete
MARK = "mark"
[53] Fix | Delete
MAX_REPEAT = "max_repeat"
[54] Fix | Delete
MAX_UNTIL = "max_until"
[55] Fix | Delete
MIN_REPEAT = "min_repeat"
[56] Fix | Delete
MIN_UNTIL = "min_until"
[57] Fix | Delete
NEGATE = "negate"
[58] Fix | Delete
NOT_LITERAL = "not_literal"
[59] Fix | Delete
NOT_LITERAL_IGNORE = "not_literal_ignore"
[60] Fix | Delete
RANGE = "range"
[61] Fix | Delete
REPEAT = "repeat"
[62] Fix | Delete
REPEAT_ONE = "repeat_one"
[63] Fix | Delete
SUBPATTERN = "subpattern"
[64] Fix | Delete
MIN_REPEAT_ONE = "min_repeat_one"
[65] Fix | Delete
[66] Fix | Delete
# positions
[67] Fix | Delete
AT_BEGINNING = "at_beginning"
[68] Fix | Delete
AT_BEGINNING_LINE = "at_beginning_line"
[69] Fix | Delete
AT_BEGINNING_STRING = "at_beginning_string"
[70] Fix | Delete
AT_BOUNDARY = "at_boundary"
[71] Fix | Delete
AT_NON_BOUNDARY = "at_non_boundary"
[72] Fix | Delete
AT_END = "at_end"
[73] Fix | Delete
AT_END_LINE = "at_end_line"
[74] Fix | Delete
AT_END_STRING = "at_end_string"
[75] Fix | Delete
AT_LOC_BOUNDARY = "at_loc_boundary"
[76] Fix | Delete
AT_LOC_NON_BOUNDARY = "at_loc_non_boundary"
[77] Fix | Delete
AT_UNI_BOUNDARY = "at_uni_boundary"
[78] Fix | Delete
AT_UNI_NON_BOUNDARY = "at_uni_non_boundary"
[79] Fix | Delete
[80] Fix | Delete
# categories
[81] Fix | Delete
CATEGORY_DIGIT = "category_digit"
[82] Fix | Delete
CATEGORY_NOT_DIGIT = "category_not_digit"
[83] Fix | Delete
CATEGORY_SPACE = "category_space"
[84] Fix | Delete
CATEGORY_NOT_SPACE = "category_not_space"
[85] Fix | Delete
CATEGORY_WORD = "category_word"
[86] Fix | Delete
CATEGORY_NOT_WORD = "category_not_word"
[87] Fix | Delete
CATEGORY_LINEBREAK = "category_linebreak"
[88] Fix | Delete
CATEGORY_NOT_LINEBREAK = "category_not_linebreak"
[89] Fix | Delete
CATEGORY_LOC_WORD = "category_loc_word"
[90] Fix | Delete
CATEGORY_LOC_NOT_WORD = "category_loc_not_word"
[91] Fix | Delete
CATEGORY_UNI_DIGIT = "category_uni_digit"
[92] Fix | Delete
CATEGORY_UNI_NOT_DIGIT = "category_uni_not_digit"
[93] Fix | Delete
CATEGORY_UNI_SPACE = "category_uni_space"
[94] Fix | Delete
CATEGORY_UNI_NOT_SPACE = "category_uni_not_space"
[95] Fix | Delete
CATEGORY_UNI_WORD = "category_uni_word"
[96] Fix | Delete
CATEGORY_UNI_NOT_WORD = "category_uni_not_word"
[97] Fix | Delete
CATEGORY_UNI_LINEBREAK = "category_uni_linebreak"
[98] Fix | Delete
CATEGORY_UNI_NOT_LINEBREAK = "category_uni_not_linebreak"
[99] Fix | Delete
[100] Fix | Delete
OPCODES = [
[101] Fix | Delete
[102] Fix | Delete
# failure=0 success=1 (just because it looks better that way :-)
[103] Fix | Delete
FAILURE, SUCCESS,
[104] Fix | Delete
[105] Fix | Delete
ANY, ANY_ALL,
[106] Fix | Delete
ASSERT, ASSERT_NOT,
[107] Fix | Delete
AT,
[108] Fix | Delete
BRANCH,
[109] Fix | Delete
CALL,
[110] Fix | Delete
CATEGORY,
[111] Fix | Delete
CHARSET, BIGCHARSET,
[112] Fix | Delete
GROUPREF, GROUPREF_EXISTS, GROUPREF_IGNORE,
[113] Fix | Delete
IN, IN_IGNORE,
[114] Fix | Delete
INFO,
[115] Fix | Delete
JUMP,
[116] Fix | Delete
LITERAL, LITERAL_IGNORE,
[117] Fix | Delete
MARK,
[118] Fix | Delete
MAX_UNTIL,
[119] Fix | Delete
MIN_UNTIL,
[120] Fix | Delete
NOT_LITERAL, NOT_LITERAL_IGNORE,
[121] Fix | Delete
NEGATE,
[122] Fix | Delete
RANGE,
[123] Fix | Delete
REPEAT,
[124] Fix | Delete
REPEAT_ONE,
[125] Fix | Delete
SUBPATTERN,
[126] Fix | Delete
MIN_REPEAT_ONE
[127] Fix | Delete
[128] Fix | Delete
]
[129] Fix | Delete
[130] Fix | Delete
ATCODES = [
[131] Fix | Delete
AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY,
[132] Fix | Delete
AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING,
[133] Fix | Delete
AT_LOC_BOUNDARY, AT_LOC_NON_BOUNDARY, AT_UNI_BOUNDARY,
[134] Fix | Delete
AT_UNI_NON_BOUNDARY
[135] Fix | Delete
]
[136] Fix | Delete
[137] Fix | Delete
CHCODES = [
[138] Fix | Delete
CATEGORY_DIGIT, CATEGORY_NOT_DIGIT, CATEGORY_SPACE,
[139] Fix | Delete
CATEGORY_NOT_SPACE, CATEGORY_WORD, CATEGORY_NOT_WORD,
[140] Fix | Delete
CATEGORY_LINEBREAK, CATEGORY_NOT_LINEBREAK, CATEGORY_LOC_WORD,
[141] Fix | Delete
CATEGORY_LOC_NOT_WORD, CATEGORY_UNI_DIGIT, CATEGORY_UNI_NOT_DIGIT,
[142] Fix | Delete
CATEGORY_UNI_SPACE, CATEGORY_UNI_NOT_SPACE, CATEGORY_UNI_WORD,
[143] Fix | Delete
CATEGORY_UNI_NOT_WORD, CATEGORY_UNI_LINEBREAK,
[144] Fix | Delete
CATEGORY_UNI_NOT_LINEBREAK
[145] Fix | Delete
]
[146] Fix | Delete
[147] Fix | Delete
def makedict(list):
[148] Fix | Delete
d = {}
[149] Fix | Delete
i = 0
[150] Fix | Delete
for item in list:
[151] Fix | Delete
d[item] = i
[152] Fix | Delete
i = i + 1
[153] Fix | Delete
return d
[154] Fix | Delete
[155] Fix | Delete
OPCODES = makedict(OPCODES)
[156] Fix | Delete
ATCODES = makedict(ATCODES)
[157] Fix | Delete
CHCODES = makedict(CHCODES)
[158] Fix | Delete
[159] Fix | Delete
# replacement operations for "ignore case" mode
[160] Fix | Delete
OP_IGNORE = {
[161] Fix | Delete
GROUPREF: GROUPREF_IGNORE,
[162] Fix | Delete
IN: IN_IGNORE,
[163] Fix | Delete
LITERAL: LITERAL_IGNORE,
[164] Fix | Delete
NOT_LITERAL: NOT_LITERAL_IGNORE
[165] Fix | Delete
}
[166] Fix | Delete
[167] Fix | Delete
AT_MULTILINE = {
[168] Fix | Delete
AT_BEGINNING: AT_BEGINNING_LINE,
[169] Fix | Delete
AT_END: AT_END_LINE
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
AT_LOCALE = {
[173] Fix | Delete
AT_BOUNDARY: AT_LOC_BOUNDARY,
[174] Fix | Delete
AT_NON_BOUNDARY: AT_LOC_NON_BOUNDARY
[175] Fix | Delete
}
[176] Fix | Delete
[177] Fix | Delete
AT_UNICODE = {
[178] Fix | Delete
AT_BOUNDARY: AT_UNI_BOUNDARY,
[179] Fix | Delete
AT_NON_BOUNDARY: AT_UNI_NON_BOUNDARY
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
CH_LOCALE = {
[183] Fix | Delete
CATEGORY_DIGIT: CATEGORY_DIGIT,
[184] Fix | Delete
CATEGORY_NOT_DIGIT: CATEGORY_NOT_DIGIT,
[185] Fix | Delete
CATEGORY_SPACE: CATEGORY_SPACE,
[186] Fix | Delete
CATEGORY_NOT_SPACE: CATEGORY_NOT_SPACE,
[187] Fix | Delete
CATEGORY_WORD: CATEGORY_LOC_WORD,
[188] Fix | Delete
CATEGORY_NOT_WORD: CATEGORY_LOC_NOT_WORD,
[189] Fix | Delete
CATEGORY_LINEBREAK: CATEGORY_LINEBREAK,
[190] Fix | Delete
CATEGORY_NOT_LINEBREAK: CATEGORY_NOT_LINEBREAK
[191] Fix | Delete
}
[192] Fix | Delete
[193] Fix | Delete
CH_UNICODE = {
[194] Fix | Delete
CATEGORY_DIGIT: CATEGORY_UNI_DIGIT,
[195] Fix | Delete
CATEGORY_NOT_DIGIT: CATEGORY_UNI_NOT_DIGIT,
[196] Fix | Delete
CATEGORY_SPACE: CATEGORY_UNI_SPACE,
[197] Fix | Delete
CATEGORY_NOT_SPACE: CATEGORY_UNI_NOT_SPACE,
[198] Fix | Delete
CATEGORY_WORD: CATEGORY_UNI_WORD,
[199] Fix | Delete
CATEGORY_NOT_WORD: CATEGORY_UNI_NOT_WORD,
[200] Fix | Delete
CATEGORY_LINEBREAK: CATEGORY_UNI_LINEBREAK,
[201] Fix | Delete
CATEGORY_NOT_LINEBREAK: CATEGORY_UNI_NOT_LINEBREAK
[202] Fix | Delete
}
[203] Fix | Delete
[204] Fix | Delete
# flags
[205] Fix | Delete
SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking)
[206] Fix | Delete
SRE_FLAG_IGNORECASE = 2 # case insensitive
[207] Fix | Delete
SRE_FLAG_LOCALE = 4 # honour system locale
[208] Fix | Delete
SRE_FLAG_MULTILINE = 8 # treat target as multiline string
[209] Fix | Delete
SRE_FLAG_DOTALL = 16 # treat target as a single string
[210] Fix | Delete
SRE_FLAG_UNICODE = 32 # use unicode locale
[211] Fix | Delete
SRE_FLAG_VERBOSE = 64 # ignore whitespace and comments
[212] Fix | Delete
SRE_FLAG_DEBUG = 128 # debugging
[213] Fix | Delete
[214] Fix | Delete
# flags for INFO primitive
[215] Fix | Delete
SRE_INFO_PREFIX = 1 # has prefix
[216] Fix | Delete
SRE_INFO_LITERAL = 2 # entire pattern is literal (given by prefix)
[217] Fix | Delete
SRE_INFO_CHARSET = 4 # pattern starts with character from given set
[218] Fix | Delete
[219] Fix | Delete
if __name__ == "__main__":
[220] Fix | Delete
def dump(f, d, prefix):
[221] Fix | Delete
items = d.items()
[222] Fix | Delete
items.sort(key=lambda a: a[1])
[223] Fix | Delete
for k, v in items:
[224] Fix | Delete
f.write("#define %s_%s %s\n" % (prefix, k.upper(), v))
[225] Fix | Delete
f = open("sre_constants.h", "w")
[226] Fix | Delete
f.write("""\
[227] Fix | Delete
/*
[228] Fix | Delete
* Secret Labs' Regular Expression Engine
[229] Fix | Delete
*
[230] Fix | Delete
* regular expression matching engine
[231] Fix | Delete
*
[232] Fix | Delete
* NOTE: This file is generated by sre_constants.py. If you need
[233] Fix | Delete
* to change anything in here, edit sre_constants.py and run it.
[234] Fix | Delete
*
[235] Fix | Delete
* Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
[236] Fix | Delete
*
[237] Fix | Delete
* See the _sre.c file for information on usage and redistribution.
[238] Fix | Delete
*/
[239] Fix | Delete
[240] Fix | Delete
""")
[241] Fix | Delete
[242] Fix | Delete
f.write("#define SRE_MAGIC %d\n" % MAGIC)
[243] Fix | Delete
[244] Fix | Delete
dump(f, OPCODES, "SRE_OP")
[245] Fix | Delete
dump(f, ATCODES, "SRE")
[246] Fix | Delete
dump(f, CHCODES, "SRE")
[247] Fix | Delete
[248] Fix | Delete
f.write("#define SRE_FLAG_TEMPLATE %d\n" % SRE_FLAG_TEMPLATE)
[249] Fix | Delete
f.write("#define SRE_FLAG_IGNORECASE %d\n" % SRE_FLAG_IGNORECASE)
[250] Fix | Delete
f.write("#define SRE_FLAG_LOCALE %d\n" % SRE_FLAG_LOCALE)
[251] Fix | Delete
f.write("#define SRE_FLAG_MULTILINE %d\n" % SRE_FLAG_MULTILINE)
[252] Fix | Delete
f.write("#define SRE_FLAG_DOTALL %d\n" % SRE_FLAG_DOTALL)
[253] Fix | Delete
f.write("#define SRE_FLAG_UNICODE %d\n" % SRE_FLAG_UNICODE)
[254] Fix | Delete
f.write("#define SRE_FLAG_VERBOSE %d\n" % SRE_FLAG_VERBOSE)
[255] Fix | Delete
[256] Fix | Delete
f.write("#define SRE_INFO_PREFIX %d\n" % SRE_INFO_PREFIX)
[257] Fix | Delete
f.write("#define SRE_INFO_LITERAL %d\n" % SRE_INFO_LITERAL)
[258] Fix | Delete
f.write("#define SRE_INFO_CHARSET %d\n" % SRE_INFO_CHARSET)
[259] Fix | Delete
[260] Fix | Delete
f.close()
[261] Fix | Delete
print "done"
[262] Fix | Delete
[263] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function