- NSIS Discussion
- C-style comment problem
Archive: C-style comment problem
iceman_k
12th October 2005 00:23 UTC
C-style comment problem
Not sure if this has been reported before.
I found that putting a complete C-style comment in a line skips everything preceding the comment in the line.
This doesn't seem to be intuitively correct.
See the attached script for an example.
kichik
12th October 2005 12:27 UTC
Do you want to take a shot at it?
iceman_k
12th October 2005 12:44 UTC
I can try.
IMHO what should be done is that any tokens after the comment should be added to tokens before the comment.
e.g.,
MessageBox MB_OK /* comment */ "Hello"
should effectively become
MessageBox MB_OK "Hello"
Let me see if I can put together a patch.
iceman_k
12th October 2005 15:34 UTC
I have submitted a patch for this.
I have tested it on a few scripts and it seems to be working OK. Give it a whirl and see if it is acceptable.
Joel
12th October 2005 16:57 UTC
What about C++'s //? :)
iceman_k
12th October 2005 17:02 UTC
Not part of the NSIS spec, sorry. :D
kichik
15th October 2005 14:53 UTC
Are you going to commit the first patch?
iceman_k
15th October 2005 16:22 UTC
Sure, if you want me to.
I thought you might want to test it before I commit it.
kichik
15th October 2005 16:29 UTC
Take a look at the bug tracker, I've replied there.
iceman_k
15th October 2005 17:14 UTC
I have a question for you in the bug tracker- please take a look.
kichik
15th October 2005 17:25 UTC
You should get an e-mail for each change to the item in the tracker. If you don't, hit the monitor button again and make sure the e-mail address you gave SourceForge is working.
iceman_k
15th October 2005 18:36 UTC
I usually do get emails. Your first reply to the patch wasn't emailed to me. Since then all replies have been emailed to me.
JasonFriday13
18th October 2005 00:49 UTC
I was also wondering if you could put in // to comment a line.
It gets a little annoying when you swap from a C\C++ IDE to nsis script and forget that nsis dosen't support //.
iceman_k
18th October 2005 01:32 UTC
I suppose you could always create a feature request. But I don't think it will be a very high priority.
Anders
21st November 2005 20:30 UTC
I was just playing around and I think I found a bug (unless I did someting stupid)
The compiler is executing the code inside my /**/ comment
It only seems to happen with include files
kichik
24th November 2005 20:14 UTC
This is not related to this patch. The preprocessor comes before the comment handling, so !ifdef will always be handled. That's why your code is invalid. !ifdef doesn't have enough parameters.
Anders
25th November 2005 10:36 UTC
yeah, i know its missing a parameter, but it seems wrong to me that a comment only comments out real commands, IMHO the comments must be parsed out first
kichik
25th November 2005 11:53 UTC
Ignore my last comment. Multiple line comments should be treated inside ifdef'ed blocks, just like normal comments. I've fixed this and add a test case to make sure it doesn't come back.
Here's a stripped down version of the script showing the problem:
!ifdef some_define_that_doesnt_exist
/*
!ifdef
*/
!endif
iceman_k
25th November 2005 12:53 UTC
Yeah, I always wondered why !ifdef processing worked the way it did.
I did run into the same problem as Anders but I assumed that preprocessor commands trumped comments.