在Cocoa中实现源代码的语法高亮的最好方法是什么? [英] What is the best way to implement syntax highlighting of source code in Cocoa?

查看:121
本文介绍了在Cocoa中实现源代码的语法高亮的最好方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究Cocoa Application,它应该能够分析和突出用Objective-C,SQL,JavaScript,Python等语言编写的源代码。文本也应该是可编辑的(通过使用NSTextView,例如)。



请告知在Mac OS X 10.5中实施此功能的最佳方法。



是不需要支持自动完成和其他额外的功能。简单的格式化关键字,字符串,#includes和数字,但性能酷的只是一个好的。



此外,如果支持语言配置, p>

谢谢!

解决方案

在准备需要类似的项目时,我找到了以下(但未深入评估):




  • / Developer / Examples / OpenGL / Cocoa / GLSLEditorSample实现语法高亮

  • IDEKit 是一个开源框架提供编程器源代码编辑,包括语法着色,弹出函数和分割帧。这没有更新一段时间(它touts 10.2和10.3兼容性,并与一个Project Builder项目 - 可以转换与Xcode 2.5)。

  • UKSyntaxColoredTextDocument


I'm working on Cocoa Application that should be able to analyze and highlight a source code written in such languages as Objective-C, SQL, JavaScript, Python etc. The text should be editable too (by using NSTextView, for example).

Please advise what is the best way to implement such feature in Mac OS X 10.5.

There is no need to support auto-completion and other extra-features. Simple formatting by keywords, strings, #includes, and numbers but with cool performance is just OK.

Also, it would be great if configuration by languages were supported.

Thanks!

解决方案

In preparing a project that will require something similar, I’ve found the following (but not evaluated them in depth):

  • /Developer/Examples/OpenGL/Cocoa/GLSLEditorSample implements syntax highlighting.
  • IDEKit, "an open-source framework that provides programmer source code editing, including syntax coloring, popup functions, and split frames". This hasn’t been updated for a while (it touts 10.2 and 10.3 compatibility, and comes with a Project Builder project – can be converted with Xcode 2.5).
  • UKSyntaxColoredTextDocument.

这篇关于在Cocoa中实现源代码的语法高亮的最好方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