views:

669

answers:

4

I'm planning to do a Cocoa app that requires code syntax to be colored (in all common languages). Instead of writing my own code highlighter/parser, are there any pre-made solutions available?

Thanks

A: 

You can use highlight that is used in QLColorCode :) (however, it's not a Framework that you include in your code, but a command-line utility)

EDIT: Ah yeah, use Geshi, it's probably better :D

naixn
This is an application that syntax-highlights code. The questioner wants to make the application he or she is writing highlight code.
Dominic Cooney
+8  A: 

You might be able to use something like Geshi, but there're also the resources listed here: http://www.cocoadev.com/index.pl?SyntaxHighlighting

Edit

More links:

Dave DeLong
Geshi is written in PHP. It would be tedious to integrate into a Cocoa app. Drilling through your second link; this is relevant: http://www.cocoadev.com/index.pl?ImplementSyntaxHighlighting
Dominic Cooney
Good links, will check them out
macatomy
+1  A: 

You can also use the JavaScript library SyntaxHighlighter and embed it into a WebView into your app.

MrMage
If I can get this working in a webview, that would work brilliantly :D
macatomy
+3  A: 

An excellent solution is Uli Kusterer's UKSyntaxColoredTextDocument. It is fast and has several built-in syntax parsers. It's easy to add new languages.

It's free for non-commercial use and very cheap if you want it for a commercial app.

Rob Keniger
Wow can't believe I didnt find this before. Thanks a ton.
macatomy