From 869ba0d246c252122cf65abd603e5c2e243dbf09 Mon Sep 17 00:00:00 2001 From: Kasper Svendsen Date: Wed, 25 Jun 2025 09:22:23 +0200 Subject: [PATCH] Use regex to match overlay annotations --- config/add-overlay-annotations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/add-overlay-annotations.py b/config/add-overlay-annotations.py index c6e3db24ae0..85b42026d8d 100644 --- a/config/add-overlay-annotations.py +++ b/config/add-overlay-annotations.py @@ -17,16 +17,16 @@ #!/usr/bin/python3 import sys import os +import re from difflib import context_diff +OVERLAY_PATTERN = re.compile(r'overlay\[[a-zA-Z?_-]+\]') def has_overlay_annotations(lines): ''' Check whether the given lines contain any overlay[...] annotations. ''' - overlays = ["local", "local?", "global", "caller", "caller?"] - annotations = [f"overlay[{t}]" for t in overlays] - return any(ann in line for ann in annotations for line in lines) + return any(OVERLAY_PATTERN.search(line) for line in lines) def is_line_comment(line):