From: Johannes Sixt Date: Thu, 23 Jul 2026 08:00:27 GMT Subject: Re: [PATCH v2] userdiff: add support for Swift Message-ID: In-Reply-To: Am 21.07.26 um 21:33 schrieb Junio C Hamano: > Shlok Kulshreshtha writes: > >> Add a built-in userdiff driver for the Swift programming language so that >> diff hunk headers and word diffs work out of the box for ".swift" files. >> >> The funcname pattern is built for Swift's own declaration grammar: an >> optional run of attributes ("@objc", "@available(iOS 13, *)", ...), >> followed by an optional run of lowercase modifiers ("public", "static", >> "final", ...), followed by a declaration keyword (func, class, struct, >> enum, protocol, extension, actor, init, deinit, subscript). The keyword >> is followed by a boundary that allows whitespace, "(" (init/subscript), >> "?" or "!" (failable init), or "<" (generics), while still acting as a >> word boundary so e.g. "initialize(" does not match. >> >> The word regex recognizes Swift identifiers, hexadecimal, octal, binary, >> integer and floating-point literals, and the language's operators. >> >> Signed-off-by: Shlok Kulshreshtha >> --- >> v2, addressing Johannes Sixt's review of v1 >> (<2a3a73c5-5e90-44a3-bf6a-6e98ce5e5a59@kdbg.org>). Changes since v1: >> >> - t4018/swift-{init,failable-init,generic-subscript}: "RIGHT" now >> appears only once, on the declaration line, so the expected header is >> unambiguous. >> - word regex: dropped the redundant "?" after the single-character >> operator class. Single characters are already covered by the >> "|[^[:space:]]" fallback that the PATTERNS macro appends, so only the >> two-character forms need to be spelled out. >> >> (A couple of Hannes's other suggestions I kept as-is; I have explained >> the reasoning in a reply to his review.) > > Thanks for an update. > > Let's wait for a few days to see if we hear more comments and > otherwise mark the topic for 'next'. This round looks good to me. Acked-by: Johannes Sixt -- Hannes