Skip to content

Commit f8a5117

Browse files
author
Chris Cummins
authored
Merge pull request #594 from ChrisCummins/fix/inst2vec-regex
[third-party] Mark inst2vec regexes as regex literals.
2 parents 56ba97a + 656efaa commit f8a5117

File tree

2 files changed

+3726
-3712
lines changed

2 files changed

+3726
-3712
lines changed

compiler_gym/third_party/inst2vec/inst2vec_preprocess.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,16 +339,16 @@ def preprocess(data):
339339
# XFG-transforming (inline and abstract statements)
340340
########################################################################################################################
341341
# Helper regexs for structure type inlining
342-
vector_type = "<\d+ x " + rgx.first_class_type + ">"
343-
array_type = "\[\d+ x " + rgx.first_class_type + "\]"
344-
array_of_array_type = "\[\d+ x " + "\[\d+ x " + rgx.first_class_type + "\]" + "\]"
342+
vector_type = r"<\d+ x " + rgx.first_class_type + r">"
343+
array_type = r"\[\d+ x " + rgx.first_class_type + r"\]"
344+
array_of_array_type = r"\[\d+ x " + r"\[\d+ x " + rgx.first_class_type + r"\]" + r"\]"
345345
function_type = (
346346
rgx.first_class_type
347-
+ " \("
347+
+ r" \("
348348
+ rgx.any_of([rgx.first_class_type, vector_type, array_type, "..."], ",")
349349
+ "*"
350350
+ rgx.any_of([rgx.first_class_type, vector_type, array_type, "..."])
351-
+ "\)\**"
351+
+ r"\)\**"
352352
)
353353
structure_entry = rgx.any_of(
354354
[
@@ -460,7 +460,7 @@ def construct_struct_types_dictionary_for_file(data):
460460
struct_prev.append(comp_structure)
461461
struct_prev_with_comma.append(comp_structure + ", ")
462462
else:
463-
comp_structure = "<?{ [ <>{}\dx\[\]\(\)\.,\*%IDvfloatdubeipqcy]+}>?$"
463+
comp_structure = r"<?{ [ <>{}\dx\[\]\(\)\.,\*%IDvfloatdubeipqcy]+}>?$"
464464

465465
# Loop over contents of to_process
466466
for i in list(to_process.items()):

0 commit comments

Comments
 (0)