Bug 495349 - Ruby encoding detection error with [/regexp/]
Summary: Ruby encoding detection error with [/regexp/]
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (other bugs)
Version First Reported In: unspecified
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-25 15:44 UTC by arksbadge
Modified: 2025-05-24 16:23 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
This is not how it is supposed to look I think. (8.01 KB, image/png)
2024-10-25 15:44 UTC, arksbadge
Details

Note You need to log in before you can comment on or make changes to this bug.
Description arksbadge 2024-10-25 15:44:04 UTC
Created attachment 175234 [details]
This is not how it is supposed to look I think.

SUMMARY
if you include a space between [ and /, it detects correctly, but the code works fine either way so [/regexp/] should also look fine and it doesn't.

STEPS TO REPRODUCE
1. Use kate
2. Edit rubyscript
3. Use Obj[/regexp/] (or just [//])

OBSERVED RESULT
incorrect highlighting

EXPECTED RESULT
correct highlighting

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  XFCE Arch, but it's unrelated to the bug
KDE Plasma Version:  6 is installed, but it's likely unrelated to the bug
KDE Frameworks Version: 5 and 6 is installed, but it's likely unrelated to the bug
Qt Version:  5 and 6 are installed, but it's likely unrelated to the bug.

ADDITIONAL INFORMATION
It's just a bug with rubyscript parsing afaik.
Comment 1 Bug Janitor Service 2025-05-21 00:18:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/703
Comment 2 Christoph Cullmann 2025-05-24 16:23:34 UTC
Git commit 82049fcfebdcc9e560149ff2cbe54448b3b284ea by Christoph Cullmann, on behalf of Jonathan Poelen.
Committed on 24/05/2025 at 16:19.
Pushed by cullmann into branch 'master'.

Ruby: fix %-string and regex in array

```rb
a = [/regex/]
a = [%(str)]
 #   ^ not an operator
```
Related: bug 495823

M  +2    -0    autotests/folding/highlight.rb.fold
M  +2    -0    autotests/html/highlight.rb.dark.html
M  +2    -0    autotests/html/highlight.rb.html
M  +2    -0    autotests/input/highlight.rb
M  +2    -0    autotests/reference/highlight.rb.ref
M  +3    -2    data/syntax/ruby.xml

https://invent.kde.org/frameworks/syntax-highlighting/-/commit/82049fcfebdcc9e560149ff2cbe54448b3b284ea