现在的位置: 首页 > 综合 > 正文

UltraEdit下Object-C文件的语法加亮

2018年02月23日 ⁄ 综合 ⁄ 共 2564字 ⁄ 字号 评论关闭

      随着iOS的全球大热,Object-C也有了越来越多的使用者。由于iOS的开发要求在Mac系统下,苹果公司在Mac系统下面提供了XCode这个软件,作为一个IDE来说也很不错了。不过因为windows下一些常用的编辑器不支持.m文件,有时还是会感到一些不方便。

      UltraEdit是一款相当相当强大的编辑器,我常常用来查看一些单个的C文件,但对于Object-C一直没有支持(至少我现在用的版本没有支持),打开.m文件的时候看到一片平平淡淡的内容感觉很不习惯,下面介绍通过修改UltraEdit的字词列表文件来进行语法加亮的方法。

       在 UltraEdit 的菜单里选择 高级 -> 配置 -> 编辑器显示 -> 语法着色(也有版本是语法加亮的) ,在这一页上找到默认应用的字词列表文件的完整路径。打开这个文件,在文件的末尾加上:

       /L14"Objective-C" OBJECTIVE-C_LANG Line Comment = // Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = "' String Literal Prefix = @ File Extensions = H M MM PCH
/Delimiters = ~!@%^&*()-+=|\/{}[]:;"'<> , .?
/Function String = "%^([a-zA-Z_0-9^[^]*]+^)[ ^t]+([^p*&:, ^t^[^]a-zA-Z_0-9.!]++)[~;]"
/Function String 1 = "%[a-zA-Z_0-9*]*::^([a-zA-Z_0-9^~]+^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-zA-Z_0-9./(!]++)[~;]"
/Function String 2 = "%[a-zA-Z_0-9^][a-zA-Z_0-9^[^]]+[ ^t*]+^([a-zA-Z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./(!]++)[~;]"
/Function String 3 = "%[a-zA-Z_0-9*&$^[^]*]+[ ^t]+[a-zA-Z_0-9*&$^[^]]+[ ^t*]+^([a-zA-Z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./(!]++)[~;]"
/Function String 4 = "%[a-z_0-9^[^]*]++ [a-z_0-9*^[^]]+[ ^t]++[a-z_0-9*^[^]]+[ ^t]++^([*a-z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-z_0-9./(!]++)[~;]"
/Function String 5 = "%^([a-zA-Z_0-9^[^]*]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./()!]++)[~;]"
/Member String = "^([A-Za-z0-9_:.]+^)[ ^t^*&]+$S[ ^t^[^]A-Za-z0-9_]++[(-);,]"
/Variable String = "%[ ^t]++^([!-~ ^t<>]+*[~a-z^p]^)$S[ ^t;,()^-]"
/Indent Strings = "{"
/Unindent Strings = "}"
/Open Brace Strings =  "{" "(" "["
/Close Brace Strings = "}" ")" "]"
/Open Fold Strings = "{"
/Close Fold Strings = "}"
/C1"Keywords" STYLE_KEYWORD
_Bool _Complex _Imaginary _cmd __func__
__asm __based __cdecl __declspec __except __far __fastcall __finally __fortran __huge __inline __int16
__int32 __int64 __int8 __interrupt __leave __loadds __near __pascal __saveregs __segment __segname __self
__stdcall __try __uuidof __multiple_inheritance __single_inheritance __virtual_inheritance
auto do double assign
bool break bycopy byref
BOOL
char class case const continue const_cast catch copy
Class
defined default do double delete dynamic_cast dllexport dllimport
enum extern else explicit export
for float false friend
goto getter
int if in inline inout id init
IMP
long
mutable
nil namespace new naked nonatomic
Nil NO NSObject
oneway out operator
Object
private protected public
Protocol
return register restrict reinterpret_cast retain readwrite readonly
self short signed sizeof static struct super switch static_cast setter
SEL
typedef template this throw true try typeid typename thread
union unsigned using uuid
void volatile virtual
while wchar_t
YES
** @ #
/C2"Operators" STYLE_OPERATOR
@
#
:
!
%
&
+
-
*
// /
<
=
>
^
|
~
?
,
/C3"Framework" STYLE_EXTENSION
alloc
dealloc
Foundation
release
** NS IB CF CA CG UI GL EAGL
/C4"OpenGL" STYLE_KEYWORD
** gl

     然后存盘,再次打开.m文件,发现语法加亮就实现了。

抱歉!评论已关闭.