rouge-ruby / rouge

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

Some sed code take very long time to be highlighted #2057

Open mikecat opened 1 week ago

mikecat commented 1 week ago

Name of the lexer

sed

Code sample

:tthousand
s/d\(.*\)0\(...\)$/\11\2/
s/d\(.*\)1\(...\)$/\12\2/
s/d\(.*\)2\(...\)$/\13\2/
s/d\(.*\)3\(...\)$/\14\2/
tthousand

Additional context

When I tried this code on Rouge, it took about 7 seconds to be highlighted.

Adding more s/d\(.*\)3\(...\)$/\14\2/ lines look making it take much more time. (I added one more line and did't get response in several minutes)