Author Topic: Lexer bug in macros  (Read 4001 times)

Offline carra

  • Multiple posting newcomer
  • *
  • Posts: 117
Lexer bug in macros
« on: July 11, 2012, 09:30:48 am »
I saw this lexer problem quite a bit ago, but I had forgotten to post it until now. As you may know, preprocessor macros admit embedded comments, very useful to clarify big multiline macros. Let's take this simple iterator macro as an example:

Code
#define ITER_C_STR( chars )  for( /* empty */; *(chars); (chars)++ )

If you view this macro in C::B editor, it will highlight it as a macro only up to the comment, and all the rest is colored as if it was normal code and not part of the macro. It seems to be only a lexer issue, since it will compile OK and the macro is even added to autocompletion list correctly.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Lexer bug in macros
« Reply #1 on: July 11, 2012, 09:53:35 am »
Confirmed on Linux + r8043...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Lexer bug in macros
« Reply #2 on: July 11, 2012, 10:11:19 am »
It seems to be only a lexer issue, since it will compile OK and the macro is even added to autocompletion list correctly.
Please try in SciTE (http://www.scintilla.org/SciTE.html) and if its the same there, file a bug report to the scintilla guys.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline carra

  • Multiple posting newcomer
  • *
  • Posts: 117
Re: Lexer bug in macros
« Reply #3 on: July 11, 2012, 10:44:54 am »
I tried with SciTE 3.20 and the bug is still there. There is a bug listed in scintilla about this (ID: 3487406). BUT, as you see here: http://sourceforge.net/tracker/index.php?func=detail&aid=3487406&group_id=2439&atid=102439

... they report it as already fixed ??
Well, it clearly isn't.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7600
    • My Best Post
Re: Lexer bug in macros
« Reply #4 on: July 11, 2012, 11:10:16 am »
I tried with SciTE 3.20 and the bug is still there. There is a bug listed in scintilla about this (ID: 3487406). BUT, as you see here: http://sourceforge.net/tracker/index.php?func=detail&aid=3487406&group_id=2439&atid=102439

... they report it as already fixed ??
Well, it clearly isn't.

The fix was committed on Date: 2012-06-25 00:25:59 PDT.

Likely you tested code written before that.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Lexer bug in macros
« Reply #5 on: July 11, 2012, 11:44:09 am »
... they report it as already fixed ??
It is, and if you compile C::B yourself, it will be there, too. Note what stahta01 said:
The fix was committed on Date: 2012-06-25 00:25:59 PDT.
Likely you tested code written before that.
SciTE 3.2.0 was released before that date. so most likely next SciTE will have this fixed, too (just as the next C::B nightly).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline carra

  • Multiple posting newcomer
  • *
  • Posts: 117
Re: Lexer bug in macros
« Reply #6 on: July 11, 2012, 12:00:04 pm »
SciTE 3.2.0 was released before that date. so most likely next SciTE will have this fixed, too (just as the next C::B nightly).
I see, so that was it. Well, in this case I have nothing left to complain here! :) I'll check this in next nightly (since I don't compile C::B)