bugGNU nano - Bugs: bug #66205, incorrect C syntax highlighting...

 
 

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

bug #66205: incorrect C syntax highlighting for /* inside a string

Submitter:  stefan11111 <stefan11111>
Submitted:  Wed 11 Sep 2024 07:55:13 PM UTC
   
 
Severity:  3 - Normal Status:  Cantfix
Assigned to:  None Open/Closed:  Open

Sat 14 Sep 2024 10:28:56 AM UTC, comment #2: 

This issue is a duplicate of bug #50355.

A related issue is bug #49945: `/*` after `//` incorrectly switching on multiline comment coloring.  For example:

//  This /* should not start comment coloring,
    but it does. */

Nano's colorizing regexes are simply not powerful enough to express that `/*` in a string or after `//` should not start comment coloring.  Can't be helped.

Benno Schulenberg <bens>
Group administrator
Fri 13 Sep 2024 09:00:58 AM UTC, comment #1: 

Surprisingly, other simple editors like `le` and `ne` colorize your example file correctly.  If you can tell me how they do it, while just using simple regexes, then I can implement it in nano too.

Benno Schulenberg <bens>
Group administrator
Wed 11 Sep 2024 07:55:13 PM UTC, original submission:  

first opened here: https://bugs.gentoo.org/show_bug.cgi?id=939479

When opening a .c file in nano, /* and */ get treated as comment markers, even in string literals.

For example, when opening this as a .c file:

char *x = "/*"; char *y = "*/";

#include <stdio.h>

int main()
{
    printf("%s %s\n", x, y);
}


The syntax highlighter treats everything between the /* and the */ as a comment,
even though this is incorrect.

stefan11111 <stefan11111>

 

(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)
  • -email is unavailable- added by stefan11111 (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-09-14 bens StatusNeed info Cantfix
        Summaryincorrect C syntax highlighting incorrect C syntax highlighting for /* inside a string
    2024-09-13 bens StatusNone Need info

    Back to the top

    Powered by Savane 3.13-4b4b.
    Corresponding source code