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], [$.struct_specifier],
[$.union_specifier], [$.union_specifier],
[$.enum_specifier], [$.enum_specifier],
[$.ns_enum_specifier],
[$.function_declarator], [$.function_declarator],
[$.type_descriptor], [$.type_descriptor],
[$.type_definition], // field attributes
[$.superclass_reference], [$.superclass_reference],
[$._expression, $.macro_type_specifier], [$._expression, $.macro_type_specifier],
[$._expression, $.generic_type_specifier], [$._expression, $.generic_type_specifier],
@ -144,7 +146,7 @@ module.exports = grammar(C, {
seq($._name, optional($.parameterized_class_type_arguments), optional($.protocol_qualifiers)), seq($._name, optional($.parameterized_class_type_arguments), optional($.protocol_qualifiers)),
$.generics_type_reference $.generics_type_reference
), ),
'(', optional(field('category', $.identifier)),')', '(', field('category', optional($.identifier)),')',
optional($.protocol_qualifiers), optional($.protocol_qualifiers),
optional($._instance_variables), optional($._instance_variables),
optional($._interface_declaration), optional($._interface_declaration),
@ -532,13 +534,25 @@ module.exports = grammar(C, {
optional($.attribute_specifier), optional($.attribute_specifier),
optional($.swift_name_attribute_sepcifier), optional($.swift_name_attribute_sepcifier),
'typedef', 'typedef',
optional($.attribute_specifier), choice(
repeat($.type_qualifier), seq(
field('type', $._type_specifier), optional($.attribute_specifier),
optional($.attribute_specifier), repeat($.type_qualifier),
repeat($.type_qualifier), field('type', $._type_specifier),
optional(field('declarator', $._type_declarator)), // NS_ENUM optional optional($.attribute_specifier),
optional(choice(field('attributes', $.identifier), $.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, $.block_abstract_declarator,
), ),
enum_specifier: ($, superclass) => choice( enum_specifier: ($, superclass) => seq(
seq( 'enum',
'enum', choice(
choice( seq(
seq( field('name', optional($._type_identifier)),
field('name', optional($._type_identifier)), field('superclass', optional(seq(':', $._type_specifier))),
field('superclass', optional(seq(':', $._type_specifier))), field('body', optional($.enumerator_list))
field('body', optional($.enumerator_list))
), ),
field('body', $.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)),
) )
), ),
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( enumerator: ($, superclass) => seq(
field('name', $.identifier), field('name', $.identifier),
optional(seq('=', field('value', $._expression))), optional(seq('=', field('value', $._expression))),
@ -589,6 +602,7 @@ module.exports = grammar(C, {
$.BOOL, $.BOOL,
$.auto, $.auto,
$.instancetype, $.instancetype,
$.ns_enum_specifier,
$.typeof_specifier, $.typeof_specifier,
$.atomic_specifier, $.atomic_specifier,
$.generic_type_specifier, $.generic_type_specifier,
@ -881,7 +895,7 @@ module.exports = grammar(C, {
keyword_argument_list: $ => repeat1($.keyword_argument), keyword_argument_list: $ => repeat1($.keyword_argument),
keyword_argument: $ => seq( keyword_argument: $ => seq(
optional(field('keyword', $.identifier)), field('keyword', optional($.identifier)),
':', ':',
field('argument', choice( field('argument', choice(
$._expression, $._expression,

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@ typedef SEL _Nonnull nonnull_SEL;
class_name: (id) class_name: (id)
type_reference: (protocol_qualifiers type_reference: (protocol_qualifiers
name: (identifier))) name: (identifier)))
attributes: (identifier)) declarator: (type_identifier))
(type_definition (type_definition
type: (generic_type_specifier type: (generic_type_specifier
class_name: (type_identifier) class_name: (type_identifier)
@ -31,7 +31,7 @@ typedef SEL _Nonnull nonnull_SEL;
declarator: (abstract_pointer_declarator)) declarator: (abstract_pointer_declarator))
(type_descriptor (type_descriptor
type: (id)))) type: (id))))
attributes: (identifier)) declarator: (type_identifier))
(type_definition (type_definition
type: (generic_type_specifier type: (generic_type_specifier
class_name: (type_identifier) class_name: (type_identifier)
@ -42,15 +42,15 @@ typedef SEL _Nonnull nonnull_SEL;
(type_descriptor (type_descriptor
type: (type_identifier) type: (type_identifier)
declarator: (abstract_pointer_declarator)))) declarator: (abstract_pointer_declarator))))
attributes: (identifier)) declarator: (type_identifier))
(type_definition (type_definition
type: (id) type: (id)
(type_qualifier) (type_qualifier)
attributes: (identifier)) declarator: (type_identifier))
(type_definition (type_definition
type: (SEL) type: (SEL)
(type_qualifier) (type_qualifier)
attributes: (identifier))) declarator: (type_identifier)))
================================================================================ ================================================================================
Typedef: attributes Typedef: attributes
@ -104,7 +104,7 @@ typedef __attribute__((__ext_vector_type__(2))) float vector_float2;
arguments: (argument_list arguments: (argument_list
(string_literal))))) (string_literal)))))
type: (type_identifier) type: (type_identifier)
attributes: (identifier)) declarator: (type_identifier))
(type_definition (type_definition
(attribute_specifier (attribute_specifier
(argument_list (argument_list
@ -113,7 +113,7 @@ typedef __attribute__((__ext_vector_type__(2))) float vector_float2;
arguments: (argument_list arguments: (argument_list
(number_literal))))) (number_literal)))))
type: (primitive_type) type: (primitive_type)
attributes: (identifier))) declarator: (type_identifier)))
================================================================================ ================================================================================
Typedef: struct Typedef: struct
@ -140,7 +140,7 @@ typedef struct __attribute__((objc_boxable)) _NSRange {
(field_declaration (field_declaration
type: (type_identifier) type: (type_identifier)
declarator: (field_identifier)))) declarator: (field_identifier))))
attributes: (identifier))) declarator: (type_identifier)))
================================================================================ ================================================================================
Typedef: struct Typedef: struct
@ -210,7 +210,7 @@ typedef struct {
(field_declaration (field_declaration
type: (type_identifier) type: (type_identifier)
declarator: (field_identifier)))) declarator: (field_identifier))))
attributes: (identifier)))) declarator: (type_identifier))))
================================================================================ ================================================================================
Typedef: block Typedef: block
@ -249,7 +249,7 @@ typedef void (^JSONObjectBlock)(id json, JSONModelError *err) DEPRECATED_ATTRIBU
type: (type_identifier) type: (type_identifier)
declarator: (pointer_declarator declarator: (pointer_declarator
declarator: (identifier))))) declarator: (identifier)))))
(attribute_specifier attributes: (attribute_specifier
(availability_attribute_specifier (availability_attribute_specifier
(platform_version (platform_version
platform: (platform) platform: (platform)
@ -275,7 +275,7 @@ typedef void (^JSONObjectBlock)(id json, JSONModelError *err) DEPRECATED_ATTRIBU
type: (type_identifier) type: (type_identifier)
declarator: (pointer_declarator declarator: (pointer_declarator
declarator: (identifier))))) declarator: (identifier)))))
(attribute_specifier attributes: (attribute_specifier
(availability_attribute_specifier)))) (availability_attribute_specifier))))
================================================================================ ================================================================================
@ -313,6 +313,114 @@ typedef void (*mtl_failedMethodCallback)(Class, Method);
(parameter_declaration (parameter_declaration
type: (type_identifier)))))) 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 Typedef: NS_ENUM
================================================================================ ================================================================================
@ -356,11 +464,11 @@ typedef enum AvatarStyle : NSUInteger {
(translation_unit (translation_unit
(type_definition (type_definition
type: (enum_specifier type: (ns_enum_specifier
type: (type_identifier) type: (type_identifier)
name: (type_identifier))) name: (type_identifier)))
(type_definition (type_definition
type: (enum_specifier type: (ns_enum_specifier
type: (type_identifier) type: (type_identifier)
name: (type_identifier) name: (type_identifier)
body: (enumerator_list body: (enumerator_list
@ -378,7 +486,7 @@ typedef enum AvatarStyle : NSUInteger {
(enumerator (enumerator
name: (identifier))))) name: (identifier)))))
(type_definition (type_definition
type: (enum_specifier type: (ns_enum_specifier
type: (type_identifier) type: (type_identifier)
name: (type_identifier) name: (type_identifier)
body: (enumerator_list body: (enumerator_list
@ -394,7 +502,7 @@ typedef enum AvatarStyle : NSUInteger {
value: (number_literal)) value: (number_literal))
(enumerator (enumerator
name: (identifier)))) name: (identifier))))
attributes: (identifier)) declarator: (type_identifier))
(type_definition (type_definition
type: (enum_specifier type: (enum_specifier
name: (type_identifier) name: (type_identifier)
@ -405,7 +513,7 @@ typedef enum AvatarStyle : NSUInteger {
value: (number_literal)) value: (number_literal))
(enumerator (enumerator
name: (identifier)))) name: (identifier))))
attributes: (identifier))) declarator: (type_identifier)))
================================================================================ ================================================================================
Typedef: NS_ENUM without typedef Typedef: NS_ENUM without typedef
@ -420,7 +528,7 @@ NS_ENUM(NSInteger)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
(translation_unit (translation_unit
(enum_specifier (ns_enum_specifier
type: (type_identifier) type: (type_identifier)
body: (enumerator_list body: (enumerator_list
(enumerator (enumerator
@ -446,7 +554,7 @@ typedef NS_ENUM(NSInteger, TTCameraDetectionType) {
(translation_unit (translation_unit
(type_definition (type_definition
type: (enum_specifier type: (ns_enum_specifier
type: (type_identifier) type: (type_identifier)
name: (type_identifier) name: (type_identifier)
body: (enumerator_list body: (enumerator_list
@ -498,7 +606,7 @@ typedef NS_ENUM(NSInteger, SVProgressHUDStyle) {
(translation_unit (translation_unit
(type_definition (type_definition
type: (enum_specifier type: (ns_enum_specifier
type: (type_identifier) type: (type_identifier)
name: (type_identifier) name: (type_identifier)
body: (enumerator_list body: (enumerator_list
@ -534,7 +642,7 @@ typedef NS_OPTIONS(NSUInteger, ActionType) {
(translation_unit (translation_unit
(type_definition (type_definition
type: (enum_specifier type: (ns_enum_specifier
type: (type_identifier) type: (type_identifier)
name: (type_identifier) name: (type_identifier)
body: (enumerator_list body: (enumerator_list