aboutsummaryrefslogtreecommitdiffstats
path: root/queries/objc/highlights.scm
diff options
context:
space:
mode:
Diffstat (limited to 'queries/objc/highlights.scm')
-rw-r--r--queries/objc/highlights.scm169
1 files changed, 111 insertions, 58 deletions
diff --git a/queries/objc/highlights.scm b/queries/objc/highlights.scm
index 129a74e89..dfb513a07 100644
--- a/queries/objc/highlights.scm
+++ b/queries/objc/highlights.scm
@@ -1,20 +1,19 @@
; inherits: c
-
; Preprocs
-
(preproc_undef
name: (_) @constant) @keyword.directive
; Includes
-
-(module_import "@import" @keyword.import path: (identifier) @module)
+(module_import
+ "@import" @keyword.import
+ path: (identifier) @module)
((preproc_include
- _ @keyword.import path: (_))
+ _ @keyword.import
+ path: (_))
(#any-of? @keyword.import "#include" "#import"))
; Type Qualifiers
-
[
"@optional"
"@required"
@@ -24,7 +23,6 @@
] @type.qualifier
; Storageclasses
-
[
"@autoreleasepool"
"@synthesize"
@@ -34,7 +32,6 @@
] @keyword.storage
; Keywords
-
[
"@protocol"
"@interface"
@@ -47,10 +44,21 @@
"@end"
] @keyword
-(class_declaration "@" @keyword "class" @keyword) ; I hate Obj-C for allowing "@ class" :)
+(class_declaration
+ "@" @keyword
+ "class" @keyword) ; I hate Obj-C for allowing "@ class" :)
-(method_definition ["+" "-"] @keyword.function)
-(method_declaration ["+" "-"] @keyword.function)
+(method_definition
+ [
+ "+"
+ "-"
+ ] @keyword.function)
+
+(method_declaration
+ [
+ "+"
+ "-"
+ ] @keyword.function)
[
"__typeof__"
@@ -65,7 +73,6 @@
] @keyword.coroutine
; Exceptions
-
[
"@try"
"__try"
@@ -77,12 +84,10 @@
] @keyword.exception
; Variables
-
((identifier) @variable.builtin
(#any-of? @variable.builtin "self" "super"))
; Functions & Methods
-
[
"objc_bridge_related"
"@available"
@@ -91,34 +96,59 @@
"asm"
] @function.builtin
-(method_definition (identifier) @function.method)
+(method_definition
+ (identifier) @function.method)
-(method_declaration (identifier) @function.method)
+(method_declaration
+ (identifier) @function.method)
-(method_identifier (identifier)? @function.method ":" @function.method (identifier)? @function.method)
+(method_identifier
+ (identifier)? @function.method
+ ":" @function.method
+ (identifier)? @function.method)
-(message_expression method: (identifier) @function.method.call)
+(message_expression
+ method: (identifier) @function.method.call)
; Constructors
-
-((message_expression method: (identifier) @constructor)
+((message_expression
+ method: (identifier) @constructor)
(#eq? @constructor "init"))
; Attributes
-
-(availability_attribute_specifier
+(availability_attribute_specifier
[
- "CF_FORMAT_FUNCTION" "NS_AVAILABLE" "__IOS_AVAILABLE" "NS_AVAILABLE_IOS"
- "API_AVAILABLE" "API_UNAVAILABLE" "API_DEPRECATED" "NS_ENUM_AVAILABLE_IOS"
- "NS_DEPRECATED_IOS" "NS_ENUM_DEPRECATED_IOS" "NS_FORMAT_FUNCTION" "DEPRECATED_MSG_ATTRIBUTE"
- "__deprecated_msg" "__deprecated_enum_msg" "NS_SWIFT_NAME" "NS_SWIFT_UNAVAILABLE"
- "NS_EXTENSION_UNAVAILABLE_IOS" "NS_CLASS_AVAILABLE_IOS" "NS_CLASS_DEPRECATED_IOS" "__OSX_AVAILABLE_STARTING"
- "NS_ROOT_CLASS" "NS_UNAVAILABLE" "NS_REQUIRES_NIL_TERMINATION" "CF_RETURNS_RETAINED"
- "CF_RETURNS_NOT_RETAINED" "DEPRECATED_ATTRIBUTE" "UI_APPEARANCE_SELECTOR" "UNAVAILABLE_ATTRIBUTE"
+ "CF_FORMAT_FUNCTION"
+ "NS_AVAILABLE"
+ "__IOS_AVAILABLE"
+ "NS_AVAILABLE_IOS"
+ "API_AVAILABLE"
+ "API_UNAVAILABLE"
+ "API_DEPRECATED"
+ "NS_ENUM_AVAILABLE_IOS"
+ "NS_DEPRECATED_IOS"
+ "NS_ENUM_DEPRECATED_IOS"
+ "NS_FORMAT_FUNCTION"
+ "DEPRECATED_MSG_ATTRIBUTE"
+ "__deprecated_msg"
+ "__deprecated_enum_msg"
+ "NS_SWIFT_NAME"
+ "NS_SWIFT_UNAVAILABLE"
+ "NS_EXTENSION_UNAVAILABLE_IOS"
+ "NS_CLASS_AVAILABLE_IOS"
+ "NS_CLASS_DEPRECATED_IOS"
+ "__OSX_AVAILABLE_STARTING"
+ "NS_ROOT_CLASS"
+ "NS_UNAVAILABLE"
+ "NS_REQUIRES_NIL_TERMINATION"
+ "CF_RETURNS_RETAINED"
+ "CF_RETURNS_NOT_RETAINED"
+ "DEPRECATED_ATTRIBUTE"
+ "UI_APPEARANCE_SELECTOR"
+ "UNAVAILABLE_ATTRIBUTE"
]) @attribute
; Macros
-
(type_qualifier
[
"_Complex"
@@ -145,22 +175,38 @@
"__weak"
]) @function.macro.builtin
-[ "__real" "__imag" ] @function.macro.builtin
+[
+ "__real"
+ "__imag"
+] @function.macro.builtin
-((call_expression function: (identifier) @function.macro)
+((call_expression
+ function: (identifier) @function.macro)
(#eq? @function.macro "testassert"))
; Types
+(class_declaration
+ (identifier) @type)
-(class_declaration (identifier) @type)
-
-(class_interface "@interface" . (identifier) @type superclass: _? @type category: _? @module)
+(class_interface
+ "@interface"
+ .
+ (identifier) @type
+ superclass: _? @type
+ category: _? @module)
-(class_implementation "@implementation" . (identifier) @type superclass: _? @type category: _? @module)
+(class_implementation
+ "@implementation"
+ .
+ (identifier) @type
+ superclass: _? @type
+ category: _? @module)
-(protocol_forward_declaration (identifier) @type) ; @interface :(
+(protocol_forward_declaration
+ (identifier) @type) ; @interface :(
-(protocol_reference_list (identifier) @type) ; ^
+(protocol_reference_list
+ (identifier) @type) ; ^
[
"BOOL"
@@ -171,46 +217,53 @@
] @type.builtin
; Constants
+(property_attribute
+ (identifier) @constant
+ "="?)
-(property_attribute (identifier) @constant "="?)
-
-[ "__asm" "__asm__" ] @constant.macro
+[
+ "__asm"
+ "__asm__"
+] @constant.macro
; Properties
-
-(property_implementation "@synthesize" (identifier) @property)
+(property_implementation
+ "@synthesize"
+ (identifier) @property)
((identifier) @property
(#has-ancestor? @property struct_declaration))
; Parameters
+(method_parameter
+ ":" @function.method
+ (identifier) @variable.parameter)
-(method_parameter ":" @function.method (identifier) @variable.parameter)
-
-(method_parameter declarator: (identifier) @variable.parameter)
+(method_parameter
+ declarator: (identifier) @variable.parameter)
-(parameter_declaration
- declarator: (function_declarator
- declarator: (parenthesized_declarator
- (block_pointer_declarator
- declarator: (identifier) @variable.parameter))))
+(parameter_declaration
+ declarator:
+ (function_declarator
+ declarator:
+ (parenthesized_declarator
+ (block_pointer_declarator
+ declarator: (identifier) @variable.parameter))))
"..." @variable.parameter.builtin
; Operators
-
-[
- "^"
-] @operator
+"^" @operator
; Literals
-
(platform) @string.special
(version_number) @string.special
; Punctuation
-
"@" @punctuation.special
-[ "<" ">" ] @punctuation.bracket
+[
+ "<"
+ ">"
+] @punctuation.bracket