* Re: [Emacs-diffs] emacs-25 326ffcc: Allow line comments ending with escaped NL to be continued to the next line. [not found] ` <E1aDaDr-0001xo-1I@vcs.savannah.gnu.org> @ 2015-12-28 16:14 ` Stefan Monnier 2015-12-28 16:41 ` Paul Eggert 2015-12-28 19:21 ` Alan Mackenzie 0 siblings, 2 replies; 4+ messages in thread From: Stefan Monnier @ 2015-12-28 16:14 UTC (permalink / raw) To: emacs-devel; +Cc: Alan Mackenzie > - /* Ignore escaped characters, except comment-enders. */ > - if (code != Sendcomment && char_quoted (from, from_byte)) > + /* Ignore escaped characters, except comment-enders which cannot > + be escaped. */ > + if ((Vcomment_end_can_be_escaped || code != Sendcomment) > + && char_quoted (from, from_byte)) [...] > if (code == Sendcomment > && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style > && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ? > - (nesting > 0 && --nesting == 0) : nesting < 0)) > + (nesting > 0 && --nesting == 0) : nesting < 0) > + && !(Vcomment_end_can_be_escaped && char_quoted (from, from_byte))) Hmm... the way I read this, it would mean that /*blabla\*/ will be treated as an unclosed comment. Is that the way C defines it as well? Stefan ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] emacs-25 326ffcc: Allow line comments ending with escaped NL to be continued to the next line. 2015-12-28 16:14 ` [Emacs-diffs] emacs-25 326ffcc: Allow line comments ending with escaped NL to be continued to the next line Stefan Monnier @ 2015-12-28 16:41 ` Paul Eggert 2015-12-28 19:25 ` Alan Mackenzie 2015-12-28 19:21 ` Alan Mackenzie 1 sibling, 1 reply; 4+ messages in thread From: Paul Eggert @ 2015-12-28 16:41 UTC (permalink / raw) To: Stefan Monnier, emacs-devel; +Cc: Alan Mackenzie Stefan Monnier wrote: > Hmm... the way I read this, it would mean that > > /*blabla\*/ > > will be treated as an unclosed comment. Is that the way C defines it as well? No, that's a closed comment. More interestingly, this: /\ \ *blabla*\ \ / printf ("\ \\ n\ "); is a closed comment followed by printf ("\n"), because backslash-newline removal is done before tokenization. So the "right" fix would be to ignore backslash-newline before identifying comments and other tokens. Backslash-backslash-newline can be tricky, as I recall from long ago when I was hacking on the GNU C preprocessor. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] emacs-25 326ffcc: Allow line comments ending with escaped NL to be continued to the next line. 2015-12-28 16:41 ` Paul Eggert @ 2015-12-28 19:25 ` Alan Mackenzie 0 siblings, 0 replies; 4+ messages in thread From: Alan Mackenzie @ 2015-12-28 19:25 UTC (permalink / raw) To: Paul Eggert; +Cc: Stefan Monnier, emacs-devel Hello, Paul. On Mon, Dec 28, 2015 at 08:41:23AM -0800, Paul Eggert wrote: > Stefan Monnier wrote: > > Hmm... the way I read this, it would mean that > > > > /*blabla\*/ > > > > will be treated as an unclosed comment. Is that the way C defines it as well? > No, that's a closed comment. More interestingly, this: > /\ > \ > *blabla*\ > \ > / > printf ("\ > \\ > n\ > "); > is a closed comment followed by printf ("\n"), because backslash-newline removal > is done before tokenization. So the "right" fix would be to ignore > backslash-newline before identifying comments and other tokens. In general, that's probably more hassle than it's worth. But I don't think it would be too difficult to remove escaped newlines from comments. I'll see what I can manage. > Backslash-backslash-newline can be tricky, as I recall from long ago when I was > hacking on the GNU C preprocessor. Yes. -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] emacs-25 326ffcc: Allow line comments ending with escaped NL to be continued to the next line. 2015-12-28 16:14 ` [Emacs-diffs] emacs-25 326ffcc: Allow line comments ending with escaped NL to be continued to the next line Stefan Monnier 2015-12-28 16:41 ` Paul Eggert @ 2015-12-28 19:21 ` Alan Mackenzie 1 sibling, 0 replies; 4+ messages in thread From: Alan Mackenzie @ 2015-12-28 19:21 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel Hello, Stefan. On Mon, Dec 28, 2015 at 11:14:36AM -0500, Stefan Monnier wrote: > > - /* Ignore escaped characters, except comment-enders. */ > > - if (code != Sendcomment && char_quoted (from, from_byte)) > > + /* Ignore escaped characters, except comment-enders which cannot > > + be escaped. */ > > + if ((Vcomment_end_can_be_escaped || code != Sendcomment) > > + && char_quoted (from, from_byte)) > [...] > > if (code == Sendcomment > > && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style > > && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ? > > - (nesting > 0 && --nesting == 0) : nesting < 0)) > > + (nesting > 0 && --nesting == 0) : nesting < 0) > > + && !(Vcomment_end_can_be_escaped && char_quoted (from, from_byte))) > Hmm... the way I read this, it would mean that > /*blabla\*/ ^ | > will be treated as an unclosed comment. Is that the way C defines it as well? I've tried it, it's not the case. The indicated * doesn't have Sendcomment syntax, so the if statement doesn't trigger. > Stefan -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-12-28 19:25 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20151228160034.7510.58055@vcs.savannah.gnu.org> [not found] ` <E1aDaDr-0001xo-1I@vcs.savannah.gnu.org> 2015-12-28 16:14 ` [Emacs-diffs] emacs-25 326ffcc: Allow line comments ending with escaped NL to be continued to the next line Stefan Monnier 2015-12-28 16:41 ` Paul Eggert 2015-12-28 19:25 ` Alan Mackenzie 2015-12-28 19:21 ` Alan Mackenzie
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.