Subject: Re: bug#63708: 29.0.60; rust-ts-mode not properly handling apostrophe

From: Йордан Миладинов<[email-masked]>
Date: Sun, 28 May 2023 19:51:42 +0000

Thanks for the comments!

Here's the updated review + the same trick applied for Go as well as I discovered the same bug in go-ts-mode.

> On Saturday, May 27th, 2023 at 6:00 AM, Randy Taylor <[email-masked]> > wrote:
>
> Do we want to use string-to-syntax here?

I believe we do as this is what both the old c-mode and the new c-ts-mode define.

If you're going to commit these fixes for both Rust and Go, would you like me to go through all native treesiter modes, check for the same bug and eventually apply the same fix?

Cheers! YM

> On Friday, May 26th, 2023 at 15:14, Йордан Миладинов [email-masked] wrote:
> 
> > Here's a patch that implements Randy's idea.
> 
> 
> Thanks for working on this!
> 
> This fix is indeed what I had in mind and I see that you also fixed another bug, thanks!
> Eli, the changes to the existing loop are needed to apply the correct syntax properties
> to type_parameters, which were previously incorrectly considered punctuation.
> I think this is the safest fix for Emacs 29.
> 
> I have some other comments about the patch below.
> 
> + (put-text-property (match-beginning 0)
> + (match-end 0)
> + 'syntax-table
> + '(7))))
> ^^^
> 
> 
> - "Apply syntax text property to template delimiters between BEG and END.
> + "Apply proper syntax properties to various special characters with
> +double meaning in Rust code between BEG and END.
> 
> Maybe "Apply syntax properties to various special characters with contextual meaning between BEG and END."?
> 
> -< and > are usually punctuation, e.g., as greater/less-than. But
> 
> -when used for types, they should be considered pairs.
> +Apostrophe (') is commonly treated as punctuation, but when used
> +to define character literals, it should be treated as a string.
> 
> Maybe "Apostrophes (') are commonly treated as punctuation, but when used to define character literals, they should be treated as strings."?