bugGNU nano - Bugs: bug #58424, the Go syntax doesn't highlight...

 
 

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

bug #58424: the Go syntax doesn't highlight "chan"

Submitter:  Ryan Westlund <yujiri>
Submitted:  Thu 21 May 2020 03:22:14 PM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Jump to the original submission

Thu 30 Jul 2020 07:13:41 AM UTC, comment #6: 

Released in nano-5.0.

Benno Schulenberg <bens>
Group administrator
Tue 26 May 2020 02:58:17 PM UTC, comment #5: 

Thanks.  Applied to master, commit 3480518a, with a tweaked commit message.

(For a reminder on creating patches, see the git commands in the last section of README.GIT: "Contributing something".)

Benno Schulenberg <bens>
Group administrator
Mon 25 May 2020 02:12:17 PM UTC, comment #4: 

Ah. I'm still a bit confused by these patch-related git commands since I don't use them often. I'm attaching a new file.

(file #49166)

Ryan Westlund <yujiri>
Mon 25 May 2020 10:18:20 AM UTC, comment #3: 

Thanks for the patch.  However, please provide it as a proper git patch, with a commit message and a signed-off-by line.  Also, I would keep the "chan" by itself in the original regex, and only add a separate regex for the chan plus the "arrows".

Benno Schulenberg <bens>
Group administrator
Sun 24 May 2020 09:25:59 PM UTC, comment #2: 

I believe the relevant documentation is here: https://golang.org/ref/spec#Channel_types

I figured out a regex that matches the chan keyword properly (including coloring the optional <-/->). It required breaking chan out of the rule for simpler keywords and giving it a rule of its own.

While I was at it, I also noticed that the rule for the special +build comment would never take effect because it appeared before the rule for normal comments. I moved it to after.

I'm attaching a patch that includes both changes.


(file #49163)

Ryan Westlund <yujiri>
Thu 21 May 2020 05:54:50 PM UTC, comment #1: 

Indeed, there is obviously something wrong with the regex that contains "chan": "\<<" and similar will never match.  If you wish, please provide a patch that fixes this.

Also, can you post a URL to some official Go documentation that treat the "chan" keyword?

Benno Schulenberg <bens>
Group administrator
Thu 21 May 2020 03:22:14 PM UTC, original submission:  

The go.nanorc file includes expressions for chan in the regex, but as far as I can tell, fails to ever color the word. I found that I could only get it to work by removing the \<...\> enclosing. My understanding is that that enclosing matches things as words, which prevents regexes involving <- and -> from being matched?

Also, the word 'chan' is valid without the <- or -> operators in Go, so I think those should be optional parts of the regex.

Ryan Westlund <yujiri>

 

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

Attached Files
file #49163:  go.patch added by yujiri (1KiB - text/x-patch)

 

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 yujiri (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-30 bens Open/ClosedOpen Closed
    2020-05-26 bens StatusIn Progress Fixed
    2020-05-25 yujiri Attached File- Added 0001-Improve-go.nanorc.patch, #49166
    2020-05-25 bens StatusNone In Progress
        Assigned toNone bens
        Summarygo.nanorc doesn't highlight &quot;chan&quot; the Go syntax doesn't highlight "chan"
    2020-05-24 yujiri Attached File- Added go.patch, #49163
    2020-05-21 bens Severity3 - Normal 2 - Minor
        Summarygo.nanorc doesn't highlight chan go.nanorc doesn't highlight "chan"

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code