使用语法突出显示

发布于 2024-11-02 00:53:02 字数 343 浏览 1 评论 0原文


我正在尝试为 iOS 编写一个 IDE,但偶然发现了一个问题。我当然希望能够进行语法突出显示,但我不知道如何让它发挥作用。

我已经在谷歌上搜索了一个多月了,但没有找到任何有用的东西。大多数库都是 C++ 的。我觉得没问题,我对 C++ 有足够的了解,但它们都使用 Boost 库,我严重怀疑是否可以轻松地将它们安装在越狱的 iOS 设备上,甚至在 Mac 上为 iOS 编译它们。

所以我来这里寻求帮助。我应该怎么办?我应该使用 PHP 语法荧光笔吗?它总是为整个文档着色?我应该自己编写一个不使用 Boost 库的语法荧光笔吗?或者这里有人知道另一个可以在 iOS 上使用的库吗?

预先感谢您,
IEF2

I'm trying to write an IDE for the iOS and I stumbled on a problem. I of course wanted to be able to do syntax highlighting, but I have no idea how I have to get this to work.

I have been googling over a month now, but I haven't found anything useful. Most libraries are C++. That I find no problem, I know enough of C++, but they all use the Boost libraries and I heavily doubt if it's easy to install them on a jailbroken iOS device, or even compile them for the iOS on the Mac.

So I come here for help. What should I do? Should I use a PHP syntax highlighter, which always colors the whole document? Should I write a syntax highlighter my self, that doesn't use the Boost library? Or does somebody here know another library, which can be used on the iOS?

Thank you in advance,
ief2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

李白 2024-11-09 00:53:02

我有一个关于语法突出显示的类似问题,但我更喜欢使用 UIWebview 解决它而不是使用核心文本,因为这是在核心文本和 UITextview 中渲染文本的不同像素(在我的问题中,我使用的是核心文本视图,该视图覆盖uitextview),然后我尝试使用 uiwebview 来解决,即使我仍在开发中,但我可以说使用 uiwebview 比核心文本更好,也许你可以看一下这个链接 http://alexgorbatchev.com/SyntaxHighlighter/ 它是一个开源代码,但它使用 javascript 开发。

i have a simillar problem about syntax highlighting, but i prefer to solved it using UIWebview than using core text, because that is a different pixel in rendering text in core text and UITextview (in my problem i was using a core text view that cover by uitextview), and then i try to solved using uiwebview, even i'm still on developing but i can say that it is better using uiwebview than core text, maybe you can take a look at this link http://alexgorbatchev.com/SyntaxHighlighter/ it is an open source code, but it develop using javascript.

喜你已久 2024-11-09 00:53:02

大多数 Boost 库都是纯头文件。只有少数 Boost 库(例如用于线程和异步 I/O 的库)使用编译库。如果您找到了一些可以正常工作的解决方案,并且不用担心使用 Boost,那么我会再次查看它们,因为它们很可能会起作用。即使您必须使用非标头的 Boost 库,您也始终可以将其构建为静态库并将其链接到您的应用程序中,以便最终需要安装的只是您的应用程序包。

Most Boost libraries are header-only. There are only a few Boost libraries, like those for threading and asynchronous I/O, that use a compiled library. If you've found some solutions that would work fine aside from your worries about using Boost, then I would look at them again, as they'll likely work. Even if you must use a Boost library that is not header-only, you can always build it as a static library and link that into your application, so that in the end the only thing that needs to be installed is just your app bundle.

坏尐絯 2024-11-09 00:53:02

我知道这已经过时了,但如果有人正在寻找 iOS 的完整语法荧光笔,有两个选择:

  • Highlightr:一个用于语法高亮的 Swift 库,支持数百种语言,但使用 JS 作为后端。不过,它对于实时编辑来说已经足够快了。 (免责声明:我是这个库的创建者)。

  • SyntaxKit:开发早期阶段的本机解决方案。将来应该支持任何 TextMate 语法。

I know this is old, but in case anybody is looking for a complete syntax highlighter for iOS, there's two options:

  • Highlightr: A Swift library for syntax highlighting, supports hundreds of languages but uses JS as backend. It's fast enough for live editing, though. (Disclaimer: I am the creator of this library).

  • SyntaxKit: A native solution on early stages of development. Should support any TextMate syntax in the future.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文