Compare commits

...

5 Commits

Author SHA1 Message Date
Shadowfacts b856c0ad2e Use --abi=14 2022-05-29 11:02:30 -04:00
shengxuanwei 626b5287fe FIX: Cargo version to 2021 2022-05-01 18:43:36 +08:00
shengxuanwei 8e2d230c29 MOD: move attribute specifiers to @attribute 2022-04-24 16:29:47 +08:00
shengxuanwei 978c89dccf MOD: update test cases 2022-04-24 16:04:02 +08:00
shengxuanwei f5935e2b40 FIX: typdef NS_ENUM declarator MISSING 2022-04-24 15:34:42 +08:00
13 changed files with 525082 additions and 505092 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 = "2022"
edition = "2021"
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,6 +1343,39 @@ 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) {
@ -1488,14 +1521,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,8 +19,10 @@ 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],
@ -144,7 +146,7 @@ module.exports = grammar(C, {
seq($._name, optional($.parameterized_class_type_arguments), optional($.protocol_qualifiers)),
$.generics_type_reference
),
'(', optional(field('category', $.identifier)),')',
'(', field('category', optional($.identifier)),')',
optional($.protocol_qualifiers),
optional($._instance_variables),
optional($._interface_declaration),
@ -483,7 +485,7 @@ module.exports = grammar(C, {
field('return_type', optional($._method_argument_type_specifier)),
field('selector', $._method_selector),
optional($.attribute_specifier),
optional(';'),
optional(';'), // compatible with: - (void)method; {}
field('body', $.compound_statement),
optional(';'),
),
@ -496,12 +498,12 @@ module.exports = grammar(C, {
),
),
_unary_selector: $ => $.identifier, // naming
_unary_selector: $ => $.identifier,
keyword_selector: $ => repeat1($.keyword_declarator),
keyword_declarator: $ => prec.right(seq(
field('keyword', optional($.identifier)), // naming
field('keyword', optional($.identifier)),
':',
field('type', optional($._method_argument_type_specifier)),
$._name,
@ -532,13 +534,25 @@ 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),
optional(field('declarator', $._type_declarator)), // NS_ENUM optional
optional(choice(field('attributes', $.identifier), $.attribute_specifier)),
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))),
';'
)),
@ -552,8 +566,7 @@ module.exports = grammar(C, {
$.block_abstract_declarator,
),
enum_specifier: ($, superclass) => choice(
seq(
enum_specifier: ($, superclass) => seq(
'enum',
choice(
seq(
@ -564,14 +577,14 @@ module.exports = grammar(C, {
field('body', $.enumerator_list)
)
),
seq(
ns_enum_specifier: ($, superclass) => 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(
@ -589,6 +602,7 @@ module.exports = grammar(C, {
$.BOOL,
$.auto,
$.instancetype,
$.ns_enum_specifier,
$.typeof_specifier,
$.atomic_specifier,
$.generic_type_specifier,
@ -881,7 +895,7 @@ module.exports = grammar(C, {
keyword_argument_list: $ => repeat1($.keyword_argument),
keyword_argument: $ => seq(
optional(field('keyword', $.identifier)),
field('keyword', optional($.identifier)),
':',
field('argument', choice(
$._expression,

View File

@ -50,8 +50,6 @@
"@throw"
"@selector"
"@encode"
"@available"
"__builtin_available"
(private)
(public)
(protected)
@ -61,11 +59,9 @@
"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"
@ -358,6 +354,12 @@ 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,6 +1846,12 @@
"type": "STRING",
"value": "typedef"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
@ -1892,9 +1898,6 @@
"name": "type_qualifier"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "declarator",
@ -1902,6 +1905,18 @@
"type": "SYMBOL",
"name": "_type_declarator"
}
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "attribute_specifier"
},
{
"type": "BLANK"
@ -1909,18 +1924,71 @@
]
},
{
"type": "CHOICE",
"members": [
"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",
@ -1932,6 +2000,7 @@
"type": "BLANK"
}
]
}
},
{
"type": "STRING",
@ -3309,6 +3378,10 @@
"type": "SYMBOL",
"name": "instancetype"
},
{
"type": "SYMBOL",
"name": "ns_enum_specifier"
},
{
"type": "SYMBOL",
"name": "typeof_specifier"
@ -3482,9 +3555,6 @@
}
},
"enum_specifier": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
@ -3568,87 +3638,6 @@
}
]
},
{
"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": [
@ -7628,21 +7617,21 @@
"type": "STRING",
"value": "("
},
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "category",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "BLANK"
}
]
}
},
{
"type": "STRING",
@ -9601,6 +9590,85 @@
]
}
},
"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": [
@ -10286,22 +10354,22 @@
},
"keyword_argument": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "keyword",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "BLANK"
}
]
}
},
{
"type": "STRING",
@ -11242,12 +11310,18 @@
[
"enum_specifier"
],
[
"ns_enum_specifier"
],
[
"function_declarator"
],
[
"type_descriptor"
],
[
"type_definition"
],
[
"superclass_reference"
],
@ -11282,6 +11356,7 @@
"precedences": [],
"externals": [],
"inline": [
"_statement",
"_top_level_item",
"_type_identifier",
"_field_identifier",

View File

@ -1295,6 +1295,10 @@
"type": "method_declaration",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "optional",
"named": true
@ -1584,6 +1588,10 @@
"type": "method_declaration",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "optional",
"named": true
@ -1850,6 +1858,10 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_def",
"named": true
@ -2035,6 +2047,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -2185,6 +2201,10 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_def",
"named": true
@ -2408,77 +2428,7 @@
"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": {
"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",
"type": "ns_enum_specifier",
"named": true
},
{
@ -2645,6 +2595,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -2865,6 +2819,10 @@
"type": "nonnull",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "nullable",
"named": true
@ -2961,6 +2919,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -3173,6 +3135,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -3343,6 +3309,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -3693,6 +3663,10 @@
"type": "nonnull",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "nullable",
"named": true
@ -3890,6 +3864,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -4030,6 +4008,10 @@
"type": "nonnull",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "nullable",
"named": true
@ -4152,6 +4134,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -4302,6 +4288,10 @@
"type": "nonnull",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "nullable",
"named": true
@ -4424,6 +4414,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -4560,6 +4554,110 @@
"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,
@ -4646,6 +4744,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -5122,6 +5224,10 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_call",
"named": true
@ -5289,6 +5395,10 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_call",
"named": true
@ -5573,6 +5683,10 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_call",
"named": true
@ -5765,6 +5879,10 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_call",
"named": true
@ -6048,6 +6166,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -6173,6 +6295,10 @@
"type": "method_declaration",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "optional",
"named": true
@ -6405,7 +6531,7 @@
},
{
"type": "string_literal",
"named": false,
"named": true,
"fields": {},
"children": {
"multiple": true,
@ -6635,6 +6761,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -6871,6 +7001,10 @@
"type": "module_import",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "preproc_def",
"named": true
@ -7000,6 +7134,10 @@
"multiple": false,
"required": false,
"types": [
{
"type": "attribute_specifier",
"named": true
},
{
"type": "identifier",
"named": true
@ -7064,6 +7202,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -7172,6 +7314,10 @@
"type": "macro_type_specifier",
"named": true
},
{
"type": "ns_enum_specifier",
"named": true
},
{
"type": "primitive_type",
"named": true
@ -8239,11 +8385,11 @@
},
{
"type": "number_literal",
"named": true
"named": false
},
{
"type": "number_literal",
"named": false
"named": true
},
{
"type": "oneway",

1029050
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 [FIXME]
Blocks: unknown
================================================================================
extern void use(id);

View File

@ -611,7 +611,7 @@ typedef void (^AFURLSessionTaskDidFinishCollectingMetricsBlock)(NSURLSession *se
type: (type_identifier)
declarator: (pointer_declarator
declarator: (identifier)))))
(attribute_specifier
attributes: (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)))))
(attribute_specifier
attributes: (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: (enum_specifier
type: (ns_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)))))
(attribute_specifier
attributes: (attribute_specifier
(availability_attribute_specifier))))
================================================================================
@ -209,7 +209,7 @@ typedef void (^AFURLSessionTaskDidFinishCollectingMetricsBlock)(NSURLSession *se
type: (type_identifier)
declarator: (pointer_declarator
declarator: (identifier)))))
(attribute_specifier
attributes: (attribute_specifier
(availability_attribute_specifier
(platform_version
platform: (platform)
@ -354,7 +354,7 @@ typedef NS_ENUM(NSInteger, SVProgressHUDStyle) {
(translation_unit
(type_definition
type: (enum_specifier
type: (ns_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)
attributes: (identifier))
declarator: (type_identifier))
(declaration
type: (auto)
declarator: (init_declarator
@ -1371,7 +1371,7 @@ NS_ENUM(NSInteger)
--------------------------------------------------------------------------------
(translation_unit
(enum_specifier
(ns_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)))
attributes: (identifier))
declarator: (type_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))))
attributes: (identifier))
declarator: (type_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))))
attributes: (identifier))
declarator: (type_identifier))
(type_definition
type: (id)
(type_qualifier)
attributes: (identifier))
declarator: (type_identifier))
(type_definition
type: (SEL)
(type_qualifier)
attributes: (identifier)))
declarator: (type_identifier)))
================================================================================
Typedef: attributes
@ -104,7 +104,7 @@ typedef __attribute__((__ext_vector_type__(2))) float vector_float2;
arguments: (argument_list
(string_literal)))))
type: (type_identifier)
attributes: (identifier))
declarator: (type_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)
attributes: (identifier)))
declarator: (type_identifier)))
================================================================================
Typedef: struct
@ -140,7 +140,7 @@ typedef struct __attribute__((objc_boxable)) _NSRange {
(field_declaration
type: (type_identifier)
declarator: (field_identifier))))
attributes: (identifier)))
declarator: (type_identifier)))
================================================================================
Typedef: struct
@ -210,7 +210,7 @@ typedef struct {
(field_declaration
type: (type_identifier)
declarator: (field_identifier))))
attributes: (identifier))))
declarator: (type_identifier))))
================================================================================
Typedef: block
@ -249,7 +249,7 @@ typedef void (^JSONObjectBlock)(id json, JSONModelError *err) DEPRECATED_ATTRIBU
type: (type_identifier)
declarator: (pointer_declarator
declarator: (identifier)))))
(attribute_specifier
attributes: (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)))))
(attribute_specifier
attributes: (attribute_specifier
(availability_attribute_specifier))))
================================================================================
@ -313,6 +313,114 @@ 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
================================================================================
@ -356,11 +464,11 @@ typedef enum AvatarStyle : NSUInteger {
(translation_unit
(type_definition
type: (enum_specifier
type: (ns_enum_specifier
type: (type_identifier)
name: (type_identifier)))
(type_definition
type: (enum_specifier
type: (ns_enum_specifier
type: (type_identifier)
name: (type_identifier)
body: (enumerator_list
@ -378,7 +486,7 @@ typedef enum AvatarStyle : NSUInteger {
(enumerator
name: (identifier)))))
(type_definition
type: (enum_specifier
type: (ns_enum_specifier
type: (type_identifier)
name: (type_identifier)
body: (enumerator_list
@ -394,7 +502,7 @@ typedef enum AvatarStyle : NSUInteger {
value: (number_literal))
(enumerator
name: (identifier))))
attributes: (identifier))
declarator: (type_identifier))
(type_definition
type: (enum_specifier
name: (type_identifier)
@ -405,7 +513,7 @@ typedef enum AvatarStyle : NSUInteger {
value: (number_literal))
(enumerator
name: (identifier))))
attributes: (identifier)))
declarator: (type_identifier)))
================================================================================
Typedef: NS_ENUM without typedef
@ -420,7 +528,7 @@ NS_ENUM(NSInteger)
--------------------------------------------------------------------------------
(translation_unit
(enum_specifier
(ns_enum_specifier
type: (type_identifier)
body: (enumerator_list
(enumerator
@ -446,7 +554,7 @@ typedef NS_ENUM(NSInteger, TTCameraDetectionType) {
(translation_unit
(type_definition
type: (enum_specifier
type: (ns_enum_specifier
type: (type_identifier)
name: (type_identifier)
body: (enumerator_list
@ -498,7 +606,7 @@ typedef NS_ENUM(NSInteger, SVProgressHUDStyle) {
(translation_unit
(type_definition
type: (enum_specifier
type: (ns_enum_specifier
type: (type_identifier)
name: (type_identifier)
body: (enumerator_list
@ -534,7 +642,7 @@ typedef NS_OPTIONS(NSUInteger, ActionType) {
(translation_unit
(type_definition
type: (enum_specifier
type: (ns_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,8 +484,7 @@ struct Derived : type_s { };
type: (id)
declarator: (pointer_declarator
declarator: (field_identifier)))))
declarator: (MISSING identifier))
(comment))
declarator: (MISSING identifier)))
(struct_specifier
name: (type_identifier)
body: (field_declaration_list
@ -495,6 +494,7 @@ struct Derived : type_s { };
(field_declaration
type: (id)
declarator: (field_identifier))))
(comment)
(struct_specifier
name: (type_identifier)
(superclass_reference