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

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitter:  Danil Ilinykh <woodroof>
Submitted:  Sat 04 Sep 2010 05:01:54 AM UTC
   
 
Severity:  3 - Normal Status:  Wont Fix
Assigned to:  None Open/Closed:  Closed

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>
Group administrator
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>
Group Member
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>
Group administrator
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

<?php
$accept="text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
$somecode="lala";
...
...

/*
multiple
line
comments
*/
lala
?>

Anonymous
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.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-04-24 bens StatusConfirmed Wont Fix
        Open/ClosedOpen Closed
        SummaryIncorrect syntax highlighting for c/c++ incorrect syntax highlighting for C/C++
    2015-03-07 bens StatusNone Confirmed
    2015-02-17 vapier Carbon-Copy- Added vapier
    2014-02-24 bens SummaryIncorrect syntax highlighting for c++ Incorrect syntax highlighting for c/c++

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code