bugGNU nano - Bugs: bug #56713, in Perl files, the character after...

 
 

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

bug #56713: in Perl files, the character after a variable gets colored too

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Sun 04 Aug 2019 10:25:00 AM UTC  
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  Benno Schulenberg <bens> Open/Closed:  Closed

Tue 22 Dec 2020 03:59:06 PM UTC, comment #5: 

Please don't post to closed issues.  If there is any problem in current nano or syntax files, please report a new bug.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sat 19 Dec 2020 04:53:21 PM UTC, comment #4: 

Same goes for php...

Peter Passchier <pepa65>
Wed 14 Aug 2019 07:28:38 AM UTC, comment #3: 

Fixed in git, commit cd274a78.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sun 04 Aug 2019 11:42:23 AM UTC, comment #2: 

The Perl syntax was contributed by Richard Smith in early 2003 [1] and improved by David Benbennick in the follow-up message, and it was committed roughly three months later.

But half a year earlier, Chris himself posted a proposal for a Perl syntax [2], and there the regex for variable names is a straightforward regex, not a start/end pair:

  color brightcyan ... "\<[A-Z_]{2,}\>"

And in subsequent messages the regex gets improved to:

  "[$@]\<([A-Za-z0-9_])+\>"

So I think we can assume that my proposed correction of the current Perl syntax file is indeed correct.

[1] https://lists.gnu.org/archive/html/nano-devel/2003-02/msg00116.html
[2] https://lists.gnu.org/archive/html/nano-devel/2002-09/msg00053.html

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sun 04 Aug 2019 10:55:11 AM UTC, comment #1: 

Attached patch fixes the issue.

(The buglet was noticed while looking at a Perl script bundled with e2fsprogs.)

(file #47296)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sun 04 Aug 2019 10:25:00 AM UTC, original submission:  

To reproduce, be sure that your ~/.nanorc includes the perl.nanorc file, then run:

  nano --line +18 /usr/share/doc/git/contrib/buildsystems/engine.pl

See that the semicolon after $out_dir is colored too, whereas the semicolon above it is not.  See that two lines above, the commas after the variable names are colored too, and the closing parenthesis too.  See also the closing parenthesis on line 28.

This is not right.  Vim and Emacs don't do this, they keep the character after a variable name uncolored.

I don't know Perl, but it would surprise me if variable names could span a line break, so I don't understand why these names are colored with a start and end regex pair:

  icolor cyan start="[$@%]" end="( |[^0-9A-Z_]|-)"

I think this should simply be:

  icolor cyan "[$@%][0-9A-Z_]+"

Or still better:

  color cyan "[$@%][0-9A-Za-z_]+"

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

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-12-22 bens Discussion LockUnlocked => Locked
    2019-08-26 bens Open/ClosedOpen => Closed
    2019-08-14 bens StatusIn Progress => Fixed
    2019-08-04 bens Attached File- => Added 0001-syntax-perl-don-t-color-the-character-after-a-variab.patch, #47296
        StatusNone => In Progress

    Back to the top


    Powered by Savane 3.6