Hacker News new | past | comments | ask | show | jobs | submit login

I would love to see a javascript highliter that consumes TextMate syntax definitions.



That's actually how I started this project! I started working on making a syntax highlighter that could pull in TextMate tmLanguage files, but then I ran into a lot of issues and decided to spin it off into this :)

That is why the syntax in Rainbow is pretty similar.

The main problem had to do with Javascript regex not fully supporting everything that most languages support such as negative/positive lookbehinds and (.*)


The problems I see are:

1. TM syntaxes are complicated. There's lots of undocumented features that bundles find ways to use in crucial places.

2. TM is slow. You don't see this so much because it's written in C++ and there's many clever optimizations (see point 1). But it's difficult to get around the fact that a syntax is hundreds of regexes that have to be run over the whole document in a pathologically slow manner. I hate to think what it would be like in JS.

3. Many TM language definitions are dependent on features of the Oniguruma regex engine, which is strictly more powerful than any JS one. So you basically have to compile Oniguruma (no mean feat) ...with emscripten.


This is very unfortunate, I'm never satisfied with syntax highliting and color schemes except in Sublime/TextMate. I've found it to support much more unique bits of grammar in code than vim's syntax highliting and there are tons of great themes available for it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: