bugGNU nano - Bugs: bug #50355, "/*" inside a string is...

 
 

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

bug #50355: "/*" inside a string is treated as start of comment block

Submitter:  None
Submitted:  Sun 19 Feb 2017 06:57:04 PM UTC
   
 
Severity:  2 - Minor Status:  Wont Fix
Assigned to:  None Open/Closed:  Closed

Tue 21 Feb 2017 12:46:58 PM UTC, comment #1: 

Sorry, can't be helped.  Nano applies the color regexes one after the other, to the whole text of the file.  So either strings inside comments would get colored as strings, or comments inside strings get colored as comments.  The latter case seems to occur the least frequently (it does not occur in nano's source, whereas the former occurs some fifty times), so that is why the order is as it is.  If you don't mind strings inside comments standing out, you could swap the order of the regexes in c.nanorc and javascript.nanorc.

Maybe someday the coloring code will be retwritten to understand that some things are strings and that there contents should not be interpreted in any way.  But that is a long way off.

Benno Schulenberg <bens>
Group administrator
Sun 19 Feb 2017 06:57:04 PM UTC, original submission:  

When opening the following minimal example in nano (representing a string containing "/*", followed by an empty comment block), it is highlighted incorrectly, as if the comment block began in the middle of the string.

The minimal example is `"/*"/**/` (not including the backticks), and triggers incorrect behaviour when treated as C or JavaScript syntax.

A related issue happens with line comments, as in the example `"//"` (a string containing two slash characters).

Anonymous

 

(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 bens (Posted a comment)
  •  

    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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-02-24 bens Severity3 - Normal 2 - Minor
        Open/ClosedOpen Closed
    2017-02-21 bens StatusNone Wont Fix
        Summary&quot;/*&quot; in string is treated as comment block "/*" inside a string is treated as start of comment block

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code