diff --git a/scripts/mk_genfile_common.py b/scripts/mk_genfile_common.py index bb6d884e6..cd2c7c83b 100644 --- a/scripts/mk_genfile_common.py +++ b/scripts/mk_genfile_common.py @@ -139,7 +139,7 @@ def mk_z3consts_py_internal(api_files, output_dir): assert False, "Invalid %s, line: %s" % (api_file, linenum) else: assert mode == IN_ENUM - words = re.split('[^\-a-zA-Z0-9_]+', line) + words = re.split('[^-a-zA-Z0-9_]+', line) m = closebrace_pat.match(line) if m: name = words[1] @@ -227,7 +227,7 @@ def mk_z3consts_dotnet_internal(api_files, output_dir): assert False, "Invalid %s, line: %s" % (api_file, linenum) else: assert mode == IN_ENUM - words = re.split('[^\-a-zA-Z0-9_]+', line) + words = re.split('[^-a-zA-Z0-9_]+', line) m = closebrace_pat.match(line) if m: name = words[1] @@ -315,7 +315,7 @@ def mk_z3consts_java_internal(api_files, package_name, output_dir): assert False, "Invalid %s, line: %s" % (api_file, linenum) else: assert mode == IN_ENUM - words = re.split('[^\-a-zA-Z0-9_]+', line) + words = re.split('[^-a-zA-Z0-9_]+', line) m = closebrace_pat.match(line) if m: name = words[1] @@ -441,7 +441,7 @@ def mk_z3consts_ml_internal(api_files, output_dir): assert False, "Invalid %s, line: %s" % (api_file, linenum) else: assert mode == IN_ENUM - words = re.split('[^\-a-zA-Z0-9_]+', line) + words = re.split('[^-a-zA-Z0-9_]+', line) m = closebrace_pat.match(line) if m: name = words[1] @@ -574,7 +574,7 @@ def mk_def_file_internal(defname, dll_name, export_header_files): for line in api: m = pat1.match(line) if m: - words = re.split('\W+', line) + words = re.split(r'\W+', line) i = 0 for w in words: if w == 'Z3_API': @@ -618,9 +618,9 @@ def mk_gparams_register_modules_internal(h_files_full_path, path): fout = open(fullname, 'w') fout.write('// Automatically generated file.\n') fout.write('#include "util/gparams.h"\n') - reg_pat = re.compile('[ \t]*REG_PARAMS\(\'([^\']*)\'\)') - reg_mod_pat = re.compile('[ \t]*REG_MODULE_PARAMS\(\'([^\']*)\', *\'([^\']*)\'\)') - reg_mod_descr_pat = re.compile('[ \t]*REG_MODULE_DESCRIPTION\(\'([^\']*)\', *\'([^\']*)\'\)') + reg_pat = re.compile(r'[ \t]*REG_PARAMS\(\'([^\']*)\'\)') + reg_mod_pat = re.compile(r'[ \t]*REG_MODULE_PARAMS\(\'([^\']*)\', *\'([^\']*)\'\)') + reg_mod_descr_pat = re.compile(r'[ \t]*REG_MODULE_DESCRIPTION\(\'([^\']*)\', *\'([^\']*)\'\)') for h_file in sorted_headers_by_component(h_files_full_path): added_include = False with io.open(h_file, encoding='utf-8', mode='r') as fin: @@ -698,9 +698,9 @@ def mk_install_tactic_cpp_internal(h_files_full_path, path): fout.write('#include "cmd_context/tactic_cmds.h"\n') fout.write('#include "cmd_context/simplifier_cmds.h"\n') fout.write('#include "cmd_context/cmd_context.h"\n') - tactic_pat = re.compile('[ \t]*ADD_TACTIC\(.*\)') - probe_pat = re.compile('[ \t]*ADD_PROBE\(.*\)') - simplifier_pat = re.compile('[ \t]*ADD_SIMPLIFIER\(.*\)') + tactic_pat = re.compile(r'[ \t]*ADD_TACTIC\(.*\)') + probe_pat = re.compile(r'[ \t]*ADD_PROBE\(.*\)') + simplifier_pat = re.compile(r'[ \t]*ADD_SIMPLIFIER\(.*\)') for h_file in sorted_headers_by_component(h_files_full_path): added_include = False try: @@ -780,10 +780,10 @@ def mk_mem_initializer_cpp_internal(h_files_full_path, path): fullname = os.path.join(path, 'mem_initializer.cpp') fout = open(fullname, 'w') fout.write('// Automatically generated file.\n') - initializer_pat = re.compile('[ \t]*ADD_INITIALIZER\(\'([^\']*)\'\)') + initializer_pat = re.compile(r'[ \t]*ADD_INITIALIZER\(\'([^\']*)\'\)') # ADD_INITIALIZER with priority - initializer_prio_pat = re.compile('[ \t]*ADD_INITIALIZER\(\'([^\']*)\',[ \t]*(-?[0-9]*)\)') - finalizer_pat = re.compile('[ \t]*ADD_FINALIZER\(\'([^\']*)\'\)') + initializer_prio_pat = re.compile(r'[ \t]*ADD_INITIALIZER\(\'([^\']*)\',[ \t]*(-?[0-9]*)\)') + finalizer_pat = re.compile(r'[ \t]*ADD_FINALIZER\(\'([^\']*)\'\)') for h_file in sorted_headers_by_component(h_files_full_path): added_include = False with io.open(h_file, encoding='utf-8', mode='r') as fin: diff --git a/scripts/mk_util.py b/scripts/mk_util.py index 805aea19d..fbb4b3590 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -395,7 +395,7 @@ def check_java(): else: # Search for jni.h in the library directories... t = open('errout', 'r') - open_pat = re.compile("\[search path for class files: (.*)\]") + open_pat = re.compile(r"\[search path for class files: (.*)\]") cdirs = [] for line in t: m = open_pat.match(line) @@ -812,8 +812,8 @@ def parse_options(): def extract_c_includes(fname): result = {} # We look for well behaved #include directives - std_inc_pat = re.compile("[ \t]*#include[ \t]*\"(.*)\"[ \t]*") - system_inc_pat = re.compile("[ \t]*#include[ \t]*\<.*\>[ \t]*") + std_inc_pat = re.compile(r"[ \t]*#include[ \t]*\"(.*)\"[ \t]*") + system_inc_pat = re.compile(r"[ \t]*#include[ \t]*\<.*\>[ \t]*") # We should generate and error for any occurrence of #include that does not match the previous pattern. non_std_inc_pat = re.compile(".*#include.*") @@ -1720,7 +1720,7 @@ class DotNetDLLComponent(Component): print("Version output to csproj:", version) - core_csproj_str = """ + core_csproj_str = r""" netstandard1.4 @@ -2246,7 +2246,7 @@ class DotNetExampleComponent(ExampleComponent): else: platform = 'x86' - dotnet_proj_str = """ + dotnet_proj_str = r""" Exe netcoreapp2.0 @@ -3162,7 +3162,7 @@ def mk_vs_proj_property_groups(f, name, target_ext, type): f.write(' Win32Proj\n') f.write(' %s\n' % get_platform_toolset_str()) f.write(' \n') - f.write(' \n') + f.write(' \n') f.write(' \n') f.write(' %s\n' % type) f.write(' Unicode\n') @@ -3173,24 +3173,24 @@ def mk_vs_proj_property_groups(f, name, target_ext, type): f.write(' Unicode\n') f.write(' false\n') f.write(' \n') - f.write(' \n') + f.write(' \n') f.write(' \n') f.write(' \n') - f.write(' \n') + f.write(' \n') f.write(' \n') f.write(' \n') - f.write(' $(SolutionDir)\$(ProjectName)\$(Configuration)\\n') + f.write(' $(SolutionDir)\\$(ProjectName)\\$(Configuration)\\\n') f.write(' %s\n' % name) f.write(' .%s\n' % target_ext) - f.write(' $(SolutionDir)\$(ProjectName)\$(Configuration)\\n') + f.write(' $(SolutionDir)\\$(ProjectName)\\$(Configuration)\\\n') f.write(' %s\n' % name) f.write(' .%s\n' % target_ext) f.write(' \n') f.write(' \n') - f.write(' $(ProjectName)\$(Configuration)\\n') + f.write(' $(ProjectName)\\$(Configuration)\\\n') f.write(' \n') f.write(' \n') - f.write(' $(ProjectName)\$(Configuration)\\n') + f.write(' $(ProjectName)\\$(Configuration)\\\n') f.write(' \n') @@ -3267,7 +3267,7 @@ def mk_vs_proj(name, components): mk_vs_proj_link_exe(f, name, debug=False) f.write(' \n') mk_vs_proj_dep_groups(f, name, components) - f.write(' \n') + f.write(' \n') f.write(' \n') f.write(' \n') f.write('\n') @@ -3308,7 +3308,7 @@ def mk_vs_proj_dll(name, components): mk_vs_proj_link_dll(f, name, debug=False) f.write(' \n') mk_vs_proj_dep_groups(f, name, components) - f.write(' \n') + f.write(' \n') f.write(' \n') f.write(' \n') f.write('\n') diff --git a/scripts/update_api.py b/scripts/update_api.py index 89a895e3b..dc25f8df2 100755 --- a/scripts/update_api.py +++ b/scripts/update_api.py @@ -116,8 +116,8 @@ class APITypes: def def_Types(self, api_files): global Closures - pat1 = re.compile(" *def_Type\(\'(.*)\',[^\']*\'(.*)\',[^\']*\'(.*)\'\)[ \t]*") - pat2 = re.compile("Z3_DECLARE_CLOSURE\((.*),(.*), \((.*)\)\)") + pat1 = re.compile(r" *def_Type\(\'(.*)\',[^\']*\'(.*)\',[^\']*\'(.*)\'\)[ \t]*") + pat2 = re.compile(r"Z3_DECLARE_CLOSURE\((.*),(.*), \((.*)\)\)") for api_file in api_files: with open(api_file, 'r') as api: for line in api: