3 " Maintainer: Reimer Behrends <behrends@cse.msu.edu>
4 " With much input from Jocelyn Fiat <fiat@eiffel.com>
5 " See http://www.cse.msu.edu/~behrends/vim/ for the most current version.
6 " Last Change: 2001 May 09
8 " For version 5.x: Clear all syntax items
9 " For version 6.x: Quit when a syntax file was already loaded
12 elseif exists("b:current_syntax")
18 if exists("eiffel_ignore_case")
22 if exists("eiffel_pedantic") || exists("eiffel_strict")
23 syn keyword eiffelError current void result precursor none
24 syn keyword eiffelError CURRENT VOID RESULT PRECURSOR None
25 syn keyword eiffelError TRUE FALSE
27 if exists("eiffel_pedantic")
28 syn keyword eiffelError true false
29 syn match eiffelError "\<[a-z_]\+[A-Z][a-zA_Z_]*\>"
30 syn match eiffelError "\<[A-Z][a-z_]*[A-Z][a-zA-Z_]*\>"
32 if exists("eiffel_lower_case_predef")
33 syn keyword eiffelPredefined current void result precursor
37 if exists("eiffel_hex_constants")
38 syn match eiffelNumber "\d[0-9a-fA-F]*[xX]"
43 syn keyword eiffelTopStruct indexing feature creation inherit
44 syn match eiffelTopStruct "\<class\>"
45 syn match eiffelKeyword "\<end\>"
46 syn match eiffelTopStruct "^end\>\(\s*--\s\+class\s\+\<[A-Z][A-Z0-9_]*\>\)\=" contains=eiffelClassName
47 syn match eiffelBrackets "[[\]]"
48 syn match eiffelBracketError "\]"
49 syn region eiffelGeneric transparent matchgroup=eiffelBrackets start="\[" end="\]" contains=ALLBUT,eiffelBracketError,eiffelGenericDecl,eiffelStringError,eiffelStringEscape,eiffelGenericCreate,eiffelTopStruct
50 if exists("eiffel_ise")
51 syn match eiffelCreate "\<create\>"
52 syn match eiffelTopStruct contained "\<create\>"
53 syn match eiffelGenericCreate contained "\<create\>"
54 syn match eiffelTopStruct "^create\>"
55 syn region eiffelGenericDecl transparent matchgroup=eiffelBrackets contained start="\[" end="\]" contains=ALLBUT,eiffelCreate,eiffelTopStruct,eiffelGeneric,eiffelBracketError,eiffelStringEscape,eiffelStringError,eiffelBrackets
56 syn region eiffelClassHeader start="^class\>" end="$" contains=ALLBUT,eiffelCreate,eiffelGenericCreate,eiffelGeneric,eiffelStringEscape,eiffelStringError,eiffelBrackets
58 syn keyword eiffelDeclaration is do once deferred unique local
59 syn keyword eiffelDeclaration Unique
60 syn keyword eiffelProperty expanded obsolete separate frozen
61 syn keyword eiffelProperty prefix infix
62 syn keyword eiffelInheritClause rename redefine undefine select export as
63 syn keyword eiffelAll all
64 syn keyword eiffelKeyword external alias
65 syn keyword eiffelStatement if else elseif inspect
66 syn keyword eiffelStatement when then
67 syn match eiffelAssertion "\<require\(\s\+else\)\=\>"
68 syn match eiffelAssertion "\<ensure\(\s\+then\)\=\>"
69 syn keyword eiffelAssertion check
70 syn keyword eiffelDebug debug
71 syn keyword eiffelStatement from until loop
72 syn keyword eiffelAssertion variant
73 syn match eiffelAssertion "\<invariant\>"
74 syn match eiffelTopStruct "^invariant\>"
75 syn keyword eiffelException rescue retry
77 syn keyword eiffelPredefined Current Void Result Precursor
80 syn match eiffelOperator "\<and\(\s\+then\)\=\>"
81 syn match eiffelOperator "\<or\(\s\+else\)\=\>"
82 syn keyword eiffelOperator xor implies not
83 syn keyword eiffelOperator strip old
84 syn keyword eiffelOperator Strip
85 syn match eiffelOperator "\$"
86 syn match eiffelCreation "!"
87 syn match eiffelExport "[{}]"
88 syn match eiffelArray "<<"
89 syn match eiffelArray ">>"
90 syn match eiffelConstraint "->"
91 syn match eiffelOperator "[@#|&][^ \e\t\b%]*"
94 syn keyword eiffelAnchored like
95 syn keyword eiffelBitType BIT
98 if !exists("eiffel_pedantic")
99 syn keyword eiffelBool true false
101 syn keyword eiffelBool True False
102 syn region eiffelString start=+"+ skip=+%"+ end=+"+ contains=eiffelStringEscape,eiffelStringError
103 syn match eiffelStringEscape contained "%[^/]"
104 syn match eiffelStringEscape contained "%/\d\+/"
105 syn match eiffelStringEscape contained "^[ \t]*%"
106 syn match eiffelStringEscape contained "%[ \t]*$"
107 syn match eiffelStringError contained "%/[^0-9]"
108 syn match eiffelStringError contained "%/\d\+[^0-9/]"
109 syn match eiffelBadConstant "'\(%[^/]\|%/\d\+/\|[^'%]\)\+'"
110 syn match eiffelBadConstant "''"
111 syn match eiffelCharacter "'\(%[^/]\|%/\d\+/\|[^'%]\)'" contains=eiffelStringEscape
112 syn match eiffelNumber "-\=\<\d\+\(_\d\+\)*\>"
113 syn match eiffelNumber "\<[01]\+[bB]\>"
114 syn match eiffelNumber "-\=\<\d\+\(_\d\+\)*\.\(\d\+\(_\d\+\)*\)\=\([eE][-+]\=\d\+\(_\d\+\)*\)\="
115 syn match eiffelNumber "-\=\.\d\+\(_\d\+\)*\([eE][-+]\=\d\+\(_\d\+\)*\)\="
116 syn match eiffelComment "--.*" contains=eiffelTodo
120 " Case sensitive stuff
122 syn keyword eiffelTodo contained TODO XXX FIXME
123 syn match eiffelClassName "\<[A-Z][A-Z0-9_]*\>"
125 " Catch mismatched parentheses
126 syn match eiffelParenError ")"
127 syn region eiffelParen transparent start="(" end=")" contains=ALLBUT,eiffelParenError,eiffelStringError,eiffelStringEscape
129 " Should suffice for even very long strings and expressions
132 " Define the default highlighting.
133 " For version 5.7 and earlier: only when not done already
134 " For version 5.8 and later: only when an item doesn't have highlighting yet
135 if version >= 508 || !exists("did_eiffel_syntax_inits")
137 let did_eiffel_syntax_inits = 1
138 command -nargs=+ HiLink hi link <args>
140 command -nargs=+ HiLink hi def link <args>
143 HiLink eiffelKeyword Statement
144 HiLink eiffelProperty Statement
145 HiLink eiffelInheritClause Statement
146 HiLink eiffelStatement Statement
147 HiLink eiffelDeclaration Statement
148 HiLink eiffelAssertion Statement
149 HiLink eiffelDebug Statement
150 HiLink eiffelException Statement
151 HiLink eiffelGenericCreate Statement
154 HiLink eiffelTopStruct PreProc
156 HiLink eiffelAll Special
157 HiLink eiffelAnchored Special
158 HiLink eiffelBitType Special
161 HiLink eiffelBool Boolean
162 HiLink eiffelString String
163 HiLink eiffelCharacter Character
164 HiLink eiffelClassName Type
165 HiLink eiffelNumber Number
167 HiLink eiffelStringEscape Special
169 HiLink eiffelOperator Special
170 HiLink eiffelArray Special
171 HiLink eiffelExport Special
172 HiLink eiffelCreation Special
173 HiLink eiffelBrackets Special
174 HiLink eiffelGeneric Special
175 HiLink eiffelGenericDecl Special
176 HiLink eiffelConstraint Special
177 HiLink eiffelCreate Special
179 HiLink eiffelPredefined Constant
181 HiLink eiffelComment Comment
183 HiLink eiffelError Error
184 HiLink eiffelBadConstant Error
185 HiLink eiffelStringError Error
186 HiLink eiffelParenError Error
187 HiLink eiffelBracketError Error
189 HiLink eiffelTodo Todo
194 let b:current_syntax = "eiffel"