Re: CC Mode multi-line strings [Was: Adding Vala support]

Alan Mackenzie <[email protected]>
Newsgroups gmane.emacs.cc-mode.general
Message-ID <YZajow3K66+oDoo0@ACM>
Hello, Theo.

On Wed, Nov 17, 2021 at 23:32:41 +0100, Theodor Thornhill wrote:
> Hi Alan!

> >> Thanks again for working on this!  There is already one user reporting
> >> that huge slowdowns aren't occurring anymore given that pr.  There are
> >> probably still stuff to iron out, ....

> > I think that's highly likely.  That's why I've left it a little while
> > before merging it into Emacs itself.


> Ok, so now I have my first bug report with the new implementation on my
> hands [1]. I must say I don't fully understand what is going on here.
> To me it seems like CC mode is now treating _all_ strings as multiline
> strings, even the ones not using the `@` prefix. Is that supposed to be
> expressed somehow?  I think what the problem boils down to is this:

> ```
> string s1 = "He said, \"This is the last \u0063hance\x0021\"";
> string s2 = @"He said, ""This is the last \u0063hance\x0021""";

> Console.WriteLine(s1);
> Console.WriteLine(s2);
> // The example displays the following output:
> //     He said, "This is the last chance!"
> //     He said, "This is the last \u0063hance\x0021"
> ```

> I am not sure if this is because of the regexes or the general
> implementation, so maybe you can point me in the correct direction? A
> good screenshot is provided in the link below.  I don't know if you use
> GitHub, so I'll attach that aswell.  Sorry to bother you with this!

No problem!  My guess is that inside the @" string, there are no escape
characters.  So "\u0063" stands for the six characters \ u 0 0 6 3
rather than the single unicode c.  If that's the case, then this isn't a
problem with C# Mode or CC Mode.

> > Well, congratulations!  I can understand the bit about it "taking some
> > time".  ;-)


> Thanks :)


> > Thanks, more or less yes.  I hope everything's OK at your end, too.


> Apart from my kids having their 45th or so cold this fall, then yes :)

Oh, that's not nice.  Not a big worry, but unpleasant all the same.

> Theo

> [1]: https://github.com/emacs-csharp/csharp-mode/issues/252

-- 
Alan Mackenzie (Nuremberg, Germany).
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.