sourceInsight 阅读php源码

http://bbs.chinaunix.net/viewthread.php?tid=727747

引用

SourceInsight(以下简称SI)是非常强劲的代码阅读工具,安装后也就才3M大小,但在阅读别人的代码的时候实在是太方便了,尤其在查找类,函数的相关定义的时候。

SI标准内置的语言主要在c/c++/Java/C#等,但就是没有PHP。这次有个比较大的PHP的项目代码需要接手,用UE看了一段,里面的函数跳来跳去,实在是麻烦。后来g了以下,发现SI官方网站自己带了PHP的语言定义文件,按照网站上的说明,倒入,配置了以下。类,函数等关联操作都已经可以了,就是语法的高亮没有。基本上就只有几个流程控制if,else高亮显示,看起来累就一个字。

从SI的language中导出的PHP语言定义,发现只配置了很少的流程控制字为keyword,所以只有这些是高亮的。这下好办了,从UltraEdit的wordfile.txt中把php的高亮配置导出,做了一些处理,分成内置function,keyword,control,operator四类,写成一个新的文本,然后再倒入进语言定义。

接着在颜色style中配置了对这四类的颜色显示,一切就OK了。

为了方便大家,我把自己做好的PHP语言定义文件和style文件上传,方便大家使用。

使用方法:

==》》解压缩,里面有两个文件:PHPScript.CLF,PHP-Styles.CF3

==》》语言文件:PHPScript.CLF

按照这个页面的提示:http://www.sourceinsight.com/public/index.html

CustomLanguagefilesforaddingnewlanguagesupporttoSourceInsight.

ToimportacustomlanguagefileintoSourceInsight

1.SelectOptions>Preferences.ClicktheLanguagestab.

2.ClicktheImportbutton.Selectandloadthecustomlanguagefile(.CLF)

3.Youshouldnowseethenewlanguageinthelistoflanguages.

4.ClicktheDocumentTypesbuttontoopentheDocumentOptionsdialogbox.

5.Ifyoudon'thaveadocumenttypealreadycreatedforthetypeoflanguagefile,youwillneedtocreateonenow.Ifyoualreadyhaveadocumenttypecreated,selectitinthelistandgotostep7.

6.ClicktheAddTypebuttontocreateanewdocumenttype.Giveitanamethatdescribesthetypeoffile.Forexample,"AntFile".ClickOKandthenfillinthefilefiltertextboxwithawildcard.Forexample,"*.ant".

7.IntheParsingsectionoftheDocumentOptionsdialogbox,selectthenewlyimportedlanguageinthelanguagedrop-downlist.Thisiswhatassociatesyourdocumenttypewiththecustomlanguage.

8.ClicktheClosebuttontocloseDocumentOptions.ThenclickOKtoclosethePreferencesdialogbox.

==》》style文件:PHP-Styles.CF3

菜单“options”-》“StyleProperties”,在弹出窗口中,选择“load”,选中style文件:PHP-Styles.CF3。确定后,你可以在左侧的“StyleName”列表中看见增加了四个新的php-function,php-keyword,php-control,php-operator。在点击“Done”确定后,就好了。

以上没什么技术含量,就是体力活。用过SI,你会更喜欢它,没有用过,推荐你用。

相关推荐