bugGNU nano - Bugs: bug #41313, too greedy Python docstring...

 
 

bug #41313: too greedy Python docstring highlighting

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Wed 22 Jan 2014 08:44:44 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: Benno Schulenberg <bens>
Open/Closed: OpenRelease: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Wed 26 Feb 2014 01:10:30 PM UTC, comment #2:

Currently the regexes for triple-quoted strings are like this:

color brightgreen start="\"\"\"[^"]" end="\"\"\""
color brightgreen start="\'\'\'[^']" end="\'\'\'"

I suggest to change them to this:

color brightgreen start="\"\"\"[^"),]" end="[^(]?\"\"\""
color brightgreen start="\'\'\'[^'),]" end="[^(]?\'\'\'"

This improves the colouring (reduces spillover) in one case: passing multiline strings as function arguments.

Benno Schulenberg <bens>
Project MemberIn charge of this item.
Tue 25 Feb 2014 02:23:04 AM UTC, comment #1:

This can never be implemented properly with nano's current syntax highlighting engine. I've written nanorc files for a few dozen languages already, and this was the only case where I concluded that no highlighting at all was better than a workaround. Not to be dismissive of nano, but the real fix is to use an editor that does full lexical analysis instead of regex matching.

Anonymous
Wed 22 Jan 2014 08:44:44 PM UTC, original submission:

When a Python file contains at least two docstrings, things
after the first docstring and before the last docstring which
are on the same line as any docstrings itself get coloured
mistakenly as brightgreen too.

Then deleting any line (^K) in the file between any pair of docstrings, causes all the text between the first and last docstrings to be coloured brightgreen.

See attached example file -- which does not contain actually
docstrings, but short strings to show the problem clearly.

(This was also reported as bug #34323, probably, because I
can't see the screenshots.)

Benno Schulenberg <bens>
Project MemberIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #30350:  whoops.py added by bens (167B - text/x-python - example file that shows too greedy string colouring)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bens (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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 26 Feb 2014 01:10:30 PM UTCbensAssigned toNone=>bens
    Wed 22 Jan 2014 08:44:44 PM UTCbensAttached File-=>Added whoops.py, #30350

    Back to the top


    Powered by Savane 3.1-cleanup