Commit ec083cdc by sikang

update

parent 547d0803
...@@ -49,7 +49,10 @@ def get_rand_code(isInFunc): ...@@ -49,7 +49,10 @@ def get_rand_code(isInFunc):
return code return code
def get_brackets(line):
left = line.count("{")
right = line.count("}")
return left - right
def process_file_content(path, file_name): def process_file_content(path, file_name):
# print("processing content: %s..." % path) # print("processing content: %s..." % path)
...@@ -88,16 +91,15 @@ def process_file_content(path, file_name): ...@@ -88,16 +91,15 @@ def process_file_content(path, file_name):
if " class " in line and "{" in line: if " class " in line and "{" in line:
func_level=0 func_level=0
if "//interference code" not in line and \
("){\n" in line or ") {\n" in line) and \ if ("){\n" in line or ") {\n" in line) and \
func_level == 0 and \ func_level == 0 and \
not isReturn: not isReturn:
func_level = 1 func_level = get_brackets(line)
elif func_level > 0: elif func_level != 0:
if "//interference code" not in line and "{\n" in line: func_level +=get_brackets(line)
func_level +=1 if func_level < 0 :
if "//interference code" not in line and "}\n" in line: func_level = 0
func_level -=1
#需要忽略的行 #需要忽略的行
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment