Be more careful about escaping in python REs
This commit is contained in:
parent
483e3394cf
commit
d6f8580675
@ -193,9 +193,9 @@ static const value_string cql_direction_names[] = {
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
CQL_BATCH_FLAG_SERIAL_CONSISTENCY = 0x10,
|
||||
CQL_BATCH_FLAG_DEFAULT_TIMESTAMP = 0x020,
|
||||
CQL_BATCH_FLAG_WITH_NAME_FOR_VALUES = 0x040
|
||||
CQL_BATCH_FLAG_SERIAL_CONSISTENCY = 0x10,
|
||||
CQL_BATCH_FLAG_DEFAULT_TIMESTAMP = 0x20,
|
||||
CQL_BATCH_FLAG_WITH_NAME_FOR_VALUES = 0x40
|
||||
} cql_batch_flags;
|
||||
|
||||
typedef enum {
|
||||
|
@ -280,7 +280,7 @@ def removeContractions(code_string):
|
||||
def removeComments(code_string):
|
||||
code_string = re.sub(re.compile(r"/\*.*?\*/", re.DOTALL), "" , code_string) # C-style comment
|
||||
# Avoid matching // where it is allowed, e.g., https://www... or file:///...
|
||||
code_string = re.sub(re.compile(r"(?<!:)(?<!/)(?<!\")(?<!"")(?<!\"\s\s)(?<!file:/)(?<!\,\s)//.*?\n" ) ,"" , code_string) # C++-style comment
|
||||
code_string = re.sub(re.compile(r"(?<!:)(?<!/)(?<!\")(?<!\")(?<!\"\s\s)(?<!file:/)(?<!\,\s)//.*?\n" ) ,"" , code_string) # C++-style comment
|
||||
return code_string
|
||||
|
||||
def getCommentWords(code_string):
|
||||
|
@ -499,7 +499,7 @@ def checkFile(filename, common_tfs, look_for_common=False, check_value_strings=F
|
||||
with open(filename, 'r') as f:
|
||||
contents = f.read()
|
||||
for c in common_tfs:
|
||||
m = re.search(r'TFS\(\s*\&' + c + '\s*\)', contents)
|
||||
m = re.search(r'TFS\(\s*\&' + c + r'\s*\)', contents)
|
||||
if m:
|
||||
if not c in common_usage:
|
||||
common_usage[c] = 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user