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 04 Sep 2010 05:01:54 AM UTC  
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Wont Fix
Privacy: PublicAssigned to: None
Open/Closed: ClosedRelease: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

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


Sat 07 Mar 2015 09:35:22 PM UTC, 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 Member
Tue 17 Feb 2015 11:49:24 PM UTC, 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>
Mon 24 Feb 2014 11:10:41 AM UTC, 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 Member
Sat 19 Oct 2013 05:40:40 PM UTC, 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 22 Dec 2010 11:52:13 AM UTC, comment #1:

Looks like it works fine in 2.2.4

Original bug was for nano in Ubuntu 10.04.

Danil Ilinykh <woodroof>
Sat 04 Sep 2010 05:01:54 AM UTC, 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 24 Apr 2015 09:13:49 AM UTCbensStatusConfirmed=>Wont Fix
      SummaryIncorrect syntax highlighting for c/c++=>incorrect syntax highlighting for C/C++
    Sat 07 Mar 2015 09:35:22 PM UTCbensStatusNone=>Confirmed
    Tue 17 Feb 2015 11:49:24 PM UTCvapierCarbon-Copy-=>Added vapier
    Mon 24 Feb 2014 11:10:41 AM UTCbensSummaryIncorrect syntax highlighting for c++=>Incorrect syntax highlighting for c/c++

    Back to the top

    Powered by Savane 3.1-cleanup