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 ':' lpar parameter_type rpar attribute? [right:]term |
126 {comma:} comma '...' |
131 {anonymous:} type anonymous |
132 {table:} type protocols? '[]' |
133 {pointer:} type pointer |
134 {protocol:} type protocols |
135 {unsigned:} unsigned pointer |
136 {function_pointer:} function_pointer;
139 {method:} lpar '^' term? rpar lpar declarations? rpar |
140 {inception:} lpar '^' term? rpar lpar type lpar '^' term? rpar lpar type rpar rpar;
143 {property:} type protocols? pointer? [left:]term [right:]term? |
144 {anonymous:} type anonymous |
145 {function_pointer:} function_pointer;
148 {type:} type_annotation? unsigned? data_type;
171 'dispatch_semaphore_t' |
202 {protocol:} 'Protocol';
205 {classes:} classe additional*;
208 {protocols:} '<' classe additional* '>';
211 {add:} ':' classe additional*;
217 {declarations:} declaration additional_declaration*;
219 additional_declaration =
220 {add:} comma declaration;
223 {pointer:} type protocols? attribute? pointer? term? '[]'? |
224 {typedef:} type more_type |
225 {function_pointer:} function_pointer |
228 declaration_variable_instance =
229 {unsigned:} type_annotation? unsigned more_type? protocols? attribute? pointer? term '[]'? |
230 {data_type:} type_annotation? data_type protocols? attribute? pointer? term? '[]'?;
233 {instance:} '{' instance_variable* '}';
235 scope_instance_variable =
236 {package:} '@package' |
237 {public:} '@public' |
238 {private:} '@private' |
239 {protected:} '@protected';
242 {scope:} scope_instance_variable |
243 {variable:} attribute? declaration_variable_instance bit_field? additional_variable* ';' |
244 {anonymous:} declaration_variable_instance anonymous ';' |
245 {structure:} structure |
248 additional_variable =
249 {add} comma term bit_field?;
252 {type:} type pointer? lpar pointer term? rpar lpar declarations rpar;
255 {name:} 'union' '{' structure_params+ '}' term ';';
258 {name:} 'struct' structure_core term ';' |
259 {type:} 'struct' type structure_core term? ';' |
260 {private:} 'struct' private structure_core? term? ';';
263 {core:} '{' structure_params+ '}';
266 {value:} declaration bit_field? ';' |
267 {structure:} structure;
270 {params:} param additional_params*;
277 {bitwise:} term '=' bitwise |
278 {term:} term '=' pointer? term+ |
279 {attr:} term attribute |
280 {attrterm:} term attribute '=' term |
281 {attrbitwise:} term attribute '=' bitwise;
284 {args:} arg additional_arg*;
294 {rterm:} bitwise_operator_not? term bitwise_operator bitwise_operator_not? term |
295 {num:} lpar bitwise_operator_not? term rpar |
296 {term:} lpar bitwise_operator_not? term additional_bitwise+ rpar arithmetic?;
300 {right_shift:} '>>' |
305 bitwise_operator_not =
309 {add:} bitwise_operator bitwise_operator_not? term;
317 {star:} pointer num |
321 {num_typed:} '-'? num_typed |
324 {negative:} '-' num |
325 {float:} num '.' num |
327 {hexadecimal:} hexadecimal |
330 {private_table:} private '[' lpar? num rpar? ']' |
331 {table:} id '[' lpar? num rpar? ']';