ColorHighlighter icon indicating copy to clipboard operation
ColorHighlighter copied to clipboard

re module: number of named groups is limited to 100

Open sspkmnd opened this issue 10 years ago • 1 comments

Hi!

I've forked ColorHighlighter to implement highlighting for SAS Colors formats but faced the next problem. I add new formats into ColorHighlighter.sublime-settings and did some changes in ColorHighlighter.py and all should work fine but ColorHighlighter.py raises the error during compiling regex: AssertionError: sorry, but this version only supports 100 named groups. As I found out the problem because of a huge amount of named groups which was increased when I added formats and it exceeded the standard threshold of 100 in re module. I googled this problem and someone recomends to use regex lib and it could be imported in that way to save already written code. I tried to include that module into sublime's internal python but failed because of my weak experience in python. Also, I've found related issue on python issue tracker and it contains the patch which removes the limit of 100.

Hopes you will consider this feature of the re module in next versions of the plugin. Kind regards

sspkmnd avatar Sep 30 '15 23:09 sspkmnd

This would be nice of course, but I don't think anyone can modify the python source code inside sublime. Also, you cannot add you own modules into the import path. However, you can just copy the source code for the library and put it locally and just use it. So, it really doesn't matter, whether you modify the re library and put it locally or copy regex library and put it locally. The only thing to consider here is performance. So I suppose that you can easily do it yourself now. If not, I'll try to find some time to do that.

Monnoroch avatar Oct 01 '15 08:10 Monnoroch