半斤八两的程序员

.net默默无语的追随者.
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

发牢骚:语法高亮很复杂?

Posted on 2009-03-27 09:33  炸弹  阅读(229)  评论(0)    收藏  举报

本来想看看语法高亮是怎么做的,我当然也知道简单的说就是选区-上颜色-改字体,仅此而已,不过这几乎没有什么实际意义,我想做到接近vs里面的效果,于是开始搜,第一个目标就是SharpDevelop,开源的c#编辑器,很好很强大,拖完源码打开一看,我就傻眼了,54个项目囧,我只能找到大致的位置,可层次太多,一头雾水,放弃。开始用google搜,中文的一个都没找到,英文的倒是找到一个

http://69.10.233.10/KB/miscctrl/FixingTheCode.aspx

不过作者下面这句话让我掉进了冰窟窿

I discovered that HighLighting is not easy. A simple wordlist might be, but when several 'rules' come into play: order is important. Paying attention to the order where in you define (and therefore execute) your rules will help a lot, but it is likely you still end up with conflicting rules.

作者还把关键字加重了

于是决定不靠别人了,自己想逻辑。

風之谷