MOD: rename (protocol_identifier) to name: (identifier)

This commit is contained in:
shengxuanwei 2022-04-24 12:51:35 +08:00
parent 0df922fb6f
commit e2c6247cbb
15 changed files with 9114 additions and 9130 deletions

View File

@ -26,8 +26,8 @@ module.exports = grammar(C, {
[$._expression, $.generic_type_specifier],
[$._declaration_specifiers],
[$._declaration_specifiers, $.class_interface],
[$.protocol_identifier, $._type_specifier],
[$.protocol_identifier, $._parameterized_class_type_arguments],
[$._protocol_identifier, $._type_specifier],
[$._protocol_identifier, $._parameterized_class_type_arguments],
[$.declaration, $._argument_type_declarator],
]),
@ -35,9 +35,9 @@ module.exports = grammar(C, {
$._expression,
$._statement,
$._declarator,
$._abstract_declarator,
$._field_declarator,
$._type_declarator,
$._abstract_declarator,
],
rules: {
@ -62,7 +62,6 @@ module.exports = grammar(C, {
//
// Imports
//
_import: $ => choice(
$.preproc_import,
$.module_import
@ -168,10 +167,10 @@ module.exports = grammar(C, {
),
protocol_qualifiers: $ => seq(
'<', commaSep1($.protocol_identifier), '>'
'<', commaSep1($._protocol_identifier), '>'
),
protocol_identifier: $ => prec.dynamic(5, alias($.identifier, 'protocol_identifier')),
_protocol_identifier: $ => prec.dynamic(5, field('name', $.identifier)),
parameterized_class_type_arguments: $ => seq(
'<', commaSep1($._parameterized_class_type_arguments), '>'
@ -909,7 +908,7 @@ module.exports = grammar(C, {
// https://opensource.apple.com/source/clang/clang-703.0.31/src/tools/clang/docs/ObjectiveCLiterals.rst.auto.html
// objc-at-expression : '@' (string-literal | encode-literal | selector-literal | protocol-literal | object-literal)
protocol_expression: $ => seq(
'@protocol', '(', $.identifier, ')'
'@protocol', '(', $._name, ')'
),
encode_expression: $ => seq(

View File

@ -247,7 +247,7 @@ declarator: (identifier) @property
(class_forward_declaration name: (identifier) @type.class)
(protocol_forward_declaration name: (identifier) @type.protocol)
(protocol_declaration name: (identifier) @type.protocol)
(protocol_qualifiers (protocol_identifier) @type.protocol)
(protocol_qualifiers name: (identifier) @type.protocol)
(protocol_expression (identifier) @type.protocol)
;; Preproc def / undef

View File

@ -7796,7 +7796,7 @@
"members": [
{
"type": "SYMBOL",
"name": "protocol_identifier"
"name": "_protocol_identifier"
},
{
"type": "REPEAT",
@ -7809,7 +7809,7 @@
},
{
"type": "SYMBOL",
"name": "protocol_identifier"
"name": "_protocol_identifier"
}
]
}
@ -7822,17 +7822,16 @@
}
]
},
"protocol_identifier": {
"_protocol_identifier": {
"type": "PREC_DYNAMIC",
"value": 5,
"content": {
"type": "ALIAS",
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "identifier"
},
"named": false,
"value": "protocol_identifier"
}
}
},
"parameterized_class_type_arguments": {
@ -10428,7 +10427,7 @@
},
{
"type": "SYMBOL",
"name": "identifier"
"name": "_name"
},
{
"type": "STRING",
@ -11268,11 +11267,11 @@
"class_interface"
],
[
"protocol_identifier",
"_protocol_identifier",
"_type_specifier"
],
[
"protocol_identifier",
"_protocol_identifier",
"_parameterized_class_type_arguments"
],
[
@ -11294,9 +11293,9 @@
"_expression",
"_statement",
"_declarator",
"_abstract_declarator",
"_field_declarator",
"_type_declarator",
"_abstract_declarator"
"_type_declarator"
]
}

View File

@ -6235,8 +6235,8 @@
{
"type": "protocol_expression",
"named": true,
"fields": {},
"children": {
"fields": {
"name": {
"multiple": false,
"required": true,
"types": [
@ -6246,6 +6246,7 @@
}
]
}
}
},
{
"type": "protocol_forward_declaration",
@ -6263,25 +6264,21 @@
}
}
},
{
"type": "protocol_identifier",
"named": true,
"fields": {}
},
{
"type": "protocol_qualifiers",
"named": true,
"fields": {},
"children": {
"fields": {
"name": {
"multiple": true,
"required": true,
"types": [
{
"type": "protocol_identifier",
"type": "identifier",
"named": true
}
]
}
}
},
{
"type": "return_statement",
@ -6408,7 +6405,7 @@
},
{
"type": "string_literal",
"named": true,
"named": false,
"fields": {},
"children": {
"multiple": true,
@ -8050,11 +8047,11 @@
},
{
"type": "auto",
"named": true
"named": false
},
{
"type": "auto",
"named": false
"named": true
},
{
"type": "break",
@ -8288,10 +8285,6 @@
"type": "protected",
"named": true
},
{
"type": "protocol_identifier",
"named": false
},
{
"type": "public",
"named": true

18043
src/parser.c

File diff suppressed because it is too large Load Diff

View File

@ -1046,7 +1046,7 @@ CGFloat (* msgSendIMP)(id, SEL, id, CGFloat) = (CGFloat (*)(id, SEL, id, CGFloat
(class_interface
name: (identifier)
(protocol_qualifiers
(protocol_identifier))
name: (identifier))
(superclass_reference
name: (identifier)
type_reference: (generic_type_references

View File

@ -55,7 +55,7 @@ __attribute__((objc_subclassing_restricted))
(superclass_reference
name: (identifier))
(protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
(class_interface
(attribute_specifier
(availability_attribute_specifier
@ -719,7 +719,7 @@ __attribute__((__swift_name__("SDWebImage")))
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
name: (identifier)))
(swift_name_attribute_sepcifier
method: (identifier)
@ -782,7 +782,7 @@ FOUNDATION_EXTERN IGListIndexSetResult *IGListDiff(NSArray<id<IGListDiffable>> *
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier))))))
name: (identifier))))))
declarator: (pointer_declarator
(type_qualifier)
declarator: (identifier)))
@ -794,7 +794,7 @@ FOUNDATION_EXTERN IGListIndexSetResult *IGListDiff(NSArray<id<IGListDiffable>> *
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier))))))
name: (identifier))))))
declarator: (pointer_declarator
(type_qualifier)
declarator: (identifier)))

