rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.33k stars 735 forks source link

Double loads, regex warnings, and cleanup, oh my! #1961

Open zenspider opened 1 year ago

zenspider commented 1 year ago

Hi hi hi... I'm poking at switching over to rogue and when ruby warnings are on (via ruby -w or $-w = true, or just plain rake spec w/ the right config), the project SPEWS. 331 lines worth to be clear...

Some (lots) of the output is ruby warning about duplicate regexp ranges and has pointed out a number of buggy regexps... not just duplicate ranges, but regexps that can't actually work right.

I'd like to clean it up (mostly done). Y'all interested?

zenspider commented 1 year ago

eg https://github.com/rouge-ruby/rouge/blob/master/lib/rouge/lexers/ada.rb#L158

zenspider commented 1 year ago

Down to the following:

lib/rouge/lexers/julia.rb:255: warning: character class has duplicated range: /[\p{L}\p{Nl}\p{S}_][\p{Word}\p{S}\p{Po}!]*/

which might be smarter than me

zenspider commented 1 year ago

I'm not alone here: https://www.reddit.com/r/ruby/comments/12sshf1/doesnt_anybody_use_w/