Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../usr/lib64/python2....
File: token.py
"""Token constants (from "token.h")."""
[0] Fix | Delete
[1] Fix | Delete
# This file is automatically generated; please don't muck it up!
[2] Fix | Delete
#
[3] Fix | Delete
# To update the symbols in this file, 'cd' to the top directory of
[4] Fix | Delete
# the python source tree after building the interpreter and run:
[5] Fix | Delete
#
[6] Fix | Delete
# ./python Lib/token.py
[7] Fix | Delete
[8] Fix | Delete
#--start constants--
[9] Fix | Delete
ENDMARKER = 0
[10] Fix | Delete
NAME = 1
[11] Fix | Delete
NUMBER = 2
[12] Fix | Delete
STRING = 3
[13] Fix | Delete
NEWLINE = 4
[14] Fix | Delete
INDENT = 5
[15] Fix | Delete
DEDENT = 6
[16] Fix | Delete
LPAR = 7
[17] Fix | Delete
RPAR = 8
[18] Fix | Delete
LSQB = 9
[19] Fix | Delete
RSQB = 10
[20] Fix | Delete
COLON = 11
[21] Fix | Delete
COMMA = 12
[22] Fix | Delete
SEMI = 13
[23] Fix | Delete
PLUS = 14
[24] Fix | Delete
MINUS = 15
[25] Fix | Delete
STAR = 16
[26] Fix | Delete
SLASH = 17
[27] Fix | Delete
VBAR = 18
[28] Fix | Delete
AMPER = 19
[29] Fix | Delete
LESS = 20
[30] Fix | Delete
GREATER = 21
[31] Fix | Delete
EQUAL = 22
[32] Fix | Delete
DOT = 23
[33] Fix | Delete
PERCENT = 24
[34] Fix | Delete
BACKQUOTE = 25
[35] Fix | Delete
LBRACE = 26
[36] Fix | Delete
RBRACE = 27
[37] Fix | Delete
EQEQUAL = 28
[38] Fix | Delete
NOTEQUAL = 29
[39] Fix | Delete
LESSEQUAL = 30
[40] Fix | Delete
GREATEREQUAL = 31
[41] Fix | Delete
TILDE = 32
[42] Fix | Delete
CIRCUMFLEX = 33
[43] Fix | Delete
LEFTSHIFT = 34
[44] Fix | Delete
RIGHTSHIFT = 35
[45] Fix | Delete
DOUBLESTAR = 36
[46] Fix | Delete
PLUSEQUAL = 37
[47] Fix | Delete
MINEQUAL = 38
[48] Fix | Delete
STAREQUAL = 39
[49] Fix | Delete
SLASHEQUAL = 40
[50] Fix | Delete
PERCENTEQUAL = 41
[51] Fix | Delete
AMPEREQUAL = 42
[52] Fix | Delete
VBAREQUAL = 43
[53] Fix | Delete
CIRCUMFLEXEQUAL = 44
[54] Fix | Delete
LEFTSHIFTEQUAL = 45
[55] Fix | Delete
RIGHTSHIFTEQUAL = 46
[56] Fix | Delete
DOUBLESTAREQUAL = 47
[57] Fix | Delete
DOUBLESLASH = 48
[58] Fix | Delete
DOUBLESLASHEQUAL = 49
[59] Fix | Delete
AT = 50
[60] Fix | Delete
OP = 51
[61] Fix | Delete
ERRORTOKEN = 52
[62] Fix | Delete
N_TOKENS = 53
[63] Fix | Delete
NT_OFFSET = 256
[64] Fix | Delete
#--end constants--
[65] Fix | Delete
[66] Fix | Delete
tok_name = {}
[67] Fix | Delete
for _name, _value in globals().items():
[68] Fix | Delete
if type(_value) is type(0):
[69] Fix | Delete
tok_name[_value] = _name
[70] Fix | Delete
del _name, _value
[71] Fix | Delete
[72] Fix | Delete
[73] Fix | Delete
def ISTERMINAL(x):
[74] Fix | Delete
return x < NT_OFFSET
[75] Fix | Delete
[76] Fix | Delete
def ISNONTERMINAL(x):
[77] Fix | Delete
return x >= NT_OFFSET
[78] Fix | Delete
[79] Fix | Delete
def ISEOF(x):
[80] Fix | Delete
return x == ENDMARKER
[81] Fix | Delete
[82] Fix | Delete
[83] Fix | Delete
def main():
[84] Fix | Delete
import re
[85] Fix | Delete
import sys
[86] Fix | Delete
args = sys.argv[1:]
[87] Fix | Delete
inFileName = args and args[0] or "Include/token.h"
[88] Fix | Delete
outFileName = "Lib/token.py"
[89] Fix | Delete
if len(args) > 1:
[90] Fix | Delete
outFileName = args[1]
[91] Fix | Delete
try:
[92] Fix | Delete
fp = open(inFileName)
[93] Fix | Delete
except IOError, err:
[94] Fix | Delete
sys.stdout.write("I/O error: %s\n" % str(err))
[95] Fix | Delete
sys.exit(1)
[96] Fix | Delete
lines = fp.read().split("\n")
[97] Fix | Delete
fp.close()
[98] Fix | Delete
prog = re.compile(
[99] Fix | Delete
"#define[ \t][ \t]*([A-Z0-9][A-Z0-9_]*)[ \t][ \t]*([0-9][0-9]*)",
[100] Fix | Delete
re.IGNORECASE)
[101] Fix | Delete
tokens = {}
[102] Fix | Delete
for line in lines:
[103] Fix | Delete
match = prog.match(line)
[104] Fix | Delete
if match:
[105] Fix | Delete
name, val = match.group(1, 2)
[106] Fix | Delete
val = int(val)
[107] Fix | Delete
tokens[val] = name # reverse so we can sort them...
[108] Fix | Delete
keys = tokens.keys()
[109] Fix | Delete
keys.sort()
[110] Fix | Delete
# load the output skeleton from the target:
[111] Fix | Delete
try:
[112] Fix | Delete
fp = open(outFileName)
[113] Fix | Delete
except IOError, err:
[114] Fix | Delete
sys.stderr.write("I/O error: %s\n" % str(err))
[115] Fix | Delete
sys.exit(2)
[116] Fix | Delete
format = fp.read().split("\n")
[117] Fix | Delete
fp.close()
[118] Fix | Delete
try:
[119] Fix | Delete
start = format.index("#--start constants--") + 1
[120] Fix | Delete
end = format.index("#--end constants--")
[121] Fix | Delete
except ValueError:
[122] Fix | Delete
sys.stderr.write("target does not contain format markers")
[123] Fix | Delete
sys.exit(3)
[124] Fix | Delete
lines = []
[125] Fix | Delete
for val in keys:
[126] Fix | Delete
lines.append("%s = %d" % (tokens[val], val))
[127] Fix | Delete
format[start:end] = lines
[128] Fix | Delete
try:
[129] Fix | Delete
fp = open(outFileName, 'w')
[130] Fix | Delete
except IOError, err:
[131] Fix | Delete
sys.stderr.write("I/O error: %s\n" % str(err))
[132] Fix | Delete
sys.exit(4)
[133] Fix | Delete
fp.write("\n".join(format))
[134] Fix | Delete
fp.close()
[135] Fix | Delete
[136] Fix | Delete
[137] Fix | Delete
if __name__ == "__main__":
[138] Fix | Delete
main()
[139] Fix | Delete
[140] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function