Skip to content

Commit

Permalink
Merge pull request #594 from ChrisCummins/fix/inst2vec-regex
Browse files Browse the repository at this point in the history
[third-party] Mark inst2vec regexes as regex literals.
  • Loading branch information
ChrisCummins authored Mar 3, 2022
2 parents 56ba97a + 656efaa commit f8a5117
Show file tree
Hide file tree
Showing 2 changed files with 3,726 additions and 3,712 deletions.
12 changes: 6 additions & 6 deletions compiler_gym/third_party/inst2vec/inst2vec_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,16 +339,16 @@ def preprocess(data):
# XFG-transforming (inline and abstract statements)
########################################################################################################################
# Helper regexs for structure type inlining
vector_type = "<\d+ x " + rgx.first_class_type + ">"
array_type = "\[\d+ x " + rgx.first_class_type + "\]"
array_of_array_type = "\[\d+ x " + "\[\d+ x " + rgx.first_class_type + "\]" + "\]"
vector_type = r"<\d+ x " + rgx.first_class_type + r">"
array_type = r"\[\d+ x " + rgx.first_class_type + r"\]"
array_of_array_type = r"\[\d+ x " + r"\[\d+ x " + rgx.first_class_type + r"\]" + r"\]"
function_type = (
rgx.first_class_type
+ " \("
+ r" \("
+ rgx.any_of([rgx.first_class_type, vector_type, array_type, "..."], ",")
+ "*"
+ rgx.any_of([rgx.first_class_type, vector_type, array_type, "..."])
+ "\)\**"
+ r"\)\**"
)
structure_entry = rgx.any_of(
[
Expand Down Expand Up @@ -460,7 +460,7 @@ def construct_struct_types_dictionary_for_file(data):
struct_prev.append(comp_structure)
struct_prev_with_comma.append(comp_structure + ", ")
else:
comp_structure = "<?{ [ <>{}\dx\[\]\(\)\.,\*%IDvfloatdubeipqcy]+}>?$"
comp_structure = r"<?{ [ <>{}\dx\[\]\(\)\.,\*%IDvfloatdubeipqcy]+}>?$"

# Loop over contents of to_process
for i in list(to_process.items()):
Expand Down
Loading

0 comments on commit f8a5117

Please sign in to comment.