Re: [GSOC][PATCH] userdiff: add support for Scheme
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 29, 2021, 20:47 UTC
- Message-ID
- <xmqq1rbxk7qi.fsf@gitster.g>
- In-Reply-To
- <562DCDA0-EAE6-408F-97D7-127689DE5559@gmail.com>
Atharva Raykar <raykar.ath@gmail.com> writes:
Show 14 quoted lines
>> Having said that, two further points.
>>
>> - the "anything but whitespaces and various forms of parentheses"
>> set would include backslash, so 'component\new' would be taken as
>> a single word with "[^][()\\{\\} \t]+", wouldn't it?
>>
>> - how common is the use of backslashes in identifiers? I am trying
>> to see if the additional complexity needed to support them is
>> worth the benefit.
>
> I have refined the regex, and now it is much simpler and does all of what
> I want it to:
>
> "([^][)(}{[:space:]])+"OK, [:space:] is already used elsewhere, so it would be OK.
In practice, the only difference from "[ \t]" (which is used in many other patterns in the same file) is that [:space:] class includes form-feed (\Ctrl-L); nobody would write vertical-tab in the code, and the matching is done one line at a time, so the fact that LF (or CRLF) is in the [:space:] class does not make a difference anyway.
> I did not have to escape the various parentheses, so I avoided the need to > handle backslashes separately. The "\\t" was causing problems as well because
If you spelled "\\t" that would have caused a problem of your own making ;-)
I think what I gave in the message you are responding to was a single backslash followed by a 't', to let the compiler turn them into a single HT character, and that wouldn't have had such a problem---in fact "[ \t]" is used in many other existing rules in the same file.
Thanks.