[llvm] [UTC] Escape multiple {{ or }} in input for check lines. (PR #71790)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 09:00:19 PST 2023


================
@@ -1171,6 +1171,9 @@ def transform_line_vars(match):
         return match.group(1) + rv + match.group(match.lastindex)
 
     lines_with_def = []
+    multiple_braces_re = re.compile(r"({{+)|(}}+)")
+    def escape_braces(match_obj):
+        return ''.join(['{{', re.escape(match_obj.group(0)), '}}'])
----------------
nikic wrote:

```suggestion
        return '{{' + re.escape(match_obj.group(0)) + '}}'
```
A bit simpler?

https://github.com/llvm/llvm-project/pull/71790


More information about the llvm-commits mailing list