Re: [PATCH v2] userdiff: add support for Swift

Johannes Sixt <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
Am 21.07.26 um 21:33 schrieb Junio C Hamano:
> Shlok Kulshreshtha <[email protected]> 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 <[email protected]>
>> ---
>> v2, addressing Johannes Sixt's review of v1
>> (<[email protected]>).  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 <[email protected]>

-- Hannes
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.