diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-31 15:58:51 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-01 05:09:44 -0600 |
commit | 2ced5e02eacfc6b9e67435fe3a24dcb6c3a29037 (patch) | |
tree | a228eef90a7000c80dab582630b85d04dac923ee /build-aux/measurestack/util.py | |
parent | 1a0c67835cd74c6bf2113bb14a7f1b520508c536 (diff) |
measurestack: Compile all regexes upfront
Diffstat (limited to 'build-aux/measurestack/util.py')
-rw-r--r-- | build-aux/measurestack/util.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/build-aux/measurestack/util.py b/build-aux/measurestack/util.py index e878ffa..5367da9 100644 --- a/build-aux/measurestack/util.py +++ b/build-aux/measurestack/util.py @@ -37,8 +37,10 @@ def synthetic_node( return n +re_location = re.compile(r"(?P<filename>.+):(?P<row>[0-9]+):(?P<col>[0-9]+)") + + def read_source(location: str) -> str: - re_location = re.compile(r"(?P<filename>.+):(?P<row>[0-9]+):(?P<col>[0-9]+)") m = re_location.fullmatch(location) if not m: raise ValueError(f"unexpected label value {location!r}") |