Skip to content

Commit 7186ea5

Browse files
authored
Merge pull request #19871 from github/kaspersv/overlay-script-re
Use regex to match overlay annotations
2 parents d39b68c + 869ba0d commit 7186ea5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

config/add-overlay-annotations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
#!/usr/bin/python3
1818
import sys
1919
import os
20+
import re
2021
from difflib import context_diff
2122

23+
OVERLAY_PATTERN = re.compile(r'overlay\[[a-zA-Z?_-]+\]')
2224

2325
def has_overlay_annotations(lines):
2426
'''
2527
Check whether the given lines contain any overlay[...] annotations.
2628
'''
27-
overlays = ["local", "local?", "global", "caller", "caller?"]
28-
annotations = [f"overlay[{t}]" for t in overlays]
29-
return any(ann in line for ann in annotations for line in lines)
29+
return any(OVERLAY_PATTERN.search(line) for line in lines)
3030

3131

3232
def is_line_comment(line):

0 commit comments

Comments
 (0)