ADD: highlight.scm
This commit is contained in:
parent
28e71ed6ea
commit
7533039f42
1
TODO.md
1
TODO.md
|
@ -1,4 +1,3 @@
|
|||
# TODO
|
||||
[ ] precedence order
|
||||
[ ] highlights.scm
|
||||
[ ] highlights tests
|
|
@ -1,31 +1,43 @@
|
|||
(identifier) @variable
|
||||
(self) @variable.builtin
|
||||
(super) @variable.builtin
|
||||
(strong) @variable.builtin
|
||||
(weak) @variable.builtin
|
||||
(nonatomic) @variable.builtin
|
||||
(atomic) @variable.builtin
|
||||
(direct) @variable.builtin
|
||||
(readwrite) @variable.builtin
|
||||
(readonly) @variable.builtin
|
||||
(copy) @variable.builtin
|
||||
(assign) @variable.builtin
|
||||
(class) @variable.builtin
|
||||
(getter) @variable.builtin
|
||||
(setter) @variable.builtin
|
||||
(nonnull) @variable.builtin
|
||||
(nullable) @variable.builtin
|
||||
(null_resettable) @variable.builtin
|
||||
(unsafe_unretained) @variable.builtin
|
||||
(null_unspecified) @variable.builtin
|
||||
[
|
||||
(comment)
|
||||
(pragma)
|
||||
] @comment
|
||||
|
||||
[
|
||||
(self)
|
||||
(super)
|
||||
] @variable.builtin
|
||||
|
||||
[
|
||||
(getter)
|
||||
(setter)
|
||||
(nonnull)
|
||||
(nullable)
|
||||
(null_resettable)
|
||||
(unsafe_unretained)
|
||||
(null_unspecified)
|
||||
(direct)
|
||||
(readwrite)
|
||||
(readonly)
|
||||
(strong)
|
||||
(weak)
|
||||
(copy)
|
||||
(assign)
|
||||
(retain)
|
||||
(atomic)
|
||||
(nonatomic)
|
||||
(class)
|
||||
(NS_NONATOMIC_IOSONLY)
|
||||
(DISPATCH_QUEUE_REFERENCE_TYPE)
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"in"
|
||||
"@interface"
|
||||
"@protocol"
|
||||
"@property"
|
||||
"@end"
|
||||
"@implementation"
|
||||
"@compatibility_alias"
|
||||
"@autoreleasepool"
|
||||
"@synchronized"
|
||||
"@class"
|
||||
|
@ -38,6 +50,8 @@
|
|||
"@throw"
|
||||
"@selector"
|
||||
"@encode"
|
||||
"@available"
|
||||
"__builtin_available"
|
||||
(private)
|
||||
(public)
|
||||
(protected)
|
||||
|
@ -47,35 +61,12 @@
|
|||
"NS_ENUM"
|
||||
"NS_ERROR_ENUM"
|
||||
"NS_OPTIONS"
|
||||
"in"
|
||||
"out"
|
||||
"inout"
|
||||
"bycopy"
|
||||
"byref"
|
||||
"oneway"
|
||||
"_Nullable"
|
||||
"_Nonnull"
|
||||
"_Nullable_result"
|
||||
"_Null_unspecified"
|
||||
"__autoreleasing"
|
||||
"__nullable"
|
||||
"__nonnull"
|
||||
"__strong"
|
||||
"__weak"
|
||||
"__bridge"
|
||||
"__bridge_transfer"
|
||||
"__bridge_retained"
|
||||
"__unsafe_unretained"
|
||||
"__block"
|
||||
"__kindof"
|
||||
"__unused"
|
||||
"_Complex"
|
||||
"__complex"
|
||||
"IBOutlet"
|
||||
"IBInspectable"
|
||||
"NS_VALID_UNTIL_END_OF_SCOPE"
|
||||
"@compatibility_alias"
|
||||
"@available"
|
||||
(type_qualifier)
|
||||
(storage_class_specifier)
|
||||
(attribute_specifier)
|
||||
(class_interface_attribute_sepcifier)
|
||||
(method_variadic_arguments_attribute_specifier)
|
||||
"NS_NOESCAPE"
|
||||
"const"
|
||||
"default"
|
||||
"enum"
|
||||
|
@ -106,18 +97,10 @@
|
|||
"do"
|
||||
"continue"
|
||||
"break"
|
||||
] @repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"case"
|
||||
"switch"
|
||||
] @conditional
|
||||
|
||||
|
||||
] @keyword.repeat
|
||||
|
||||
"#define" @constant.macro
|
||||
|
||||
[
|
||||
"#if"
|
||||
"#ifdef"
|
||||
|
@ -176,25 +159,35 @@
|
|||
"@"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"case"
|
||||
"switch"
|
||||
] @keyword.conditional
|
||||
|
||||
(conditional_expression [ "?" ":" ] @keyword.conditional)
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
"YES"
|
||||
"NO"
|
||||
] @boolean
|
||||
(YES)
|
||||
(NO)
|
||||
] @keyword.boolean
|
||||
|
||||
[ "." ";" ":" "," ] @punctuation.delimiter
|
||||
|
||||
"..." @punctuation.special
|
||||
|
||||
(conditional_expression [ "?" ":" ] @conditional)
|
||||
|
||||
|
||||
[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
|
||||
(string_literal) @string
|
||||
(string_expression) @string
|
||||
(system_lib_string) @string
|
||||
[
|
||||
(string_literal)
|
||||
(string_expression)
|
||||
(system_lib_string)
|
||||
(module_string)
|
||||
] @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(null) @constant.builtin
|
||||
|
@ -208,27 +201,24 @@
|
|||
(preproc_defined)
|
||||
] @function.macro
|
||||
|
||||
declarator: (identifier) @property
|
||||
(cast_expression value: (identifier) @property)
|
||||
|
||||
(((field_expression
|
||||
(field_identifier) @property)) @_parent
|
||||
(#not-has-parent? @_parent template_method function_declarator call_expression))
|
||||
(#not-has-parent? @_parent function_declarator call_expression))
|
||||
|
||||
(((field_identifier) @property)
|
||||
(#has-ancestor? @property field_declaration)
|
||||
(#not-has-ancestor? @property function_declarator))
|
||||
|
||||
(property_declaration
|
||||
(pointer_declarator
|
||||
(identifier)) @property)
|
||||
|
||||
(property_declaration
|
||||
(primitive_type)
|
||||
(identifier) @property)
|
||||
|
||||
(property_declaration
|
||||
(id)
|
||||
(identifier) @property)
|
||||
|
||||
(statement_identifier) @label
|
||||
[
|
||||
(type_identifier)
|
||||
(primitive_type)
|
||||
(sized_type_specifier)
|
||||
(type_descriptor)
|
||||
(generics_type_reference)
|
||||
] @type
|
||||
|
||||
[
|
||||
(id)
|
||||
|
@ -236,19 +226,29 @@
|
|||
(Method)
|
||||
(IMP)
|
||||
(SEL)
|
||||
(BOOL)
|
||||
(instancetype)
|
||||
(auto)
|
||||
(type_identifier)
|
||||
(primitive_type)
|
||||
(sized_type_specifier)
|
||||
(type_descriptor)
|
||||
] @type
|
||||
] @type.builtin
|
||||
|
||||
(declaration (type_qualifier) @type)
|
||||
(cast_expression type: (type_descriptor) @type)
|
||||
(sizeof_expression value: (parenthesized_expression (identifier) @type))
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_$]+$"))
|
||||
(class_interface name: (identifier) @type.class)
|
||||
(category_interface name: (identifier) @type.class)
|
||||
(category_interface category: (identifier) @type.category)
|
||||
(superclass_reference name: (identifier) @type.class)
|
||||
(parameterized_class_type_arguments) @type.class
|
||||
(class_implementation name: (identifier) @type.class)
|
||||
(category_implementation name: (identifier) @type.class)
|
||||
(compatibility_alias_declaration (identifier) @type.class)
|
||||
(category_implementation category: (identifier) @type.category)
|
||||
(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_expression (identifier) @type.protocol)
|
||||
|
||||
;; Preproc def / undef
|
||||
(preproc_def
|
||||
|
@ -260,29 +260,95 @@
|
|||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function))
|
||||
(field_expression
|
||||
field: (field_identifier) @function)
|
||||
(function_declarator
|
||||
declarator: (identifier) @function)
|
||||
(preproc_function_def
|
||||
name: (identifier) @function.macro)
|
||||
(selector_expression
|
||||
name: (identifier) @function)
|
||||
|
||||
|
||||
(method_declaration
|
||||
selector: (identifier) @function)
|
||||
|
||||
(method_declaration
|
||||
(keyword_selector
|
||||
(keyword_declarator
|
||||
keyword: (identifier) @function)))
|
||||
|
||||
(method_declaration
|
||||
(keyword_selector
|
||||
(keyword_declarator
|
||||
name: (identifier) @function)))
|
||||
|
||||
(message_expression
|
||||
receiver: (field_expression
|
||||
field: (field_identifier) @variable))
|
||||
|
||||
(method_definition
|
||||
selector: (identifier) @function)
|
||||
|
||||
(method_definition
|
||||
(keyword_selector
|
||||
(keyword_declarator
|
||||
keyword: (identifier) @function)))
|
||||
|
||||
(message_expression
|
||||
selector: (identifier) @function)
|
||||
|
||||
(method_definition
|
||||
(keyword_selector
|
||||
(keyword_declarator
|
||||
name: (identifier) @property)))
|
||||
|
||||
(message_expression
|
||||
selector: (keyword_argument_list
|
||||
(keyword_argument
|
||||
keyword: (identifier) @function)))
|
||||
|
||||
(message_expression
|
||||
selector: (keyword_argument_list
|
||||
(keyword_argument
|
||||
argument: (identifier) @property)))
|
||||
|
||||
(unary_expression argument: (identifier) @function)
|
||||
(va_arg_expression) @function
|
||||
(va_arg_expression va_list: (identifier) @property)
|
||||
(enumerator name: (identifier) @property)
|
||||
|
||||
(comment) @comment
|
||||
|
||||
;; Parameters
|
||||
(parameter_declaration
|
||||
declarator: (identifier) @parameter)
|
||||
declarator: (identifier) @variable.parameter)
|
||||
|
||||
(parameter_declaration
|
||||
declarator: (pointer_declarator) @parameter)
|
||||
declarator: (pointer_declarator) @variable.parameter)
|
||||
|
||||
(preproc_params
|
||||
(identifier)) @parameter
|
||||
(parameter_declaration
|
||||
declarator: (pointer_declarator
|
||||
declarator: (identifier) @variable.parameter))
|
||||
|
||||
(for_in_statement
|
||||
loop: (identifier) @variable.parameter)
|
||||
|
||||
(dictionary_expression
|
||||
key:(_expression) @property)
|
||||
(dictionary_expression
|
||||
value: (_expression) @property)
|
||||
(array_expression
|
||||
(identifier) @property)
|
||||
(argument_list
|
||||
(identifier) @property)
|
||||
(expression_statement
|
||||
(identifier) @property)
|
||||
|
||||
(_expression (identifier) @property)
|
||||
|
||||
[
|
||||
"__attribute"
|
||||
"__attribute__"
|
||||
"_Nonnull"
|
||||
"__cdecl"
|
||||
"__clrcall"
|
||||
"__stdcall"
|
||||
|
@ -294,4 +360,9 @@
|
|||
"__declspec"
|
||||
] @attribute
|
||||
|
||||
(attribute_specifier) @attribute
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_$]+$"))
|
||||
|
||||
(ERROR) @error
|
Loading…
Reference in New Issue