GNU nano - Bugs: bug #55982, the regex for Ruby constants...
You are not allowed to post comments on this tracker with your current authentication level.
bug #55982: the regex for Ruby constants matches too many things
Submitter: | Rory Thrasher <thrasher> | ||
Submitted: | Fri 22 Mar 2019 10:39:24 PM UTC | ||
Severity: | 3 - Normal | Status: | Need Info |
Assigned to: | bens | Open/Closed: | Closed |
Jump to the original submission
Sun 09 Feb 2020 10:36:06 AM UTC, comment #17: |
Benno Schulenberg <bens> |
Tue 21 Jan 2020 06:11:40 PM UTC, comment #16: Ping... How is things with this? Is this still a problem on your machine? If yes, did you check (as suggested in the previous comment #15) how a self-compiled nano behaves? |
Benno Schulenberg <bens> |
Sun 27 Oct 2019 03:53:27 PM UTC, comment #15: On an inherited machine, I've run a Fedora 30 live image inside VirtualBox, have installed the nano package (version 4.2) and have dowloaded the global.rb file. But I don't see any miscolorings: "require" and other words that start with a lowercase letter are in the default color, strings are green, keywords like "module" and "class" are brown, and only the words that start with a capital are blue.
|
Benno Schulenberg <bens> |
Sat 18 May 2019 06:36:42 AM UTC, comment #14: Sorry for the delay on this. I haven't forgotten, just haven't gotten around to it yet. I'm hoping to try a live-usb next week.
|
Rory Thrasher <thrasher> |
Sun 21 Apr 2019 10:21:12 AM UTC, comment #13: Any news on this, Rory? Does it affect also a fresh Fedora install? |
Benno Schulenberg <bens> |
Sat 30 Mar 2019 09:51:18 AM UTC, comment #12: It must be some locale setting on your system. It's not really treating regexes case-insensitively, because if that were the case, [[:upper:]] wouldn't work either. (When in nano you search for, for example, "[[:upper:]]om", it finds also "some" and "command". You have to toggle case-sensitivity on to make it find only "Home" and such.)
|
Benno Schulenberg <bens> |
Fri 29 Mar 2019 08:57:42 PM UTC, comment #11: Yup. "zeep" is in blue.
|
Rory Thrasher <thrasher> |
Fri 29 Mar 2019 08:20:42 PM UTC, comment #10: Strange... For me, the en_US.UTF-8 locale does not cause regexes to become case insensitive.
|
Benno Schulenberg <bens> |
Tue 26 Mar 2019 07:51:50 PM UTC, comment #9: $ locale
|
Rory Thrasher <thrasher> |
Tue 26 Mar 2019 07:50:08 PM UTC, comment #8: To see your locale, please paste the full output of the 'locale' command. I'm guessing that you have a changed setting for LC_COLLATE, which makes that [A-Z] does not cover only uppercase letters but also lowercase ones (at least a-y, probably not z).
|
Benno Schulenberg <bens> |
Tue 26 Mar 2019 07:32:22 PM UTC, comment #7: Sorry, missed the second comment. It is only finding words that begin with "he". So I think that means word boundaries are working fine. |
Rory Thrasher <thrasher> |
Tue 26 Mar 2019 07:24:47 PM UTC, comment #6: Interesting. Changing to [[:upper:]] seems to work pretty well. It doesn't color global/instance variables that are lowercase (@args or @failed or @messages in global.rb) - but I assume that is what the oversight missed?
|
Rory Thrasher <thrasher> |
Tue 26 Mar 2019 06:21:57 PM UTC, comment #5: To exclude a problem with word boundaries, could you run:
|
Benno Schulenberg <bens> |
Tue 26 Mar 2019 06:15:08 PM UTC, comment #4: Looking at that global.rb file, for me all the words "require" have the normal color, the strings are green, and only the words that start with an uppercase letter (I18n, ActiveSupport, Inflector, and so on) are bright blue. It would seems that the regex functions on your system somehow use REG_ICASE by default.
|
Benno Schulenberg <bens> |
Mon 25 Mar 2019 09:05:00 PM UTC, comment #3: Hmmm. I guess I was focusing on class/instance/global variables. I'm not sure if that regex is also supposed to get generic class/instance/variables that are all lowercase (eg, @foo) or if it is only constants (that might also be class/instance/global - eg @BAR). Highlighting class/instance/global variables that aren't constants might also be nice if those aren't intended as part of this regex.
|
Rory Thrasher <thrasher> |
Mon 25 Mar 2019 04:35:34 PM UTC, comment #2: Hmm... I don't see how the color rule for Ruby constants could miscolor any of the reserved words (apart from "BEGIN" and "END"), because most of those reserved word are in all-lowercase, and constants must start with an uppercase letter, says the color rule. So... if you really see this miscoloring, please give me the URL of a Ruby file where you see it (because I have no Ruby files on my machine and zero knowledge of the language).
|
Benno Schulenberg <bens> |
Sun 24 Mar 2019 05:21:18 PM UTC, comment #1: On second though, `{1}` is redundant, isn't it? So...
|
Rory Thrasher <thrasher> |
Fri 22 Mar 2019 10:39:24 PM UTC, original submission:
The regex for ruby constants has an error where it matches almost every word, including reserved words and variables. It tries to match with things starting with $|@|@@, but it does it 0 or 1 times - which matches basically everything. This overwrites the reserved words that are defined right before this.
|
Rory Thrasher <thrasher> |
Depends on the following items: None found
Items that depend on this one: None found
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 7 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2020-02-09 | bens | Open/Closed | Open | Closed | |
2019-03-26 | bens | Severity | 2 - Minor | 3 - Normal | |
2019-03-25 | bens | Severity | 3 - Normal | 2 - Minor | |
Status | None | Need Info | |||
Assigned to | None | bens | |||
Summary | Ruby syntax highlighting regex for constants matches too many things | the regex for Ruby constants matches too many things | |||
2019-03-22 | thrasher | Attached File | - | Added patch, #46627 |
Powered by Savane 3.13-d3ae.
Corresponding source code
Closing due to a lack of information. When you have new info, please post it and I will reopen the issue.