bugGNU nano - Bugs: bug #30962, incorrect syntax highlighting for...


bug #30962: incorrect syntax highlighting for C/C++

Submitted by:  Danil Ilinykh <woodroof>
Submitted on:  Sat Sep 4 05:01:54 2010  
Severity: 3 - NormalStatus: Wont Fix
Assigned to: NoneOpen/Closed: Closed

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Sat Mar 7 21:35:22 2015, comment #5:

Added a note to the docs about the inherent imperfection of regular expressions in revision 5129. (Unfortunately Savannah doesn't know CANTFIX...)

Benno Schulenberg <bens>
Project Administrator
Tue Feb 17 23:49:24 2015, comment #4:

unfortunately, because nano uses regular expressions to colorize, there's really not a lot we can do here. you need a full language parser in order to get these edge cases right.

so maybe we update the docs with info on these limitations and close the bug as CANTFIX.

Mike Frysinger <vapier>
Project Member
Mon Feb 24 11:10:41 2014, comment #3:

No, it isn't fixed. Try this, for example:

some_function(param1, "/some/words/*",
param2, param3);
/* Some comment. */

This is due to the simple way nano colours things: it doesn't see that the first "/*" is within a string and therefore cannot be a comment starter.

You can avoid this particular case by demanding that any comment starts with a space. For example in the c.nanorc file:

color brightblue start="/\* " end=" \*/"

Benno Schulenberg <bens>
Project Administrator
Sat Oct 19 17:40:40 2013, comment #2:

You get this also in PHP. (everything from the /* inside the $accept string to the */ before "lala" is highlighted as a multiple line comment. (GNU nano version 2.2.6 (compiled 20:32:12, Dec 3 2010)) Ubuntu 12.04



Wed Dec 22 11:52:13 2010, comment #1:

Looks like it works fine in 2.2.4

Original bug was for nano in Ubuntu 10.04.

Danil Ilinykh <woodroof>
Sat Sep 4 05:01:54 2010, original submission:

some_function(param1, "/some/words/*",
param2, param3); <-- this line is highlighting as a comment

Danil Ilinykh <woodroof>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by vapier (Posted a comment)
  • -unavailable- added by vapier
  • -unavailable- added by bens (Posted a comment)
  • -unavailable- added by woodroof (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri Apr 24 09:13:49 2015bensStatusConfirmed=>Wont Fix
      SummaryIncorrect syntax highlighting for c/c++=>incorrect syntax highlighting for C/C++
    Sat Mar 7 21:35:22 2015bensStatusNone=>Confirmed
    Tue Feb 17 23:49:24 2015vapierCarbon-Copy-=>Added vapier
    Mon Feb 24 11:10:41 2014bensSummaryIncorrect syntax highlighting for c++=>Incorrect syntax highlighting for c/c++

    Back to the top

    Powered by Savane 3.1-cleanup1