GNU bug report logs - #28418
25.2; c++ angle bracket incorrect mismatch

Previous Next

Packages: cc-mode, emacs;

Reported by: "Tanis, Craig" <Craig-Tanis <at> utc.edu>

Date: Mon, 11 Sep 2017 15:26:01 UTC

Severity: normal

Found in version 25.2

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 28418 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: "Tanis, Craig" <Craig-Tanis <at> utc.edu>
Cc: 28418 <at> debbugs.gnu.org
Subject: Re: bug#28418: 25.2; c++ angle bracket incorrect mismatch
Date: 11 Sep 2017 17:55:08 -0000
Hello, Craig.

In article <mailman.329.1505143569.14750.bug-gnu-emacs <at> gnu.org> you wrote:



> The opening angle bracket from the stream insertion operator (<<)
> becomes misclassified as an opening delimiter if a later string literal in the
> file contains >>

Firstly, thanks for taking the trouble to report this bug, and thanks
even more for trimming it down to a nice, easy to work with snippet.

> See the following sample file.  Notice that you must type in the string
> as indicated because the act of typing triggers the misclassification.
> When the error occurs, the closing bracket matches the '<' right before "nice". 

Being more precise, I think the >> in the string already has to exist at
the time the << gets typed.

> I suggest pasting this into a new file and then manipulating the first string.


> //---------------------------
> int main(int argc, char *argv[])
> {
>   std::cout << "nice"; // <-- manually type in this string
>   return 0;
> }

> void subroutine()
> {
>     char* foo= "a >> b";
>     return;
> }

> //---------------------------

What seems to be happening is after typing in the opening " of "nice",
but before typing in the closing ", we have a sort of string extending
from that opening " to the opening " of "a >> b".  That >> is
(temporarily) outside a string, and is thus balanced with the <<.  This
balancing is done by applying a "text property" to each of the second <
and the first > characters.

Where things go wrong is when "nice" is closed by typing the closing ".
At this point, the text properties don't get removed from these < and >,
although they no longer match.  This is the fault in the code.

Give me a little time, and I will fix it.




> In GNU Emacs 25.2.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911))
> of 2017-04-21 built on builder10-9.porkrind.org
> Windowing system distributor 'Apple', version 10.3.1504
> Configured using:
> 'configure --with-ns '--enable-locallisppath=/Library/Application
> Support/Emacs/${version}/site-lisp:/Library/Application
> Support/Emacs/site-lisp' --with-modules'

> Major mode: C++/l

[ .... ]

> ----
> Craig Tanis, PhD
> UTC Computer Science and Engineering
> craig-tanis <at> utc.edu

-- 
Alan Mackenzie (Nuremberg, Germany).





This bug report was last modified 7 years and 312 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.