View File

@ -45,18 +45,18 @@ Class interface: protocol qualifier
(class_interface
name: (identifier)
(protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
(class_interface
name: (identifier)
(superclass_reference
name: (identifier))
(protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
(class_interface
name: (identifier)
(protocol_qualifiers
(protocol_identifier)
(protocol_identifier))))
name: (identifier)
name: (identifier))))
================================================================================
Class interface: ObjectType generic
@ -89,12 +89,12 @@ Class interface: ObjectType generic
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)
(protocol_identifier)))))
name: (identifier)
name: (identifier)))))
(superclass_reference
name: (identifier))
(protocol_qualifiers
(protocol_identifier))
name: (identifier))
(property_declaration
(property_attributes
(nonatomic)
@ -102,14 +102,14 @@ Class interface: ObjectType generic
type: (generic_type_specifier
class_name: (type_identifier)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
declarator: (pointer_declarator
declarator: (identifier))))
(category_interface
name: (identifier)
(protocol_qualifiers
(protocol_identifier)
(protocol_identifier)))
name: (identifier)
name: (identifier)))
(class_interface
name: (identifier)
(parameterized_class_type_arguments
@ -123,7 +123,7 @@ Class interface: ObjectType generic
(type_descriptor
type: (type_identifier))))
(protocol_qualifiers
(protocol_identifier))))
name: (identifier))))
================================================================================
Class interface: __GENERICS generic
@ -180,7 +180,7 @@ Class interface: superclass type arguments
type: (type_identifier)
declarator: (abstract_pointer_declarator))))
(protocol_qualifiers
(protocol_identifier))))
name: (identifier))))
================================================================================
Class interface: parameterized classes
@ -218,13 +218,13 @@ Class interface: parameterized classes
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)))))
name: (identifier)))))
(superclass_reference
name: (identifier)))
(class_interface
name: (identifier)
(protocol_qualifiers
(protocol_identifier))
name: (identifier))
(superclass_reference
name: (identifier)
type_reference: (generic_type_references
@ -399,7 +399,7 @@ Class interface: property generic type
type: (generic_type_specifier
class_name: (type_identifier)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
declarator: (pointer_declarator
declarator: (identifier)))
(property_declaration
@ -413,7 +413,7 @@ Class interface: property generic type
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier))))))
name: (identifier))))))
declarator: (pointer_declarator
declarator: (identifier)))
(property_declaration
@ -444,7 +444,7 @@ Class interface: property generic type
type: (generic_type_specifier
class_name: (type_identifier)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
declarator: (abstract_pointer_declarator))))
declarator: (pointer_declarator
declarator: (identifier)))
@ -459,8 +459,8 @@ Class interface: property generic type
type: (type_identifier)
declarator: (abstract_pointer_declarator)))
type_reference: (protocol_qualifiers
(protocol_identifier)
(protocol_identifier)))
name: (identifier)
name: (identifier)))
declarator: (pointer_declarator
declarator: (identifier)))))
@ -524,7 +524,7 @@ Method declaration: unary selector
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
selector: (identifier))))
================================================================================
@ -664,7 +664,7 @@ Class implementation: method definition ending with semicolon
(class_interface
name: (identifier)
(protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
(class_implementation
name: (identifier)
(method_definition
@ -856,8 +856,8 @@ Category interface: protocol qualifier
name: (identifier)
category: (identifier)
(protocol_qualifiers
(protocol_identifier)
(protocol_identifier))))
name: (identifier)
name: (identifier))))
================================================================================
Category implementation
@ -886,8 +886,8 @@ Protocol declaration: inheritance
(protocol_declaration
name: (identifier)
(protocol_qualifiers
(protocol_identifier)
(protocol_identifier))))
name: (identifier)
name: (identifier))))
================================================================================
Protocol forward declaration
@ -927,7 +927,7 @@ Class forward declaration
(class_forward_declaration
name: (identifier)
(protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
(class_forward_declaration
name: (identifier)
(parameterized_class_type_arguments
@ -936,7 +936,7 @@ Class forward declaration
name: (identifier)
name: (identifier)
(protocol_qualifiers
(protocol_identifier))))
name: (identifier))))
================================================================================
FOUNDATION_EXPORT global declaration

