bugGNU nano - Bugs: bug #49945, syntax coloring of C files does...

 
 

bug #49945: syntax coloring of C files does not show that // annuls /*

Submitted by:  None
Submitted on:  Wed 28 Dec 2016 03:07:06 PM UTC  
 
Severity: 2 - MinorStatus: Wont Fix
Assigned to: Benno Schulenberg <bens>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 24 Feb 2017 11:40:04 AM UTC, comment #3:

Can't fix, thus closing. Thanks for reporting anyway.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Fri 30 Dec 2016 10:17:56 AM UTC, comment #2:

The 'start="(^|[^/])/\*"' is a small improvement,
but it only covers the case of '//*', not the case
of '// /*', for example. Also, above regex would
color the charater that is immediately before the
'/*'. Mostly this will be whitespace, but if it
is a semicolon...

So, in fact I'm not going to change this. The power of regexes is limited; can't be helped.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Wed 28 Dec 2016 04:40:41 PM UTC, comment #1:

Good point. Thanks!

I would shorten it to this, though:

color brightblue start="(^|[^/])/\" end="\/"

Can I add a Suggested-by tag with your name on it? Or do you prefer to stay nameless? :) Or maybe you want to produce a full signed-off patch yourself?

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Wed 28 Dec 2016 03:07:06 PM UTC, original submission:

This is a suggestion about the use of comments in c and c++ of type /* ... */.

In c and c++ a double "//" annuls this type of comments. Something like this is not a comment in gcc:
//*
...
valid code
...
//*/

while this is a comment:
/*
...
comment
...
//*/

This behaviour is not produced by the line in c.nanorc, which colours both cases:
color brightblue start="/\" end="\/"

I rather use this:
color brightblue start="([^/]/\|^/\)" end="\*/"

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

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

    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 Feb 2017 11:40:04 AM UTCbensOpen/ClosedOpen=>Closed
      Summarybehaviour of comments of type /* ... */ in c and c++ files, after c.nanorc=>syntax coloring of C files does not show that // annuls /*
    Fri 30 Dec 2016 10:17:56 AM UTCbensSeverity3 - Normal=>2 - Minor
      StatusIn Progress=>Wont Fix
    Wed 28 Dec 2016 04:40:41 PM UTCbensStatusNone=>In Progress
      Assigned toNone=>bens

    Back to the top


    Powered by Savane 3.1-cleanup1