1 /* Grammar for Objective-C header files */
7 letter = upper | lower;
15 string = '"' (Any - '"')* '"';
16 class = upper (letter | '_' | digit)*;
17 id = lower (letter | '_' | digit)*;
19 private = '_' (letter | digit)+;
21 macro_name = '__' (letter | '_')+;
22 num_typed = num upper+;
23 hexadecimal = '0x' (letter | digit)+;
26 blank = (' ' | '\t' | '\n')+;
27 comments = ('#' (Any - '\n')*);
30 Ignored blank, comments;
35 {class:} '@class' classes ';' |
36 {protocol:} protocol |
37 {attribute:} attribute |
39 {structure:} structure |
40 {interface:} '@interface' class interface? inheritance? protocols? instance_variables? interface_block* '@end' |
45 {instance:} instance_declaration;
48 {library_extern_declaration:} library_extern_declaration |
51 {enum:} 'enum' '{' params '}' attribute? ';';
54 {variable:} 'typedef' 'struct'? declaration ';' |
55 {method:} 'typedef' type method ';' |
56 {structure:} 'typedef' structure |
57 {anonymous:} 'typedef' type anonymous ';';
59 instance_declaration =
60 {signature:} signature_block |
61 {property:} property_declaration;
63 property_declaration =
64 {property:} optional_method? '@property' property_attribute? property attribute* ';';
67 {attribute:} lpar params rpar;
70 {interface:} lpar params? rpar;
72 library_extern_declaration =
73 {simple:} 'UIKIT_EXTERN' type pointer? 'const'? term attribute? ';' |
74 {method:} 'UIKIT_EXTERN' type method? attribute? ';';
77 {declaration:} '@protocol' type additional_type* ';' |
78 {construction:} '@protocol' type protocols? protocol_block+ '@end';
84 {signature:} signature_block |
85 {property:} property_declaration;
88 {signature:} optional_method? scope signature_return_type? parameter+ attribute_list? ';';
90 signature_return_type =
91 {return:} lpar type pointer? function_pointer? protocols? rpar;
94 {required:} '@required' |
95 {optional:} '@optional';
98 {call:} pointer? term lpar args rpar |
99 {declaration:} pointer? term lpar declarations rpar;
105 {availability:} '__attribute__' lpar lpar 'availability' lpar params rpar rpar rpar |
106 {visibility:} '__attribute__' lpar lpar 'visibility' lpar term rpar rpar rpar |
107 {objc_gc:} '__attribute__' lpar lpar 'objc_gc' lpar term rpar rpar rpar |
108 {attribute_id:} '__attribute__' lpar lpar term rpar rpar |
109 {attribute_method:} '__attribute__' lpar lpar method rpar rpar;
112 {method:} 'extern' type method attribute? ';' |
113 {simple:} 'extern' type pointer? 'const'? term attribute? ';';
116 {method:} 'static' 'inline' type method attribute? ';' |
117 {attr:} 'static' '__inline__' attribute+ type method attribute? ';';
124 {named:} [left:]term ':' parameter_type_in_par? attribute? [right:]term |
126 {comma:} comma '...' |
129 parameter_type_in_par = lpar parameter_type rpar;
133 {anonymous:} type anonymous |
134 {table:} type protocols? '[]' |
135 {pointer:} type pointer |
136 {protocol:} type protocols |
137 {unsigned:} unsigned pointer |
138 {function_pointer:} function_pointer;
141 {method:} lpar '^' term? rpar lpar declarations? rpar |
142 {inception:} lpar '^' term? rpar lpar type lpar '^' term? rpar lpar type rpar rpar;
145 {property:} type protocols? pointer? [left:]term [right:]term? |
146 {anonymous:} type anonymous |
147 {function_pointer:} function_pointer;
150 {type:} type_annotation? unsigned? data_type;
173 'dispatch_semaphore_t' |
205 {protocol:} 'Protocol';
208 {classes:} classe additional*;
211 {protocols:} '<' classe additional* '>';
214 {add:} ':' classe additional*;
220 {declarations:} declaration additional_declaration*;
222 additional_declaration =
223 {add:} comma declaration;
226 {pointer:} type protocols? attribute? pointer? term? '[]'? |
227 {typedef:} type more_type |
228 {function_pointer:} function_pointer |
231 declaration_variable_instance =
232 {unsigned:} type_annotation? unsigned more_type? protocols? attribute? pointer? term '[]'? |
233 {data_type:} type_annotation? data_type protocols? attribute? pointer? term? '[]'?;
236 {instance:} '{' instance_variable* '}';
238 scope_instance_variable =
239 {package:} '@package' |
240 {public:} '@public' |
241 {private:} '@private' |
242 {protected:} '@protected';
245 {scope:} scope_instance_variable |
246 {variable:} attribute? declaration_variable_instance bit_field? additional_variable* ';' |
247 {anonymous:} declaration_variable_instance anonymous ';' |
248 {structure:} structure |
251 additional_variable =
252 {add} comma term bit_field?;
255 {type:} type pointer? lpar pointer term? rpar lpar declarations rpar;
258 {name:} 'union' '{' structure_params+ '}' term ';';
261 {name:} 'struct' structure_core term ';' |
262 {type:} 'struct' type structure_core term? ';' |
263 {private:} 'struct' private structure_core? term? ';';
266 {core:} '{' structure_params+ '}';
269 {value:} declaration bit_field? ';' |
270 {structure:} structure;
273 {params:} param additional_params*;
280 {bitwise:} term '=' bitwise |
281 {term:} term '=' pointer? term+ |
282 {attr:} term attribute |
283 {attrterm:} term attribute '=' term |
284 {attrbitwise:} term attribute '=' bitwise;
287 {args:} arg additional_arg*;
297 {rterm:} bitwise_operator_not? term bitwise_operator bitwise_operator_not? term |
298 {num:} lpar bitwise_operator_not? term rpar |
299 {term:} lpar bitwise_operator_not? term additional_bitwise+ rpar arithmetic?;
303 {right_shift:} '>>' |
308 bitwise_operator_not =
312 {add:} bitwise_operator bitwise_operator_not? term;
320 {star:} pointer num |
324 {num_typed:} '-'? num_typed |
327 {negative:} '-' num |
328 {float:} num '.' num |
330 {hexadecimal:} hexadecimal |
333 {private_table:} private '[' lpar? num rpar? ']' |
334 {table:} id '[' lpar? num rpar? ']';