View File

@ -141,7 +141,7 @@ int n;
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
declarator: (abstract_array_declarator))))
(expression_statement
(encode_expression
@ -355,7 +355,7 @@ NSArray *array = @[[NSArray class], [AFHTTPResponseSerializer <AFURLResponseSeri
receiver: (generic_type_specifier
class_name: (type_identifier)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
selector: (identifier))))))
================================================================================

View File

@ -52,7 +52,7 @@ typedef NS_ENUM(NSUInteger, RLMSyncStopPolicy);
name: (identifier)
name: (identifier)
(protocol_qualifiers
(protocol_identifier))))
name: (identifier))))
================================================================================
jsonmodel
@ -681,7 +681,7 @@ FOUNDATION_EXTERN IGListIndexSetResult *IGListDiff(NSArray<id<IGListDiffable>> *
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier))))))
name: (identifier))))))
declarator: (pointer_declarator
(type_qualifier)
declarator: (identifier)))
@ -693,7 +693,7 @@ FOUNDATION_EXTERN IGListIndexSetResult *IGListDiff(NSArray<id<IGListDiffable>> *
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier))))))
name: (identifier))))))
declarator: (pointer_declarator
(type_qualifier)
declarator: (identifier)))
@ -949,7 +949,7 @@ __auto_type copy = (typeof(self.message))[self.message copy];
(superclass_reference
name: (identifier))
(protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
(class_interface
name: (identifier)
(method_declaration
@ -961,7 +961,7 @@ __auto_type copy = (typeof(self.message))[self.message copy];
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
name: (identifier)))
(swift_name_attribute_sepcifier
method: (identifier)
@ -1460,7 +1460,7 @@ NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropri
receiver: (generic_type_specifier
class_name: (type_identifier)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
selector: (identifier))))))))
(class_interface
(attribute_specifier

View File

@ -44,7 +44,7 @@ ifdef
(category_interface
name: (identifier)
(protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
(category_interface
name: (identifier)
(property_declaration

View File

@ -35,7 +35,7 @@ Property: declaration
type: (type_identifier)
declarator: (abstract_pointer_declarator)))
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
declarator: (pointer_declarator
declarator: (identifier)))
(property_declaration

View File

@ -71,7 +71,7 @@ for (NSNumber * _Nonnull foo in foos) {
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
declarator: (identifier)
loop: (field_expression
argument: (self)
@ -81,7 +81,7 @@ for (NSNumber * _Nonnull foo in foos) {
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
declarator: (identifier)
loop: (field_expression
argument: (message_expression

View File

@ -20,7 +20,7 @@ typedef SEL _Nonnull nonnull_SEL;
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
attributes: (identifier))
(type_definition
type: (generic_type_specifier

View File

@ -26,7 +26,7 @@ NSArray<__kindof UIView *> *backgroundSubviews;
type: (generic_type_specifier
class_name: (type_identifier)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
declarator: (pointer_declarator
declarator: (identifier)))
(declaration
@ -175,7 +175,7 @@ Type: generics in selector receiver
receiver: (generic_type_specifier
class_name: (type_identifier)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
selector: (identifier))
selector: (identifier))))
@ -197,7 +197,7 @@ static NSMapTable <Class <TTLElementProtocol>, NSString *> * mapTable = nil;
type: (generic_type_specifier
class_name: (Class)
type_reference: (protocol_qualifiers
(protocol_identifier))))
name: (identifier))))
(type_descriptor
type: (type_identifier)
declarator: (abstract_pointer_declarator))))
@ -223,7 +223,7 @@ id<SDImageCoder> imageCoder;
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
declarator: (function_declarator
declarator: (identifier)
parameters: (parameter_list
@ -231,7 +231,7 @@ id<SDImageCoder> imageCoder;
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
declarator: (identifier))))
body: (compound_statement
(expression_statement
@ -243,7 +243,7 @@ id<SDImageCoder> imageCoder;
type: (generic_type_specifier
class_name: (id)
type_reference: (protocol_qualifiers
(protocol_identifier)))
name: (identifier)))
declarator: (identifier)))
================================================================================
@ -415,8 +415,8 @@ Type: **
type: (generic_type_specifier
class_name: (type_identifier)
type_reference: (protocol_qualifiers
(protocol_identifier)
(protocol_identifier)))
name: (identifier)
name: (identifier)))
declarator: (abstract_pointer_declarator)
name: (identifier))
(keyword_declarator