Bug 495349

Summary: Ruby encoding detection error with [/regexp/]
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: arksbadge <arksbadge1>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: christoph, walter.von.entferndt
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: This is not how it is supposed to look I think.

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