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