FIX: typdef NS_ENUM declarator MISSING

This commit is contained in:
shengxuanwei 2022-04-24 15:09:42 +08:00
parent e2c6247cbb
commit f5935e2b40
7 changed files with 567905 additions and 571352 deletions

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),
@ -532,13 +534,25 @@ module.exports = grammar(C, {
optional($.attribute_specifier),
optional($.swift_name_attribute_sepcifier),
'typedef',
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)),
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))),
';'
)),
@ -552,28 +566,27 @@ module.exports = grammar(C, {
$.block_abstract_declarator,
),
enum_specifier: ($, superclass) => choice(
seq(
'enum',
choice(
seq(
field('name', optional($._type_identifier)),
field('superclass', optional(seq(':', $._type_specifier))),
field('body', optional($.enumerator_list))
enum_specifier: ($, superclass) => seq(
'enum',
choice(
seq(
field('name', optional($._type_identifier)),
field('superclass', optional(seq(':', $._type_specifier))),
field('body', optional($.enumerator_list))
),
field('body', $.enumerator_list)
)
),
seq(
choice('NS_ENUM', 'NS_ERROR_ENUM', 'NS_OPTIONS'),
'(',
field('type', $._type_specifier),
optional(seq(',', field('name', $._type_identifier))),
')',
field('body', optional($.enumerator_list)),
field('body', $.enumerator_list)
)
),
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(
field('name', $.identifier),
optional(seq('=', field('value', $._expression))),
@ -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

@ -1850,89 +1850,158 @@
"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": "_type_specifier"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "attribute_specifier"
},
{
"type": "BLANK"
}
]
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "type_qualifier"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "declarator",
"content": {
"type": "SYMBOL",
"name": "_type_declarator"
}
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "attributes",
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "attribute_specifier"
},
{
"type": "BLANK"
}
]
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "identifier"
"name": "type_qualifier"
}
},
{
"type": "SYMBOL",
"name": "attribute_specifier"
"type": "FIELD",
"name": "type",
"content": {
"type": "SYMBOL",
"name": "_type_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": "SYMBOL",
"name": "_type_declarator"
}
}
]
},
{
"type": "BLANK"
"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",
"name": "attribute_specifier"
}
]
},
{
"type": "BLANK"
}
]
}
},
{
"type": "STRING",
"value": ";"
@ -3309,6 +3378,10 @@
"type": "SYMBOL",
"name": "instancetype"
},
{
"type": "SYMBOL",
"name": "ns_enum_specifier"
},
{
"type": "SYMBOL",
"name": "typeof_specifier"
@ -3482,167 +3555,83 @@
}
},
"enum_specifier": {
"type": "CHOICE",
"type": "SEQ",
"members": [
{
"type": "SEQ",
"type": "STRING",
"value": "enum"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "enum"
},
{
"type": "CHOICE",
"type": "SEQ",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_type_identifier"
},
{
"type": "BLANK"
}
]
}
},
{
"type": "FIELD",
"name": "superclass",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ":"
},
{
"type": "SYMBOL",
"name": "_type_identifier"
},
{
"type": "BLANK"
"name": "_type_specifier"
}
]
},
{
"type": "BLANK"
}
},
{
"type": "FIELD",
"name": "superclass",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ":"
},
{
"type": "SYMBOL",
"name": "_type_specifier"
}
]
},
{
"type": "BLANK"
}
]
}
},
{
"type": "FIELD",
"name": "body",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "enumerator_list"
},
{
"type": "BLANK"
}
]
}
}
]
]
}
},
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "enumerator_list"
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "enumerator_list"
},
{
"type": "BLANK"
}
]
}
}
]
}
]
},
{
"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"
}
]
"type": "SYMBOL",
"name": "enumerator_list"
}
}
]
@ -7629,20 +7618,20 @@
"value": "("
},
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "category",
"content": {
"type": "FIELD",
"name": "category",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "BLANK"
}
},
{
"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": [
@ -9990,8 +10058,17 @@
"value": "BOOL"
},
"auto": {
"type": "STRING",
"value": "__auto_type"
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "auto"
},
{
"type": "STRING",
"value": "__auto_type"
}
]
},
"autoreleasepool_statement": {
"type": "PREC_RIGHT",
@ -10288,20 +10365,20 @@
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "keyword",
"content": {
"type": "FIELD",
"name": "keyword",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "BLANK"
}
},
{
"type": "BLANK"
}
]
]
}
},
{
"type": "STRING",
@ -11242,12 +11319,18 @@
[
"enum_specifier"
],
[
"ns_enum_specifier"
],
[
"function_declarator"
],
[
"type_descriptor"
],
[
"type_definition"
],
[
"superclass_reference"
],

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",

1138190
src/parser.c

File diff suppressed because it is too large Load Diff

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