Compare commits

..

No commits in common. "b856c0ad2e58ad71abb489073db819ecf831400c" and "e2c6247cbb833f6a80dcfa9a565f553f90d93acb" have entirely different histories.

13 changed files with 512437 additions and 532427 deletions

View File

@ -7,7 +7,7 @@ license = "MIT"
keywords = ["tree-sitter", "incremental", "parsing", "objc"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/jiyee/tree-sitter-objc"
edition = "2021"
edition = "2022"
build = "bindings/rust/build.rs"
include = [

View File

@ -35,7 +35,7 @@ pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
// Uncomment these to include any queries that this grammar contains
pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm");
// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm");
// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm");

View File

@ -1343,39 +1343,6 @@ typedef id (*NSNumberAllocImp)(id receiver, SEL selector);
typedef void (*mtl_failedMethodCallback)(Class, Method);
enum {
UITableViewCellStyleDefault,
UITableViewCellStyleValue1,
UITableViewCellStyleValue2,
UITableViewCellStyleSubtitle
};
typedef enum {
UITableViewCellStyleDefault,
UITableViewCellStyleValue1,
UITableViewCellStyleValue2,
UITableViewCellStyleSubtitle
} UITableViewCellStyle;
typedef enum {
UITableViewCellStyleDefault,
UITableViewCellStyleValue1,
UITableViewCellStyleValue2,
UITableViewCellStyleSubtitle
};
typedef NSInteger UITableViewCellStyle;
// enum attr-spec-seq(optional) identifier(optional) { enumerator-list }
enum week{Mon, Tue, Wed}; // type specifier
enum week day; // declaration, "day" is the declarator
// Every declaration of an enum or a typedef is a definition.
enum week{Mon, Tue, Wed}day; // declaring an enum variable
// "week{Mon, Tue, Wed}" is the type specifier
// "day" is the declarator
typedef NS_ENUM(NSUInteger, RLMSyncStopPolicy);
typedef NS_ENUM(NSUInteger, SDAnimatedImagePlaybackMode) {
@ -1521,14 +1488,14 @@ typedef struct _AspectBlock {
struct unarchive_list {
int ifield;
id *list;
};
}; // FIXME
@end
struct type_s {
SS may_recurse;
id id_val;
}; // FIXME
};
struct Derived : type_s { };

View File

@ -19,10 +19,8 @@ module.exports = grammar(C, {
[$.struct_specifier],
[$.union_specifier],
[$.enum_specifier],
[$.ns_enum_specifier],
[$.function_declarator],
[$.type_descriptor],
[$.type_definition], // field attributes
[$.superclass_reference],
[$._expression, $.macro_type_specifier],
[$._expression, $.generic_type_specifier],
@ -146,7 +144,7 @@ module.exports = grammar(C, {
seq($._name, optional($.parameterized_class_type_arguments), optional($.protocol_qualifiers)),
$.generics_type_reference
),
'(', field('category', optional($.identifier)),')',
'(', optional(field('category', $.identifier)),')',
optional($.protocol_qualifiers),
optional($._instance_variables),
optional($._interface_declaration),
@ -485,7 +483,7 @@ module.exports = grammar(C, {
field('return_type', optional($._method_argument_type_specifier)),
field('selector', $._method_selector),
optional($.attribute_specifier),
optional(';'), // compatible with: - (void)method; {}
optional(';'),
field('body', $.compound_statement),
optional(';'),
),
@ -498,12 +496,12 @@ module.exports = grammar(C, {
),
),
_unary_selector: $ => $.identifier,
_unary_selector: $ => $.identifier, // naming
keyword_selector: $ => repeat1($.keyword_declarator),
keyword_declarator: $ => prec.right(seq(
field('keyword', optional($.identifier)),
field('keyword', optional($.identifier)), // naming
':',
field('type', optional($._method_argument_type_specifier)),
$._name,
@ -534,25 +532,13 @@ module.exports = grammar(C, {
optional($.attribute_specifier),
optional($.swift_name_attribute_sepcifier),
'typedef',
choice(
seq(
optional($.attribute_specifier),
repeat($.type_qualifier),
field('type', $._type_specifier),
optional($.attribute_specifier),
repeat($.type_qualifier),
field('declarator', $._type_declarator),
),
seq(
optional($.attribute_specifier),
repeat($.type_qualifier),
field('type', $.ns_enum_specifier),
optional($.attribute_specifier),
repeat($.type_qualifier),
field('declarator', optional($._type_declarator)), // NS_ENUM optional
)
),
field('attributes', optional(choice($.identifier, $.attribute_specifier))),
optional(field('declarator', $._type_declarator)), // NS_ENUM optional
optional(choice(field('attributes', $.identifier), $.attribute_specifier)),
';'
)),
@ -566,7 +552,8 @@ module.exports = grammar(C, {
$.block_abstract_declarator,
),
enum_specifier: ($, superclass) => seq(
enum_specifier: ($, superclass) => choice(
seq(
'enum',
choice(
seq(
@ -577,14 +564,14 @@ module.exports = grammar(C, {
field('body', $.enumerator_list)
)
),
ns_enum_specifier: ($, superclass) => seq(
seq(
choice('NS_ENUM', 'NS_ERROR_ENUM', 'NS_OPTIONS'),
'(',
field('type', $._type_specifier),
optional(seq(',', field('name', $._type_identifier))),
')',
field('body', optional($.enumerator_list)),
)
),
enumerator: ($, superclass) => seq(
@ -602,7 +589,6 @@ module.exports = grammar(C, {
$.BOOL,
$.auto,
$.instancetype,
$.ns_enum_specifier,
$.typeof_specifier,
$.atomic_specifier,
$.generic_type_specifier,
@ -895,7 +881,7 @@ module.exports = grammar(C, {
keyword_argument_list: $ => repeat1($.keyword_argument),
keyword_argument: $ => seq(
field('keyword', optional($.identifier)),
optional(field('keyword', $.identifier)),
':',
field('argument', choice(
$._expression,

View File

@ -50,6 +50,8 @@
"@throw"
"@selector"
"@encode"
"@available"
"__builtin_available"
(private)
(public)
(protected)
@ -59,9 +61,11 @@
"NS_ENUM"
"NS_ERROR_ENUM"
"NS_OPTIONS"
"NS_SWIFT_NAME"
(type_qualifier)
(storage_class_specifier)
(attribute_specifier)
(class_interface_attribute_sepcifier)
(method_variadic_arguments_attribute_specifier)
"NS_NOESCAPE"
"const"
"default"
@ -354,12 +358,6 @@ declarator: (identifier) @property
"_unaligned"
"__unaligned"
"__declspec"
"__unused"
"__builtin_available"
"@available"
(attribute_specifier)
(class_interface_attribute_sepcifier)
(method_variadic_arguments_attribute_specifier)
] @attribute
(attribute_specifier) @attribute

View File

@ -1846,12 +1846,6 @@
"type": "STRING",
"value": "typedef"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
@ -1898,6 +1892,9 @@
"name": "type_qualifier"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "declarator",
@ -1905,90 +1902,25 @@
"type": "SYMBOL",
"name": "_type_declarator"
}
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "attribute_specifier"
},
{
"type": "BLANK"
}
]
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "type_qualifier"
}
},
{
"type": "FIELD",
"name": "type",
"content": {
"type": "SYMBOL",
"name": "ns_enum_specifier"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "attribute_specifier"
},
{
"type": "BLANK"
}
]
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "type_qualifier"
}
},
{
"type": "FIELD",
"name": "declarator",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_type_declarator"
},
{
"type": "BLANK"
}
]
}
}
]
}
]
},
{
"type": "FIELD",
"name": "attributes",
"content": {
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "SYMBOL",
@ -2000,7 +1932,6 @@
"type": "BLANK"
}
]
}
},
{
"type": "STRING",
@ -3378,10 +3309,6 @@
"type": "SYMBOL",
"name": "instancetype"
},
{
"type": "SYMBOL",
"name": "ns_enum_specifier"
},
{
"type": "SYMBOL",
"name": "typeof_specifier"
@ -3555,6 +3482,9 @@
}
},
"enum_specifier": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
@ -3638,6 +3568,87 @@
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "NS_ENUM"
},
{
"type": "STRING",
"value": "NS_ERROR_ENUM"
},
{
"type": "STRING",
"value": "NS_OPTIONS"
}
]
},
{
"type": "STRING",
"value": "("
},
{
"type": "FIELD",
"name": "type",
"content": {
"type": "SYMBOL",
"name": "_type_specifier"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "_type_identifier"
}
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": ")"
},
{
"type": "FIELD",
"name": "body",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "enumerator_list"
},
{
"type": "BLANK"
}
]
}
}
]
}
]
},
"enumerator_list": {
"type": "SEQ",
"members": [
@ -7618,20 +7629,20 @@
"value": "("
},
{
"type": "FIELD",
"name": "category",
"content": {
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "category",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "BLANK"
}
]
}
},
{
"type": "STRING",
@ -9590,85 +9601,6 @@
]
}
},
"ns_enum_specifier": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "NS_ENUM"
},
{
"type": "STRING",
"value": "NS_ERROR_ENUM"
},
{
"type": "STRING",
"value": "NS_OPTIONS"
}
]
},
{
"type": "STRING",
"value": "("
},
{
"type": "FIELD",
"name": "type",
"content": {
"type": "SYMBOL",
"name": "_type_specifier"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "_type_identifier"
}
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": ")"
},
{
"type": "FIELD",
"name": "body",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "enumerator_list"
},
{
"type": "BLANK"
}
]
}
}
]
},
"typeof_specifier": {
"type": "SEQ",
"members": [
@ -10356,20 +10288,20 @@
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "keyword",
"content": {
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "keyword",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "BLANK"
}
]
}
},
{
"type": "STRING",
@ -11310,18 +11242,12 @@
[
"enum_specifier"
],
[
"ns_enum_specifier"
],
[
"function_declarator"
],
[
"type_descriptor"
],
[
"type_definition"
],
[
"superclass_reference"
],
@ -11356,7 +11282,6 @@
"precedences": [],
"externals": [],
"inline": [
"_statement",
"_top_level_item",
"_type_identifier",
"_field_identifier",

View File

@ -1295,10 +1295,6 @@
"type": "method_declaration",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "optional",
"named": true
@ -1588,10 +1584,6 @@
"type": "method_declaration",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "optional",
"named": true
@ -1858,10 +1850,6 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_def",
"named": true
@ -2047,10 +2035,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -2201,10 +2185,6 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_def",
"named": true
@ -2428,7 +2408,77 @@
"named": true
},
{
"type": "ns_enum_specifier",
"type": "primitive_type",
"named": true
},
{
"type": "sized_type_specifier",
"named": true
},
{
"type": "struct_specifier",
"named": true
},
{
"type": "type_identifier",
"named": true
},
{
"type": "typeof_specifier",
"named": true
},
{
"type": "union_specifier",
"named": true
}
]
},
"type": {
"multiple": false,
"required": false,
"types": [
{
"type": "BOOL",
"named": true
},
{
"type": "Class",
"named": true
},
{
"type": "IMP",
"named": true
},
{
"type": "SEL",
"named": true
},
{
"type": "atomic_specifier",
"named": true
},
{
"type": "auto",
"named": true
},
{
"type": "enum_specifier",
"named": true
},
{
"type": "generic_type_specifier",
"named": true
},
{
"type": "id",
"named": true
},
{
"type": "instancetype",
"named": true
},
{
"type": "macro_type_specifier",
"named": true
},
{
@ -2595,10 +2645,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -2819,10 +2865,6 @@
"type": "nonnull",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "nullable",
"named": true
@ -2919,10 +2961,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -3135,10 +3173,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -3309,10 +3343,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -3663,10 +3693,6 @@
"type": "nonnull",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "nullable",
"named": true
@ -3864,10 +3890,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -4008,10 +4030,6 @@
"type": "nonnull",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "nullable",
"named": true
@ -4134,10 +4152,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -4288,10 +4302,6 @@
"type": "nonnull",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "nullable",
"named": true
@ -4414,10 +4424,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -4554,110 +4560,6 @@
"named": true,
"fields": {}
},
{
"type": "ns_enum_specifier",
"named": true,
"fields": {
"body": {
"multiple": false,
"required": false,
"types": [
{
"type": "enumerator_list",
"named": true
}
]
},
"name": {
"multiple": false,
"required": false,
"types": [
{
"type": "type_identifier",
"named": true
}
]
},
"type": {
"multiple": false,
"required": true,
"types": [
{
"type": "BOOL",
"named": true
},
{
"type": "Class",
"named": true
},
{
"type": "IMP",
"named": true
},
{
"type": "SEL",
"named": true
},
{
"type": "atomic_specifier",
"named": true
},
{
"type": "auto",
"named": true
},
{
"type": "enum_specifier",
"named": true
},
{
"type": "generic_type_specifier",
"named": true
},
{
"type": "id",
"named": true
},
{
"type": "instancetype",
"named": true
},
{
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
},
{
"type": "sized_type_specifier",
"named": true
},
{
"type": "struct_specifier",
"named": true
},
{
"type": "type_identifier",
"named": true
},
{
"type": "typeof_specifier",
"named": true
},
{
"type": "union_specifier",
"named": true
}
]
}
}
},
{
"type": "number_expression",
"named": true,
@ -4744,10 +4646,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -5224,10 +5122,6 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_call",
"named": true
@ -5395,10 +5289,6 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_call",
"named": true
@ -5683,10 +5573,6 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_call",
"named": true
@ -5879,10 +5765,6 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_call",
"named": true
@ -6166,10 +6048,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -6295,10 +6173,6 @@
"type": "method_declaration",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "optional",
"named": true
@ -6531,7 +6405,7 @@
},
{
"type": "string_literal",
"named": true,
"named": false,
"fields": {},
"children": {
"multiple": true,
@ -6761,10 +6635,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -7001,10 +6871,6 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_def",
"named": true
@ -7134,10 +7000,6 @@
"multiple": false,
"required": false,
"types": [
{
"type": "attribute_specifier",
"named": true
},
{
"type": "identifier",
"named": true
@ -7202,10 +7064,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -7314,10 +7172,6 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -8385,11 +8239,11 @@
},
{
"type": "number_literal",
"named": false
"named": true
},
{
"type": "number_literal",
"named": true
"named": false
},
{
"type": "oneway",

1043736
src/parser.c

File diff suppressed because it is too large Load Diff

View File

@ -825,7 +825,7 @@ Blocks: as a instance variable
parameters: (parameter_list)))))
================================================================================
Blocks: unknown
Blocks: unknown [FIXME]
================================================================================
extern void use(id);

View File

@ -611,7 +611,7 @@ typedef void (^AFURLSessionTaskDidFinishCollectingMetricsBlock)(NSURLSession *se
type: (type_identifier)
declarator: (pointer_declarator
declarator: (identifier)))))
attributes: (attribute_specifier
(attribute_specifier
(availability_attribute_specifier)))
(type_definition
type: (primitive_type)
@ -630,7 +630,7 @@ typedef void (^AFURLSessionTaskDidFinishCollectingMetricsBlock)(NSURLSession *se
type: (type_identifier)
declarator: (pointer_declarator
declarator: (identifier)))))
attributes: (attribute_specifier
(attribute_specifier
(availability_attribute_specifier
(platform_version
platform: (platform)

View File

@ -45,7 +45,7 @@ typedef NS_ENUM(NSUInteger, RLMSyncStopPolicy);
declarator: (identifier)
(swift_name_attribute_sepcifier)))
(type_definition
type: (ns_enum_specifier
type: (enum_specifier
type: (type_identifier)
name: (type_identifier)))
(class_forward_declaration
@ -75,7 +75,7 @@ typedef void (^JSONObjectBlock)(id json, JSONModelError *err) DEPRECATED_ATTRIBU
type: (type_identifier)
declarator: (pointer_declarator
declarator: (identifier)))))
attributes: (attribute_specifier
(attribute_specifier
(availability_attribute_specifier))))
================================================================================
@ -209,7 +209,7 @@ typedef void (^AFURLSessionTaskDidFinishCollectingMetricsBlock)(NSURLSession *se
type: (type_identifier)
declarator: (pointer_declarator
declarator: (identifier)))))
attributes: (attribute_specifier
(attribute_specifier
(availability_attribute_specifier
(platform_version
platform: (platform)
@ -354,7 +354,7 @@ typedef NS_ENUM(NSInteger, SVProgressHUDStyle) {
(translation_unit
(type_definition
type: (ns_enum_specifier
type: (enum_specifier
type: (type_identifier)
name: (type_identifier)
body: (enumerator_list
@ -1021,7 +1021,7 @@ __auto_type copy = (typeof(self.message))[self.message copy];
arguments: (argument_list
(string_literal)))))
type: (type_identifier)
declarator: (type_identifier))
attributes: (identifier))
(declaration
type: (auto)
declarator: (init_declarator
@ -1371,7 +1371,7 @@ NS_ENUM(NSInteger)
--------------------------------------------------------------------------------
(translation_unit
(ns_enum_specifier
(enum_specifier
type: (type_identifier)
body: (enumerator_list
(enumerator

View File

@ -21,7 +21,7 @@ typedef SEL _Nonnull nonnull_SEL;
class_name: (id)
type_reference: (protocol_qualifiers
name: (identifier)))
declarator: (type_identifier))
attributes: (identifier))
(type_definition
type: (generic_type_specifier
class_name: (type_identifier)
@ -31,7 +31,7 @@ typedef SEL _Nonnull nonnull_SEL;
declarator: (abstract_pointer_declarator))
(type_descriptor
type: (id))))
declarator: (type_identifier))
attributes: (identifier))
(type_definition
type: (generic_type_specifier
class_name: (type_identifier)
@ -42,15 +42,15 @@ typedef SEL _Nonnull nonnull_SEL;
(type_descriptor
type: (type_identifier)
declarator: (abstract_pointer_declarator))))
declarator: (type_identifier))
attributes: (identifier))
(type_definition
type: (id)
(type_qualifier)
declarator: (type_identifier))
attributes: (identifier))
(type_definition
type: (SEL)
(type_qualifier)
declarator: (type_identifier)))
attributes: (identifier)))
================================================================================
Typedef: attributes
@ -104,7 +104,7 @@ typedef __attribute__((__ext_vector_type__(2))) float vector_float2;
arguments: (argument_list
(string_literal)))))
type: (type_identifier)
declarator: (type_identifier))
attributes: (identifier))
(type_definition
(attribute_specifier
(argument_list
@ -113,7 +113,7 @@ typedef __attribute__((__ext_vector_type__(2))) float vector_float2;
arguments: (argument_list
(number_literal)))))
type: (primitive_type)
declarator: (type_identifier)))
attributes: (identifier)))
================================================================================
Typedef: struct
@ -140,7 +140,7 @@ typedef struct __attribute__((objc_boxable)) _NSRange {
(field_declaration
type: (type_identifier)
declarator: (field_identifier))))
declarator: (type_identifier)))
attributes: (identifier)))
================================================================================
Typedef: struct
@ -210,7 +210,7 @@ typedef struct {
(field_declaration
type: (type_identifier)
declarator: (field_identifier))))
declarator: (type_identifier))))
attributes: (identifier))))
================================================================================
Typedef: block
@ -249,7 +249,7 @@ typedef void (^JSONObjectBlock)(id json, JSONModelError *err) DEPRECATED_ATTRIBU
type: (type_identifier)
declarator: (pointer_declarator
declarator: (identifier)))))
attributes: (attribute_specifier
(attribute_specifier
(availability_attribute_specifier
(platform_version
platform: (platform)
@ -275,7 +275,7 @@ typedef void (^JSONObjectBlock)(id json, JSONModelError *err) DEPRECATED_ATTRIBU
type: (type_identifier)
declarator: (pointer_declarator
declarator: (identifier)))))
attributes: (attribute_specifier
(attribute_specifier
(availability_attribute_specifier))))
================================================================================
@ -313,114 +313,6 @@ typedef void (*mtl_failedMethodCallback)(Class, Method);
(parameter_declaration
type: (type_identifier))))))
================================================================================
Typedef: enum
================================================================================
enum {
UITableViewCellStyleDefault,
UITableViewCellStyleValue1,
UITableViewCellStyleValue2,
UITableViewCellStyleSubtitle
};
typedef enum {
UITableViewCellStyleDefault,
UITableViewCellStyleValue1,
UITableViewCellStyleValue2,
UITableViewCellStyleSubtitle
} UITableViewCellStyle;
typedef enum {
UITableViewCellStyleDefault,
UITableViewCellStyleValue1,
UITableViewCellStyleValue2,
UITableViewCellStyleSubtitle
};
typedef NSInteger UITableViewCellStyle;
// enum attr-spec-seq(optional) identifier(optional) { enumerator-list }
enum week{Mon, Tue, Wed}; // type specifier
enum week day; // declaration, "day" is the declarator
// Every declaration of an enum or a typedef is a definition.
enum week{Mon, Tue, Wed}day; // declaring an enum variable
// "week{Mon, Tue, Wed}" is the type specifier
// "day" is the declarator
--------------------------------------------------------------------------------
(translation_unit
(enum_specifier
body: (enumerator_list
(enumerator
name: (identifier))
(enumerator
name: (identifier))
(enumerator
name: (identifier))
(enumerator
name: (identifier))))
(type_definition
type: (enum_specifier
body: (enumerator_list
(enumerator
name: (identifier))
(enumerator
name: (identifier))
(enumerator
name: (identifier))
(enumerator
name: (identifier))))
declarator: (type_identifier))
(type_definition
type: (enum_specifier
body: (enumerator_list
(enumerator
name: (identifier))
(enumerator
name: (identifier))
(enumerator
name: (identifier))
(enumerator
name: (identifier))))
declarator: (MISSING type_identifier))
(type_definition
type: (type_identifier)
declarator: (type_identifier))
(comment)
(enum_specifier
name: (type_identifier)
body: (enumerator_list
(enumerator
name: (identifier))
(enumerator
name: (identifier))
(enumerator
name: (identifier))))
(comment)
(declaration
type: (enum_specifier
name: (type_identifier))
declarator: (identifier))
(comment)
(comment)
(declaration
type: (enum_specifier
name: (type_identifier)
body: (enumerator_list
(enumerator
name: (identifier))
(enumerator
name: (identifier))
(enumerator
name: (identifier))))
declarator: (identifier))
(comment)
(comment)
(comment))
================================================================================
Typedef: NS_ENUM
================================================================================
@ -464,11 +356,11 @@ typedef enum AvatarStyle : NSUInteger {
(translation_unit
(type_definition
type: (ns_enum_specifier
type: (enum_specifier
type: (type_identifier)
name: (type_identifier)))
(type_definition
type: (ns_enum_specifier
type: (enum_specifier
type: (type_identifier)
name: (type_identifier)
body: (enumerator_list
@ -486,7 +378,7 @@ typedef enum AvatarStyle : NSUInteger {
(enumerator
name: (identifier)))))
(type_definition
type: (ns_enum_specifier
type: (enum_specifier
type: (type_identifier)
name: (type_identifier)
body: (enumerator_list
@ -502,7 +394,7 @@ typedef enum AvatarStyle : NSUInteger {
value: (number_literal))
(enumerator
name: (identifier))))
declarator: (type_identifier))
attributes: (identifier))
(type_definition
type: (enum_specifier
name: (type_identifier)
@ -513,7 +405,7 @@ typedef enum AvatarStyle : NSUInteger {
value: (number_literal))
(enumerator
name: (identifier))))
declarator: (type_identifier)))
attributes: (identifier)))
================================================================================
Typedef: NS_ENUM without typedef
@ -528,7 +420,7 @@ NS_ENUM(NSInteger)
--------------------------------------------------------------------------------
(translation_unit
(ns_enum_specifier
(enum_specifier
type: (type_identifier)
body: (enumerator_list
(enumerator
@ -554,7 +446,7 @@ typedef NS_ENUM(NSInteger, TTCameraDetectionType) {
(translation_unit
(type_definition
type: (ns_enum_specifier
type: (enum_specifier
type: (type_identifier)
name: (type_identifier)
body: (enumerator_list
@ -606,7 +498,7 @@ typedef NS_ENUM(NSInteger, SVProgressHUDStyle) {
(translation_unit
(type_definition
type: (ns_enum_specifier
type: (enum_specifier
type: (type_identifier)
name: (type_identifier)
body: (enumerator_list
@ -642,7 +534,7 @@ typedef NS_OPTIONS(NSUInteger, ActionType) {
(translation_unit
(type_definition
type: (ns_enum_specifier
type: (enum_specifier
type: (type_identifier)
name: (type_identifier)
body: (enumerator_list

View File

@ -457,14 +457,14 @@ Struct
struct unarchive_list {
int ifield;
id *list;
};
}; // FIXME
@end
struct type_s {
SS may_recurse;
id id_val;
}; // FIXME
};
struct Derived : type_s { };
@ -484,7 +484,8 @@ struct Derived : type_s { };
type: (id)
declarator: (pointer_declarator
declarator: (field_identifier)))))
declarator: (MISSING identifier)))
declarator: (MISSING identifier))
(comment))
(struct_specifier
name: (type_identifier)
body: (field_declaration_list
@ -494,7 +495,6 @@ struct Derived : type_s { };
(field_declaration
type: (id)
declarator: (field_identifier))))
(comment)
(struct_specifier
name: (type_identifier)
(superclass_reference