comparison runtime/syntax/objc.vim @ 7:3fc0f57ecb91 v7.0001

updated for version 7.0001
author vimboss
date Sun, 13 Jun 2004 20:20:40 +0000
parents
children 4707450c2b33
comparison
equal deleted inserted replaced
6:c2daee826b8f 7:3fc0f57ecb91
1 " Vim syntax file
2 " Language: Objective C
3 " Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com>
4 " Ex-maintainer: Anthony Hodsdon <ahodsdon@fastmail.fm>
5 " First Author: Valentino Kyriakides <1kyriaki@informatik.uni-hamburg.de>
6 " Last Change: 2004 May 20
7
8 " For version 5.x: Clear all syntax items
9 " For version 6.x: Quit when a syntax file was already loaded
10 if version < 600
11 syntax clear
12 elseif exists("b:current_syntax")
13 finish
14 endif
15
16 if &filetype != 'objcpp'
17 " Read the C syntax to start with
18 if version < 600
19 source <sfile>:p:h/c.vim
20 else
21 runtime! syntax/c.vim
22 endif
23 endif
24
25 " Objective C extentions follow below
26 "
27 " NOTE: Objective C is abbreviated to ObjC/objc
28 " and uses *.h, *.m as file extensions!
29
30
31 " ObjC keywords, types, type qualifiers etc.
32 syn keyword objcStatement self super _cmd
33 syn keyword objcType id Class SEL IMP BOOL nil Nil
34 syn keyword objcTypeModifier bycopy in out inout oneway
35
36 " Match the ObjC #import directive (like C's #include)
37 syn region objcImported display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
38 syn match objcImported display contained "<[_0-9a-zA-Z.\/]*>"
39 syn match objcImport display "^\s*\(%:\|#\)\s*import\>\s*["<]" contains=objcImported
40
41 " Match the important ObjC directives
42 syn match objcScopeDecl "@public\|@private\|@protected"
43 syn match objcDirective "@interface\|@implementation"
44 syn match objcDirective "@class\|@end\|@defs"
45 syn match objcDirective "@encode\|@protocol\|@selector"
46
47 " Match the ObjC method types
48 "
49 " NOTE: here I match only the indicators, this looks
50 " much nicer and reduces cluttering color highlightings.
51 " However, if you prefer full method declaration matching
52 " append .* at the end of the next two patterns!
53 "
54 syn match objcInstMethod "^\s*-\s*"
55 syn match objcFactMethod "^\s*+\s*"
56
57 " To distinguish from a header inclusion from a protocol list.
58 syn match objcProtocol display "<[_a-zA-Z][_a-zA-Z0-9]*>" contains=objcType,cType,Type
59
60
61 " To distinguish labels from the keyword for a method's parameter.
62 syn region objcKeyForMethodParam display
63 \ start="^\s*[_a-zA-Z][_a-zA-Z0-9]*\s*:\s*("
64 \ end=")\s*[_a-zA-Z][_a-zA-Z0-9]*"
65 \ contains=objcType,objcTypeModifier,cType,cStructure,cStorageClass,Type
66
67 " Objective-C Constant Strings
68 syn match objcSpecial display "%@" contained
69 syn region objcString start=+\(@"\|"\)+ skip=+\\\\\|\\"+ end=+"+ contains=cFormat,cSpecial,objcSpecial
70
71 " Objective-C Message Expressions
72 syn region objcMessage display start="\[" end="\]" contains=objcMessage,objcStatement,objcType,objcTypeModifier,objcString,objcConstant,objcDirective,cType,cStructure,cStorageClass,cString,cCharacter,cSpecialCharacter,cNumbers,cConstant,cOperator,cComment,cCommentL,Type
73
74 syn cluster cParenGroup add=objcMessage
75 syn cluster cPreProcGroup add=objcMessage
76
77 " Define the default highlighting.
78 " For version 5.7 and earlier: only when not done already
79 " For version 5.8 and later: only when an item doesn't have highlighting yet
80 if version >= 508 || !exists("did_objc_syntax_inits")
81 if version < 508
82 let did_objc_syntax_inits = 1
83 command -nargs=+ HiLink hi link <args>
84 else
85 command -nargs=+ HiLink hi def link <args>
86 endif
87
88 HiLink objcImport Include
89 HiLink objcImported cString
90 HiLink objcTypeModifier objcType
91 HiLink objcType Type
92 HiLink objcScopeDecl Statement
93 HiLink objcInstMethod Function
94 HiLink objcFactMethod Function
95 HiLink objcStatement Statement
96 HiLink objcDirective Statement
97 HiLink objcKeyForMethodParam None
98 HiLink objcString cString
99 HiLink objcSpecial Special
100 HiLink objcProtocol None
101
102 delcommand HiLink
103 endif
104
105 let b:current_syntax = "objc"
106
107 " vim: ts=8