Skip to content

Commit 8c8c551

Browse files
committed
Update regex/getting matches
1 parent b277560 commit 8c8c551

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clang/tools/clang-format/clang-format.el

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,15 @@ which can be passed directly to ‘clang-format’."
196196
;; "@@ -80 +80 @@" or "@@ -80,2 +80,2 @@"
197197
(goto-char (point-min))
198198
(while (re-search-forward
199-
"^@@\s-[0-9,]+\s\\+\\([0-9]+\\)\\(,\\([0-9]+\\)\\)?\s@@$"
199+
"^@@[[:blank:]]-[[:digit:],]+[[:blank:]]\\+\\([[:digit:]]+\\)\\(,\\([[:digit:]]+\\)\\)?[[:blank:]]@@$"
200200
nil
201201
t
202202
1)
203203
(let ((match1 (string-to-number (match-string 1)))
204-
(match3 (if (match-string 3)
205-
(string-to-number (match-string 3))
206-
nil)))
204+
(match3 (let ((match3_or_nil (match-string 3)))
205+
(if match3_or_nil
206+
(string-to-number match3_or_nil)
207+
nil))))
207208
(push (format
208209
"--lines=%d:%d"
209210
match1

0 commit comments

Comments
 (0)